Author: clopes
Date: 2012-10-25 15:08:31 -0700 (Thu, 25 Oct 2012)
New Revision: 30710
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/GradientEditorPanel.java
Log:
Fixes #1506 (VizMapper: sometimes, we need to click cancel button 5 times to
close the dialog "Please pick a color")
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/GradientEditorPanel.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/GradientEditorPanel.java
2012-10-25 21:51:46 UTC (rev 30709)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/GradientEditorPanel.java
2012-10-25 22:08:31 UTC (rev 30710)
@@ -84,14 +84,28 @@
public GradientEditorPanel(final VisualStyle style, final
ContinuousMapping<T, Color> mapping, final CyTable attr,
final CyApplicationManager appManager, final
ValueEditor<Paint> colorEditor, final VisualMappingManager vmm, final
VisualMappingFunctionFactory continuousMappingFactory) {
-
super(style, mapping, attr, appManager, vmm,
continuousMappingFactory);
this.colorEditor = colorEditor;
this.appManager = appManager;
iconPanel.setVisible(false);
+
initSlider();
+ slider.addMouseListener(new ThumbMouseListener());
+ slider.addMouseListener(new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ final JComponent selectedThumb =
slider.getSelectedThumb();
+
+ if (selectedThumb != null) {
+ if (e.getClickCount() == 2) {
+ final Paint newColor =
colorEditor.showEditor(slider, null);
+ if (newColor != null)
+ setColor((Color)
newColor);
+ }
+ }
+ }
+ });
if ((mapping != null) && (mapping.getPointCount() == 0))
addButtonActionPerformed(null);
@@ -101,7 +115,6 @@
getAndSetColor();
}
});
-
}
private void getAndSetColor() {
@@ -153,7 +166,6 @@
}
private void createSimpleGradient() {
-
Number rangeValue = tracer.getRange(type);
Number minValue = tracer.getMin(type);
@@ -219,22 +231,8 @@
}
protected void initSlider() {
-
slider.updateUI();
- slider.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
-
- final JComponent selectedThumb =
slider.getSelectedThumb();
- if (selectedThumb != null) {
- if (e.getClickCount() == 2) {
- final Paint newColor =
colorEditor.showEditor(slider, null);
- if (newColor != null)
- setColor((Color)
newColor);
- }
- }
- }
- });
-
+
final double actualRange = tracer.getRange(type);
final double minValue = tracer.getMin(type);
@@ -256,7 +254,6 @@
slider.getModel().addThumb(
((Number)
((point.getValue().doubleValue() - minValue) / actualRange)).floatValue() * 100,
bound.equalValue);
-
}
if (!sortedPoints.isEmpty()) {
@@ -275,7 +272,6 @@
slider.setThumbRenderer(thumbRend);
slider.setTrackRenderer(gRend);
- slider.addMouseListener(new ThumbMouseListener());
// Add tooltip as help for users.
slider.setToolTipText("Double-click handles to edit boundary
colors.");
--
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.