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

📄 actioneditor.java

📁 一个很好实用的工作流OSWORKFLOW开发例子.有着非常优秀的灵活性.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }
    else if(command.equals("permissionadd"))
    {
      add();
    }
    else if(command.equals("permissionremove"))
    {
      remove();
    }
    else if(command.equals("permissionedit"))
    {
      modify();
    }
    else if(command.equals("preadd"))
    {
      preadd();
    }
    else if(command.equals("preremove"))
    {
      preremove();
    }
    else if(command.equals("preedit"))
    {
      premodify();
    }
    else if(command.equals("postadd"))
    {
      postadd();
    }
    else if(command.equals("postremove"))
    {
      postremove();
    }
    else if(command.equals("postedit"))
    {
      postmodify();
    }
    else if(command.equals("validatoradd"))
    {
      validatoradd();
    }
    else if(command.equals("validatoredit"))
    {
      validatormodify();
    }
    else if(command.equals("validatorremove"))
    {
      validatorremove();
    }
  }

  private void attributeadd()
  {
    AttributeDialog dlg = new AttributeDialog(WorkflowDesigner.INSTANCE, "", "", true);
    if(dlg.ask(WorkflowDesigner.INSTANCE))
    {
      String sKey = dlg.keyField.getText();
      String sValue = dlg.valueField.getText();
      if(sKey.length() > 0)
      {
        attributesModel.add(sKey, sValue);
      }
    }
  }

  private void attributeremove()
  {
    int[] rows = attributesTable.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      String sKey = (String)attributesModel.getValueAt(rows[i], 0);
      attributesModel.remove(sKey);
    }
  }

  private void attributemodify()
  {
    int[] rows = attributesTable.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      attributemodify(rows[i]);
    }
  }

  private void attributemodify(int selected)
  {
    String sKey = (String)attributesModel.getValueAt(selected, 0);
    String sValue = (String)attributesModel.getValueAt(selected, 1);
    if((sKey != null) && (sKey.length() > 0))
    {
      AttributeDialog dlg = new AttributeDialog(WorkflowDesigner.INSTANCE, sKey, sValue, false);
      if(dlg.ask(WorkflowDesigner.INSTANCE))
      {
        sValue = dlg.valueField.getText();
        attributesModel.add(sKey, sValue);
      }
    }
  }

  private void add()
  {
    StartPermissionEditor editor = new StartPermissionEditor((ActionDescriptor)getDescriptor());
    editor.setModel(getModel());
    ConditionDescriptor cond = editor.add();
    if(cond != null)
    {
      conditionsModel.add(cond);
    }
  }

  private void remove()
  {
    int[] rows = conditionsTable.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      conditionsModel.remove(rows[i]);
    }
  }

  private void modify()
  {
    int[] rows = conditionsTable.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      modify(rows[i]);
    }
  }

  private void modify(int selected)
  {
    ConditionDescriptor cond = (ConditionDescriptor)conditionsModel.get(selected);

    StartPermissionEditor editor = new StartPermissionEditor((ActionDescriptor)getDescriptor());
    editor.setModel(getModel());
    editor.modify(cond);

    conditionsModel.fireTableDataChanged();
  }

  private void preadd()
  {
    StartFunctionEditor editor = new StartFunctionEditor((ActionDescriptor)getDescriptor());
    editor.setModel(getModel());
    FunctionDescriptor func = editor.add();
    if(func != null)
    {
      preModel.add(func);
    }
  }

  private void preremove()
  {
    int[] rows = pre.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      preModel.remove(rows[i]);
    }
  }

  private void premodify()
  {
    int[] rows = pre.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      premodify(rows[i]);
    }

  }

  private void premodify(int selected)
  {
    FunctionDescriptor func = (FunctionDescriptor)preModel.get(selected);

    StartFunctionEditor editor = new StartFunctionEditor((ActionDescriptor)getDescriptor());
    editor.setModel(getModel());
    editor.modify(func);

    preModel.fireTableDataChanged();
  }

  private void postadd()
  {
    StartFunctionEditor editor = new StartFunctionEditor((ActionDescriptor)getDescriptor());
    editor.setModel(getModel());
    FunctionDescriptor func = editor.add();
    if(func != null)
    {
      postModel.add(func);
    }
  }

  private void postremove()
  {
    int[] rows = post.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      postModel.remove(rows[i]);
    }
  }

  private void postmodify()
  {
    int[] rows = post.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      postmodify(rows[i]);
    }

  }

  private void postmodify(int selected)
  {
    FunctionDescriptor func = (FunctionDescriptor)postModel.get(selected);

    StartFunctionEditor editor = new StartFunctionEditor((ActionDescriptor)getDescriptor());
    editor.setModel(getModel());
    editor.modify(func);

    postModel.fireTableDataChanged();
  }

  private void validatoradd()
  {
    ValidatorEditor editor = new ValidatorEditor(getDescriptor());
    editor.setModel(getModel());
    ValidatorDescriptor val = editor.add();
    if(val != null)
    {
      validatorsModel.add(val);
    }
  }

  private void validatorremove()
  {
    int[] rows = validatorsTable.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      validatorsModel.remove(rows[i]);
    }
  }

  private void validatormodify()
  {
    int[] rows = validatorsTable.getSelectedRows();
    for(int i = 0; i < rows.length; i++)
    {
      validatormodify(rows[i]);
    }
  }

  private void validatormodify(int selected)
  {
    ValidatorDescriptor val = (ValidatorDescriptor)validatorsModel.get(selected);

    ValidatorEditor editor = new ValidatorEditor(getDescriptor());
    editor.setModel(getModel());
    editor.modify(val);

    validatorsModel.fireTableDataChanged();
  }
}

⌨️ 快捷键说明

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