コード例 #1
0
  /**
   * Builds a figure for the given edge and adds it to contents.
   *
   * @param contents the parent figure to add the edge to
   * @param edge the edge
   */
  private void buildEdgeFigure(final IFigure contents, final IEdge edge) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(
          "Building edge from " + edge.getTail().getName() + " to " + edge.getHead().getName());
    }
    final DotRoute route = (DotRoute) edge.getAttr(POSITION_ATTR);

    String name = edge.getName();
    if ("".equals(name)) {
      name = null;
    }

    final PolylineConnection conn = addConnectionFromRoute(contents, name, route);

    if (edge.getAttr(DRAW2DFGCOLOR_ATTR) != null) {
      conn.setForegroundColor((Color) edge.getAttr(DRAW2DFGCOLOR_ATTR));
    }

    if (edge.getAttr(DRAW2DLINEWIDTH_ATTR) != null) {
      conn.setLineWidth(edge.getAttrInt(DRAW2DLINEWIDTH_ATTR));
    }

    final PolygonDecoration dec = new PolygonDecoration();
    conn.setTargetDecoration(dec);

    conn.setToolTip(new LinkTooltip(edge));
    conn.setCursor(Cursors.HAND);
  }
コード例 #2
0
 /**
  * Creates a basic link.
  *
  * @param link Link
  * @return IEdge
  */
 private IEdge addLink(final Link link) {
   final IEdge edge =
       dotGraph.newEdge(
           vertexLUT.get(link.getStartNode().getName()),
           vertexLUT.get(link.getEndNode().getName()),
           currentLinkName,
           link);
   final GrandUiPrefStore preferenceStore = Application.getInstance().getPreferenceStore();
   if (link.hasAttributes(Link.ATTR_WEAK_LINK)) {
     edge.setAttr(DRAW2DFGCOLOR_ATTR, preferenceStore.getColor(PreferenceKeys.LINK_WEAK_COLOR));
     edge.setAttr(
         DRAW2DLINEWIDTH_ATTR, preferenceStore.getInt(PreferenceKeys.LINK_WEAK_LINEWIDTH));
   } else {
     edge.setAttr(DRAW2DFGCOLOR_ATTR, preferenceStore.getColor(PreferenceKeys.LINK_DEFAULT_COLOR));
     edge.setAttr(
         DRAW2DLINEWIDTH_ATTR, preferenceStore.getInt(PreferenceKeys.LINK_DEFAULT_LINEWIDTH));
   }
   return edge;
 }
コード例 #3
0
 /**
  * Method visitLink.
  *
  * @param link SubantTaskLink
  * @see net.ggtools.grand.graph.visit.LinkVisitor#visitLink(net.ggtools.grand.ant.SubantTaskLink)
  */
 public final void visitLink(final SubantTaskLink link) {
   final IEdge edge = addLink(link);
   edge.setAttr(LINK_TASK_ATTR, link.getTaskName());
   edge.setAttr(LINK_PARAMETERS_ATTR, link.getParameterMap());
   edge.setAttr(LINK_SUBANT_DIRECTORIES, link.getDirectories());
   final GrandUiPrefStore preferenceStore = Application.getInstance().getPreferenceStore();
   edge.setAttr(DRAW2DFGCOLOR_ATTR, preferenceStore.getColor(PreferenceKeys.LINK_SUBANT_COLOR));
   edge.setAttr(
       DRAW2DLINEWIDTH_ATTR, preferenceStore.getInt(PreferenceKeys.LINK_SUBANT_LINEWIDTH));
 }
コード例 #4
0
 /**
  * Method visitLink.
  *
  * @param link AntTaskLink
  * @see net.ggtools.grand.graph.visit.LinkVisitor#visitLink(net.ggtools.grand.ant.AntTaskLink)
  */
 public final void visitLink(final AntTaskLink link) {
   final IEdge edge = addLink(link);
   edge.setAttr(LINK_TASK_ATTR, link.getTaskName());
   edge.setAttr(LINK_PARAMETERS_ATTR, link.getParameterMap());
 }