[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/eyes/tools/java/de/tub/eyes/diagram
Link.java, 1.1, 1.2
Till Wimmer
twimmer at users.sourceforge.net
Mon Apr 24 07:05:41 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/eyes/tools/java/de/tub/eyes/diagram
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23609
Modified Files:
Link.java
Log Message:
added set/get Visible methods; paint only when visible
Index: Link.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/eyes/tools/java/de/tub/eyes/diagram/Link.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Link.java 19 Oct 2005 15:22:27 -0000 1.1
--- Link.java 24 Apr 2006 14:05:39 -0000 1.2
***************
*** 28,31 ****
--- 28,32 ----
int id;
Date date;
+ boolean visible = false;
/**
***************
*** 82,90 ****
*/
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
! Point p1 = start.getPosition();
! Point p2 = end.getPosition();
g2.setStroke(new BasicStroke(LINE_WIDTH));
g2.setColor(color);
--- 83,98 ----
*/
public void paint(Graphics g) {
+ if (!visible)
+ return;
+
+ Point p1 = start.getPosition();
+ Point p2 = end.getPosition();
+ if (p1.x < 0 || p1.y < 0 || p2.x < 0 || p2.y < 0)
+ return;
+
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
!
g2.setStroke(new BasicStroke(LINE_WIDTH));
g2.setColor(color);
***************
*** 109,112 ****
--- 117,128 ----
}
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ public boolean getVisible() {
+ return this.visible;
+ }
+
/**
* Informs the Link that a Node it is connected to has moved. Calls repaint
More information about the Tinyos-contrib-commits
mailing list