[Schmitzm-commits] r465 - in branches/1.0-gt2-2.6/src/skrueger: geotools i8n swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Oct 13 18:20:38 CEST 2009


Author: alfonx
Date: 2009-10-13 18:20:37 +0200 (Tue, 13 Oct 2009)
New Revision: 465

Added:
   branches/1.0-gt2-2.6/src/skrueger/swing/ColorButton.java
Modified:
   branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeMetadataMap.java
   branches/1.0-gt2-2.6/src/skrueger/i8n/SwitchLanguageDialog.java
Log:
* AS-Feature: Halo effect now editable in AtlasStyler

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeMetadataMap.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeMetadataMap.java	2009-10-13 13:22:31 UTC (rev 464)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeMetadataMap.java	2009-10-13 16:20:37 UTC (rev 465)
@@ -2,7 +2,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.geotools.feature.NameImpl;

Modified: branches/1.0-gt2-2.6/src/skrueger/i8n/SwitchLanguageDialog.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/i8n/SwitchLanguageDialog.java	2009-10-13 13:22:31 UTC (rev 464)
+++ branches/1.0-gt2-2.6/src/skrueger/i8n/SwitchLanguageDialog.java	2009-10-13 16:20:37 UTC (rev 465)
@@ -286,4 +286,4 @@
 		return jComboBox;
 	}
 
-} // @jve:decl-index=0:visual-constraint="0,0"
+} 

Added: branches/1.0-gt2-2.6/src/skrueger/swing/ColorButton.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/swing/ColorButton.java	2009-10-13 13:22:31 UTC (rev 464)
+++ branches/1.0-gt2-2.6/src/skrueger/swing/ColorButton.java	2009-10-13 16:20:37 UTC (rev 465)
@@ -0,0 +1,70 @@
+package skrueger.swing;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import javax.swing.AbstractAction;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+
+import org.opengis.filter.expression.Expression;
+
+import schmitzm.geotools.styling.StylingUtil;
+
+public class ColorButton extends JButton {
+
+	private Color color = Color.red;
+
+	public ColorButton(Color newColor) {
+		setColor(newColor);
+	}
+
+	public ColorButton() {
+		setColor(color);
+	}
+
+	public ColorButton(AbstractAction abstractAction) {
+		super(abstractAction);
+		setColor(color);
+	}
+
+	public Color getColor() {
+		return color;
+	}
+
+	public void setColor(Expression colorExpression) {
+		setColor(StylingUtil.getColorFromExpression(colorExpression));
+	}
+
+	/**
+	 * Updates a {@link JButton}'s {@link Icon} with a {@link Color}.
+	 * 
+	 * @param button
+	 *            The {@link JButton} to change the {@link Icon}
+	 * @param newColor
+	 *            {@link Color} to set.
+	 * 
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
+	 *         Kr&uuml;ger</a>
+	 */
+	public void setColor(final Color newColor) {
+		color = newColor;
+
+		if (newColor == null) {
+			setIcon(null); // TODO nice color coose me icons?!
+			return;
+		}
+		setEnabled(true);
+
+		final BufferedImage bi = new BufferedImage(30, 10,
+				BufferedImage.TYPE_INT_RGB);
+		final Graphics2D g2d = bi.createGraphics();
+		g2d.setColor(newColor);
+		g2d.setBackground(newColor);
+		g2d.fillRect(0, 0, 30, 10);
+		setIcon(new ImageIcon(bi));
+	}
+
+}


Property changes on: branches/1.0-gt2-2.6/src/skrueger/swing/ColorButton.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id URL
Name: svn:eol-style
   + native



More information about the Schmitzm-commits mailing list