Example #1
0
 @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()));
 }
Example #2
0
    @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
      }
    }
  /**
   * 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;
  }
Example #4
0
    /*
     * 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);
      }
    }
  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]);
  }
Example #6
0
    @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));
        }
      }
    }
  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;
  }
  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;
  }
Example #9
0
 public void actionPerformed(ActionEvent e) {
   Model m = getAbstractView(e).getModel();
   m.removeChild(toRemove.getParent(), toRemove);
 }
Example #10
0
    public void actionPerformed(ActionEvent e) {
      Model m = getAbstractView(e).getModel();

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