コード例 #1
0
 public boolean step() throws SyntaxError {
   Note note = diagram.getDataProvider().getNote();
   if (note != null) {
     freeNoteNumber = Math.max(freeNoteNumber, note.getNumber() + 1);
     diagram.getPaintDevice().addSequenceElement(note);
     notes.add(note);
     closeNote(note.getLocation().getName());
     diagram.getFragmentManager().openFragments();
     diagram.getPaintDevice().announce(note.getHeight());
     note.setTop(diagram.getVerticalPosition());
     if (note.isConsuming()) {
       diagram.extendLifelines(note.getHeight());
     } else {
       pendingNotes.put(note.getLocation().getName(), note);
     }
     if (diagram.getDataProvider().getState() != null) {
       diagram.addToStateMap(note, diagram.getDataProvider().getState());
     }
     diagram.getFragmentManager().clearLabels();
     return true;
   }
   Pair<Lifeline, Integer> eventAssoc = diagram.getDataProvider().getEventAssociation();
   if (eventAssoc != null) {
     associateEvent(eventAssoc.getFirst(), eventAssoc.getSecond());
     return true;
   }
   return false;
 }
コード例 #2
0
 public void computeArrowAssociations() {
   for (Note description : notes) {
     List<Message> msgs = messageAssociation.get(description.getNumber());
     if (msgs != null) {
       for (Message msg : msgs) {
         // This can be a pseudo-message ("_") that returns
         // the control flow to an object.
         // We just ignore the attempt to uselessly associate a
         // note to this.
         if (msg.getArrow() != null) {
           description.addTarget(msg.getArrow().getAnchor());
         }
       }
     }
     List<Pair<Lifeline, Integer>> pairs = eventAssociation.get(description.getNumber());
     if (pairs != null) {
       for (Pair<Lifeline, Integer> pair : pairs) {
         int x = pair.getFirst().getView().getLeft() + pair.getFirst().getView().getWidth() / 2;
         Point p = new Point(x, pair.getSecond());
         description.addTarget(p);
       }
     }
   }
 }