📄 caseform.java
字号:
Box condictionBox = Box.createHorizontalBox();
condictionBox.add(new JLabel("判断条件:"));
condictionBox.add(condictionField);
condictionTitledPanel.add(condictionBox, BorderLayout.CENTER);
actionArea = new JHightLightLineTextPane();
JPanel actionPanel = new JPanel(new BorderLayout());
actionPanel.setPreferredSize(new Dimension(250, 110));
//actionPanel.setBorder(new TitledBorder("执行代码"));
actionPanel.add(condictionBox, BorderLayout.NORTH);
actionPanel.add(actionArea, BorderLayout.WEST);
actionPanel.add(actionArea.scrollPane, BorderLayout.CENTER);
JButton exitButton = new JButton("关 闭");
exitButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
saveData();
}
});
JPanel exitPanel = new JPanel(new FlowLayout());
exitPanel.add(exitButton);
///////////////////////////////////////////////////////////
//初始化actionArea
if(FlowGraphConstants.getActionTemplate(edge.getAttributes()) != null){
ActionTemplate action = (ActionTemplate)FlowGraphConstants.getActionTemplate(edge.getAttributes());
//actionArea.setText(action.getAction().length()<=0?TemplateConstants.ACTION_TEMPLATE:action.getAction());
actionArea.setText(action.getAction());
}
if(FlowGraphConstants.getCaseTemplate(edge.getAttributes()) != null){
CaseTemplate c = (CaseTemplate)FlowGraphConstants.getCaseTemplate(edge.getAttributes());
condictionField.setText(c.getCondiction());
}
////////////////////////////////////////////////////////////
inputAddButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(inputName.getText().length() <= 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"变量名称不能为空!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputName.requestFocus();
return;
}
if(inputType.getSelectedIndex() == 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"请选择数据类型!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputType.requestFocus();
return;
}
if(inputFlag.isSelected() == true){
if(inputSource.getSelectedIndex() <= 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"请选择数据来源!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputSource.requestFocus();
return;
}
}
//////////////////////////
//判断变量名是否已经存在
/*
if(FlowGraphConstants.getInputTemplate(cell.getAttributes()) != null){
if(((Parameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).exitsParameter(inputName.getText())){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"变量"+inputName.getText()+"已经存在!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputName.requestFocus();
return;
}
}*/
for(int i=0;i<((InputParameterTableModel)inputTable.getModel()).getRowCount();i++){
if(((InputParameterTableModel)inputTable.getModel()).getValueAt(i, 0).toString().equalsIgnoreCase(inputName.getText())){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"变量"+inputName.getText()+" 已经存在!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputName.requestFocus();
return;
}
}
((InputParameterTableModel)inputTable.getModel()).addRow(inputName.getText(), inputType.getSelectedItem().toString(), inputFlag.isSelected(), inputSource.getSelectedItem()==null?"":inputSource.getSelectedItem().toString(), inputValue.getText(), inputDiscription.getText());
InputParameter p = new InputParameter(inputName.getText(), inputType.getSelectedItem().toString(), inputFlag.isSelected(), inputSource.getSelectedItem()==null?"":inputSource.getSelectedItem().toString(), inputValue.getText(), inputDiscription.getText());
((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).addParameter(p);
inputName.setText("");
inputType.setSelectedIndex(0);
inputFlag.setSelected(false);
inputSource.setSelectedIndex(0);
inputValue.setText("");
inputDiscription.setText("");
}});
inputTable.addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
inputRowID = inputTable.rowAtPoint(e.getPoint());
int columnID = inputTable.columnAtPoint(e.getPoint());
inputName.setText(((InputParameterTableModel)inputTable.getModel()).getValueAt(inputRowID, 0).toString());
inputType.setSelectedItem(((InputParameterTableModel)inputTable.getModel()).getValueAt(inputRowID, 1).toString());
inputFlag.setSelected(((Boolean)((InputParameterTableModel)inputTable.getModel()).getValueAt(inputRowID, 2)).booleanValue());
inputSource.setSelectedItem(((InputParameterTableModel)inputTable.getModel()).getValueAt(inputRowID, 3).toString());
inputValue.setText(((InputParameterTableModel)inputTable.getModel()).getValueAt(inputRowID, 4).toString());
inputDiscription.setText(((InputParameterTableModel)inputTable.getModel()).getValueAt(inputRowID, 5).toString());
}
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}});
inputModifyButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(inputRowID != -1){
if(inputName.getText().length() <= 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"变量名称不能为空!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputName.requestFocus();
return;
}
if(inputType.getSelectedIndex() == 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"请选择数据类型!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputType.requestFocus();
return;
}
if(inputFlag.isSelected() == true){
if(inputSource.getSelectedIndex() <= 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"请选择数据来源!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputSource.requestFocus();
return;
}
}
//////////////////////////
//判断变量名是否已经存在
for(int i=0;i<((InputParameterTableModel)inputTable.getModel()).getRowCount();i++){
if(i == inputRowID)
continue;
if(((InputParameterTableModel)inputTable.getModel()).getValueAt(i, 0).toString().equalsIgnoreCase(inputName.getText())){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"变量"+inputName.getText()+" 已经存在!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
inputName.requestFocus();
return;
}
}
String name = ((InputParameterTableModel)inputTable.getModel()).getValueAt(inputRowID, 0).toString();
int index = ((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getExistsParameter(name);
if(index >= 0){
((InputParameter)((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getParameters().get(index)).setName(inputName.getText());
((InputParameter)((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getParameters().get(index)).setType(inputType.getSelectedItem().toString());
((InputParameter)((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getParameters().get(index)).setFlag(inputFlag.isSelected());
((InputParameter)((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getParameters().get(index)).setSource(inputSource.getSelectedItem().toString());
((InputParameter)((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getParameters().get(index)).setValue(inputValue.getText());
((InputParameter)((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getParameters().get(index)).setDiscription(inputDiscription.getText());
}
((InputParameterTableModel)inputTable.getModel()).setValueAt(inputName.getText(), inputRowID, 0);
((InputParameterTableModel)inputTable.getModel()).setValueAt(inputType.getSelectedItem().toString(), inputRowID, 1);
((InputParameterTableModel)inputTable.getModel()).setValueAt(inputFlag.isSelected(), inputRowID, 2);
((InputParameterTableModel)inputTable.getModel()).setValueAt(inputSource.getSelectedItem().toString(), inputRowID, 3);
((InputParameterTableModel)inputTable.getModel()).setValueAt(inputValue.getText(), inputRowID, 4);
((InputParameterTableModel)inputTable.getModel()).setValueAt(inputDiscription.getText(), inputRowID, 5);
inputName.setText("");
inputType.setSelectedIndex(0);
inputFlag.setSelected(false);
inputSource.setSelectedIndex(0);
inputValue.setText("");
inputDiscription.setText("");
}
inputRowID = -1;
}});
inputDeleteButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(inputRowID != -1){
((InputParameterTableModel)inputTable.getModel()).removeRow(inputRowID);
int index = ((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getExistsParameter(inputName.getText());
if(index >= 0){
((InputParameters)FlowGraphConstants.getInputTemplate(cell.getAttributes())).getParameters().remove(index);
}
inputName.setText("");
inputType.setSelectedIndex(0);
inputFlag.setSelected(false);
inputSource.setSelectedIndex(0);
inputValue.setText("");
inputDiscription.setText("");
}
inputRowID = -1;
}});
///////////////////////////////////////////////////////////
outputAddButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(outputName.getText().length() <= 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"变量名称不能为空!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
outputName.requestFocus();
return;
}
if(outputType.getSelectedIndex() == 0){
JOptionPane.showConfirmDialog(FlowManager.getInstance(),
"请选择数据类型!",
"工作流操作提示",
JOptionPane.CLOSED_OPTION);
outputType.requestFocus();
return;
}
//////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -