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

📄 functioneditor.java

📁 一个很好实用的工作流OSWORKFLOW开发例子.有着非常优秀的灵活性.
💻 JAVA
字号:
package com.opensymphony.workflow.designer.editor;import java.util.HashMap;import java.util.Map;import java.awt.*;import com.opensymphony.workflow.designer.WorkflowGraphModel;import com.opensymphony.workflow.designer.WorkflowDesigner;import com.opensymphony.workflow.designer.spi.DefaultFunctionPlugin;import com.opensymphony.workflow.designer.spi.FunctionPlugin;import com.opensymphony.workflow.loader.AbstractDescriptor;import com.opensymphony.workflow.loader.ConfigFunctionDescriptor;import com.opensymphony.workflow.loader.FunctionDescriptor;import com.opensymphony.workflow.loader.DescriptorFactory;/** * @author baab */public abstract class FunctionEditor{  //protected WorkflowCell cell;  protected AbstractDescriptor descriptor;  protected WorkflowGraphModel model;  public FunctionEditor(AbstractDescriptor descriptor)  {    this.descriptor = descriptor;  }  public WorkflowGraphModel getModel()  {    return model;  }	public AbstractDescriptor getDescriptor()	{		return descriptor;	}  public void setModel(WorkflowGraphModel model)  {    this.model = model;  }  public FunctionDescriptor add()  {    ConfigFunctionDescriptor function = getFunction();    if(function == null)    {      return null;    }    function = editFunction(function, WorkflowDesigner.INSTANCE);    if(function != null)    {      FunctionDescriptor func = DescriptorFactory.getFactory().createFunctionDescriptor();      //			cond.setId(0);      func.setParent(getParent());      func.setType(function.getType());      func.setName(function.getName());      func.getArgs().putAll(function.getArgs());      return func;    }    else    {      return null;    }  }  public void modify(FunctionDescriptor func)  {    ConfigFunctionDescriptor function;    if(func.getName() != null)    {	    function = new ConfigFunctionDescriptor(getModel().getPalette().getPrefunction(func.getName()));    }    else    {      function = new ConfigFunctionDescriptor(getModel().getPalette());      function.setType(func.getType());    }    function.getArgs().putAll(func.getArgs());    function = editFunction(function, WorkflowDesigner.INSTANCE);    if(function != null)    {      func.getArgs().putAll(function.getArgs());    }  }  private ConfigFunctionDescriptor editFunction(ConfigFunctionDescriptor config, Component parent)  {    // get plugin    String clazz = config.getPlugin();    if(clazz == null || clazz.length() == 0)    {      clazz = "com.opensymphony.workflow.designer.spi.DefaultFunctionPlugin";    }    FunctionPlugin funcImpl;    try    {      funcImpl = (FunctionPlugin)Class.forName(clazz).newInstance();    }    catch(Exception e1)    {      e1.printStackTrace();      funcImpl = new DefaultFunctionPlugin();    }    funcImpl.setFunction(config);    // put the parameter    Map args = new HashMap();    args.put("cell", descriptor);    if(!funcImpl.editFunction(args, parent))    {      // cancel      return null;    }    config = funcImpl.getFunction();    return config;  }  abstract protected AbstractDescriptor getParent();	abstract protected ConfigFunctionDescriptor getFunction();}

⌨️ 快捷键说明

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