Author: kono
Date: 2010-11-29 19:08:56 -0800 (Mon, 29 Nov 2010)
New Revision: 23050
Added:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ColorIcon.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/TextIcon.java
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ArrowIcon.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/LineTypeIcon.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/NodeIcon.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIcon.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DGraphView.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
Log:
Still fixing both Vizmap GUI and DING. Ding is still partially broken (due to
old giny static values?)
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -65,12 +65,13 @@
HEXAGON(GraphGraphics.SHAPE_HEXAGON, "Hexagon", true),
OCTAGON(GraphGraphics.SHAPE_OCTAGON, "Octagon", true);
- private int ginyShape;
- private String name;
- private boolean isSupported;
- private static Map<Byte, Shape> nodeShapes =
GraphGraphics.getNodeShapes();
+ private final Byte ginyShape;
+ private final String name;
+ private final boolean isSupported;
+
+ private static final Map<Byte, Shape> nodeShapes =
GraphGraphics.getNodeShapes();
- private NodeShape(int ginyShape, String name, boolean isSupported) {
+ private NodeShape(Byte ginyShape, String name, boolean isSupported) {
this.ginyShape = ginyShape;
this.name = name;
this.isSupported = isSupported;
@@ -166,7 +167,7 @@
* @return Giny shape as integer.
*/
// TODO rename this method so that it doesn't reference GINY
- public int getGinyShape() {
+ public Byte getGinyShape() {
return ginyShape;
}
@@ -176,7 +177,7 @@
* @param ginyShape
* @return
*/
- public static NodeShape getNodeShape(int ginyShape) {
+ public static NodeShape getNodeShape(Byte ginyShape) {
for (NodeShape shape : values()) {
if (shape.ginyShape == ginyShape)
return shape;
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ArrowIcon.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ArrowIcon.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ArrowIcon.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -34,9 +34,13 @@
*/
package org.cytoscape.ding.icon;
-import org.cytoscape.ding.ArrowShape;
-
-import java.awt.*;
+import java.awt.BasicStroke;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
@@ -67,8 +71,8 @@
* @param name DOCUMENT ME!
* @param color DOCUMENT ME!
*/
- public ArrowIcon(Shape shape, int width, int height, String name, Color
color) {
- super(shape, width, height, name, color);
+ public ArrowIcon(Shape shape, int width, int height, String name) {
+ super(shape, width, height, name);
}
/**
Added:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ColorIcon.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ColorIcon.java
(rev 0)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/ColorIcon.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -0,0 +1,35 @@
+package org.cytoscape.ding.icon;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Stroke;
+
+public class ColorIcon extends VisualPropertyIcon<Color> {
+
+ private static final long serialVersionUID = 5636448639330547200L;
+
+ private static final Stroke BORDER = new BasicStroke(1.0f);
+
+ public ColorIcon(final Color value, final int width, final int height,
final String name) {
+ super(value, width, height, name);
+ }
+
+ @Override public void paintIcon(Component c, Graphics g, int x, int y) {
+ final Graphics2D g2d = (Graphics2D) g;
+
+ // Turn AA on
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+
+ g2d.setColor(value);
+ g2d.fillRect(x+leftPad, y+bottomPad, width, height);
+ g2d.setColor(color);
+ g2d.setStroke(BORDER);
+ g2d.drawRect(x+leftPad, y+bottomPad, width, height);
+
+ }
+
+}
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/LineTypeIcon.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/LineTypeIcon.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/LineTypeIcon.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -34,18 +34,24 @@
*/
package org.cytoscape.ding.icon;
-import org.cytoscape.ding.LineStyle;
-
-import javax.swing.*;
-import java.awt.*;
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Stroke;
import java.awt.geom.Line2D;
+import javax.swing.SwingUtilities;
+
/**
* DOCUMENT ME!
*
* @author $author$
*/
-public class LineTypeIcon extends VisualPropertyIcon {
+public class LineTypeIcon extends VisualPropertyIcon<Stroke> {
private final static long serialVersionUID = 1202339875918391L;
private BasicStroke stroke;
protected Graphics2D g2d;
@@ -72,8 +78,8 @@
* @param name DOCUMENT ME!
* @param color DOCUMENT ME!
*/
- public LineTypeIcon(Stroke stroke, int width, int height, String name,
Color color) {
- super(null, width, height, name, color);
+ public LineTypeIcon(Stroke stroke, int width, int height, String name) {
+ super(null, width, height, name);
// TODO this value used to be set by the visual style default
final float lineWidth = 5.0f;
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/NodeIcon.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/NodeIcon.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/NodeIcon.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -67,8 +67,8 @@
* @param name DOCUMENT ME!
* @param color DOCUMENT ME!
*/
- public NodeIcon(Shape shape, int width, int height, String name, Color
color) {
- super(shape, width, height, name, color);
+ public NodeIcon(Shape shape, int width, int height, String name) {
+ super(shape, width, height, name);
adjustShape();
}
@@ -109,7 +109,7 @@
* @param x DOCUMENT ME!
* @param y DOCUMENT ME!
*/
- public void paintIcon(Component c, Graphics g, int x, int y) {
+ @Override public void paintIcon(Component c, Graphics g, int x, int y) {
g2d = (Graphics2D) g;
final AffineTransform af = new AffineTransform();
@@ -137,7 +137,7 @@
* @return DOCUMENT ME!
*/
public NodeIcon clone() {
- final NodeIcon cloned = new NodeIcon(value, width, height,
name, color);
+ final NodeIcon cloned = new NodeIcon(value, width, height,
name);
return cloned;
}
Added:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/TextIcon.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/TextIcon.java
(rev 0)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/TextIcon.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -0,0 +1,40 @@
+package org.cytoscape.ding.icon;
+
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+
+public class TextIcon extends VisualPropertyIcon<Object> {
+
+ private static final long serialVersionUID = -4217147694751380332L;
+
+ private static final Font font = new Font("SansSerif", Font.BOLD, 18);
+
+ public TextIcon(final Object value, final int width, final int height,
+ final String name) {
+ super(value, width, height, name);
+ this.leftPad = 15;
+ }
+
+ @Override
+ public void paintIcon(Component c, Graphics g, int x, int y) {
+ final Graphics2D g2d = (Graphics2D) g;
+
+ // Turn AA on
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ Font original = g2d.getFont();
+ if (value != null) {
+ g2d.setColor(color);
+ g2d.setFont(font);
+ g2d.drawString(value.toString(), x + leftPad,
y+height/2+9);
+ }
+
+ g2d.setFont(original);
+
+ }
+
+}
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIcon.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIcon.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIcon.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -80,9 +80,11 @@
* @param color
*/
public VisualPropertyIcon(final T value, final int width,
- final int height, final String name, final Color color)
{
+ final int height, final String name) {
// Validate parameters
+ if (value == null)
+ throw new NullPointerException("Value parameter is
null.");
if (name == null)
throw new NullPointerException("Name parameter is
null.");
if (width <= 0 || height <= 0)
@@ -95,11 +97,7 @@
this.height = height;
this.name = name;
- // For color, use default value if null.
- if (color != null)
- this.color = color;
- else
- this.color = DEFAULT_ICON_COLOR;
+ this.color = DEFAULT_ICON_COLOR;
}
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -8,7 +8,6 @@
import org.cytoscape.ding.LineStyle;
import org.cytoscape.ding.NodeShape;
import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.presentation.property.TwoDVisualLexicon;
public class VisualPropertyIconFactory implements IconFactory {
@@ -16,17 +15,19 @@
@Override
public <V> Icon createIcon(VisualProperty<V> vp, V value, int w, int h)
{
+ if(value == null)
+ return null;
Icon icon = null;
if(value instanceof Color) {
-
+ icon = new ColorIcon((Color) value, w, h,
value.toString());
} else if(value instanceof NodeShape) {
- icon = new NodeIcon(((NodeShape) value).getShape(), w,
h, ((NodeShape) value).getShapeName(), VisualPropertyIcon.DEFAULT_ICON_COLOR);
+ icon = new NodeIcon(((NodeShape) value).getShape(), w,
h, ((NodeShape) value).getShapeName());
} else if(value instanceof LineStyle) {
-
+ icon = new LineTypeIcon(((LineStyle)
value).getStroke(5), w, h, ((LineStyle) value).name());
} else {
-
+ icon = new TextIcon(value, w, h, value.toString());
}
return icon;
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -645,7 +645,9 @@
break;
default:
- throw new
IllegalArgumentException("unrecognized edge end type: " + type);
+ // TODO: is this OK?
+ m_view.m_edgeDetails.overrideSourceArrow(m_inx,
GraphGraphics.ARROW_NONE);
+ //throw new
IllegalArgumentException("unrecognized edge end type: " + type);
}
m_sourceEdgeEnd = type;
@@ -710,7 +712,8 @@
break;
default:
- throw new
IllegalArgumentException("unrecognized edge end type: " + type);
+ m_view.m_edgeDetails.overrideTargetArrow(m_inx,
GraphGraphics.ARROW_NONE);
+// throw new
IllegalArgumentException("unrecognized edge end type: " + type);
}
m_targetEdgeEnd = type;
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DGraphView.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -65,8 +65,10 @@
import org.cytoscape.ding.GraphView;
import org.cytoscape.ding.GraphViewChangeListener;
import org.cytoscape.ding.GraphViewObject;
+import org.cytoscape.ding.IconFactory;
import org.cytoscape.ding.NodeView;
import org.cytoscape.ding.PrintLOD;
+import org.cytoscape.ding.icon.VisualPropertyIconFactory;
import org.cytoscape.event.CyEventHelper;
import org.cytoscape.graph.render.immed.GraphGraphics;
import org.cytoscape.graph.render.stateful.GraphLOD;
@@ -374,6 +376,8 @@
// This is the view model. This should be immutable.
final CyNetworkView cyNetworkView;
+
+ private final IconFactory iconFactory;
/**
@@ -476,6 +480,8 @@
// cyNetworkView.getVisualProperty(vp));
new FlagAndSelectionHandler(this);
+
+ iconFactory = new VisualPropertyIconFactory();
logger.debug("Phase 4: Everything created: time = " +
(System.currentTimeMillis() - start));
}
@@ -2849,8 +2855,7 @@
@Override
public <V> Icon createIcon(VisualProperty<V> vp, V value, int w, int h)
{
- // TODO Auto-generated method stub
- return null;
+ return iconFactory.createIcon(vp, value, w, h);
}
@Override
Modified:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -105,9 +105,9 @@
public static final VisualProperty<Double> NODE_SIZE = new
DoubleVisualProperty(
50.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NODE_SIZE",
"Node size", CyNode.class);
public static final VisualProperty<Double> NODE_X_SIZE = new
DoubleVisualProperty(
- 50.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NODE_X_SIZE",
"Node X size (width)", CyNode.class);
+ 60.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NODE_X_SIZE",
"Node X size (width)", CyNode.class);
public static final VisualProperty<Double> NODE_Y_SIZE = new
DoubleVisualProperty(
- 70.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NODE_Y_SIZE",
"Node y size (height)", CyNode.class);
+ 40.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NODE_Y_SIZE",
"Node y size (height)", CyNode.class);
public static final VisualProperty<Boolean> NODE_VISIBLE = new
BooleanVisualProperty(
true, "NODE_VISIBLE", "Node Visible", CyNode.class);
@@ -141,21 +141,21 @@
//////// Network VP ////////
public static final VisualProperty<Double> NETWORK_SCALE_FACTOR = new
DoubleVisualProperty(
- 1.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE,
"NETWORK_SCALE_FACTOR", "Network Scale Factor", CyNetwork.class);
+ 1.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE,
"NETWORK_SCALE_FACTOR", "Network Scale Factor", true, CyNetwork.class);
public static final VisualProperty<Double> NETWORK_CENTER_LOCATION =
new DoubleVisualProperty(
- 0.0, ARBITRARY_DOUBLE_RANGE, "NETWORK_CENTER_LOCATION",
"Network Center Location", CyNetwork.class);
+ 0.0, ARBITRARY_DOUBLE_RANGE, "NETWORK_CENTER_LOCATION",
"Network Center Location", true, CyNetwork.class);
public static final VisualProperty<Double> NETWORK_CENTER_X_LOCATION =
new DoubleVisualProperty(
- 0.0, ARBITRARY_DOUBLE_RANGE,
"NETWORK_CENTER_X_LOCATION", "Network Center X Location", CyNetwork.class);
+ 0.0, ARBITRARY_DOUBLE_RANGE,
"NETWORK_CENTER_X_LOCATION", "Network Center X Location", true,
CyNetwork.class);
public static final VisualProperty<Double> NETWORK_CENTER_Y_LOCATION =
new DoubleVisualProperty(
- 0.0, ARBITRARY_DOUBLE_RANGE,
"NETWORK_CENTER_Y_LOCATION", "Network Center Y Location", CyNetwork.class);
+ 0.0, ARBITRARY_DOUBLE_RANGE,
"NETWORK_CENTER_Y_LOCATION", "Network Center Y Location", true,
CyNetwork.class);
public static final VisualProperty<Double> NETWORK_SIZE = new
DoubleVisualProperty(
- 100.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NETWORK_SIZE",
"Network Size", CyNetwork.class);
+ 100.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NETWORK_SIZE",
"Network Size", true, CyNetwork.class);
public static final VisualProperty<Double> NETWORK_WIDTH = new
DoubleVisualProperty(
- 100.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE,
"NETWORK_WIDTH", "Network Width", CyNetwork.class);
+ 100.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE,
"NETWORK_WIDTH", "Network Width", true, CyNetwork.class);
public static final VisualProperty<Double> NETWORK_HEIGHT = new
DoubleVisualProperty(
- 100.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE,
"NETWORK_HEIGHT", "Network Height", CyNetwork.class);
+ 100.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE,
"NETWORK_HEIGHT", "Network Height", true, CyNetwork.class);
public static final VisualProperty<String> NETWORK_TITLE = new
StringVisualProperty(
"", ARBITRARY_STRING_RANGE, "NETWORK_TITLE", "Network
Title", CyNetwork.class);
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -27,7 +27,6 @@
*/
package org.cytoscape.view.vizmap.gui.internal;
-
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@@ -77,6 +76,8 @@
import org.jdesktop.swingx.JXList;
import org.jdesktop.swingx.JXPanel;
import org.jdesktop.swingx.border.DropShadowBorder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Dialog for editing default visual property values.<br>
@@ -99,7 +100,10 @@
DefaultViewEditor, SelectedVisualStyleSwitchedListener {
private final static long serialVersionUID = 1202339876675416L;
-
+
+ private static final Logger logger = LoggerFactory
+ .getLogger(DefaultViewEditorImpl.class);
+
private static final int ICON_WIDTH = 48;
private static final int ICON_HEIGHT = 48;
@@ -493,14 +497,10 @@
}
private void applyNewStyle(CyNetworkView view) {
- VisualStyle curVS = vmm.getVisualStyle(view);
final VisualStyle selectedStyle = selectedManager
.getCurrentVisualStyle();
- if (curVS == null) {
- // Set new style
- vmm.setVisualStyle(selectedStyle, view);
- }
+ vmm.setVisualStyle(selectedStyle, view);
selectedStyle.apply(view);
view.updateView();
@@ -574,8 +574,9 @@
*
*/
class VisualPropCellRenderer extends JLabel implements ListCellRenderer
{
- private final static long serialVersionUID = 1202339876646385L;
+ private static final long serialVersionUID =
-1325179272895141114L;
+
private final Font SELECTED_FONT = new Font("SansSerif",
Font.ITALIC,
14);
private final Font NORMAL_FONT = new Font("SansSerif",
Font.BOLD, 12);
@@ -586,24 +587,29 @@
setOpaque(true);
}
- @Override public Component getListCellRendererComponent(JList
list, Object value,
+ @Override
+ public Component getListCellRendererComponent(JList list,
Object value,
int index, boolean isSelected, boolean
cellHasFocus) {
final VisualStyle selectedStyle = selectedManager
.getCurrentVisualStyle();
+
Icon icon = null;
VisualProperty<Object> vp = null;
if (value instanceof VisualProperty<?>) {
vp = (VisualProperty<Object>) value;
- RenderingEngine<?> presentation =
cyApplicationManager
+ final RenderingEngine<?> presentation =
cyApplicationManager
.getCurrentRenderingEngine();
- if (presentation != null)
- icon = presentation.createIcon(vp,
selectedStyle.getDefaultValue(vp), ICON_WIDTH, ICON_HEIGHT);
+
+ if (presentation != null) {
+ icon = presentation.createIcon(vp,
+
selectedStyle.getDefaultValue(vp), ICON_WIDTH,
+ ICON_HEIGHT);
+ }
}
- setText(vp.getDisplayName() + " = "
- + selectedStyle.getDefaultValue(vp));
+ setText(vp.getDisplayName());
setToolTipText(vp.getDisplayName());
setIcon(icon);
setFont(isSelected ? SELECTED_FONT : NORMAL_FONT);
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/event/CellEditorEventHandler.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -639,6 +639,10 @@
propList.add(newRootProp);
parent = null;
+
+ final VisualStyle currentStyle =
manager.getCurrentVisualStyle();
+ currentStyle.apply(applicationManager.getCurrentNetworkView());
+ applicationManager.getCurrentNetworkView().updateView();
}
// private <K, V> VisualMappingFunction<K, V> getNewMappingFunction(
Modified:
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
===================================================================
---
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
2010-11-29 23:09:05 UTC (rev 23049)
+++
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
2010-11-30 03:08:56 UTC (rev 23050)
@@ -286,20 +286,23 @@
// reset all rows to allow usage of default value:
for (final View<?> viewModel : views) {
- final Object currentValue =
viewModel.getVisualProperty(vp);
- // Some of the VP has null defaults.
- if (currentValue == null)
- continue;
-
- // If equals, it is not necessary to set new value.
- if (currentValue.equals(defaultValue))
- continue;
-
// Not a leaf VP. We can ignore those.
if
(lexicon.getVisualLexiconNode(vp).getChildren().size() != 0)
continue;
+
+ final Object currentValue =
viewModel.getVisualProperty(vp);
+
+// // Some of the VP has null defaults.
+// if (currentValue == null)
+// continue;
+// // If equals, it is not necessary to set new value.
+// if (currentValue.equals(defaultValue))
+// continue;
+//
+//
+
// This is a leaf, and need to be updated.
viewModel.setVisualProperty(vp, defaultValue);
--
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.