Author: kono
Date: 2011-11-28 16:24:44 -0800 (Mon, 28 Nov 2011)
New Revision: 27625
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/NodeViewDefaultSupport.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DependencyTable.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
Log:
Some bugs related to Custom Graphics had been fixed. Still layer ordering bug
exists.
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
2011-11-29 00:19:39 UTC (rev 27624)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
2011-11-29 00:24:44 UTC (rev 27625)
@@ -30,7 +30,6 @@
@Override
public Set<CyCustomGraphics> values() {
-
return new
HashSet<CyCustomGraphics>(manager.getAllCustomGraphics());
}
@@ -38,5 +37,13 @@
public void addRangeValue(CyCustomGraphics newValue) {
manager.addCustomGraphics(newValue, null);
}
+
+ @Override
+ public boolean inRange(CyCustomGraphics value) {
+ if(manager.getAllCustomGraphics().contains(value))
+ return true;
+ else
+ return false;
+ }
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
2011-11-29 00:19:39 UTC (rev 27624)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
2011-11-29 00:24:44 UTC (rev 27625)
@@ -32,17 +32,24 @@
import java.awt.Font;
import java.awt.Paint;
import java.awt.TexturePaint;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.cytoscape.ding.DNodeShape;
import org.cytoscape.ding.Label;
+import org.cytoscape.ding.customgraphics.CyCustomGraphics;
+import org.cytoscape.ding.customgraphics.Layer;
+import org.cytoscape.ding.impl.visualproperty.CustomGraphicsVisualProperty;
import org.cytoscape.graph.render.stateful.CustomGraphic;
import org.cytoscape.graph.render.stateful.NodeDetails;
import org.cytoscape.util.intr.IntObjHash;
+import org.cytoscape.view.model.VisualProperty;
/*
@@ -51,6 +58,9 @@
*/
class DNodeDetails extends IntermediateNodeDetails {
+ // Will be used when Custom graphics is empty.
+ private final static Set<CustomGraphic> EMPTY_CUSTOM_GRAPHICS = new
LinkedHashSet<CustomGraphic>(0);
+
final DGraphView m_view;
final Object m_deletedEntry = new Object();
@@ -81,8 +91,6 @@
Map<Integer, Double> m_width = new HashMap<Integer, Double>();
-
-
private Set<Integer> selected = new HashSet<Integer>();
// Default values
@@ -107,13 +115,15 @@
private Double m_labelOffsetVectorXDefault;
private Double m_labelOffsetVectorYDefault;
private Byte m_labelJustifyDefault;
- private Double m_labelWidthDefault;
+ private Double m_labelWidthDefault;
+ private final Map<CustomGraphicsVisualProperty,
CyCustomGraphics<CustomGraphic>> defaultCustomGraphicsMap;
private boolean isCleared = false;
-
+
DNodeDetails(final DGraphView view) {
m_view = view;
+ defaultCustomGraphicsMap = new
HashMap<CustomGraphicsVisualProperty, CyCustomGraphics<CustomGraphic>>();
}
void clear() {
@@ -243,21 +253,6 @@
}
-// /*
-// * A null color has the special meaning to remove overridden color.
-// */
-// void overrideColorLowDetail(int node, Color color) {
-// if ((color == null) ||
color.equals(super.colorLowDetail(node))) {
-// final Object val = m_colorsLowDetail.get(node);
-//
-// if ((val != null) && (val != m_deletedEntry))
-// m_colorsLowDetail.put(node, m_deletedEntry);
-// } else {
-// m_colorsLowDetail.put(node, color);
-// isCleared = false;
-// }
-// }
-
@Override
public byte shape(final int node) {
final Byte shape = m_shapes.get(node);
@@ -339,8 +334,6 @@
void unselect(final int node) {
selected.remove(node);
}
-
-
@Override
@@ -558,32 +551,44 @@
}
}
- // overrides NodeDetails.customGraphicCount():
+
+ @Override
public int customGraphicCount(final int node) {
final DNodeView dnv = (DNodeView) m_view.getDNodeView(node);
return dnv.getNumCustomGraphics();
}
- // overrides NodeDetails.customGraphics():
+
+ @Override
public Iterator<CustomGraphic> customGraphics (final int node) {
final DNodeView dnv = (DNodeView) m_view.getDNodeView(node);
- return dnv.customGraphicIterator();
+ final Iterator<CustomGraphic> iterator =
dnv.customGraphicIterator();
+
+ if (iterator == null) {
+ if ( defaultCustomGraphicsMap.size() == 0)
+ return EMPTY_CUSTOM_GRAPHICS.iterator();
+ else {
+ List<CustomGraphic> cgList = new
ArrayList<CustomGraphic>();
+ for (CyCustomGraphics<CustomGraphic>
val:defaultCustomGraphicsMap.values()) {
+ List<Layer<CustomGraphic>> layers =
val.getLayers();
+ for(Layer<CustomGraphic> layer: layers)
{
+
cgList.add(layer.getLayerObject());
+ }
+ }
+ return cgList.iterator();
+ }
+ } else
+ return dnv.customGraphicIterator();
}
- // overrides NodeDetails.customGraphicLock():
- public Object customGraphicLock (final int node) {
- final DNodeView dnv = (DNodeView) m_view.getDNodeView(node);
- return dnv.customGraphicLock();
+
+
+ void setCustomGraphicsDefault(final CustomGraphicsVisualProperty vp,
+ final CyCustomGraphics<CustomGraphic> customGraphics) {
+ defaultCustomGraphicsMap.put(vp, customGraphics);
}
- // label positioning
- /**
- * DOCUMENT ME!
- *
- * @param node DOCUMENT ME!
- * @param labelInx DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
+
+ @Override
public byte labelTextAnchor(final int node, final int labelInx) {
final Integer p = m_labelTextAnchors.get(node);
@@ -609,14 +614,7 @@
}
}
- /**
- * DOCUMENT ME!
- *
- * @param node DOCUMENT ME!
- * @param labelInx DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
+ @Override
public byte labelNodeAnchor(final int node, final int labelInx) {
final Integer o = m_labelNodeAnchors.get(node);
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
2011-11-29 00:19:39 UTC (rev 27624)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
2011-11-29 00:24:44 UTC (rev 27625)
@@ -177,9 +177,6 @@
// object assuming it takes up the least amount of memory:
private final Object[] CG_LOCK = new Object[0];
- // Will be used when Custom graphics is empty.
- private final static Set<CustomGraphic> EMPTY_CUSTOM_GRAPHICS = new
LinkedHashSet<CustomGraphic>(0);
-
// Map from NodeCustomGraphics Visual Property to native CustomGraphics
// objects.
private final Map<VisualProperty<?>, Set<CustomGraphic>> cgMap;
@@ -696,10 +693,6 @@
m_selected = true;
graphView.m_nodeDetails.select(m_inx);
-
-// graphView.m_nodeDetails.overrideFillPaint(m_inx,
graphView.m_nodeDetails.selectedPaint(m_inx));
-// graphView.m_nodeDetails.overrideColorLowDetail(m_inx, (Color)
graphView.m_nodeDetails.selectedPaint(m_inx));
-
graphView.m_selectedNodes.insert(m_inx);
return true;
@@ -724,9 +717,6 @@
m_selected = false;
graphView.m_nodeDetails.unselect(m_inx);
-// graphView.m_nodeDetails.overrideFillPaint(m_inx,
graphView.m_nodeDetails.fillPaint(m_inx));
-// graphView.m_nodeDetails.overrideColorLowDetail(m_inx, (Color)
graphView.m_nodeDetails.fillPaint(m_inx));
-
graphView.m_selectedNodes.delete(m_inx);
return true;
@@ -792,12 +782,7 @@
}
}
- /**
- * DOCUMENT ME!
- *
- * @param textPaint
- * DOCUMENT ME!
- */
+
@Override
public void setTextPaint(Paint textPaint) {
synchronized (graphView.m_lock) {
@@ -806,32 +791,16 @@
}
}
- /**
- * DOCUMENT ME!
- *
- * @param threshold
- * DOCUMENT ME!
- */
- public void setGreekThreshold(double threshold) {
- }
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
+ @Override
public String getText() {
synchronized (graphView.m_lock) {
return graphView.m_nodeDetails.labelText(m_inx, 0);
}
}
- /**
- * DOCUMENT ME!
- *
- * @param text
- * DOCUMENT ME!
- */
+
+ @Override
public void setText(String text) {
synchronized (graphView.m_lock) {
graphView.m_nodeDetails.overrideLabelText(m_inx, 0,
text);
@@ -900,8 +869,6 @@
retVal = false;
else {
retVal = orderedCustomGraphicLayers.add(cg);
- // ????graphicsPositions.put(cg,
- // ObjectPositionImpl.DEFAULT_POSITION);
}
}
ensureContentChanged();
@@ -925,26 +892,22 @@
}
/**
- * Return a non-null, read-only Iterator over all CustomGraphics
contained
+ * Return a read-only Iterator over all CustomGraphics contained
* in this DNodeView. The Iterator will return each CustomGraphic in
draw
* order. The Iterator cannot be used to modify the underlying set of
* CustomGraphics.
*
* @return The CustomGraphics Iterator. If no CustomGraphics are
associated
- * with this DNOdeView, an empty Iterator is returned.
+ * with this DNOdeView, null is returned.
* @throws UnsupportedOperationException
* if an attempt is made to use the Iterator's remove()
method.
- * @since Cytoscape 2.6
*/
public Iterator<CustomGraphic> customGraphicIterator() {
- final Iterable<CustomGraphic> toIterate;
synchronized (CG_LOCK) {
- if (orderedCustomGraphicLayers == null) {
- toIterate = EMPTY_CUSTOM_GRAPHICS;
- } else {
- toIterate = orderedCustomGraphicLayers;
- }
- return new ReadOnlyIterator<CustomGraphic>(toIterate);
+ if (orderedCustomGraphicLayers == null)
+ return null;
+ else
+ return new
ReadOnlyIterator<CustomGraphic>(orderedCustomGraphicLayers);
}
}
@@ -1315,53 +1278,23 @@
final VisualProperty<ObjectPosition> cgPositionVP =
DVisualLexicon.getAssociatedCustomGraphicsPositionVP(vp);
final ObjectPosition positionValue =
getVisualProperty(cgPositionVP);
- // final ObjectPosition position =
this.graphicsPositions.get(vp);
- // System.out.print("CG Position for: " +
- // cgPositionVP.getDisplayName());
- // System.out.println(" = " + positionValue);
-
for (Layer<CustomGraphic> layer : layers) {
// Assume it's a Ding layer
CustomGraphic newCG = layer.getLayerObject();
- // if(newPosition != null) {
- // newCG = this.moveCustomGraphicsToNewPosition(newCG,
newPosition);
- // System.out.println("MOVED: " + vp.getDisplayName());
- // }
-
CustomGraphic finalCG = newCG;
if (sync) {
// Size is locked to node size.
finalCG = syncSize(customGraphics, newCG,
lexicon.getVisualLexiconNode(MinimalVisualLexicon.NODE_WIDTH)
.isDepend());
}
- // addCustomGraphic(resized);
- // dCustomGraphicsSet.add(resized);
- // } else {
- // addCustomGraphic(newCG);
- // dCustomGraphicsSet.add(newCG);
- // }
-
finalCG = moveCustomGraphicsToNewPosition(finalCG,
positionValue);
addCustomGraphic(finalCG);
dCustomGraphicsSet.add(finalCG);
}
- // this.currentMap.put(dv, targets);
- // if(position != null &&
- // position.equals(ObjectPositionImpl.DEFAULT_POSITION) ==
false) {
- // // Transform
- // this.transformCustomGraphics(dCustomGraphicsSet, vp,
position);
- // }
-
cgMap.put(vp, dCustomGraphicsSet);
-
- // Flag this as used Custom Graphics
- //
Cytoscape.getVisualMappingManager().getCustomGraphicsManager().setUsedInCurrentSession(graphics,
- // true);
-
- // System.out.println("CG Applyed: " + vp.getDisplayName());
}
private void applyCustomGraphicsPosition(final VisualProperty<?> vp,
final ObjectPosition position) {
@@ -1384,31 +1317,21 @@
if (parent == null)
throw new NullPointerException("Associated Custom
Graphics VP is missing for " + vp.getDisplayName());
- // System.out.println("Got associated CG = " +
parent.getDisplayName());
final Set<CustomGraphic> currentCG = cgMap.get(parent);
- if (currentCG == null || currentCG.size() == 0) {
- // Ignore if no CG is available.
- // System.out.println(" CG not found. No need to
update: " +
- // parent.getDisplayName());
+ if (currentCG == null || currentCG.size() == 0)
return;
- }
final Set<CustomGraphic> newList = new HashSet<CustomGraphic>();
for (CustomGraphic g : currentCG) {
newList.add(moveCustomGraphicsToNewPosition(g,
position));
- // this.removeCustomGraphic(g);
}
currentCG.clear();
currentCG.addAll(newList);
this.cgMap.put(parent, currentCG);
- // this.graphicsPositions.put(parent, position);
-
- // System.out.println("Position applied of CG = " +
vp.getDisplayName()
- // + " <--- " + parent.getDisplayName());
}
private CustomGraphic syncSize(CyCustomGraphics<?> graphics, final
CustomGraphic cg, final boolean whLock) {
@@ -1446,56 +1369,4 @@
}
return new
CustomGraphic(scale.createTransformedShape(originalShape),
cg.getPaintFactory());
}
-
-// @Override
-// public <T> T getVisualProperty(final VisualProperty<T> vp) {
-// Object value = null;
-//
-// if (vp == DVisualLexicon.NODE_SHAPE) {
-// value = Integer.valueOf(getShape());
-// } else if (vp == DVisualLexicon.NODE_SELECTED_PAINT) {
-// value = getSelectedPaint();
-// } else if (vp == MinimalVisualLexicon.NODE_SELECTED) {
-// value = Boolean.valueOf(isSelected());
-// } else if (vp == MinimalVisualLexicon.NODE_VISIBLE) {
-// value = !graphView.isHidden(this);
-// } else if (vp == MinimalVisualLexicon.NODE_FILL_COLOR) {
-// value = getUnselectedPaint();
-// } else if (vp == DVisualLexicon.NODE_BORDER_PAINT) {
-// value = getBorderPaint();
-// } else if (vp == DVisualLexicon.NODE_BORDER_WIDTH) {
-// value = getBorderWidth();
-// } else if (vp == DVisualLexicon.NODE_BORDER_LINE_TYPE) {
-// value = this.getBorder();
-// } else if (vp == DVisualLexicon.NODE_TRANSPARENCY) {
-// value = getTransparency();
-// } else if (vp == MinimalVisualLexicon.NODE_WIDTH) {
-// value = getWidth();
-// } else if (vp == MinimalVisualLexicon.NODE_HEIGHT) {
-// value = getHeight();
-// } else if (vp == MinimalVisualLexicon.NODE_SIZE) {
-// value = getWidth();
-// } else if (vp == MinimalVisualLexicon.NODE_LABEL) {
-// value = getText();
-// } else if (vp == MinimalVisualLexicon.NODE_X_LOCATION) {
-// value = getXPosition();
-// } else if (vp == MinimalVisualLexicon.NODE_Y_LOCATION) {
-// value = getYPosition();
-// } else if (vp == DVisualLexicon.NODE_TOOLTIP) {
-// value = getToolTip();
-// } else if (vp == MinimalVisualLexicon.NODE_LABEL_COLOR) {
-// value = getTextPaint();
-// } else if (vp == DVisualLexicon.NODE_LABEL_FONT_FACE) {
-// value = getFont();
-// } else if (vp == DVisualLexicon.NODE_LABEL_FONT_SIZE) {
-// value = getFont().getSize();
-// } else if (vp == DVisualLexicon.NODE_LABEL_POSITION) {
-// value = getLabelPosition();
-// } else if (vp instanceof CustomGraphicsVisualProperty) {
-// // FIXME!
-// } else
-// value = vp.getDefault();
-//
-// return (T) value;
-// }
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/NodeViewDefaultSupport.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/NodeViewDefaultSupport.java
2011-11-29 00:19:39 UTC (rev 27624)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/NodeViewDefaultSupport.java
2011-11-29 00:24:44 UTC (rev 27625)
@@ -31,9 +31,16 @@
import java.awt.Color;
import java.awt.Font;
import java.awt.Paint;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import org.cytoscape.ding.DNodeShape;
import org.cytoscape.ding.ObjectPosition;
+import org.cytoscape.ding.customgraphics.CyCustomGraphics;
+import org.cytoscape.ding.impl.visualproperty.CustomGraphicsVisualProperty;
+import org.cytoscape.graph.render.stateful.CustomGraphic;
import org.cytoscape.view.model.VisualProperty;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
@@ -60,16 +67,19 @@
private Font font;
private Color borderColor;
+ private final Map<VisualProperty<CyCustomGraphics<CustomGraphic>>,
CyCustomGraphics<CustomGraphic>> defaultCustomGraphicsMap;
+
NodeViewDefaultSupport(final DNodeDetails nodeDetails, final Object
lock) {
this.nodeDetails = nodeDetails;
this.lock = lock;
+ this.defaultCustomGraphicsMap = new
HashMap<VisualProperty<CyCustomGraphics<CustomGraphic>>,
CyCustomGraphics<CustomGraphic>>();
}
- <T, V extends T> void setNodeViewDefault(final VisualProperty<? extends
T> vp, V value) {
+ <V> void setNodeViewDefault(final VisualProperty<?> vpOriginal, V
value) {
+ final VisualProperty<?> vp = vpOriginal;
-
// Null means set value to VP's default.
if(value == null)
value = (V) vp.getDefault();
@@ -110,6 +120,8 @@
}
} else if (vp == DVisualLexicon.NODE_LABEL_POSITION) {
this.setLabelPosition((ObjectPosition) value);
+ } else if (vp instanceof CustomGraphicsVisualProperty) {
+ setCustomGraphics(vp, (CyCustomGraphics<CustomGraphic>)
value);
}
}
@@ -190,6 +202,7 @@
}
}
+
void setFont(Font newFont, float newSize) {
synchronized (lock) {
if ( newFont == null )
@@ -203,12 +216,14 @@
}
}
+
void setLabelWidth(double width) {
synchronized (lock) {
nodeDetails.setLabelWidthDefault(width);
}
}
+
public void setLabelPosition(final ObjectPosition labelPosition) {
synchronized (lock) {
nodeDetails.setLabelTextAnchorDefault(labelPosition.getAnchor().getConversionConstant());
@@ -219,4 +234,15 @@
}
}
+
+ void setCustomGraphics(final VisualProperty<?> vp, final
CyCustomGraphics<CustomGraphic> customGraphics) {
+
+ synchronized (lock) {
+ // Pick from Custom Graphics 1-9.
+ final CyCustomGraphics<CustomGraphic> currentCG =
defaultCustomGraphicsMap.get(vp);
+
nodeDetails.setCustomGraphicsDefault((CustomGraphicsVisualProperty) vp,
customGraphics);
+ }
+
+ }
+
}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
2011-11-29 00:19:39 UTC (rev 27624)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
2011-11-29 00:24:44 UTC (rev 27625)
@@ -244,7 +244,6 @@
}
-
private void updateDependencyTable() {
final VisualStyle selectedStyle =
selectedManager.getCurrentVisualStyle();
@@ -276,13 +275,12 @@
depTableModel.addRow(newRow);
}
}
+
depTable = new DependencyTable(cyApplicationManager,
cyEventHelper, depTableModel,
(List<VisualPropertyDependency>) depList,
depStateMap);
depMap.put(selectedStyle, depStateMap);
dependencyScrollPane.setViewportView(depTable);
depTable.repaint();
-
- logger.info("Row count = " + depTable.getModel().getRowCount());
}
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DependencyTable.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DependencyTable.java
2011-11-29 00:19:39 UTC (rev 27624)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DependencyTable.java
2011-11-29 00:24:44 UTC (rev 27625)
@@ -67,7 +67,22 @@
private void processMouseClick() {
final int selected = this.getSelectedRow();
- final VisualPropertyDependency dep = depList.get(selected);
+ if(selected == -1)
+ return;
+
+ final Object selectedRowString = this.getValueAt(selected, 1);
+
+ System.out.println("#Selected Row val = " +
selectedRowString.toString());
+
+ VisualPropertyDependency dep = null;
+ for(VisualPropertyDependency dependency: depList) {
+
if(dependency.getDisplayName().equals(selectedRowString.toString())) {
+ dep = dependency;
+ break;
+ }
+ }
+
+ System.out.println("#And dep = " + dep.toString());
final boolean isDepend = (Boolean) model.getValueAt(selected,
0);
depStateMap.put(dep, isDepend);
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
2011-11-29 00:19:39 UTC (rev 27624)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
2011-11-29 00:24:44 UTC (rev 27625)
@@ -157,7 +157,6 @@
this.valueEditors.put(ve.getType(), ve);
}
-
public void removeValueEditor(ValueEditor<?> valueEditor,
@SuppressWarnings("rawtypes") Map properties) {
logger.debug("************* Removing Value Editor
****************");
valueEditors.remove(valueEditor.getType());
@@ -169,17 +168,15 @@
logger.debug("Total editor count = " + editors.size());
}
-
public void removeVisualPropertyEditor(VisualPropertyEditor<?> vpEditor,
@SuppressWarnings("rawtypes") Map properties) {
logger.debug("************* Removing VP Editor
****************");
editors.remove(vpEditor.getType());
}
-
@Override
- public <V> V showVisualPropertyValueEditor(final Component
parentComponent, final VisualProperty<V> type, V initialValue)
- throws Exception {
+ public <V> V showVisualPropertyValueEditor(final Component
parentComponent, final VisualProperty<V> type,
+ V initialValue) throws Exception {
@SuppressWarnings("unchecked")
final ValueEditor<V> editor = (ValueEditor<V>)
valueEditors.get(type.getRange().getType());
@@ -187,21 +184,21 @@
if (editor == null)
throw new IllegalStateException("No value editor for "
+ type.getDisplayName() + " is available.");
- while (true) {
- final V newValue = editor.showEditor(parentComponent,
initialValue);
- // Null is valid return value. It's from "Cancel"
button.
- if(newValue == null)
- return null;
+ final V newValue = editor.showEditor(parentComponent,
initialValue);
+ // Null is valid return value. It's from "Cancel" button.
+ if (newValue == null)
+ return null;
+
+ if (type.getRange().inRange(newValue))
+ return newValue;
+ else {
+ String message = "Value is out-of-range.";
+ if (type.getRange() instanceof ContinuousRange)
+ message = message + ": " + ((ContinuousRange)
type.getRange()).getMin() + " to "
+ + ((ContinuousRange)
type.getRange()).getMax();
+ JOptionPane.showMessageDialog(parentComponent, message,
"Invalid Value", JOptionPane.ERROR_MESSAGE);
- if (type.getRange().inRange(newValue))
- return newValue;
- else {
- String message = "Value is out-of-range.
Please evter valid value.";
- if (type.getRange() instanceof ContinuousRange)
- message = message + ": " +
((ContinuousRange) type.getRange()).getMin() + " to "
- + ((ContinuousRange)
type.getRange()).getMax();
- JOptionPane.showMessageDialog(parentComponent,
message, "Invalid Value", JOptionPane.ERROR_MESSAGE);
- }
+ return initialValue;
}
}
@@ -247,7 +244,6 @@
return ret;
}
-
public PropertyEditor getDefaultComboBoxEditor(String editorName) {
PropertyEditor editor = comboBoxEditors.get(editorName);
if (editor == null) {
--
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.