Author: kono
Date: 2012-01-25 11:46:42 -0800 (Wed, 25 Jan 2012)
New Revision: 28104
Modified:
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyColorPropertyEditor.java
Log:
Reformat only.
Modified:
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyColorPropertyEditor.java
===================================================================
---
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyColorPropertyEditor.java
2012-01-25 19:16:39 UTC (rev 28103)
+++
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyColorPropertyEditor.java
2012-01-25 19:46:42 UTC (rev 28104)
@@ -17,6 +17,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
import com.l2fprod.common.beans.editor.AbstractPropertyEditor;
import com.l2fprod.common.beans.editor.ColorPropertyEditor;
import com.l2fprod.common.beans.editor.FilePropertyEditor;
@@ -26,115 +33,96 @@
import cytoscape.util.CyColorChooser;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JColorChooser;
-import javax.swing.JPanel;
-
-
/**
* ColorPropertyEditor. <br>
- *
+ *
*/
public class CyColorPropertyEditor extends AbstractPropertyEditor {
- private CyColorCellRenderer label;
- private JButton button;
- private Color color;
+
+ private CyColorCellRenderer label;
+ private JButton button;
+ private Color color;
- /**
- * Creates a new CyColorPropertyEditor object.
- */
- public CyColorPropertyEditor() {
- editor = new JPanel(new PercentLayout(PercentLayout.HORIZONTAL, 0));
- ((JPanel) editor).add("*", label = new CyColorCellRenderer());
- label.setOpaque(false);
- ((JPanel) editor).add(button =
ComponentFactory.Helper.getFactory().createMiniButton());
- button.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- selectColor();
- }
- });
- ((JPanel) editor).add(button =
ComponentFactory.Helper.getFactory().createMiniButton());
- button.setText("X");
- button.addActionListener(
- new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- selectNull();
- }
- });
- ((JPanel) editor).setOpaque(false);
- }
+ /**
+ * Creates a new CyColorPropertyEditor object.
+ */
+ public CyColorPropertyEditor() {
+ editor = new JPanel(new PercentLayout(PercentLayout.HORIZONTAL,
0));
+ ((JPanel) editor).add("*", label = new CyColorCellRenderer());
+ label.setOpaque(false);
+ ((JPanel) editor).add(button =
ComponentFactory.Helper.getFactory().createMiniButton());
+ button.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ selectColor();
+ }
+ });
+ ((JPanel) editor).add(button =
ComponentFactory.Helper.getFactory().createMiniButton());
+ button.setText("X");
+ button.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ selectNull();
+ }
+ });
+ ((JPanel) editor).setOpaque(false);
+ }
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public Object getValue() {
- return color;
- }
+ @Override
+ public Object getValue() {
+ return color;
+ }
- /**
- * DOCUMENT ME!
- *
- * @param value DOCUMENT ME!
- */
- public void setValue(Object value) {
- color = (Color) value;
- label.setValue(color);
- }
+ @Override
+ public void setValue(Object value) {
+ color = (Color) value;
+ label.setValue(color);
+ }
- protected void selectColor() {
- ResourceManager rm = ResourceManager.all(FilePropertyEditor.class);
- String title = rm.getString("ColorPropertyEditor.title");
- Color selectedColor = CyColorChooser.showDialog(editor, title, color);
+ protected void selectColor() {
+ ResourceManager rm =
ResourceManager.all(FilePropertyEditor.class);
+ String title = rm.getString("ColorPropertyEditor.title");
+ Color selectedColor = CyColorChooser.showDialog(editor, title,
color);
- if (selectedColor != null) {
- Color oldColor = color;
- Color newColor = selectedColor;
- label.setValue(newColor);
- color = newColor;
- firePropertyChange(oldColor, newColor);
- }
- }
+ if (selectedColor != null) {
+ Color oldColor = color;
+ Color newColor = selectedColor;
+ label.setValue(newColor);
+ color = newColor;
+ firePropertyChange(oldColor, newColor);
+ }
+ }
- protected void selectNull() {
- Color oldColor = color;
- label.setValue(null);
- color = null;
- firePropertyChange(oldColor, null);
- }
+ protected void selectNull() {
+ Color oldColor = color;
+ label.setValue(null);
+ color = null;
+ firePropertyChange(oldColor, null);
+ }
- public static class AsInt extends ColorPropertyEditor {
- public void setValue(Object arg0) {
- if (arg0 instanceof Integer)
- super.setValue(new Color(((Integer) arg0).intValue()));
- else
- super.setValue(arg0);
- }
+ public static final class AsInt extends ColorPropertyEditor {
+ public void setValue(Object arg0) {
+ if (arg0 instanceof Integer)
+ super.setValue(new Color(((Integer)
arg0).intValue()));
+ else
+ super.setValue(arg0);
+ }
- public Object getValue() {
- Object value = super.getValue();
+ public Object getValue() {
+ Object value = super.getValue();
- if (value == null)
- return null;
- else
- return new Integer(((Color) value).getRGB());
- }
+ if (value == null)
+ return null;
+ else
+ return new Integer(((Color) value).getRGB());
+ }
- protected void firePropertyChange(Object oldValue, Object newValue) {
- if (oldValue instanceof Color)
- oldValue = new Integer(((Color) oldValue).getRGB());
+ protected void firePropertyChange(Object oldValue, Object
newValue) {
+ if (oldValue instanceof Color)
+ oldValue = new Integer(((Color)
oldValue).getRGB());
- if (newValue instanceof Color)
- newValue = new Integer(((Color) newValue).getRGB());
+ if (newValue instanceof Color)
+ newValue = new Integer(((Color)
newValue).getRGB());
- super.firePropertyChange(oldValue, newValue);
- }
- }
+ super.firePropertyChange(oldValue, newValue);
+ }
+ }
}
--
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.