You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/10/30 16:49:53 UTC
svn commit: r831347 - in /incubator/pivot/trunk:
tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
wtk/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserSkin.java
wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
Author: tvolkert
Date: Fri Oct 30 15:49:53 2009
New Revision: 831347
URL: http://svn.apache.org/viewvc?rev=831347&view=rev
Log:
Fixed bugs in TerraColorChooserSkin, TerraExpanderSkin, added preliminary support for Color properties in ComponentInspectorSkin
Modified:
incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
Modified: incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java?rev=831347&r1=831346&r2=831347&view=diff
==============================================================================
--- incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java (original)
+++ incubator/pivot/trunk/tools/src/org/apache/pivot/tools/wtk/ComponentInspectorSkin.java Fri Oct 30 15:49:53 2009
@@ -16,6 +16,8 @@
*/
package org.apache.pivot.tools.wtk;
+import java.awt.Color;
+
import org.apache.pivot.collections.Dictionary;
import org.apache.pivot.collections.EnumList;
import org.apache.pivot.collections.HashMap;
@@ -23,6 +25,8 @@
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonStateListener;
import org.apache.pivot.wtk.Checkbox;
+import org.apache.pivot.wtk.ColorChooser;
+import org.apache.pivot.wtk.ColorChooserSelectionListener;
import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.ComponentStateListener;
import org.apache.pivot.wtk.CornerRadii;
@@ -138,6 +142,8 @@
control = addInsetsControl(dictionary, key, section);
} else if (type == CornerRadii.class) {
control = addCornerRadiiControl(dictionary, key, section);
+ } else if (type == Color.class) {
+ control = addColorControl(dictionary, key, section);
}
if (control != null) {
@@ -951,4 +957,28 @@
return boxPane;
}
+
+ private Component addColorControl(final Dictionary<String, Object> dictionary,
+ final String key, Form.Section section) {
+ Color color = (Color)dictionary.get(key);
+
+ ColorChooser colorChooser = new ColorChooser();
+ colorChooser.setSelectedColor(color);
+ section.add(colorChooser);
+ Form.setLabel(colorChooser, key);
+
+ colorChooser.getColorChooserSelectionListeners().add(new ColorChooserSelectionListener() {
+ @Override
+ public void selectedColorChanged(ColorChooser colorChooser,
+ Color previousSelectedColor) {
+ try {
+ dictionary.put(key, colorChooser.getSelectedColor());
+ } catch (Exception exception) {
+ dictionary.put(key, previousSelectedColor);
+ }
+ }
+ });
+
+ return colorChooser;
+ }
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserSkin.java?rev=831347&r1=831346&r2=831347&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraColorChooserSkin.java Fri Oct 30 15:49:53 2009
@@ -117,7 +117,8 @@
public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseUp(component, button, x, y);
- if (button == Mouse.Button.LEFT) {
+ if (button == Mouse.Button.LEFT
+ && Mouse.getCapturer() == component) {
Mouse.release();
}
@@ -236,7 +237,8 @@
public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseUp(component, button, x, y);
- if (button == Mouse.Button.LEFT) {
+ if (button == Mouse.Button.LEFT
+ && Mouse.getCapturer() == component) {
Mouse.release();
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=831347&r1=831346&r2=831347&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java Fri Oct 30 15:49:53 2009
@@ -178,7 +178,6 @@
private Color titleBarBackgroundColor;
private Color titleBarBorderColor;
private Color shadeButtonColor;
- private Color shadeButtonBackgroundColor;
private Color borderColor;
private Insets padding;
@@ -214,7 +213,6 @@
titleBarBackgroundColor = theme.getColor(10);
titleBarBorderColor = theme.getColor(7);
shadeButtonColor = theme.getColor(7);
- shadeButtonBackgroundColor = theme.getColor(4);
borderColor = theme.getColor(7);
padding = new Insets(4);
@@ -517,24 +515,6 @@
setShadeButtonColor(GraphicsUtilities.decodeColor(shadeButtonColor));
}
- public Color getShadeButtonBackgroundColor() {
- return shadeButtonBackgroundColor;
- }
-
- public void setShadeButtonBackgroundColor(Color shadeButtonBackgroundColor) {
- this.shadeButtonBackgroundColor = shadeButtonBackgroundColor;
- shadeButton.getStyles().put("shadeButtonBackgroundColor", shadeButtonBackgroundColor);
- repaintComponent();
- }
-
- public final void setShadeButtonBackgroundColor(String shadeButtonBackgroundColor) {
- if (shadeButtonBackgroundColor == null) {
- throw new IllegalArgumentException("shadeButtonBackgroundColor is null.");
- }
-
- setShadeButtonBackgroundColor(GraphicsUtilities.decodeColor(shadeButtonBackgroundColor));
- }
-
public Color getBorderColor() {
return borderColor;
}