⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 workflow_graphed_changecellattribute_dialog.java

📁 用java实现的工作流
💻 JAVA
字号:
package treedoc;


/**
* 功能描述
* 在GraphEd类中调用的对流程拓扑图节点属性进行编辑的弹出窗口类(只是修改图的节点ICON和名称)
* 和树目录中对已经提交的流程节点进行活动编辑有所区别
*/


/**
 * 名称       : WORKFLOW_GraphEd_ChangeCellAttribute_Dialog
 * 描述       : WWW.FANGFA.NET 工作流管理系统--流程节点属性修改窗体
 * 版权信息   : Copyright (c) 2004 COMSCI
 * @作者      : COMSCI Sichuan Fangfa Digital
 * @版本      : 0.9 builder 2004091910
 * @日期      : 2004/09/19
 */




import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.jgraph.graph.*;
import com.borland.jbcl.layout.*;



public class workflow_GraphEd_ChangeCellAttribute_Dialog
    extends JDialog {

  /** 非控件定义
*/
  int working_way;
  String working_time, nodecode;

  // 控件定义
  XYLayout xYLayout1 = new XYLayout();
  XYLayout xYLayout3 = new XYLayout();
  JButton cancelbutton = new JButton();
  JLabel jLabel1 = new JLabel();
  JPanel jPanel1 = new JPanel();
  JLabel jLabel2 = new JLabel();
  JButton jButton1 = new JButton();
  JTextField jTextField1 = new JTextField();
  XYLayout xYLayout5 = new XYLayout();

//可以替换的ICON列表,用于节点ICON表示
  Icon icon = new ImageIcon("resources/icon1.gif");
  Icon icon1 = new ImageIcon("resources/icon2.gif");
  Icon icon2 = new ImageIcon("resources/icon3.gif");
  Icon icon3 = new ImageIcon("resources/icon4.gif");
  Icon icon4 = new ImageIcon("resources/ModuleOm.gif");
  Icon icon5 = new ImageIcon("resources/ActivitySetItem.gif");
  Icon icon6 = new ImageIcon("resources/ren.gif");
  Icon icon7 = new ImageIcon("resources/ren1.gif");
  Icon icon8 = new ImageIcon("resources/pc04.gif");
  Icon icon9 = new ImageIcon("resources/logo.gif");

  Object[] items = {
      icon7, icon1, icon2, icon3, icon4, icon5,icon6,icon,icon8,icon9};

  workflow_GraphEd ed1;

  JLabel jLabel5 = new JLabel();


  JComboBox jComboBox1 = new JComboBox(items); //给JComboBox初使化,带入ICON表

  JPanel jPanel3 = new JPanel();
  XYLayout xYLayout2 = new XYLayout();
  JComboBox jComboBox2 = new JComboBox();

//类构造方法--传入GraphEd类型参数

  public workflow_GraphEd_ChangeCellAttribute_Dialog(workflow_GraphEd ed) {

    //初始系统变量
    ed1 = ed;

    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }



  }

//  主窗体方法..不使用
 // public static void main(String argv[]) {
  /*  try {

      LookAndFeel alloyLnF = new com.incors.plaf.alloy.AlloyLookAndFeel();
      UIManager.setLookAndFeel(alloyLnF);
      Enumeration enum = UIManager.getDefaults().keys();
      String str;
      while (enum.hasMoreElements()) {
        str = (String) enum.nextElement();
        if (str.endsWith("font")) {
          UIManager.put(str, new Font("宋体", 0, 14));

        }
      }
    }
    catch (Exception e) {}
  */
    //    JDialog pane1 = new edit_test();
    //    pane1.setTitle("任务管理器");
    //    pane1.setSize(424, 313);
    //    pane1.show();

//  }

