📄 modelexportjbpm.java
字号:
/*
*
* Copyright (C) 2003-2004 David Benson
*
* JGpd is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* JGpd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with JGpd; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
package org.jgpd.io.jbpm;
import java.net.URL;
import org.jgpd.UI.PropPanelConfig;
import org.jgpd.UI.tableModels.JGpdTableModel;
import org.jgpd.io.ModelExportImpl;
import org.jgpd.io.jbpm.definition.impl.*;
import org.jgpd.io.jbpm.io.FileSaveJbpm;
import org.jgraph.GPGraphpad;
import org.jgraph.pad.GPDocument;
import org.jgraph.pad.GPGraph;
import javax.swing.JTable;
public class ModelExportJBpm extends ModelExportImpl {
public ProcessDefinitionImpl processDefinition = new ProcessDefinitionImpl();
public ModelExportJBpm()
{
processDefinition = new ProcessDefinitionImpl();
}
public Object createActivity()
{
// Create an activity in the jBpm model
ActivityStateImpl actState = new ActivityStateImpl();
return actState;
}
public Object createDecision()
{
// Create a decision in the jBpm model
DecisionImpl decision = new DecisionImpl();
return decision;
}
//inclusive
public Object createInclusiveGateway()
{
// Create a inclusive in the jBpm model
InclusiveGatewayStateImpl inclusiveGateway= new InclusiveGatewayStateImpl();
return inclusiveGateway;
}
public Object createProcess()
{
// Create a process in the jBpm model
ProcessStateImpl process = new ProcessStateImpl();
return process;
}
public Object createFork()
{
// Create a process in the jBpm model
ForkImpl fork = new ForkImpl();
return fork;
}
public Object createJoin()
{
// Create a process in the jBpm model
JoinImpl join = new JoinImpl();
return join;
}
public Object createStart()
{
// Create a start block in the jBpm model
StartStateImpl startState = new StartStateImpl();
processDefinition.setStartState(startState);
return startState;
}
public Object createEnd()
{
// Create an end block in the jBpm model
EndStateImpl endState = new EndStateImpl();
processDefinition.setEndState(endState);
return endState;
}
public void promptProcessProps(GPGraph graph)
{
processDefinition.getUIProperties(graph);
}
public PropPanelConfig getPropPanelModel(Object cell,
JGpdTableModel[] tableModel,
JTable[] table,
GPGraphpad gp)
{
if (cell != null)
{
// Check hashCode of object against current model objects
// Note you must check node of sub-classes before parents
// otherwise the sub-class will branch on the parent condition
if (cell instanceof StartStateImpl)
{
return ((StartStateImpl)cell).propPanelModel(table, tableModel);
}
else if (cell instanceof EndStateImpl)
{
return ((EndStateImpl)cell).propPanelModel(table, tableModel);
}
else if (cell instanceof ActivityStateImpl)
{
return ((ActivityStateImpl)cell).propPanelModel(table, tableModel);
}
else if (cell instanceof DecisionImpl)
{
return ((DecisionImpl)cell).propPanelModel(table, tableModel, gp);
}
//inclusiveͨ·
else if (cell instanceof InclusiveGatewayStateImpl)
{
return ((InclusiveGatewayStateImpl)cell).propPanelModel(table, tableModel);
}
else if (cell instanceof ForkImpl)
{
return ((ForkImpl)cell).propPanelModel(table, tableModel, gp);
}
else if (cell instanceof JoinImpl)
{
return ((JoinImpl)cell).propPanelModel(table, tableModel, gp);
}
}
else
{
// FIXME it's an error for the cell to be null
}
return null; // indicates error in cell selection
}
/**
* @see org.jgpd.io.ModelExportInterface#getPropPanelModelTypes()
*/
public JGpdTableModel[] getPropPanelModelTypes(int numTables)
{
JGpdTableModel[] tableList = new JGpdTableModel[numTables];
for (int i = 0; i < numTables; i++)
{
tableList[i] = new JGpdTableModel();
}
return tableList;
}
public void saveFile( GPGraphpad graphpad,
GPDocument doc,
URL filename,
GPGraph gpGraph)
{
FileSaveJbpm fileSave = new FileSaveJbpm(graphpad,
doc,
filename,
gpGraph);
fileSave.saveFile();
}
/**
* @see org.jgpd.io.ModelExportInterface#exportModelXML()
*/
public String exportModelXML(GPGraph graph)
{
// Create the necessary parts and package them as a .par
return processDefinition.writeXML(graph);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -