コード例 #1
0
ファイル: Actions.java プロジェクト: petkle/Sequence-Planner
 @Override
 public void actionPerformed(ActionEvent e) {
   OperationView v =
       getAbstractView(e).getSPContainer().createOperationView(node.getNodeData().getName());
   Model model = getAbstractView(e).getModel();
   v.open(model.getOperationRealizedBy(node.getId()));
 }
コード例 #2
0
ファイル: TreeView.java プロジェクト: kristoferB/javaSP
    @Override
    public void dragEnter(DragSourceDragEvent ddd) {
      ddd.getDragSourceContext().getCursor();

      if (Model.isResource(node.getNodeData())) {
        //                ddd.getDragSourceContext().setCursor(resPointer);
      } else if (Model.isLiason(node.getNodeData())) {
        //                ddd.getDragSourceContext().setCursor(productPointer);s
      }
    }
コード例 #3
0
  /**
   * Clone everything except id that is set to -1.
   *
   * @return
   */
  public Object clone() {
    OperationData ret = new OperationData(this.getName(), getId());

    if (getCopy()) {
      ret.setId(Model.newId());
      ret.setName(ret.getName() + "_" + ret.getId());
    }

    Set<String> keys = preference.keySet();

    for (String key : keys) {
      ret.setValue(key, getValue(key));
    }

    // Copy preconditions
    //        sequenceCondition

    ret.setSequenceCondition(cloneSequenceConditions(sequenceCondition));
    ret.setPSequenceCondition(cloneSequenceConditions(pSequenceCondition));

    ret.setSeqInvariant(cloneSequenceConditions(seqInvariant));

    ret.setResourceBooking(cloneResources(resourceBooking));
    ret.setPResourceBooking(cloneResources(pResourceBooking));

    ret.setActions(cloneActions(actions));
    return ret;
  }
コード例 #4
0
ファイル: TreeView.java プロジェクト: kristoferB/javaSP
    /*
     * Drag Gesture Handler
     */
    @Override
    public void dragGestureRecognized(DragGestureEvent dge) {
      TreePath path = tree.getSelectionPath();

      if ((path == null) || (path.getPathCount() <= 1)) {
        return;
      }

      node = (TreeNode) path.getLastPathComponent();
      node.getNodeData().setCopy(false);
      transferable = new TransferableNode(node);

      if (Model.isResource(node.getNodeData()) || Model.isLiason(node.getNodeData())) {
        source.startDrag(dge, DragSource.DefaultLinkDrop, transferable, this);
      } else {
        source.startDrag(dge, DragSource.DefaultMoveDrop, transferable, this);
      }
    }
コード例 #5
0
  public String[] getRawActions() {

    ArrayList<String> result = new ArrayList<String>();

    for (Action action : actions) {
      result.add(
          Integer.toString(action.id)
              + Model.getActionSetType(action.state)
              + Integer.toString(action.value));
    }

    return result.toArray(new String[0]);
  }
コード例 #6
0
ファイル: TreeView.java プロジェクト: kristoferB/javaSP
    @Override
    public void dropActionChanged(DragSourceDragEvent dd) {
      // Can maby change the cursor?

      if (Model.isOperation(node.getNodeData())) {

        if (dd.getUserAction() == TransferHandler.COPY) {
          node.getNodeData().setCopy(true);
          dd.getDragSourceContext().setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
        } else if (dd.getUserAction() == TransferHandler.MOVE) {
          node.getNodeData().setCopy(false);
          dd.getDragSourceContext().setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
        }
      }
    }
コード例 #7
0
  public String getRawOr(LinkedList<SeqCond> s) {
    String out = "";

    if (s.size() == 1) {
      SeqCond seqCond = s.getFirst();

      if (seqCond.isOperationCheck()) {
        out += Integer.toString(seqCond.id) + Model.getOperationEnding(seqCond.state);
      } else if (seqCond.isVariableCheck()) {
        out +=
            Integer.toString(seqCond.id)
                + Model.getVariabelCheck(seqCond.state)
                + Integer.toString(seqCond.value);
      }

    } else if (s.size() > 1) {
      out += "(";
      for (Iterator<SeqCond> it = s.iterator(); it.hasNext(); ) {
        SeqCond seqCond = it.next();

        if (seqCond.isOperationCheck()) {
          out += Integer.toString(seqCond.id) + Model.getOperationEnding(seqCond.state);
        } else if (seqCond.isVariableCheck()) {
          out +=
              Integer.toString(seqCond.id)
                  + Model.getVariabelCheck(seqCond.state)
                  + Integer.toString(seqCond.value);
        }

        out = it.hasNext() ? out + EFAVariables.SP_OR : out;
      }
      out += ")";
    }

    return out;
  }
コード例 #8
0
  public String getRawSequenceCondition(
      LinkedList<LinkedList<SeqCond>> sequenceCond, LinkedList<Integer[]> resource) {
    String pre = "";

    for (LinkedList<SeqCond> linkedList : sequenceCond) {
      pre = pre.isEmpty() ? pre : pre + " " + EFAVariables.SP_AND + " ";
      pre += getRawOr(linkedList);
    }

    if (resource != null) {
      for (Iterator it = resource.iterator(); it.hasNext(); ) {
        Integer[] out = (Integer[]) it.next();

        pre = pre.isEmpty() ? pre : pre + " " + EFAVariables.SP_AND + " ";
        pre += out[0] + Model.getResourceEnding(out[1]);
      }
    }

    return pre;
  }
コード例 #9
0
ファイル: Actions.java プロジェクト: petkle/Sequence-Planner
 public void actionPerformed(ActionEvent e) {
   Model m = getAbstractView(e).getModel();
   m.removeChild(toRemove.getParent(), toRemove);
 }
コード例 #10
0
ファイル: Actions.java プロジェクト: petkle/Sequence-Planner
    public void actionPerformed(ActionEvent e) {
      Model m = getAbstractView(e).getModel();

      m.insertChild(parent, m.getChild(child));
    }