Author: mmichaud
Date: 2009-04-06 07:51:37 -0700 (Mon, 06 Apr 2009)
New Revision: 16463
Modified:
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedFloatHandler.java
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedIntegerHandler.java
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedLongHandler.java
Log:
Modified:
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedFloatHandler.java
===================================================================
---
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedFloatHandler.java
2009-04-06 14:22:10 UTC (rev 16462)
+++
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedFloatHandler.java
2009-04-06 14:51:37 UTC (rev 16463)
@@ -1,6 +1,6 @@
package org.cytoscape.work.internal.gui;
-import java.lang.reflect.*;
+
import javax.swing.*;
import org.cytoscape.work.AbstractGuiHandler;
@@ -11,12 +11,11 @@
import org.cytoscape.work.util.mySlider;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;
+import java.lang.reflect.*;
-
public class BoundedFloatHandler extends AbstractGuiHandler implements
Guihandler ,ActionListener{
JTextField jtf;
@@ -28,7 +27,7 @@
String newline = System.getProperty("line.separator");
Double value=null;
- public BoundedFloatHandler(Field f, Object o, Tunable t) {
+ protected BoundedFloatHandler(Field f, Object o, Tunable t) {
super(f,o,t);
try {
this.myBounded = (BoundedFloat)f.get(o);
@@ -41,19 +40,17 @@
if(useslider){
JLabel label = new JLabel(title);
label.setFont(new Font(null, Font.PLAIN,12));
- panel.add(label,BorderLayout.WEST);
slider = new
mySlider(title,myBounded.getLowerBound(),myBounded.getUpperBound(),myBounded.getValue(),myBounded.isLowerBoundStrict(),myBounded.isUpperBoundStrict());
//slider.addChangeListener(this);
+ panel.add(label,BorderLayout.WEST);
panel.add(slider,BorderLayout.EAST);
}
else{
- try {
- JLabel label = new JLabel( title + " (max: " +
myBounded.getLowerBound().toString() + " min: " +
myBounded.getUpperBound().toString() + ")" );
- label.setFont(new Font(null, Font.PLAIN,12));
- panel.add(label,BorderLayout.WEST);
- boundedField = new
myBoundedSwing(myBounded.getValue(),myBounded.getLowerBound(),myBounded.getUpperBound(),myBounded.isLowerBoundStrict(),myBounded.isUpperBoundStrict());
- panel.add(boundedField,BorderLayout.EAST);
- } catch (Exception e) { e.printStackTrace();}
+ JLabel label = new JLabel( title + " (max: " +
myBounded.getLowerBound().toString() + " min: " +
myBounded.getUpperBound().toString() + ")" );
+ label.setFont(new Font(null, Font.PLAIN,12));
+ boundedField = new
myBoundedSwing(myBounded.getValue(),myBounded.getLowerBound(),myBounded.getUpperBound(),myBounded.isLowerBoundStrict(),myBounded.isUpperBoundStrict());
+ panel.add(label,BorderLayout.WEST);
+ panel.add(boundedField,BorderLayout.EAST);
}
}
@@ -62,19 +59,7 @@
myBounded.setValue(slider.getValue().floatValue());
}
else{
- try{
- jtf.setBackground(Color.white);
- value = Double.parseDouble(jtf.getText());
- }catch(NumberFormatException nfe){
- try{
- jtf.setBackground(Color.red);
- value =
Double.parseDouble(myBounded.getValue().toString());
- JOptionPane.showMessageDialog(null,"An Integer
was Expected"+newline+"Value will be set to default = "+value.floatValue(),
"Error",JOptionPane.ERROR_MESSAGE);
- }catch(Exception e){e.printStackTrace();}
- }
- try {
- myBounded.setValue(value.floatValue());
- } catch (Exception e) { e.printStackTrace();}
+ myBounded.setValue(boundedField.getFieldValue().floatValue());
}
}
@@ -82,4 +67,4 @@
public String getState() {
return myBounded.getValue().toString();
}
-}
\ No newline at end of file
+}
Modified:
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedIntegerHandler.java
===================================================================
---
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedIntegerHandler.java
2009-04-06 14:22:10 UTC (rev 16462)
+++
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedIntegerHandler.java
2009-04-06 14:51:37 UTC (rev 16463)
@@ -1,31 +1,30 @@
package org.cytoscape.work.internal.gui;
-import java.lang.reflect.*;
+
import javax.swing.*;
import org.cytoscape.work.AbstractGuiHandler;
import org.cytoscape.work.Tunable;
import org.cytoscape.work.Tunable.Param;
+import org.cytoscape.work.util.BoundedInteger;
+import org.cytoscape.work.util.myBoundedSwing;
+import org.cytoscape.work.util.mySlider;
+
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;
-import org.cytoscape.work.util.*;
+import java.lang.reflect.*;
-
public class BoundedIntegerHandler extends AbstractGuiHandler implements
Guihandler ,ActionListener{
- JTextField jtf;
BoundedInteger myBounded;
String title;
Boolean useslider=false;
mySlider slider;
myBoundedSwing boundedField;
- Double value=null;
- String newline = System.getProperty("line.separator");
- public BoundedIntegerHandler(Field f, Object o, Tunable t) {
+ protected BoundedIntegerHandler(Field f, Object o, Tunable t) {
super(f,o,t);
try {
this.myBounded = (BoundedInteger)f.get(o);
@@ -44,13 +43,11 @@
panel.add(slider,BorderLayout.EAST);
}
else{
- try {
- JLabel label = new JLabel( title + " (max: " +
myBounded.getLowerBound().toString() + " min: " +
myBounded.getUpperBound().toString() + ")" );
- label.setFont(new Font(null, Font.PLAIN,12));
- panel.add(label,BorderLayout.WEST);
- boundedField = new
myBoundedSwing(myBounded.getValue(),myBounded.getLowerBound(),myBounded.getUpperBound(),myBounded.isLowerBoundStrict(),myBounded.isUpperBoundStrict());
- panel.add(boundedField,BorderLayout.EAST);
- } catch (Exception e) { e.printStackTrace(); }
+ JLabel label = new JLabel( title + " (max: " +
myBounded.getLowerBound().toString() + " min: " +
myBounded.getUpperBound().toString() + ")" );
+ label.setFont(new Font(null, Font.PLAIN,12));
+ boundedField = new
myBoundedSwing(myBounded.getValue(),myBounded.getLowerBound(),myBounded.getUpperBound(),myBounded.isLowerBoundStrict(),myBounded.isUpperBoundStrict());
+ panel.add(label,BorderLayout.WEST);
+ panel.add(boundedField,BorderLayout.EAST);
}
}
@@ -59,24 +56,12 @@
myBounded.setValue(slider.getValue().intValue());
}
else{
- try{
- jtf.setBackground(Color.white);
- value = Double.parseDouble(jtf.getText());
- }catch(NumberFormatException nfe){
- try{
- jtf.setBackground(Color.red);
- value =
Double.parseDouble(myBounded.getValue().toString());
- JOptionPane.showMessageDialog(null,"An Integer
was Expected"+newline+"Value will be set to default = "+value.intValue(),
"Error",JOptionPane.ERROR_MESSAGE);
- }catch(Exception e){e.printStackTrace();}
- }
- try {
- myBounded.setValue(value.intValue());
- } catch (Exception e) { e.printStackTrace();}
+ myBounded.setValue(boundedField.getFieldValue().intValue());
}
}
+
-
public String getState() {
return myBounded.getValue().toString();
}
-}
\ No newline at end of file
+}
Modified:
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedLongHandler.java
===================================================================
---
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedLongHandler.java
2009-04-06 14:22:10 UTC (rev 16462)
+++
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/internal/gui/BoundedLongHandler.java
2009-04-06 14:51:37 UTC (rev 16463)
@@ -1,31 +1,30 @@
package org.cytoscape.work.internal.gui;
-import java.lang.reflect.*;
+
import javax.swing.*;
import org.cytoscape.work.AbstractGuiHandler;
import org.cytoscape.work.Tunable;
import org.cytoscape.work.Tunable.Param;
-import org.cytoscape.work.util.*;
+import org.cytoscape.work.util.BoundedLong;
+import org.cytoscape.work.util.myBoundedSwing;
+import org.cytoscape.work.util.mySlider;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionListener;
+import java.lang.reflect.*;
public class BoundedLongHandler extends AbstractGuiHandler implements
Guihandler ,ActionListener{
- JTextField jtf;
BoundedLong myBounded;
String title;
Boolean useslider=false;
mySlider slider;
myBoundedSwing boundedField;
- Double value=null;
- String newline = System.getProperty("line.separator");
- public BoundedLongHandler(Field f, Object o, Tunable t) {
+ protected BoundedLongHandler(Field f, Object o, Tunable t) {
super(f,o,t);
try {
this.myBounded = (BoundedLong)f.get(o);
@@ -40,18 +39,14 @@
label.setFont(new Font(null, Font.PLAIN,12));
panel.add(label,BorderLayout.WEST);
slider = new
mySlider(title,myBounded.getLowerBound(),myBounded.getUpperBound(),myBounded.getValue(),myBounded.isLowerBoundStrict(),myBounded.isUpperBoundStrict());
- //slider.addChangeListener(this);
panel.add(slider,BorderLayout.EAST);
}
else{
-
- try {
JLabel label = new JLabel( title + " (max: " +
myBounded.getLowerBound().toString() + " min: " +
myBounded.getUpperBound().toString() + ")" );
label.setFont(new Font(null, Font.PLAIN,12));
- panel.add(label,BorderLayout.WEST);
boundedField = new
myBoundedSwing(myBounded.getValue(),myBounded.getLowerBound(),myBounded.getUpperBound(),myBounded.isLowerBoundStrict(),myBounded.isUpperBoundStrict());
+ panel.add(label,BorderLayout.WEST);
panel.add(boundedField,BorderLayout.EAST);
- } catch (Exception e) { e.printStackTrace();}
}
}
@@ -61,23 +56,11 @@
myBounded.setValue(slider.getValue().longValue());
}
else{
- try{
- jtf.setBackground(Color.white);
- value = Double.parseDouble(jtf.getText());
- }catch(NumberFormatException nfe){
- try{
- jtf.setBackground(Color.red);
- value =
Double.parseDouble(myBounded.getValue().toString());
- JOptionPane.showMessageDialog(null,"An Integer
was Expected"+newline+"Value will be set to default = "+value.longValue(),
"Error",JOptionPane.ERROR_MESSAGE);
- }catch(Exception e){e.printStackTrace();}
- }
- try {
- myBounded.setValue(value.longValue());
- } catch (Exception e) { e.printStackTrace();}
+ myBounded.setValue(boundedField.getFieldValue().longValue());
}
}
public String getState() {
return myBounded.getValue().toString();
}
-}
\ No newline at end of file
+}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---