Author: kono
Date: 2011-06-17 14:15:50 -0700 (Fri, 17 Jun 2011)
New Revision: 25799
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/cellrenderer/CyColorCellRenderer.java
Log:
Source code format was broken and had been re-formatted. NO FUNCTIONAL CHANGE.
Modified:
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/cellrenderer/CyColorCellRenderer.java
===================================================================
---
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/cellrenderer/CyColorCellRenderer.java
2011-06-17 21:06:43 UTC (rev 25798)
+++
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/cellrenderer/CyColorCellRenderer.java
2011-06-17 21:15:50 UTC (rev 25799)
@@ -11,103 +11,86 @@
import com.l2fprod.common.swing.renderer.DefaultCellRenderer;
-
/**
- * CyColorCellRenderer.
- * Provides both table/Llist cell renderers.
- *
+ * CyColorCellRenderer. Provides both table/Llist cell renderers.
+ *
* @since Cytoscape 2.5
*/
public class CyColorCellRenderer extends DefaultCellRenderer {
private final static long serialVersionUID = 1202339868706383L;
- /**
- * DOCUMENT ME!
- *
- * @param color
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public static String toHex(Color color) {
- String red = Integer.toHexString(color.getRed());
- String green = Integer.toHexString(color.getGreen());
- String blue = Integer.toHexString(color.getBlue());
- if (red.length() == 1)
- red = "0" + red;
+
+ public static String toHex(Color color) {
+ String red = Integer.toHexString(color.getRed());
+ String green = Integer.toHexString(color.getGreen());
+ String blue = Integer.toHexString(color.getBlue());
- if (green.length() == 1)
- green = "0" + green;
+ if (red.length() == 1)
+ red = "0" + red;
- if (blue.length() == 1)
- blue = "0" + blue;
+ if (green.length() == 1)
+ green = "0" + green;
- return ("#" + red + green + blue).toUpperCase();
- }
+ if (blue.length() == 1)
+ blue = "0" + blue;
- protected String convertToString(Object value) {
- // Do not return color as string.
- return null;
- }
+ return ("#" + red + green + blue).toUpperCase();
+ }
- protected Icon convertToIcon(Object value) {
- if (value == null)
- return null;
+ protected String convertToString(Object value) {
+ // Do not return color as string.
+ return null;
+ }
- if (value instanceof Number)
- value = new Color(((Number) value).intValue());
+ protected Icon convertToIcon(Object value) {
+ if (value == null)
+ return null;
- return new PaintIcon((Paint) value);
- }
+ if (value instanceof Number)
+ value = new Color(((Number) value).intValue());
- public static class PaintIcon
- implements Icon {
- private final Paint color;
- private int width;
- private int height;
+ return new PaintIcon((Paint) value);
+ }
- public PaintIcon(Paint color) {
- this(color, 70, 10);
- }
+ public static class PaintIcon implements Icon {
+ private final Paint color;
+ private int width;
+ private int height;
- public PaintIcon(Paint color, int width, int height) {
- this.color = color;
- this.width = width;
- this.height = height;
- }
+ public PaintIcon(Paint color) {
+ this(color, 70, 10);
+ }
- public int getIconHeight() {
- return height;
- }
+ public PaintIcon(Paint color, int width, int height) {
+ this.color = color;
+ this.width = width;
+ this.height = height;
+ }
- public int getIconWidth() {
- return width;
- }
+ public int getIconHeight() {
+ return height;
+ }
- public void paintIcon(Component c, Graphics g, int x, int y) {
- Graphics2D g2d = (Graphics2D) g;
- Paint oldPaint = g2d.getPaint();
+ public int getIconWidth() {
+ return width;
+ }
- if (c != null)
- width = c.getWidth() - 6;
+ public void paintIcon(Component c, Graphics g, int x, int y) {
+ Graphics2D g2d = (Graphics2D) g;
+ Paint oldPaint = g2d.getPaint();
- if (color != null) {
- g2d.setPaint(color);
- g.fillRect(
- 3,
- y,
- getIconWidth(),
- getIconHeight());
- }
+ if (c != null)
+ width = c.getWidth() - 6;
- g.setColor(UIManager.getColor("controlDkShadow"));
- g.drawRect(
- 3,
- y,
- getIconWidth(),
- getIconHeight());
+ if (color != null) {
+ g2d.setPaint(color);
+ g.fillRect(3, y, getIconWidth(),
getIconHeight());
+ }
- g2d.setPaint(oldPaint);
- }
- }
+ g.setColor(UIManager.getColor("controlDkShadow"));
+ g.drawRect(3, y, getIconWidth(), getIconHeight());
+
+ g2d.setPaint(oldPaint);
+ }
+ }
}
--
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.