Esempio n. 1
0
 /**
  * Implementation of callback from layout algorithm. This method is called once for each revision
  * or branch marker to be added to the view.
  *
  * @see net.sf.versiontree.layout.drawer.IDrawMethod#draw(net.sf.versiontree.data.ITreeElement,
  *     int, int)
  */
 public void draw(ITreeElement element, int x, int y) {
   if (element instanceof IRevision) {
     Revision revision = new Revision(connectors, 0);
     revision.setRevisionData((IRevision) element);
     revision.addMouseListener(this);
     revision.setMenu(this.getMenu());
     revision.setLocation(BORDER + x * (width + hspacing), BORDER + y * (height + vspacing));
     revision.setSize(revision.computeSize(SWT.DEFAULT, SWT.DEFAULT));
     // check if this is the current revision
     if ((revision.getRevisionData().getState() & ITreeElement.STATE_CURRENT) != 0) {
       currentRevision = revision;
       selectionManager.revisionSelected(currentRevision.getRevisionData(), 1);
       logSelectionListener.logEntrySelected(currentRevision.getRevisionData().getLogEntry());
     }
   } else {
     Branch branch = new Branch(connectors, 0);
     branch.setBranchData(((IBranch) element));
     branch.addMouseListener(this);
     branch.setLocation(BORDER + x * (width + hspacing), BORDER + y * (height + vspacing));
     branch.setSize(branch.computeSize(SWT.DEFAULT, SWT.DEFAULT));
   }
 }