assigndetailtable.java

来自「JGraph扩展应用。自定义Renderer,自定义视图View实现自定义工作流」· Java 代码 · 共 62 行

JAVA
62
字号
/**
 * 
 */
package flow.graph.gui.graph.cell.ui.table;

import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;

import org.jgraph.JGraph;
import org.jgraph.graph.DefaultGraphCell;

import flow.graph.gui.graph.FlowGraphConstants;
import flow.graph.gui.graph.cell.bpel.Assign;
import flow.graph.gui.graph.cell.bpel.Copy;
import flow.graph.gui.graph.cell.bpel.From;
import flow.graph.gui.graph.cell.bpel.Message;
import flow.graph.gui.graph.cell.bpel.Messages;
import flow.graph.gui.graph.cell.bpel.Part;
import flow.graph.gui.graph.cell.bpel.To;

/**
 * @author Administrator
 *
 */
public class AssignDetailTable extends JTable{
	private DefaultGraphCell cell;
	private JGraph graph;
	private AssignDetailTableModel tableModel;
	public final static int DEFAULT_ROW_COUNT = 10;
	
	public AssignDetailTable(DefaultGraphCell cell, JGraph graph){
		super(new AssignDetailTableModel());
		tableModel = (AssignDetailTableModel)getModel();
		//getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(new JComboBox(Message.DataType)));
		this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		this.cell = cell;
		this.graph = graph;
		Assign assign = (Assign)FlowGraphConstants.getBpelAssign(cell.getAttributes());
		if(assign != null){
			for(int i=0;i<assign.getCopys().size();i++){
				Copy copy = (Copy)(assign.getCopys().get(i));
				//tableModel.addRow(message.getName(), message.getType());
				From from = copy.getFrom();
				To to = copy.getTo();
				tableModel.addRow(to.getMessage(), to.getProperty(), from.getFlag(), from.getMessage(), from.getProperty(), from.getExpression());
			}
		}
		//initTable();
	}

	public void initTable(){
		if(getRowCount() < DEFAULT_ROW_COUNT){
			for(int i=getRowCount();i<DEFAULT_ROW_COUNT;i++){
				tableModel.addRow("", "", false, "", "", "");
			}
		}
		tableModel.fireTableDataChanged();
	}
}

⌨️ 快捷键说明

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