//JB的界面组件初使化方法........

  private void jbInit() throws Exception {


    Container ContentPane = this.getContentPane();
    ContentPane.setLayout(xYLayout1);
    jLabel1.setEnabled(true);
    jLabel1.setBorder(BorderFactory.createEtchedBorder());
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("节点名称");
    cancelbutton.addActionListener(new edittest_jButton2_actionAdapter(this));
    cancelbutton.setText("取消");
    cancelbutton.addActionListener(new edittest_jButton2_actionAdapter(this));
    cancelbutton.addActionListener(new edittest_jButton2_actionAdapter(this));

    jPanel1.setEnabled(true);
    jPanel1.setBorder(BorderFactory.createEtchedBorder());
    jPanel1.setLayout(xYLayout3);
    jLabel2.setEnabled(true);
    jLabel2.setBorder(BorderFactory.createEtchedBorder());
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("节点类型");
    jButton1.setText("确认");
    jButton1.addActionListener(new edittest_jButton1_actionAdapter(this));
    jButton1.addActionListener(new edittest_jButton1_actionAdapter(this));
    jButton1.addActionListener(new edittest_jButton1_actionAdapter(this));
    jButton1.addActionListener(new edittest_jButton1_actionAdapter(this));
    jTextField1.setDoubleBuffered(true);
    jTextField1.setText("");
    jLabel5.setBorder(BorderFactory.createEtchedBorder());
    jLabel5.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel5.setText("选择任务图标");
    jPanel3.setBorder(BorderFactory.createEtchedBorder());
    jPanel3.setLayout(xYLayout2);
    jComboBox1.setBorder(BorderFactory.createEtchedBorder());
    jComboBox2.addActionListener(new
        workflow_GraphEd_ChangeCellAttribute_Dialog_jComboBox2_actionAdapter(this));
    jComboBox2.setEnabled(true);
    jComboBox2.setDoubleBuffered(false);
    jComboBox2.setEditable(true);
    ContentPane.add(jPanel1,       new XYConstraints(8, 12, 285, 79));
    jPanel1.add(jLabel2,   new XYConstraints(5, 43, 63, 23));
    jPanel1.add(jLabel1,  new XYConstraints(5, 7, 64, 26));
    jPanel1.add(jTextField1,   new XYConstraints(78, 7, 143, 27));
    jPanel1.add(jComboBox2,      new XYConstraints(78, 43, 143, -1));
    jPanel3.add(jLabel5,    new XYConstraints(6, 13, 85, 28));
    jPanel3.add(jComboBox1,     new XYConstraints(101, 11, 170, 35));
    ContentPane.add(cancelbutton, new XYConstraints(199, 170, -1, -1));
    ContentPane.add(jButton1,   new XYConstraints(76, 169, -1, -1));
    ContentPane.add(jPanel3,   new XYConstraints(8, 96, 286, 60));

  }

//返回工作处理方式方法

 // public int return_workingway() {

  //  if (jRadioButton1.isSelected()) {
  //    working_way = 1;
  //  }
  //  if (jRadioButton2.isSelected()) {
 //     working_way = 2;
 //   }
  //  if (jRadioButton3.isSelected()) {
  //    working_way = 3;
 //   }

//    return working_way;

//  }

  //返回工作处理时间

  public String return_workingTime() {

  //  working_time = (String) jComboBox3.getSelectedItem();
    return working_time;

  }

  public String return_NodeCode() {

 //   nodecode = (String) jComboBox3.getSelectedItem();
    return nodecode;

  }

//选择了ICON列表中的ICON后,让GRAPH中的节点ICON显示效果

  void jButton1_actionPerformed(ActionEvent e) {
//图标OK.............
    org.jgraph.graph.AttributeMap map12 = new org.jgraph.graph.AttributeMap();

    Object ob = ed1.graph.getSelectionCell();
    CellView view = ed1.graph.getGraphLayoutCache().getMapping(ob, true);
    Map map1 = GraphConstants.createAttributes(ob, null, null);

    // 从JCOMBOX中获得图标
    GraphConstants.setIcon(map1, (Icon) jComboBox1.getSelectedItem());
    // 设置节点名称
    GraphConstants.setValue(map1, jTextField1.getText());

    // 设置活动属性
    // 设置MAP属性
    map12.applyMap(map1);

    DefaultGraphCell ob1 = (DefaultGraphCell) ob;
    ob1.changeAttributes(map1); //改变实际值
    view.setAttributes(map12); //改变VIEW的映射
    // 刷新主窗口
    view.refresh(true);
    view.update();

    ed1.graph.updateUI();

    dispose();

  }

  void cancelbutton_actionPerformed(ActionEvent e) {
    this.dispose();
  }

  void jComboBox2_actionPerformed(ActionEvent e) {

  }

}

class edittest_jButton1_actionAdapter
    implements java.awt.event.ActionListener {
  workflow_GraphEd_ChangeCellAttribute_Dialog adaptee;

  edittest_jButton1_actionAdapter(workflow_GraphEd_ChangeCellAttribute_Dialog adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class edittest_jButton2_actionAdapter
    implements java.awt.event.ActionListener {
  workflow_GraphEd_ChangeCellAttribute_Dialog adaptee;

  edittest_jButton2_actionAdapter(workflow_GraphEd_ChangeCellAttribute_Dialog adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.cancelbutton_actionPerformed(e);
  }
}

class workflow_GraphEd_ChangeCellAttribute_Dialog_jComboBox2_actionAdapter
    implements java.awt.event.ActionListener {
  workflow_GraphEd_ChangeCellAttribute_Dialog adaptee;

  workflow_GraphEd_ChangeCellAttribute_Dialog_jComboBox2_actionAdapter(
      workflow_GraphEd_ChangeCellAttribute_Dialog adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.jComboBox2_actionPerformed(e);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -