📄 conceptapl.java
字号:
package org.impact.stars.appclient.concept;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.tree.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import java.io.*;
import java.net.*;
import java.sql.Date;
import org.impact.stars.appclient.concept.model.Concept;
import org.impact.stars.appclient.concept.model.ConceptTree;
import org.impact.stars.appclient.concept.model.ConceptTreeModel;
import org.impact.stars.appclient.concept.model.Conceptnode;
import org.impact.stars.appclient.perspective.PerspectiveInfoDlg;
import org.impact.stars.appclient.perspective.ReviewInfoDlg;
import org.impact.stars.appclient.common.StarsTablePanel;
import org.impact.stars.appclient.common.StarsConsole;
import org.impact.stars.appclient.util.ClientUtil;
import org.impact.stars.conceptmd.concept.model.*;
import org.impact.stars.conceptmd.conceptstr.model.*;
import org.impact.stars.control.event.ConceptEvent;
import org.impact.stars.control.event.ConceptstrEvent;
import org.impact.stars.control.event.StarsEventSupport;
/**
* Insert the type's description here.
* Creation date: (7/22/00 2:32:56 PM)
* Modified 10/8/2001
* @author: Jian Cai
* serialVersion
*/
public class Conceptapl extends javax.swing.JApplet implements MouseListener, MouseMotionListener, StarsConsole {
private javax.swing.JButton ivjEditButton = null;
private javax.swing.JButton ivjHelpButton = null;
private javax.swing.JButton ivjInfoButton = null;
private javax.swing.JPanel ivjJAppletContentPane = null;
private javax.swing.JPanel ivjJPanel1 = null;
//private javax.swing.JPanel ivjJPanel2 = null;
private javax.swing.JPanel ivjJPanel3 = null;
private ConceptTablePanel conceptTablePanel = null;
private javax.swing.JSplitPane ivjJSplitPane1 = null;
private javax.swing.JScrollPane ivjJScrollPane1 = null;
private javax.swing.JTabbedPane ivjJTabbedPane1 = null;
private javax.swing.JTextArea statusTextArea = null;
private javax.swing.JToolBar ivjJToolBar1 = null;
private javax.swing.JButton ivjLoadButton = null;
private javax.swing.JButton ivjNewButton = null;
private javax.swing.JPanel ivjPage1 = null;
private javax.swing.JButton ivjSaveButton = null;
private javax.swing.JTree ivjCstree = null;
private javax.swing.JScrollPane ivjJScrollPane2 = null;
private javax.swing.JPanel ivjPage2 = null;
private GridLayout ivjPage2GridLayout = null;
private javax.swing.JPanel ivjPage3 = null;
private Conceptnode holetreenode = null;
//private String currentconceptID = null;
// this should be load from teh project infor when login
private String conceptstrID = "1";
private String projectID = "1";
private String stakeholderID = "default";
private int lastclickx = 0;
private int lastclicky = 0;
private Addconceptdlg addconceptdlg_ = null;
//the right click handle dialog
//private javax.swing.JTextArea statusTextArea = new javax.swing.JTextArea();
//
//private Vector conceptvector = null;
private java.awt.List conceptList = null;
private String webServerControlStr = null;
private String webServerConceptStr = null;
private String webServerConceptstrStr = null;
private String webServerReadStr = null;
private Eventgenerator eventgr = null;
//private String hostName = "localhost";
private String hostName;
private int port = 8080;
private String servletreadPath = "/stars/ReadConceptstr?conceptstrID=1";
private String servletcontrolPath = "/stars/control/concept";
private String servletconceptPath = "/stars/control/concept";
private String servletconceptstrPath = "/stars/control/conceptstr";
private final int COLUMN_WIDTH = 35;
private String lastID = "0";
boolean reload = true;
//***********************************************added
//
/**
* When the display button is pressed, we simply get the
* concept list and display the concepts in the GUI.
*/
/*class NewButtonActionListener implements java.awt.event.ActionListener {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (e.getSource() == Conceptapl.this.getEditButton())
Addconceptdlg(e);
};
}; */
class ivjNewButtonActionListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
// createConcept("1");
}
}
class ivjLoadButtonActionListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
try {
// Get a list of the concepts
//Vector conceptVector = getConceptList();
// Display the list of concepts
//displayConcepts(conceptVector);
//
reload = true;
displayConceptTree();
}
catch (Exception e) {
System.out.println("Error: " + e);
}
}
}
class ivjEditButtonActionListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
try {
//getJTabbedPane1().setSelectedComponent(getPage2());
getJTabbedPane1().setSelectedComponent(ivjPage2);
// user code begin {2}
// user code end
}
catch (Exception e) {
System.out.println("Error: " + e);
}
}
}
public Date getCurrentDate() {
java.sql.Date cdate= new java.sql.Date(((new GregorianCalendar()).getTime()).getTime());
return cdate;
}
protected String getConceptstrID() {
return conceptstrID;
}
public String getProjectID() {
return projectID;
}
protected String getStakeholderID() {
return stakeholderID;
}
protected void setConceptstrID(String cstrid) {
conceptstrID = cstrid;
}
protected void setProjectID(String pid) {
projectID = pid;
}
protected void setStakeholderID(String sid) {
stakeholderID = sid;
}
public Object[][] getTableIniData() {
Object[][] inidata = {
{"Name", " "},
{"Definition", " "},
{"Shared", " "},
{"Type", " "},
{"Proposer", " "},
{"Propose Time", getCurrentDate()},
{"Description", " "}};
return inidata;
}
/*
public void setSize(int width, int height)
{
Dimension appletSize = getSize();
if (appletSize.width != width || appletSize.height != height)
{
super.setSize(width, height);
validate();
}
}
*/
protected class ConceptTablePanel extends StarsTablePanel {
boolean editright = false;
final int NAME = 0;
final int DEFINITION =1;
final int SHARED =2;
final int TYPE = 3;
final int PROPOSER = 4;
final int PTIME = 5 ;
final int DESCRIPTION = 6;
private String currentconceptID = " ";
private String parentID =" ";
ConceptModel concept = null;
public String getCurrentconceptID() {
return currentconceptID;
}
public void setCurrentconceptID(String cptID) {
currentconceptID = cptID;
}
public String getParentID() {
return parentID;
}
public void setParentID(String ptID) {
parentID = ptID;
}
public boolean getEditRight() {
return editright;
}
public void setEditRight(boolean b) {
editright = b;
}
public ConceptModel getConceptModel() {
//ConceptModel cptmodel = new ConceptModel(getCurrentconceptID(),"da1","1","dfafa","dfa","dfa", (new Date(2001,1,20)),"1","1");
System.out.println("Ptime value: " + (Date)getTableView().getValueAt(PTIME, 1));
ConceptModel cptmodel = new ConceptModel(
getCurrentconceptID(),
(String)getTableView().getValueAt(NAME, 1),
getParentID(),
(String)getTableView().getValueAt(TYPE, 1),
(String)getTableView().getValueAt(PROPOSER, 1),
(String)getTableView().getValueAt(SHARED, 1),
// Date.valueOf((String)getTableView().getValueAt(PTIME, 1)),
(Date)getTableView().getValueAt(PTIME, 1),
(String)getTableView().getValueAt(DEFINITION, 1),
(String)getTableView().getValueAt(DESCRIPTION, 1)
);
return cptmodel;
}
/**
* View a new concept in the table.
* Display the concept information in the right StarsTablePanel
*/
protected void viewConcept(Conceptnode aconcept) {
String[] tablenames = {"Property", "Value"};
//JTable concepttable = this.getTableView();
Object[] data = { aconcept.getName(),
aconcept.getDefinition(),
aconcept.getShared(),
aconcept.getType(),
aconcept.getProposer(),
aconcept.getProposetime(),
aconcept.getDescription()
};
for(int i = 0; i< data.length; i++ ) {
getTableView().setValueAt(data[i], i, 1);
}
setCurrentconceptID(aconcept.getConceptID());
setParentID(aconcept.getParentID());
getTableView().repaint();
}
public ConceptTablePanel(String[] name, Object[][] data) {
super(name, data);
//JButton
this.saveButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent e) {
// createConcept("1");
if(!editright) {
displayServerResponse("Warning", "No Change Occured");
}
else {
if (getCurrentconceptID().equals("new")) //create concept
{
log("Create concept");
editConcept(conceptstrID , conceptTablePanel.getCurrentconceptID(), ConceptEvent.CREATE_CONCEPT_DATA);
}
else { //update concept
editConcept(conceptstrID , conceptTablePanel.getCurrentconceptID(), ConceptEvent.UPDATE_CONCEPT_DATA);
log("Update concpt: ID" + conceptTablePanel.getCurrentconceptID());
}
}
getTableView().repaint();}
});
this.resetButton.addMouseListener(new java.awt.event.MouseAdapter() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -