Author: scooter
Date: 2012-06-18 17:41:47 -0700 (Mon, 18 Jun 2012)
New Revision: 29613
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/ArbitraryGraphicsCanvas.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/CyAnnotator.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/AbstractAnnotation.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ArrowAnnotationImpl.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/BoundedTextAnnotationImpl.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/GraphicsUtilities.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ShapeAnnotationImpl.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/TextAnnotationImpl.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/api/ArrowAnnotation.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/dialogs/ArrowAnnotationPanel.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasKeyListener.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasMouseMotionListener.java
Log:
Finish arrow work and fix printing. Session save/restore also works, now.
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/ArbitraryGraphicsCanvas.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/ArbitraryGraphicsCanvas.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/ArbitraryGraphicsCanvas.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -297,34 +297,13 @@
}
-
-/*
- @Override
- public Component getComponentAt(int x, int y) {
-
- int n=getComponentCount();
-
- for(int i=0;i<n;i++){
- Component
c=this.getComponent(i).getComponentAt(x, y);
-
- if(c!=null)
- return c;
- }
- return null;
- }
-*/
-
-
/**
* Invoke this method to print the component.
*
* @param graphics Graphics
*/
public void print(Graphics graphics) {
- int num=this.getComponentCount();
- for(int i=0;i<num;i++){
- this.getComponent(i).print(graphics);
- }
+ this.paintChildren(graphics);
}
private boolean setBoundsChildren() {
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/CyAnnotator.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/CyAnnotator.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/CyAnnotator.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -127,7 +127,12 @@
if (annotation instanceof ArrowAnnotation) {
ArrowAnnotation arrow =
(ArrowAnnotation)annotation;
arrow.getSource().addArrow(arrow);
-
arrow.getCanvas().add(arrow.getComponent());
+ if (arrow.getCanvas() != null)
+
arrow.getCanvas().add(arrow.getComponent());
+ else
+
foreGroundCanvas.add(arrow.getComponent());
+
+ addAnnotation(arrow);
}
}
}
@@ -191,6 +196,7 @@
}
public void addAnnotation(Annotation annotation) {
+ // System.out.println("Adding annotation: "+annotation);
annotationMap.put(annotation, annotation.getArgMap());
updateNetworkAttributes(view.getModel());
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/AbstractAnnotation.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/AbstractAnnotation.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/AbstractAnnotation.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -114,7 +114,9 @@
}
public String toString() {
- return "annotation "+uuid.toString()+" at "+getX()+",
"+getY()+" zoom="+globalZoom+" on canvas "+canvasName;
+ Map<String,String>argMap = getArgMap();
+
+ return argMap.get("type")+" annotation "+uuid.toString()+" at
"+getX()+", "+getY()+" zoom="+globalZoom+" on canvas "+canvasName;
}
@Override
@@ -266,9 +268,6 @@
public void drawAnnotation(Graphics g, double x,
double y, double scaleFactor) {
- for (ArrowAnnotation arrow: arrowList) {
- arrow.drawAnnotation(g, x, y, scaleFactor);
- }
}
public void update() {
@@ -286,14 +285,31 @@
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+ g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
+
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ // High quality color rendering is ON.
+ g2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
+ RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+
+ g2.setRenderingHint(RenderingHints.KEY_DITHERING,
+ RenderingHints.VALUE_DITHER_ENABLE);
+
+ g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+
+ // Text antialiasing is ON.
+ g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+ RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
+ RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+ g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
+ RenderingHints.VALUE_STROKE_PURE);
+
+
if (!usedForPreviews()) {
// We need to control composite ourselves for
previews...
g2.setComposite(AlphaComposite.Src);
-
- // for (ArrowAnnotation arrow: arrowList) {
- // arrow.drawArrow(g);
- // }
}
}
@@ -303,11 +319,11 @@
protected void updateAnnotationAttributes() {
if (!usedForPreviews) {
cyAnnotator.addAnnotation(this);
- if (arrowList != null) {
- for (ArrowAnnotation annotation: arrowList) {
- cyAnnotator.addAnnotation(annotation);
- }
- }
+ // if (arrowList != null) {
+ // for (ArrowAnnotation annotation: arrowList) {
+ // cyAnnotator.addAnnotation(annotation);
+ // }
+ // }
contentChanged();
}
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ArrowAnnotationImpl.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ArrowAnnotationImpl.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ArrowAnnotationImpl.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -98,7 +98,6 @@
Paint lineColor,
ArrowType sourceType, Paint sourceColor,
float sourceSize,
ArrowType targetType, Paint targetColor,
float targetSize) {
- // super(cyAnnotator, view, view.getZoom());
super(cyAnnotator, view, source.getComponent().getX(),
source.getComponent().getY(), view.getZoom());
// Line parameters
@@ -155,7 +154,14 @@
UUID uuid = UUID.fromString(argMap.get(TARGETANN));
target = cyAnnotator.getAnnotation(uuid);
} else if (argMap.containsKey(TARGETNODE)) {
+ String point = argMap.get(TARGETNODE);
+ String[] xy = point.split(",");
+ double x = Double.parseDouble(xy[0]);
+ double y = Double.parseDouble(xy[1]);
+ DNodeView nv = (DNodeView)view.getPickedNodeView(new
Point2D.Double(x,y));
+ target = nv.getModel();
}
+ updateBounds();
}
public Map<String,String> getArgMap() {
@@ -178,6 +184,12 @@
} else if (target instanceof Annotation) {
argMap.put(TARGETANN,((Annotation)target).getUUID().toString());
} else if (target instanceof CyNode) {
+ CyNode node = (CyNode)target;
+ DNodeView nv =
(DNodeView)view.getNodeView((CyNode)target);
+ double xCenter = nv.getXPosition();
+ double yCenter = nv.getYPosition();
+ argMap.put(TARGETNODE,
+
Double.toString(xCenter)+","+Double.toString(yCenter));
}
argMap.put(TARGETTYPE,
Integer.toString(this.targetType.ordinal()));
@@ -288,15 +300,20 @@
boolean selected = isSelected();
setSelected(false);
+ double scale = scaleFactor/getZoom();
+
// Get the stroke
- float border = lineWidth;
- if (border < 1.0f) border = 1.0f;
+ double border = lineWidth*scale;
+ if (border < 1.0) border = 1.0;
g2.setPaint(lineColor);
- g2.setStroke(new BasicStroke(border));
+ g2.setStroke(new BasicStroke((float)border));
- Line2D relativeLine = getRelativeLine(arrowLine, scaleFactor);
- if (relativeLine != null)
+ Line2D relativeLine = getRelativeLine(arrowLine,
+ x*scaleFactor,
y*scaleFactor, scale, border);
+
+ if (relativeLine != null) {
g2.draw(relativeLine);
+ }
// Add the head
if (sourceType != ArrowType.NONE) {
@@ -320,10 +337,15 @@
public void paint(Graphics g) {
super.paint(g);
- drawArrow(g);
+ drawArrow(g, false);
}
- public void drawArrow(Graphics g) {
+ public void print(Graphics g) {
+ super.paint(g);
+ drawArrow(g, true);
+ }
+
+ public void drawArrow(Graphics g, boolean isPrinting) {
if ( (source == null || target == null) && !usedForPreviews )
return;
if (!usedForPreviews)
@@ -336,11 +358,11 @@
// Get the stroke
float border = lineWidth;
- if (border < 1.0f) border = 1.0f;
+ if (!isPrinting && border < 1.0f) border = 1.0f;
g2.setPaint(lineColor);
- g2.setStroke(new BasicStroke(border));
+ g2.setStroke(new BasicStroke(border, BasicStroke.JOIN_ROUND,
BasicStroke.JOIN_ROUND, 10.0f));
- Line2D relativeLine = getRelativeLine(arrowLine, 1.0);
+ Line2D relativeLine = getRelativeLine(arrowLine, 0.0, 0.0, 1.0,
border);
g2.draw(relativeLine);
// Add the head
@@ -369,31 +391,32 @@
return new ArrowAnnotationDialog(this);
}
- private Line2D getRelativeLine(Line2D line, double scaleFactor) {
+ private Line2D getRelativeLine(Line2D line, double x, double y,
+ double scaleFactor, double stroke) {
if (usedForPreviews || line == null)
return line;
- double x1 = line.getX1();
- double x2 = line.getX2();
- double width = Math.abs(x2-x1)+xOffset;
- double y1 = line.getY1();
- double y2 = line.getY2();
- double height = Math.abs(y2-y1)+yOffset;
+ double x1 = line.getX1()*scaleFactor;
+ double x2 = line.getX2()*scaleFactor;
+ double width = Math.abs(x2-x1)+xOffset*scaleFactor;
+ double y1 = line.getY1()*scaleFactor;
+ double y2 = line.getY2()*scaleFactor;
+ double height = Math.abs(y2-y1)+yOffset*scaleFactor;
if (y2 < y1) {
- y1 = height;
- y2 = yOffset;
+ y1 = height+y-stroke;
+ y2 = yOffset*scaleFactor+y+stroke;
} else {
- y1 = yOffset;
- y2 = height;
+ y1 = yOffset*scaleFactor+y+stroke;
+ y2 = height+y-stroke;
}
if (x2 < x1) {
- x1 = width;
- x2 = xOffset;
+ x1 = width+x-stroke;
+ x2 = xOffset*scaleFactor+x+stroke;
} else {
- x1 = xOffset;
- x2 = width;
+ x1 = xOffset*scaleFactor+x+stroke;
+ x2 = width+x-stroke;
}
- return new Line2D.Double(x1*scaleFactor, y1*scaleFactor,
x2*scaleFactor, y2*scaleFactor);
+ return new Line2D.Double(x1, y1, x2, y2);
}
private void updateBounds() {
@@ -401,13 +424,13 @@
// We need to take into account our arrows
if (targetType != ArrowType.NONE) {
- xOffset = targetSize*10.0*getZoom();
- yOffset = targetSize*10.0*getZoom();
+ xOffset = targetSize*10.0*getZoom() + lineWidth*2;;
+ yOffset = targetSize*10.0*getZoom() + lineWidth*2;;
}
if (sourceType != ArrowType.NONE) {
- xOffset += sourceSize*10.0*getZoom();
- yOffset += sourceSize*10.0*getZoom();
+ xOffset += sourceSize*10.0*getZoom() + lineWidth*2;;
+ yOffset += sourceSize*10.0*getZoom() + lineWidth*2;;
}
// Update our bounds
@@ -420,7 +443,6 @@
setLocation((int)(Math.min(x1, x2)-xOffset),
(int)(Math.min(y1, y2)-yOffset));
setSize(Math.abs(x1-x2)+xOffset*2,
Math.abs(y1-y2)+yOffset*2);
}
-
}
private Line2D getArrowLine(Object target, Annotation source) {
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/BoundedTextAnnotationImpl.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/BoundedTextAnnotationImpl.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/BoundedTextAnnotationImpl.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -182,10 +182,16 @@
return;
}
- // g2.drawString(text, getX()+halfWidth, getY()+halfHeight);
g2.drawString(text, halfWidth, halfHeight);
}
+ public void print(Graphics g) {
+ boolean selected = isSelected();
+ setSelected(false);
+ paint(g);
+ setSelected(selected);
+ }
+
@Override
public void setSpecificZoom(double zoom) {
font=font.deriveFont(((float)(zoom/getSpecificZoom()))*font.getSize2D());
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/GraphicsUtilities.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/GraphicsUtilities.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/GraphicsUtilities.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -84,19 +84,19 @@
// Given a position and a size, draw a shape. We use the
ShapeAnnotation to get the
// shape itself, colors, strokes, etc.
static public void drawShape(Graphics g, double x, double y, double
width, double height,
- ShapeAnnotation annotation) {
+ ShapeAnnotation annotation, boolean
isPrinting) {
Graphics2D g2 = (Graphics2D)g;
// System.out.println("drawShape:
("+x+","+y+","+width+"x"+height+")");
+ // Get the stroke
+ float border = (float)annotation.getBorderWidth();
+ if (!isPrinting && border < 1.0f) border = 1.0f;
+
// Get the shape
- Shape shape = getShape(annotation.getShapeType(), x, y, width,
height);
+ Shape shape = getShape(annotation.getShapeType(), x+border,
y+border, width-border, height-border);
// System.out.println("drawShape: shape = "+shape.toString());
- // Stroke it
- float border = (float)annotation.getBorderWidth();
- if (border < 1.0f) border = 1.0f;
-
// Set our fill color
if (annotation.getFillColor() != null) {
// System.out.println("drawShape: fill color =
"+annotation.getFillColor());
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ShapeAnnotationImpl.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ShapeAnnotationImpl.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/ShapeAnnotationImpl.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -183,26 +183,19 @@
boolean selected = isSelected();
setSelected(false);
GraphicsUtilities.drawShape(g, (int)(x*scaleFactor),
(int)(y*scaleFactor),
- width, height, this);
+ width, height, this, false);
setSelected(selected);
borderWidth = savedBorder;
}
public void paint(Graphics g) {
super.paint(g);
+ GraphicsUtilities.drawShape(g, 0, 0, getWidth()-1,
getHeight()-1, this, false);
+ }
- GraphicsUtilities.drawShape(g, 0, 0,
- getWidth()-1, getHeight()-1, this);
- if (usedForPreviews()) {
- // For previews, our size and position is managed by
the surrounding component
- //GraphicsUtilities.drawShape(g, borderWidth/2,
borderWidth/2,
- // shapeWidth-borderWidth,
shapeHeight-borderWidth, this);
- return;
- }
-
- // Point2D p1 = getLocation();
- // GraphicsUtilities.drawShape(g, (int)p1.getX(),
(int)p1.getY(), shapeWidth, shapeHeight, this);
- // GraphicsUtilities.drawShape(g, 0, 0, shapeWidth,
shapeHeight, this);
+ public void print(Graphics g) {
+ super.paint(g);
+ GraphicsUtilities.drawShape(g, 0, 0, getWidth()-1,
getHeight()-1, this, true);
}
public void setSize(double width, double height) {
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/TextAnnotationImpl.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/TextAnnotationImpl.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/annotations/TextAnnotationImpl.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -9,6 +9,8 @@
import java.awt.Paint;
import java.awt.Rectangle;
+import java.awt.font.FontRenderContext;
+
import javax.swing.JFrame;
import java.util.Map;
@@ -193,8 +195,8 @@
g2.setColor(textColor);
g2.setFont(font);
- int halfWidth = (getWidth()-getTextWidth(g2))/2;
- int halfHeight = (getHeight()+getTextHeight(g2)/2)/2; // Note,
this is + because we start at the baseline
+ int halfWidth = (int)((double)getWidth()-getTextWidth(g2))/2;
+ int halfHeight =
(int)((double)getHeight()+getTextHeight(g2)/2.0)/2; // Note, this is + because
we start at the baseline
if(usedForPreviews) {
g2.drawString(text, halfWidth, halfHeight);
@@ -208,34 +210,47 @@
g2.setColor(Color.YELLOW);
g2.setStroke(new BasicStroke(2.0f));
// g2.drawRect(getX()-4, getY()-4, getTextWidth(g2)+8,
getTextHeight(g2)+8);
- g2.drawRect(0, 0, getTextWidth(g2), getTextHeight(g2));
+ g2.drawRect(0, 0, getAnnotationWidth(),
getAnnotationHeight());
}
}
+ public void print(Graphics g) {
+ boolean selected = isSelected();
+ setSelected(false);
+ paint(g);
+ setSelected(selected);
+ }
+
int getAnnotationWidth() {
- return getTextWidth((Graphics2D)this.getGraphics());
+ return (int)(getTextWidth((Graphics2D)this.getGraphics())+1.0);
}
int getAnnotationHeight() {
- return getTextHeight((Graphics2D)this.getGraphics());
+ return (int)(getTextHeight((Graphics2D)this.getGraphics())+1.0);
}
- int getTextWidth(Graphics2D g2) {
+ double getTextWidth(Graphics2D g2) {
+ return font.getStringBounds(text, new FontRenderContext(null,
true, true)).getWidth();
+/*
if (g2 != null) {
FontMetrics fontMetrics=g2.getFontMetrics(font);
return fontMetrics.stringWidth(text);
}
// If we don't have a graphics context, yet, make some
assumptions
return (int)(text.length()*fontSize);
+*/
}
- int getTextHeight(Graphics2D g2) {
+ double getTextHeight(Graphics2D g2) {
+ return font.getStringBounds(text, new FontRenderContext(null,
true, true)).getHeight();
+/*
if (g2 != null) {
FontMetrics fontMetrics=g2.getFontMetrics(font);
return fontMetrics.getHeight();
}
// If we don't have a graphics context, yet, make some
assumptions
return (int)(fontSize*1.5);
+*/
}
Font getArgFont(Map<String, String> argMap) {
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/api/ArrowAnnotation.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/api/ArrowAnnotation.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/api/ArrowAnnotation.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -53,5 +53,5 @@
public ArrowType[] getSupportedArrows();
- public void drawArrow(Graphics g);
+ // public void drawArrow(Graphics g, boolean isPrinting);
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/dialogs/ArrowAnnotationPanel.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/dialogs/ArrowAnnotationPanel.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/dialogs/ArrowAnnotationPanel.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -171,8 +171,34 @@
add(targetPanel);
// targetPanel.setLocation(LEFT, y);
targetPanel.setBounds(LEFT, y, WIDTH-15, ARROWHEIGHT);
+
+ iModifySAPreview();
}
+
+ public void iModifySAPreview(){
+ // Line parameters
+ preview.setLineWidth( mAnnotation.getLineWidth() );
+ preview.setLineColor( mAnnotation.getLineColor() );
+
+ // Source arrow parameters
+ preview.setArrowType(ArrowEnd.SOURCE,
+ mAnnotation.getArrowType(ArrowEnd.SOURCE));
+ preview.setArrowSize(ArrowEnd.SOURCE,
+ mAnnotation.getArrowSize(ArrowEnd.SOURCE));
+ preview.setArrowColor(ArrowEnd.SOURCE,
+
mAnnotation.getArrowColor(ArrowEnd.SOURCE));
+
+ // Target arrow parameters
+ preview.setArrowType(ArrowEnd.TARGET,
+ mAnnotation.getArrowType(ArrowEnd.TARGET));
+ preview.setArrowSize(ArrowEnd.TARGET,
+ mAnnotation.getArrowSize(ArrowEnd.TARGET));
+ preview.setArrowColor(ArrowEnd.TARGET,
+
mAnnotation.getArrowColor(ArrowEnd.TARGET));
+ previewPanel.repaint();
+ }
+
public ArrowAnnotation getPreview() {
return preview;
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasKeyListener.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasKeyListener.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasKeyListener.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -67,6 +67,7 @@
//Adjust the locations of the selected
annotations
annotation.getComponent().setLocation(x,y);
}
+ annotation.update();
annotation.getCanvas().repaint();
}
} else {
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasMouseMotionListener.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasMouseMotionListener.java
2012-06-18 23:42:32 UTC (rev 29612)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/cyannotator/listeners/CanvasMouseMotionListener.java
2012-06-19 00:41:47 UTC (rev 29613)
@@ -45,6 +45,7 @@
if (moveAnnotation != null) {
moveAnnotation.getComponent().setLocation(mouseX,
mouseY);
+ moveAnnotation.update();
moveAnnotation.getCanvas().repaint();
} else if (resizeAnnotation != null) {
Component resizeComponent =
resizeAnnotation.getComponent();
@@ -71,6 +72,7 @@
if (width == 0) width = 2;
if (height == 0) height = 2;
resizeAnnotation.setSize((double)width, (double)height);
+ resizeAnnotation.update();
resizeAnnotation.getCanvas().repaint();
} else if (repositionAnnotation != null) {
Point2D mousePoint = new Point2D.Double(mouseX, mouseY);
@@ -91,6 +93,7 @@
repositionAnnotation.setTarget(mousePoint);
}
+ repositionAnnotation.update();
repositionAnnotation.getCanvas().repaint();
}
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.