[graphl-cvs] graphl/src/org/mediavirus/graphl/painter ImageNodePainter.java StraightLineEdgePainter.
Status: Pre-Alpha
Brought to you by:
flo1
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16461/src/org/mediavirus/graphl/painter Modified Files: ImageNodePainter.java StraightLineEdgePainter.java LineEdgePainter.java BoxNodePainter.java StraightLineEdgePainterBeanInfo.java ShapeNodePainter.java Log Message: - FEATURE: added navigator thread for update-exhibition, disabled in normal operation - FEATURE: started implementation of filtering architecture - FEATURE: creating new node opens type context menu - CODE: added NS calss for easier namespace referencing in code Index: LineEdgePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/LineEdgePainter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LineEdgePainter.java 30 Nov 2004 09:38:34 -0000 1.8 --- LineEdgePainter.java 17 Aug 2005 15:52:51 -0000 1.9 *************** *** 17,20 **** --- 17,21 ---- import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.view.LabelGenerator; + import org.mediavirus.graphl.vocabulary.NS; import org.mediavirus.util.ParseUtils; *************** *** 27,31 **** --- 28,40 ---- protected boolean paintArrow = true; protected boolean paintLabel = true; + + /** + * + * @uml.property name="invertArrow" + */ + protected boolean invertArrow = false; + + Stroke stroke; Stroke highlightedStroke; *************** *** 101,104 **** --- 110,132 ---- /** + * @return Returns the invertArrow. + * + * @uml.property name="invertArrow" + */ + public boolean isInvertArrow() { + return invertArrow; + } + + /** + * @param invertArrow The invertArrow to set. + * + * @uml.property name="invertArrow" + */ + public void setInvertArrow(boolean invertArrow) { + this.invertArrow = invertArrow; + } + + + /** * @return The Stroke currently set for rendering the Edge. */ *************** *** 217,236 **** public void setConfigurationNode(Node node) { ! String str = node.getProperty("http://www.mediavirus.org/graphl#paintArrow"); if (str != null) { setPaintArrow(str.equalsIgnoreCase("true")); } ! str = node.getProperty("http://www.mediavirus.org/graphl#paintLabel"); if (str != null) { setPaintLabel(str.equalsIgnoreCase("true")); } ! Color col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#color")); if (col != null) setColor(col); ! col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#labelColor")); if (col != null) setLabelColor(col); ! Stroke stroke = ParseUtils.parseStroke(node.getProperty("http://www.mediavirus.org/graphl#stroke")); if (stroke != null) setStroke(stroke); --- 245,268 ---- public void setConfigurationNode(Node node) { ! String str = node.getProperty(NS.graphl + "paintArrow"); if (str != null) { setPaintArrow(str.equalsIgnoreCase("true")); } ! str = node.getProperty(NS.graphl + "paintLabel"); if (str != null) { setPaintLabel(str.equalsIgnoreCase("true")); } + str = node.getProperty(NS.graphl + "invertArrow"); + if (str != null) { + setInvertArrow(str.equalsIgnoreCase("true")); + } ! Color col = ParseUtils.parseColor(node.getProperty(NS.graphl + "color")); if (col != null) setColor(col); ! col = ParseUtils.parseColor(node.getProperty(NS.graphl + "labelColor")); if (col != null) setLabelColor(col); ! Stroke stroke = ParseUtils.parseStroke(node.getProperty(NS.graphl + "stroke")); if (stroke != null) setStroke(stroke); Index: StraightLineEdgePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/StraightLineEdgePainter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StraightLineEdgePainter.java 30 Nov 2004 09:38:33 -0000 1.6 --- StraightLineEdgePainter.java 17 Aug 2005 15:52:51 -0000 1.7 *************** *** 123,130 **** if (to.x>from.x) { angle = Math.atan2(to.y-from.y,to.x-from.x); } else { angle = Math.atan2(from.y-to.y,from.x-to.x); ! flipped = true; } --- 123,131 ---- if (to.x>from.x) { angle = Math.atan2(to.y-from.y,to.x-from.x); + flipped = invertArrow; } else { angle = Math.atan2(from.y-to.y,from.x-to.x); ! flipped = !invertArrow; } Index: ImageNodePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/ImageNodePainter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ImageNodePainter.java 21 Oct 2004 16:00:46 -0000 1.6 --- ImageNodePainter.java 17 Aug 2005 15:52:51 -0000 1.7 *************** *** 23,26 **** --- 23,27 ---- import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; + import org.mediavirus.graphl.vocabulary.NS; import org.mediavirus.util.ParseUtils; *************** *** 56,60 **** public void paintNode(GraphlPane graphPane, Graphics2D g, Node node, boolean selected, boolean highlighted) { ! Image img = getImage(node, graphPane.getGraph().getBaseURL()); if (img != null) { int iw, ih; --- 57,68 ---- public void paintNode(GraphlPane graphPane, Graphics2D g, Node node, boolean selected, boolean highlighted) { ! URL baseURL = null; ! try { ! baseURL = new URL(node.getFirstNeighbour(NS.graphl + "loadedFrom", true).getId()); ! } ! catch (Exception ex) { ! // do nothing ! } ! Image img = getImage(node, baseURL); if (img != null) { int iw, ih; *************** *** 140,144 **** int iw=1, ih=1; ! Image img = getImage(node, graphPane.getGraph().getBaseURL()); if (img != null) { if (node.getWidth() > 0) { --- 148,159 ---- int iw=1, ih=1; ! URL baseURL = null; ! try { ! baseURL = new URL(node.getFirstNeighbour(NS.graphl + "loadedFrom", true).getId()); ! } ! catch (Exception ex) { ! // do nothing ! } ! Image img = getImage(node, baseURL); if (img != null) { if (node.getWidth() > 0) { *************** *** 330,343 **** public void setConfigurationNode(Node node) { ! String str = node.getProperty("http://www.mediavirus.org/graphl#useStatic"); if (str != null) setUseStatic(Boolean.valueOf(str).booleanValue()); ! str = node.getProperty("http://www.mediavirus.org/graphl#property"); if (str != null) setProperty(str); ! str = node.getProperty("http://www.mediavirus.org/graphl#staticURL"); if (str != null) setStaticURL(str); ! Color col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#borderColor")); if (col != null) setBorderColor(col); --- 345,358 ---- public void setConfigurationNode(Node node) { ! String str = node.getProperty(NS.graphl + "useStatic"); if (str != null) setUseStatic(Boolean.valueOf(str).booleanValue()); ! str = node.getProperty(NS.graphl + "property"); if (str != null) setProperty(str); ! str = node.getProperty(NS.graphl + "staticURL"); if (str != null) setStaticURL(str); ! Color col = ParseUtils.parseColor(node.getProperty(NS.graphl + "borderColor")); if (col != null) setBorderColor(col); Index: ShapeNodePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/ShapeNodePainter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ShapeNodePainter.java 30 Nov 2004 09:38:34 -0000 1.5 --- ShapeNodePainter.java 17 Aug 2005 15:52:51 -0000 1.6 *************** *** 22,25 **** --- 22,26 ---- import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.graph.Node; + import org.mediavirus.graphl.vocabulary.NS; import org.mediavirus.util.ParseUtils; *************** *** 197,201 **** public void setConfigurationNode(Node node) { ! String str = node.getProperty("http://www.mediavirus.org/graphl#shape"); if ( str != null) { if (str.equalsIgnoreCase("X")) { --- 198,202 ---- public void setConfigurationNode(Node node) { ! String str = node.getProperty(NS.graphl + "shape"); if ( str != null) { if (str.equalsIgnoreCase("X")) { *************** *** 210,220 **** } ! Stroke stroke = ParseUtils.parseStroke(node.getProperty("http://www.mediavirus.org/graphl#stroke")); if (stroke != null) setStroke(stroke); ! Color col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#color")); if (col != null) setBorderColor(col); ! col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#fillColor")); if (col != null) setFillColor(col); --- 211,221 ---- } ! Stroke stroke = ParseUtils.parseStroke(node.getProperty(NS.graphl + "stroke")); if (stroke != null) setStroke(stroke); ! Color col = ParseUtils.parseColor(node.getProperty(NS.graphl + "color")); if (col != null) setBorderColor(col); ! col = ParseUtils.parseColor(node.getProperty(NS.graphl + "fillColor")); if (col != null) setFillColor(col); Index: StraightLineEdgePainterBeanInfo.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/StraightLineEdgePainterBeanInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StraightLineEdgePainterBeanInfo.java 14 Oct 2004 13:03:03 -0000 1.2 --- StraightLineEdgePainterBeanInfo.java 17 Aug 2005 15:52:51 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- new PropertyDescriptor("stroke", beanClass), new PropertyDescriptor("paintArrow", beanClass), + new PropertyDescriptor("invertArrow", beanClass), new PropertyDescriptor("paintLabel", beanClass) }; Index: BoxNodePainter.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/painter/BoxNodePainter.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BoxNodePainter.java 29 Dec 2004 14:31:34 -0000 1.9 --- BoxNodePainter.java 17 Aug 2005 15:52:51 -0000 1.10 *************** *** 18,21 **** --- 18,22 ---- import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.view.LabelGenerator; + import org.mediavirus.graphl.vocabulary.NS; import org.mediavirus.util.ParseUtils; *************** *** 323,340 **** public void setConfigurationNode(Node node) { ! Color col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#baseColor")); if (col != null) baseColor = col; ! col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#borderColor")); if (col != null) borderColor = col; ! col = ParseUtils.parseColor(node.getProperty("http://www.mediavirus.org/graphl#textColor")); if (col != null) textColor = col; ! Font font = ParseUtils.parseFont(node.getProperty("http://www.mediavirus.org/graphl#font")); if (font != null) setFont(font); try { ! Node labelGeneratorNode = (Node)node.getNeighbours("http://www.mediavirus.org/graphl#labelGenerator", true).get(0); labelGenerator.setConfigurationNode(labelGeneratorNode); } --- 324,341 ---- public void setConfigurationNode(Node node) { ! Color col = ParseUtils.parseColor(node.getProperty(NS.graphl + "baseColor")); if (col != null) baseColor = col; ! col = ParseUtils.parseColor(node.getProperty(NS.graphl + "borderColor")); if (col != null) borderColor = col; ! col = ParseUtils.parseColor(node.getProperty(NS.graphl + "textColor")); if (col != null) textColor = col; ! Font font = ParseUtils.parseFont(node.getProperty(NS.graphl + "font")); if (font != null) setFont(font); try { ! Node labelGeneratorNode = (Node)node.getNeighbours(NS.graphl + "labelGenerator", true).get(0); labelGenerator.setConfigurationNode(labelGeneratorNode); } *************** *** 343,356 **** } ! Stroke stroke = ParseUtils.parseStroke(node.getProperty("http://www.mediavirus.org/graphl#borderStroke")); if (stroke != null) setBorderStroke(stroke); ! String str = node.getProperty("http://www.mediavirus.org/graphl#roundRect"); if (str != null) setRoundRect(str.equalsIgnoreCase("true")); ! str = node.getProperty("http://www.mediavirus.org/graphl#useBorderColor"); if (str != null) setUseBorderColor(str.equalsIgnoreCase("true")); ! str = node.getProperty("http://www.mediavirus.org/graphl#cornerRadius"); if (str != null) setCornerRadius(Integer.parseInt(str)); } --- 344,357 ---- } ! Stroke stroke = ParseUtils.parseStroke(node.getProperty(NS.graphl + "borderStroke")); if (stroke != null) setBorderStroke(stroke); ! String str = node.getProperty(NS.graphl + "roundRect"); if (str != null) setRoundRect(str.equalsIgnoreCase("true")); ! str = node.getProperty(NS.graphl + "useBorderColor"); if (str != null) setUseBorderColor(str.equalsIgnoreCase("true")); ! str = node.getProperty(NS.graphl + "cornerRadius"); if (str != null) setCornerRadius(Integer.parseInt(str)); } |