/** * Creates a <em>basic node</em>. * * @param node Node * @return IVertex */ private IVertex addNode(final Node node) { final String name = node.getName(); final IVertex vertex = dotGraph.newVertex(name, node); if (node.equals(startNode)) { setVertexPreferences(vertex, "start"); } else if (node.hasAttributes(Node.ATTR_MAIN_NODE)) { setVertexPreferences(vertex, "main"); } else if (node.hasAttributes(Node.ATTR_MISSING_NODE)) { setVertexPreferences(vertex, "missing"); } else { setVertexPreferences(vertex, "default"); } if (node.getDescription() != null) { vertex.setAttr(DESCRIPTION_ATTR, node.getDescription()); } if (useBusRouting) { final GrandUiPrefStore preferenceStore = Application.getInstance().getPreferenceStore(); vertex.setAttr("inthreshold", preferenceStore.getInt(PreferenceKeys.GRAPH_BUS_IN_THRESHOLD)); vertex.setAttr( "outthreshold", preferenceStore.getInt(PreferenceKeys.GRAPH_BUS_OUT_THRESHOLD)); } vertexLUT.put(name, vertex); nameDimensions.put(name, vertex); return vertex; }
/** * @param vertex IVertex * @param nodeType String */ private void setVertexPreferences(final IVertex vertex, final String nodeType) { final GrandUiPrefStore preferenceStore = Application.getInstance().getPreferenceStore(); final String keyPrefix = PreferenceKeys.NODE_PREFIX + nodeType; vertex.setAttr(SHAPE_ATTR, preferenceStore.getString(keyPrefix + ".shape")); vertex.setAttr(DRAW2DFGCOLOR_ATTR, preferenceStore.getColor(keyPrefix + ".fgcolor")); vertex.setAttr(DRAW2DFILLCOLOR_ATTR, preferenceStore.getColor(keyPrefix + ".fillcolor")); vertex.setAttr(DRAW2DLINEWIDTH_ATTR, preferenceStore.getInt(keyPrefix + ".linewidth")); }
/** * 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)); }
/** * 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; }