📄 addconceptdlg.java
字号:
package org.impact.stars.appclient.concept;
/**
* Insert the type's description here.
* Creation date: (7/28/00 12:42:27 PM)
* @author: Jian Cai
*/
import java.awt.Insets;
import java.awt.Point;
import java.awt.Component;
import java.awt.Frame;
import javax.swing.*;
import java.awt.Font;
import java.awt.Dimension;
import java.awt.Container;
import java.awt.Event;
import java.awt.event.*;
import java.awt.*;
import java.sql.Date;
import org.impact.stars.conceptmd.concept.model.*;
import org.impact.stars.conceptmd.conceptstr.model.*;
public class Addconceptdlg extends javax.swing.JDialog
{
boolean registerButtonPressed = false;
ConceptModel theConcept = null;
private String aparent;
protected String aconceptID;
private String aname;
private String aparentID;
private String atype;
private String apstakeholder;
private String ashared;
private Date aproposetime;
private String adefinition;
private String adescription;
// Used for addNotify check.
boolean fComponentsAdjusted = false;
//{{DECLARE_CONTROLS
javax.swing.JLabel label1 = new javax.swing.JLabel();
javax.swing.JTextField TypeTextField = new javax.swing.JTextField();
javax.swing.JLabel label2 = new javax.swing.JLabel();
javax.swing.JTextField NameTextField = new javax.swing.JTextField();
javax.swing.JLabel label3 = new javax.swing.JLabel();
javax.swing.JTextField DiscriptionTextField = new javax.swing.JTextField();
javax.swing.JLabel label4 = new javax.swing.JLabel();
javax.swing.JTextField ProposerTextField = new javax.swing.JTextField();
javax.swing.JLabel label5 = new javax.swing.JLabel();
javax.swing.JComboBox ViewGroupChoice = new javax.swing.JComboBox();
javax.swing.JLabel label6 = new javax.swing.JLabel();
javax.swing.JTextField AddtimeTextField = new javax.swing.JTextField();
javax.swing.JLabel label7 = new javax.swing.JLabel();
javax.swing.JLabel label8 = new javax.swing.JLabel();
javax.swing.JComboBox StatusChoice = new javax.swing.JComboBox();
javax.swing.JButton registerButton = new JButton();
javax.swing.JButton cancelButton = new JButton();
javax.swing.JLabel label9 = new javax.swing.JLabel("Comments");
javax.swing.JScrollPane Textpane1= new javax.swing.JScrollPane();
javax.swing.JTextArea commentTextArea = new javax.swing.JTextArea();
//}}
class SymWindow extends java.awt.event.WindowAdapter
{
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
if (object == Addconceptdlg.this)
Dialog1_WindowClosing(event);
}
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == cancelButton)
cancelButton_Action(event);
else if (object == registerButton)
registerButton_Action(event);
}
}
/**
* Addconceptdlg constructor comment.
*/
public Addconceptdlg() {
super();
}
public Addconceptdlg(JFrame parent, String title, boolean modal)
{
this(parent, modal);
setTitle(title);
}
public Addconceptdlg(JFrame parent, boolean modal)
{
super(parent, modal);
parent.setResizable(false);
/*GridLayout layout = new GridLayout(6,5);
layout.setVgap(20);
layout.setHgap(24);
getContentPane().setLayout(layout);*/
getContentPane().setLayout(null);
setSize(620,350);
setVisible(false);
label1.setText("ConceptModel Name");
label1 = new javax.swing.JLabel("ConceptModel Name");
label1.setBounds(12,24,84,24);
getContentPane().add(label1);
TypeTextField = new javax.swing.JTextField();
TypeTextField.setBounds(120,24,140,25);
label2.setText("ConceptModel Type");
getContentPane().add(TypeTextField);
label2 = new javax.swing.JLabel("ConceptModel Type");
label2.setBounds(300,24,96,24);
getContentPane().add(label2);
NameTextField = new javax.swing.JTextField();
NameTextField.setBounds(432,24,140,25);
label3.setText("Description");
getContentPane().add(NameTextField);
label3 = new javax.swing.JLabel("Description");
label3.setBounds(12,60,84,24);
getContentPane().add(label3);
DiscriptionTextField = new javax.swing.JTextField();
DiscriptionTextField.setBounds(120,60,139,24);
label4.setText("Propose Stakeholder");
getContentPane().add(DiscriptionTextField);
label4 = new javax.swing.JLabel("Propose Stakeholder");
label4.setBounds(300,60,120,24);
getContentPane().add(label4);
ProposerTextField = new javax.swing.JTextField();
ProposerTextField.setBounds(432,60,140,25);
label5.setText("View Group");
getContentPane().add(ProposerTextField);
label5 = new javax.swing.JLabel("View Group");
label5.setBounds(12,96,72,24);
getContentPane().add(label5);
ViewGroupChoice = new javax.swing.JComboBox();
ViewGroupChoice.addItem("-- SELECT A Group --");
ViewGroupChoice.addItem("Overall Group");
ViewGroupChoice.addItem("Customer Group");
ViewGroupChoice.addItem("Design Consultant Group");
ViewGroupChoice.addItem("Design Engineer Group");
ViewGroupChoice.addItem("Project Management Group");
ViewGroupChoice.addItem("Bussiness Owner Group");
ViewGroupChoice.addItem("Other Group");
ViewGroupChoice.setBackground(java.awt.Color.white);
try {
//ViewGroupChoice.select(0);
}
catch (IllegalArgumentException e) { }
getContentPane().add(ViewGroupChoice);
ViewGroupChoice.setBounds(120,96,156,25);
label6.setText("Propose Time");
label6 = new javax.swing.JLabel("Propose Time");
label6.setBounds(300,96,96,24);
getContentPane().add(label6);
AddtimeTextField = new javax.swing.JTextField();
AddtimeTextField.setBounds(432,96,139,25);
label7.setText("(yyyy-mm-dd)");
getContentPane().add(AddtimeTextField);
label7 = new javax.swing.JLabel("(yyyy-mm-dd)");
label7.setBounds(444,132,84,13);
label8.setText("Status");
label7.setFont(new Font("Dialog", Font.ITALIC, 12));
getContentPane().add(label7);
label8 = new javax.swing.JLabel("Status");
label8.setBounds(12,132,60,24);
getContentPane().add(label8);
/*label9.setText("Comment");
label9 = new javax.swing.JLabel("Comment");
label9.setBounds(12,132,60,24);*/
//label8.setFont(new Font("Dialog", Font.PLAIN, 12));
StatusChoice = new javax.swing.JComboBox();
StatusChoice.addItem("-- SELECT A Status --");
StatusChoice.addItem("Shared Defined");
StatusChoice.addItem("Shared Undefined");
StatusChoice.addItem("Individual Defined");
StatusChoice.addItem("Individual Undefined");
StatusChoice.addItem("Other Status");
StatusChoice.setBackground(java.awt.Color.white);
try {
//StatusChoice.select(0);
}
catch (IllegalArgumentException e) { }
getContentPane().add(StatusChoice);
StatusChoice.setBounds(120,132,156,25);
label9 = new javax.swing.JLabel("Comments");
label9.setBounds(getInsets().left + 12,getInsets().top + 168,120,25);
getContentPane().add(label9);
commentTextArea = new javax.swing.JTextArea();
//commentTextArea.setBounds(getInsets().left + 12,getInsets().top + 204,480,89);
//commentTextArea.setBounds(0,0,500,100);
commentTextArea.setLineWrap(true);
commentTextArea.setColumns(10);
commentTextArea.setVisible(true);
Textpane1= new javax.swing.JScrollPane();
Textpane1.setBounds(getInsets().left + 12,getInsets().top + 204,550,90);
//Textpane1.setLayout(new BorderLayout());
Textpane1.add(commentTextArea);
Textpane1.setViewportView(commentTextArea);
getContentPane().add(Textpane1, Textpane1.getName());
registerButton = new JButton("Add ConceptModel");
registerButton.setBounds(324,312,120,24);
registerButton.setBackground(java.awt.Color.green);
getContentPane().add(registerButton);
cancelButton = new JButton("Cancel");
cancelButton.setBounds(432,312,100,24);
cancelButton.setBackground(java.awt.Color.red);
getContentPane().add(cancelButton);
setTitle("Add New ConceptModel");
this.setResizable(false);
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
cancelButton.addActionListener(lSymAction);
registerButton.addActionListener(lSymAction);
//}}
}
public void addNotify()
{
// Record the size of the window prior to calling parents addNotify.
Dimension d = getSize();
super.addNotify();
if (fComponentsAdjusted)
return;
// Adjust components according to the insets
setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
Component components[] = getComponents();
for (int i = 0; i < components.length; i++)
{
Point p = components[i].getLocation();
p.translate(getInsets().left, getInsets().top);
components[i].setLocation(p);
}
fComponentsAdjusted = true;
}
void cancelButton_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
registerButtonPressed = false;
this.setVisible(false);
}
void Dialog1_WindowClosing(java.awt.event.WindowEvent event)
{
dispose();
}
public ConceptModel getConcept()
{
return theConcept;
}
public boolean isRegisterButtonPressed()
{
return registerButtonPressed;
}
void registerButton_Action(java.awt.event.ActionEvent event)
{
// to do: code goes here.
registerButtonPressed = true;
aname = NameTextField.getText().trim();
atype = TypeTextField.getText().trim();
adescription = DiscriptionTextField.getText().trim();
apstakeholder = ProposerTextField.getText().trim();
aproposetime = Date.valueOf(AddtimeTextField.getText().trim());
//atype = (String)ViewGroupChoice.getSelectedItem();
ashared = (String)StatusChoice.getSelectedItem();
adefinition= commentTextArea.getText().trim();
aconceptID="aname";
aparent="0";
// create a ConceptModel object based on form data
theConcept = new ConceptModel(aconceptID, aname, aparentID, atype,
apstakeholder, ashared, aproposetime, adefinition, adescription);
// close this window and return to caller
this.setVisible(false);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -