Author: ruschein
Date: 2010-08-10 13:31:28 -0700 (Tue, 10 Aug 2010)
New Revision: 21288
Removed:
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/FlexiblyBoundedHandler.java
Modified:
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/utils/XorPanel.java
Log:
Fixed some trivial problems.
Deleted:
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/FlexiblyBoundedHandler.java
===================================================================
---
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/FlexiblyBoundedHandler.java
2010-08-10 20:03:29 UTC (rev 21287)
+++
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/FlexiblyBoundedHandler.java
2010-08-10 20:31:28 UTC (rev 21288)
@@ -1,128 +0,0 @@
-package org.cytoscape.work.internal.tunables;
-
-import java.lang.reflect.*;
-import javax.swing.*;
-
-import org.cytoscape.work.Tunable;
-import org.cytoscape.work.util.AbstractFlexiblyBounded;
-
-import java.awt.event.*;
-
-
-/**
- * Handler for the type <i>FlexiblyBounded</i> of <code>Tunable</code>
- *
- * @author pasteur
- *
- * @param <T> type of <code>AbstractFlexiblyBounded</code>
- */
-...@suppresswarnings("unchecked")
-public class FlexiblyBoundedHandler<T extends AbstractFlexiblyBounded> extends
AbstractGUIHandler {
- private JTextField textField;
- private T flexiblyBounded;
- private final JLabel label;
- private T flexiblyBoundedInit;
-
- /**
- * Construction of the <code>GUIHandler</code> for the
<code>FlexiblyBounded</code> type
- *
- * Creates a JTextField to display the value contained in the object
and its information, and adds 2 buttons to modify the upper and lower bounds
- *
- * @param f field that has been annotated
- * @param o object contained in <code>f</code>
- * @param t tunable associated to <code>f</code>
- */
- public FlexiblyBoundedHandler(Field f, Object o, Tunable t) {
- super(f,o,t);
- try {
- flexiblyBoundedInit = (T)f.get(o);
- } catch (IllegalAccessException iae) {
- iae.printStackTrace();
- flexiblyBoundedInit = null;
- }
- flexiblyBounded = flexiblyBoundedInit;
- panel = new JPanel();
-
- JButton up = new JButton( new SetAction("Set Upper
Bound",panel,false));
- JButton low = new JButton( new SetAction("Set Lower
Bound",panel,true));
-
- label = new JLabel();
- setLabelText();
- try {
- panel.add( label );
- textField = new JTextField(
flexiblyBounded.getValue().toString(), 6);
- textField.addActionListener(this);
- panel.add(textField);
- panel.add(low);
- panel.add(up);
- } catch (Exception e) { e.printStackTrace(); }
-
- }
-
-
- /**
- * displays information about the <code>Tunable</code>, and the
bounds/value of the FlexiblyBounded object
- */
- private void setLabelText() {
- label.setText( t.description() + " (min: " +
flexiblyBounded.getLowerBound().toString() + " max: " +
flexiblyBounded.getUpperBound().toString() + ")" );
- }
-
-
-
- /**
- * To set the value to the <code>FlexiblyBounded</code> object
- *
- * The constraints of the bound values have to be respected :
<code>lowerBound < value < upperBound</code> or <code>lowerBound <i;
value <i; upperBound</code> or ....
- */
- public void handle() {
- String value = textField.getText();
- try {
- flexiblyBounded.setValue(value);
- } catch (Exception e) { e.printStackTrace(); }
- }
-
-
- /**
- * To get the current value of the <code>FlexiblyBounded</code> object
- * @return the value of the <code>FlexiblyBounded</code> object
- */
- public String getState() {
- return flexiblyBounded.getValue().toString();
- }
-
-
-
- /**
- * set the action related to buttons used to modify the upper and lower
bounds of the FlexiblyBounded object : displays a Dialog box to enter the new
value
- * @author pasteur
- */
- private class SetAction extends AbstractAction {
- JPanel par;
- boolean low;
- SetAction(String name,JPanel par,boolean low) {
- super(name);
- this.par = par;
- this.low = low;
- }
- public void actionPerformed(ActionEvent ae) {
- String value = JOptionPane.showInputDialog(par,"Enter
the new bound value:");
- if ( value != null ) {
- if ( low )
- flexiblyBounded.setLowerBound(value);
- else
- flexiblyBounded.setUpperBound(value);
-
- setLabelText();
- }
- }
- }
-
-
- /**
- * To reset the current value and the bounds of this
<code>FlexiblyBoundedHandler</code>, and set it to the initial ones
- */
- public void resetValue() {
- //need to be set
- }
-
-}
Modified:
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/utils/XorPanel.java
===================================================================
---
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/utils/XorPanel.java
2010-08-10 20:03:29 UTC (rev 21287)
+++
core3/work-swing-impl/trunk/src/main/java/org/cytoscape/work/internal/tunables/utils/XorPanel.java
2010-08-10 20:31:28 UTC (rev 21288)
@@ -13,7 +13,7 @@
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
-import org.cytoscape.work.Handler;
+import org.cytoscape.work.TunableHandler;
import org.cytoscape.work.Tunable;
import org.cytoscape.work.internal.tunables.GUIHandler;
@@ -22,7 +22,7 @@
public class XorPanel extends JPanel {
private JPanel switchPanel;
private JPanel contentPanel;
- private JPanel currentPanel = null;
+ private JPanel currentPanel = null;
private GUIHandler gh;
private boolean first = true;
@@ -31,9 +31,9 @@
super();
gh = g;
- gh.addDependent(new GUIHandlerSwitchListener());
+ gh.addDependent(new GUIHandlerSwitchListener());
- switchPanel = new JPanel();
+ switchPanel = new JPanel();
contentPanel = new JPanel(new CardLayout());
TitledBorder titleborder =
BorderFactory.createTitledBorder(title);
titleborder.setTitleColor(Color.GREEN);
@@ -46,7 +46,7 @@
public Component add(Component c) {
if (first) {
- switchPanel.add(c);
+ switchPanel.add(c);
first = false;
return c;
} else {
@@ -60,7 +60,7 @@
public void add(Component c, Object constraint) {
if (first) {
- switchPanel.add(c);
+ switchPanel.add(c);
first = false;
} else {
currentPanel = (JPanel)c;
@@ -73,8 +73,8 @@
public Field getField() {return null;}
public Object getObject() {return null;}
public void actionPerformed(ActionEvent ae) { }
- public void notifyDependents() { }
- public void addDependent(GUIHandler gh) { }
+ public void notifyDependents() { }
+ public void addDependent(GUIHandler gh) { }
public String getDependency() { return null; }
public void handleDependents(){}
public void resetValue(){}
@@ -83,28 +83,21 @@
CardLayout cl = (CardLayout) contentPanel.getLayout();
cl.show(contentPanel, state);
}
-
+
+ @Override public String dependsOn() { return null; }
+ @Override public String getChildKey() { return null; }
+ @Override public boolean
controlsMutuallyExclusiveNestedChildren() { return false; }
+ @Override public Tunable.Param[] getGroupTitleFlags() { return
null; }
+ @Override public String[] getGroups() { return null; }
+ @Override public Tunable.Param[] getAlignments() { return null;
}
+ @Override public Tunable.Param[] getFlags() { return null; }
+ @Override public String getDescription() { return null; }
+ @Override public Object getValue() { return null; }
+ @Override public void setValue(final Object newValue) { }
public String getName() { return null; }
public JPanel getJPanel() { return null; }
public void handle() {}
public String getState() {return null;}
public void returnPanel() {}
-
- public Method getGetMethod() {
- // TODO Auto-generated method stub
- return null;
- }
- public Tunable getGetTunable() {
- // TODO Auto-generated method stub
- return null;
- }
- public Method getSetMethod() {
- // TODO Auto-generated method stub
- return null;
- }
- public Tunable getSetTunable() {
- // TODO Auto-generated method stub
- return 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.