You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/05/27 15:42:01 UTC
svn commit: r779169 [2/3] - in /incubator/pivot/trunk: ./
core/src/pivot/beans/ core/src/pivot/collections/
core/src/pivot/collections/adapter/ core/src/pivot/serialization/
core/src/pivot/util/concurrent/ core/test/pivot/core/test/
core/test/resources...
Modified: incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java (original)
+++ incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java Wed May 27 13:41:59 2009
@@ -25,76 +25,76 @@
public class QueryDictionaryTest extends TestCase {
- public void testQueryDictionary() {
- QueryDictionary dict = new Query.QueryDictionary();
+ public void testQueryDictionary() {
+ QueryDictionary dict = new Query.QueryDictionary();
- assertNull(dict.get("key"));
+ assertNull(dict.get("key"));
- dict.put("key", "value");
- assertNotNull(dict.get("key"));
+ dict.put("key", "value");
+ assertNotNull(dict.get("key"));
- assertEquals("value", dict.get("key", 0));
+ assertEquals("value", dict.get("key", 0));
- assertEquals(1, dict.getLength("key"));
+ assertEquals(1, dict.getLength("key"));
- try {
- dict.get("key", 1);
- fail("Expected IndexOutOfBoundsException");
- } catch (IndexOutOfBoundsException ex) {
- }
+ try {
+ dict.get("key", 1);
+ fail("Expected IndexOutOfBoundsException");
+ } catch (IndexOutOfBoundsException ex) {
+ }
- assertEquals("value", dict.put("key", "value2"));
- assertEquals("value2", dict.get("key"));
+ assertEquals("value", dict.put("key", "value2"));
+ assertEquals("value2", dict.get("key"));
- dict.add("key", "another value");
+ dict.add("key", "another value");
- assertEquals("another value", dict.get("key", 1));
+ assertEquals("another value", dict.get("key", 1));
- assertEquals(0, dict.getLength("nokey"));
+ assertEquals(0, dict.getLength("nokey"));
- assertEquals(0, dict.add("key2", "new value"));
+ assertEquals(0, dict.add("key2", "new value"));
- dict.insert("key", "yet another value", 0);
+ dict.insert("key", "yet another value", 0);
- assertEquals(3, dict.getLength("key"));
+ assertEquals(3, dict.getLength("key"));
- try {
- dict.insert("key", "bad value", 10);
- fail("Expected IndexOutOfBoundsException");
- } catch (IndexOutOfBoundsException ex) {
+ try {
+ dict.insert("key", "bad value", 10);
+ fail("Expected IndexOutOfBoundsException");
+ } catch (IndexOutOfBoundsException ex) {
- }
+ }
- assertEquals("yet another value", dict.remove("key"));
- assertNull(dict.remove("key"));
+ assertEquals("yet another value", dict.remove("key"));
+ assertNull(dict.remove("key"));
- dict.add("key2", "2nd value");
- assertEquals("new value", dict.remove("key2", 0));
+ dict.add("key2", "2nd value");
+ assertEquals("new value", dict.remove("key2", 0));
- try {
- dict.remove("key2", 10);
- fail("Expected IndexOutOfBoundsException");
- } catch (IndexOutOfBoundsException ex) {
+ try {
+ dict.remove("key2", 10);
+ fail("Expected IndexOutOfBoundsException");
+ } catch (IndexOutOfBoundsException ex) {
- }
+ }
- dict.add("key3", "something");
+ dict.add("key3", "something");
- Set<String> validKeys = new HashSet<String>();
- validKeys.add("key2");
- validKeys.add("key3");
+ Set<String> validKeys = new HashSet<String>();
+ validKeys.add("key2");
+ validKeys.add("key3");
- for (String s : (Iterable<String>) dict) {
- assertTrue(s, validKeys.remove(s));
- }
+ for (String s : (Iterable<String>) dict) {
+ assertTrue(s, validKeys.remove(s));
+ }
- assertEquals(0, validKeys.size());
+ assertEquals(0, validKeys.size());
- assertTrue(dict.containsKey("key2"));
- assertFalse(dict.isEmpty());
+ assertTrue(dict.containsKey("key2"));
+ assertFalse(dict.isEmpty());
- dict.clear();
- assertTrue(dict.isEmpty());
+ dict.clear();
+ assertTrue(dict.isEmpty());
- }
+ }
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/Accordion.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/Accordion.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/Accordion.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/Accordion.java Wed May 27 13:41:59 2009
@@ -192,7 +192,7 @@
private static class AccordionSelectionListenerList extends ListenerList<AccordionSelectionListener>
implements AccordionSelectionListener {
- public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex) {
+ public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex) {
Vote vote = Vote.APPROVE;
for (AccordionSelectionListener listener : this) {
@@ -200,15 +200,15 @@
}
return vote;
- }
+ }
- public void selectedIndexChangeVetoed(Accordion accordion, Vote reason) {
+ public void selectedIndexChangeVetoed(Accordion accordion, Vote reason) {
for (AccordionSelectionListener listener : this) {
listener.selectedIndexChangeVetoed(accordion, reason);
}
- }
+ }
- public void selectedIndexChanged(Accordion accordion, int previousSelectedIndex) {
+ public void selectedIndexChanged(Accordion accordion, int previousSelectedIndex) {
for (AccordionSelectionListener listener : this) {
listener.selectedIndexChanged(accordion, previousSelectedIndex);
}
@@ -255,19 +255,19 @@
int previousSelectedIndex = this.selectedIndex;
if (previousSelectedIndex != selectedIndex) {
- Vote vote = accordionSelectionListeners.previewSelectedIndexChange(this, selectedIndex);
+ Vote vote = accordionSelectionListeners.previewSelectedIndexChange(this, selectedIndex);
- if (vote == Vote.APPROVE) {
- this.selectedIndex = selectedIndex;
- accordionSelectionListeners.selectedIndexChanged(this, previousSelectedIndex);
- } else {
- accordionSelectionListeners.selectedIndexChangeVetoed(this, vote);
- }
+ if (vote == Vote.APPROVE) {
+ this.selectedIndex = selectedIndex;
+ accordionSelectionListeners.selectedIndexChanged(this, previousSelectedIndex);
+ } else {
+ accordionSelectionListeners.selectedIndexChangeVetoed(this, vote);
+ }
}
}
public Component getSelectedPanel() {
- return (selectedIndex == -1) ? null : panels.get(selectedIndex);
+ return (selectedIndex == -1) ? null : panels.get(selectedIndex);
}
@Override
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/AccordionSelectionListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/AccordionSelectionListener.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/AccordionSelectionListener.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/AccordionSelectionListener.java Wed May 27 13:41:59 2009
@@ -41,23 +41,23 @@
}
}
- /**
- * Called to preview a selected index change.
- *
- * @param accordion
- * @param selectedIndex
- */
- public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex);
+ /**
+ * Called to preview a selected index change.
+ *
+ * @param accordion
+ * @param selectedIndex
+ */
+ public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex);
- /**
- * Called when a selected index change has been vetoed.
- *
- * @param accordion
- * @param reason
- */
- public void selectedIndexChangeVetoed(Accordion accordion, Vote reason);
+ /**
+ * Called when a selected index change has been vetoed.
+ *
+ * @param accordion
+ * @param reason
+ */
+ public void selectedIndexChangeVetoed(Accordion accordion, Vote reason);
- /**
+ /**
* Called when an accordion's selected index has changed.
*
* @param accordion
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/Alert.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/Alert.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/Alert.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/Alert.java Wed May 27 13:41:59 2009
@@ -144,7 +144,7 @@
}
public static void alert(String message, Window owner,
- DialogCloseListener dialogCloseListener) {
+ DialogCloseListener dialogCloseListener) {
alert(MessageType.INFO, message, owner, dialogCloseListener);
}
@@ -153,7 +153,7 @@
}
public static void alert(MessageType type, String message, Window owner,
- DialogCloseListener dialogCloseListener) {
+ DialogCloseListener dialogCloseListener) {
Alert alert = createAlert(type, message);
alert.open(owner, dialogCloseListener);
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/BrowserApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/BrowserApplicationContext.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/BrowserApplicationContext.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/BrowserApplicationContext.java Wed May 27 13:41:59 2009
@@ -59,7 +59,7 @@
public boolean containsKey(String key) {
return properties.containsKey(key)
- || getParameter(key) != null;
+ || getParameter(key) != null;
}
public boolean isEmpty() {
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/CardPane.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/CardPane.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/CardPane.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/CardPane.java Wed May 27 13:41:59 2009
@@ -29,7 +29,7 @@
public class CardPane extends Container {
private static class CardPaneListenerList extends ListenerList<CardPaneListener>
implements CardPaneListener {
- public Vote previewSelectedIndexChange(CardPane cardPane, int selectedIndex) {
+ public Vote previewSelectedIndexChange(CardPane cardPane, int selectedIndex) {
Vote vote = Vote.APPROVE;
for (CardPaneListener listener : this) {
@@ -37,13 +37,13 @@
}
return vote;
- }
+ }
- public void selectedIndexChangeVetoed(CardPane cardPane, Vote reason) {
+ public void selectedIndexChangeVetoed(CardPane cardPane, Vote reason) {
for (CardPaneListener listener : this) {
listener.selectedIndexChangeVetoed(cardPane, reason);
}
- }
+ }
public void selectedIndexChanged(CardPane cardPane, int previousSelectedIndex) {
for (CardPaneListener listener : this) {
@@ -84,19 +84,19 @@
int previousSelectedIndex = this.selectedIndex;
if (previousSelectedIndex != selectedIndex) {
- Vote vote = cardPaneListeners.previewSelectedIndexChange(this, selectedIndex);
+ Vote vote = cardPaneListeners.previewSelectedIndexChange(this, selectedIndex);
- if (vote == Vote.APPROVE) {
+ if (vote == Vote.APPROVE) {
this.selectedIndex = selectedIndex;
cardPaneListeners.selectedIndexChanged(this, previousSelectedIndex);
- } else {
- cardPaneListeners.selectedIndexChangeVetoed(this, vote);
- }
+ } else {
+ cardPaneListeners.selectedIndexChangeVetoed(this, vote);
+ }
}
}
public Component getSelectedCard() {
- return (selectedIndex == -1) ? null : get(selectedIndex);
+ return (selectedIndex == -1) ? null : get(selectedIndex);
}
@Override
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/CardPaneListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/CardPaneListener.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/CardPaneListener.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/CardPaneListener.java Wed May 27 13:41:59 2009
@@ -41,21 +41,21 @@
}
}
- /**
- * Called to preview a selected index change.
- *
- * @param cardPane
- * @param selectedIndex
- */
- public Vote previewSelectedIndexChange(CardPane cardPane, int selectedIndex);
+ /**
+ * Called to preview a selected index change.
+ *
+ * @param cardPane
+ * @param selectedIndex
+ */
+ public Vote previewSelectedIndexChange(CardPane cardPane, int selectedIndex);
- /**
- * Called when a selected index change has been vetoed.
- *
- * @param cardPane
- * @param reason
- */
- public void selectedIndexChangeVetoed(CardPane cardPane, Vote reason);
+ /**
+ * Called when a selected index change has been vetoed.
+ *
+ * @param cardPane
+ * @param reason
+ */
+ public void selectedIndexChangeVetoed(CardPane cardPane, Vote reason);
/**
* Called when a card pane's selected index has changed.
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/Dialog.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/Dialog.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/Dialog.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/Dialog.java Wed May 27 13:41:59 2009
@@ -174,9 +174,9 @@
this.modal = modal;
if (modal) {
- if (!owner.isEnabled()) {
- throw new IllegalStateException("Owner is already disabled.");
- }
+ if (!owner.isEnabled()) {
+ throw new IllegalStateException("Owner is already disabled.");
+ }
// Walk owner tree to find the nearest enabled owning ancestor
// and disable it
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/Label.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/Label.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/Label.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/Label.java Wed May 27 13:41:59 2009
@@ -100,10 +100,10 @@
&& context.containsKey(textKey)) {
Object value = context.get(textKey);
if (value != null) {
- value = value.toString();
+ value = value.toString();
}
- setText((String)value);
+ setText((String)value);
}
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/ScriptApplication.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/ScriptApplication.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/ScriptApplication.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/ScriptApplication.java Wed May 27 13:41:59 2009
@@ -25,41 +25,41 @@
* @author gbrown
*/
public class ScriptApplication implements Application {
- private Window window = null;
+ private Window window = null;
- private static final String SRC_ARGUMENT = "src";
- private static final String TITLE_ARGUMENT = "title";
+ private static final String SRC_ARGUMENT = "src";
+ private static final String TITLE_ARGUMENT = "title";
- public static void main(String[] args) {
- DesktopApplicationContext.main(ScriptApplication.class, args);
- }
-
- public void startup(Display display, Dictionary<String, String> properties)
- throws Exception {
- if (!properties.containsKey(SRC_ARGUMENT)) {
- throw new IllegalArgumentException(SRC_ARGUMENT + " argument is required.");
- }
-
- String src = properties.get(SRC_ARGUMENT);
- String title = properties.get(TITLE_ARGUMENT);
-
- WTKXSerializer wtkxSerializer = new WTKXSerializer();
-
- Component content = (Component)wtkxSerializer.readObject(src);
- window = new Window(content);
- window.setTitle(title);
- window.setMaximized(true);
- window.open(display);
- }
-
- public boolean shutdown(boolean optional) {
- window.close();
- return true;
- }
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(ScriptApplication.class, args);
+ }
+
+ public void startup(Display display, Dictionary<String, String> properties)
+ throws Exception {
+ if (!properties.containsKey(SRC_ARGUMENT)) {
+ throw new IllegalArgumentException(SRC_ARGUMENT + " argument is required.");
+ }
+
+ String src = properties.get(SRC_ARGUMENT);
+ String title = properties.get(TITLE_ARGUMENT);
+
+ WTKXSerializer wtkxSerializer = new WTKXSerializer();
+
+ Component content = (Component)wtkxSerializer.readObject(src);
+ window = new Window(content);
+ window.setTitle(title);
+ window.setMaximized(true);
+ window.open(display);
+ }
+
+ public boolean shutdown(boolean optional) {
+ window.close();
+ return true;
+ }
- public void resume() {
- }
+ public void resume() {
+ }
- public void suspend() {
- }
+ public void suspend() {
+ }
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/Sheet.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/Sheet.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/Sheet.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/Sheet.java Wed May 27 13:41:59 2009
@@ -111,7 +111,7 @@
@Override
public void setSize(int width, int height) {
- super.setSize(width, height);
+ super.setSize(width, height);
ApplicationContext.queueCallback(new Runnable() {
public void run() {
@@ -143,7 +143,7 @@
Component content = owner.getContent();
if (content.isBlocked()) {
- throw new IllegalStateException("Owner content is already blocked.");
+ throw new IllegalStateException("Owner content is already blocked.");
}
content.setEnabled(false);
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/Slider.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/Slider.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/Slider.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/Slider.java Wed May 27 13:41:59 2009
@@ -26,89 +26,89 @@
* @author gbrown
*/
public class Slider extends Container {
- private static class SliderListenerList extends ListenerList<SliderListener>
- implements SliderListener {
- public void boundsChanged(Slider slider, int previousMinimum, int previousMaximum) {
- for (SliderListener listener : this) {
- listener.boundsChanged(slider, previousMinimum, previousMaximum);
- }
- }
- }
-
- private static class SliderValueListenerList extends ListenerList<SliderValueListener>
- implements SliderValueListener {
- public void valueChanged(Slider slider, int previousValue) {
- for (SliderValueListener listener : this) {
- listener.valueChanged(slider, previousValue);
- }
- }
- }
-
- private int minimum = DEFAULT_MINIMUM;
- private int maximum = DEFAULT_MAXIMUM;
- private int value = DEFAULT_VALUE;
-
- private SliderListenerList sliderListeners = new SliderListenerList();
- private SliderValueListenerList sliderValueListeners = new SliderValueListenerList();
-
- public static final int DEFAULT_MINIMUM = 0;
- public static final int DEFAULT_MAXIMUM = 100;
- public static final int DEFAULT_VALUE = 0;
-
- public static final String MINIMUM_KEY = "minimum";
- public static final String MAXIMUM_KEY = "maximum";
-
- public Slider() {
- installSkin(Slider.class);
- }
-
- public int getMinimum() {
- return minimum;
- }
-
- public void setMinimum(int minimum) {
- setBounds(minimum, maximum);
- }
-
- public int getMaximum() {
- return maximum;
- }
-
- public void setMaximum(int maximum) {
- setBounds(minimum, maximum);
- }
-
- public void setBounds(int minimum, int maximum) {
- if (minimum > maximum) {
- throw new IllegalArgumentException("minimum is greater than maximum.");
- }
-
- int previousMinimum = this.minimum;
- int previousMaximum = this.maximum;
- int previousValue = this.value;
-
- if (minimum != previousMinimum
- || maximum != previousMaximum) {
- this.minimum = minimum;
- if (value < minimum) {
- this.value = minimum;
- }
-
- this.maximum = maximum;
- if (value > maximum) {
- this.value = maximum;
- }
-
- sliderListeners.boundsChanged(this, previousMinimum, previousMaximum);
-
- if (previousValue < minimum
- || previousValue > maximum) {
- sliderValueListeners.valueChanged(this, previousValue);
- }
- }
- }
+ private static class SliderListenerList extends ListenerList<SliderListener>
+ implements SliderListener {
+ public void boundsChanged(Slider slider, int previousMinimum, int previousMaximum) {
+ for (SliderListener listener : this) {
+ listener.boundsChanged(slider, previousMinimum, previousMaximum);
+ }
+ }
+ }
+
+ private static class SliderValueListenerList extends ListenerList<SliderValueListener>
+ implements SliderValueListener {
+ public void valueChanged(Slider slider, int previousValue) {
+ for (SliderValueListener listener : this) {
+ listener.valueChanged(slider, previousValue);
+ }
+ }
+ }
+
+ private int minimum = DEFAULT_MINIMUM;
+ private int maximum = DEFAULT_MAXIMUM;
+ private int value = DEFAULT_VALUE;
+
+ private SliderListenerList sliderListeners = new SliderListenerList();
+ private SliderValueListenerList sliderValueListeners = new SliderValueListenerList();
+
+ public static final int DEFAULT_MINIMUM = 0;
+ public static final int DEFAULT_MAXIMUM = 100;
+ public static final int DEFAULT_VALUE = 0;
+
+ public static final String MINIMUM_KEY = "minimum";
+ public static final String MAXIMUM_KEY = "maximum";
- public final void setBounds(Dictionary<String, ?> bounds) {
+ public Slider() {
+ installSkin(Slider.class);
+ }
+
+ public int getMinimum() {
+ return minimum;
+ }
+
+ public void setMinimum(int minimum) {
+ setBounds(minimum, maximum);
+ }
+
+ public int getMaximum() {
+ return maximum;
+ }
+
+ public void setMaximum(int maximum) {
+ setBounds(minimum, maximum);
+ }
+
+ public void setBounds(int minimum, int maximum) {
+ if (minimum > maximum) {
+ throw new IllegalArgumentException("minimum is greater than maximum.");
+ }
+
+ int previousMinimum = this.minimum;
+ int previousMaximum = this.maximum;
+ int previousValue = this.value;
+
+ if (minimum != previousMinimum
+ || maximum != previousMaximum) {
+ this.minimum = minimum;
+ if (value < minimum) {
+ this.value = minimum;
+ }
+
+ this.maximum = maximum;
+ if (value > maximum) {
+ this.value = maximum;
+ }
+
+ sliderListeners.boundsChanged(this, previousMinimum, previousMaximum);
+
+ if (previousValue < minimum
+ || previousValue > maximum) {
+ sliderValueListeners.valueChanged(this, previousValue);
+ }
+ }
+ }
+
+ public final void setBounds(Dictionary<String, ?> bounds) {
if (bounds == null) {
throw new IllegalArgumentException("bounds is null.");
}
@@ -120,46 +120,46 @@
int maximum = DEFAULT_MAXIMUM;
if (bounds.containsKey(MAXIMUM_KEY)) {
- maximum = ((Number)bounds.get(MAXIMUM_KEY)).intValue();
+ maximum = ((Number)bounds.get(MAXIMUM_KEY)).intValue();
}
setBounds(minimum, maximum);
- }
+ }
- public final void setBounds(String bounds) {
+ public final void setBounds(String bounds) {
if (bounds == null) {
throw new IllegalArgumentException("bounds is null.");
}
setBounds(JSONSerializer.parseMap(bounds));
- }
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public void setValue(int value) {
+ if (value < minimum) {
+ throw new IllegalArgumentException("value is less than minimum.");
+ }
+
+ if (value > maximum) {
+ throw new IllegalArgumentException("value is greater than maximum.");
+ }
+
+ int previousValue = this.value;
+
+ if (value != previousValue) {
+ this.value = value;
+ sliderValueListeners.valueChanged(this, previousValue);
+ }
+ }
- public int getValue() {
- return value;
- }
-
- public void setValue(int value) {
- if (value < minimum) {
- throw new IllegalArgumentException("value is less than minimum.");
- }
-
- if (value > maximum) {
- throw new IllegalArgumentException("value is greater than maximum.");
- }
-
- int previousValue = this.value;
-
- if (value != previousValue) {
- this.value = value;
- sliderValueListeners.valueChanged(this, previousValue);
- }
- }
-
- public ListenerList<SliderListener> getSliderListeners() {
- return sliderListeners;
- }
+ public ListenerList<SliderListener> getSliderListeners() {
+ return sliderListeners;
+ }
public ListenerList<SliderValueListener> getSliderValueListeners() {
- return sliderValueListeners;
- }
+ return sliderValueListeners;
+ }
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/SliderListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/SliderListener.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/SliderListener.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/SliderListener.java Wed May 27 13:41:59 2009
@@ -22,12 +22,12 @@
* @author gbrown
*/
public interface SliderListener {
- /**
- * Called when a slider's bounds have changed.
- *
- * @param slider
- * @param previousMinimum
- * @param previousMaximum
- */
- public void boundsChanged(Slider slider, int previousMinimum, int previousMaximum);
+ /**
+ * Called when a slider's bounds have changed.
+ *
+ * @param slider
+ * @param previousMinimum
+ * @param previousMaximum
+ */
+ public void boundsChanged(Slider slider, int previousMinimum, int previousMaximum);
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/SliderValueListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/SliderValueListener.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/SliderValueListener.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/SliderValueListener.java Wed May 27 13:41:59 2009
@@ -22,11 +22,11 @@
* @author gbrown
*/
public interface SliderValueListener {
- /**
- * Called when a slider's value has changed.
- *
- * @param slider
- * @param previousValue
- */
- public void valueChanged(Slider slider, int previousValue);
+ /**
+ * Called when a slider's value has changed.
+ *
+ * @param slider
+ * @param previousValue
+ */
+ public void valueChanged(Slider slider, int previousValue);
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/TabPane.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/TabPane.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/TabPane.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/TabPane.java Wed May 27 13:41:59 2009
@@ -211,7 +211,7 @@
private static class TabPaneSelectionListenerList extends ListenerList<TabPaneSelectionListener>
implements TabPaneSelectionListener {
- public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex) {
+ public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex) {
Vote vote = Vote.APPROVE;
for (TabPaneSelectionListener listener : this) {
@@ -219,15 +219,15 @@
}
return vote;
- }
+ }
- public void selectedIndexChangeVetoed(TabPane tabPane, Vote reason) {
+ public void selectedIndexChangeVetoed(TabPane tabPane, Vote reason) {
for (TabPaneSelectionListener listener : this) {
listener.selectedIndexChangeVetoed(tabPane, reason);
}
- }
+ }
- public void selectedIndexChanged(TabPane tabPane, int previousSelectedIndex) {
+ public void selectedIndexChanged(TabPane tabPane, int previousSelectedIndex) {
for (TabPaneSelectionListener listener : this) {
listener.selectedIndexChanged(tabPane, previousSelectedIndex);
}
@@ -279,19 +279,19 @@
int previousSelectedIndex = this.selectedIndex;
if (previousSelectedIndex != selectedIndex) {
- Vote vote = tabPaneSelectionListeners.previewSelectedIndexChange(this, selectedIndex);
+ Vote vote = tabPaneSelectionListeners.previewSelectedIndexChange(this, selectedIndex);
- if (vote == Vote.APPROVE) {
- this.selectedIndex = selectedIndex;
- tabPaneSelectionListeners.selectedIndexChanged(this, previousSelectedIndex);
- } else {
- tabPaneSelectionListeners.selectedIndexChangeVetoed(this, vote);
- }
+ if (vote == Vote.APPROVE) {
+ this.selectedIndex = selectedIndex;
+ tabPaneSelectionListeners.selectedIndexChanged(this, previousSelectedIndex);
+ } else {
+ tabPaneSelectionListeners.selectedIndexChangeVetoed(this, vote);
+ }
}
}
public Component getSelectedTab() {
- return (selectedIndex == -1) ? null : tabs.get(selectedIndex);
+ return (selectedIndex == -1) ? null : tabs.get(selectedIndex);
}
public TabSequence getTabs() {
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/TabPaneSelectionListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/TabPaneSelectionListener.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/TabPaneSelectionListener.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/TabPaneSelectionListener.java Wed May 27 13:41:59 2009
@@ -41,23 +41,23 @@
}
}
- /**
- * Called to preview a selected index change.
- *
- * @param tabPane
- * @param selectedIndex
- */
- public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex);
+ /**
+ * Called to preview a selected index change.
+ *
+ * @param tabPane
+ * @param selectedIndex
+ */
+ public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex);
- /**
- * Called when a selected index change has been vetoed.
- *
- * @param tabPane
- * @param reason
- */
- public void selectedIndexChangeVetoed(TabPane tabPane, Vote reason);
+ /**
+ * Called when a selected index change has been vetoed.
+ *
+ * @param tabPane
+ * @param reason
+ */
+ public void selectedIndexChangeVetoed(TabPane tabPane, Vote reason);
- /**
+ /**
* Called when a tab pane's selected index has changed.
*
* @param tabPane
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/TableView.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/TableView.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/TableView.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/TableView.java Wed May 27 13:41:59 2009
@@ -491,19 +491,19 @@
@SuppressWarnings("unchecked")
public int compare(Object o1, Object o2) {
- Dictionary<String, ?> row1;
- if (o1 instanceof Dictionary<?, ?>) {
- row1 = (Dictionary<String, ?>)o1;
- } else {
- row1 = new BeanDictionary(o1);
- }
-
- Dictionary<String, ?> row2;
- if (o2 instanceof Dictionary<?, ?>) {
- row2 = (Dictionary<String, ?>)o2;
- } else {
- row2 = new BeanDictionary(o2);
- }
+ Dictionary<String, ?> row1;
+ if (o1 instanceof Dictionary<?, ?>) {
+ row1 = (Dictionary<String, ?>)o1;
+ } else {
+ row1 = new BeanDictionary(o1);
+ }
+
+ Dictionary<String, ?> row2;
+ if (o2 instanceof Dictionary<?, ?>) {
+ row2 = (Dictionary<String, ?>)o2;
+ } else {
+ row2 = new BeanDictionary(o2);
+ }
Comparable<Object> comparable = (Comparable<Object>)row1.get(columnName);
Object value = row2.get(columnName);
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/content/ColorItem.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/content/ColorItem.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/content/ColorItem.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/content/ColorItem.java Wed May 27 13:41:59 2009
@@ -24,54 +24,54 @@
* @author gbrown
*/
public class ColorItem {
- private Color color;
- private String name;
+ private Color color;
+ private String name;
- public ColorItem() {
- this(Color.BLACK, null);
- }
-
- public ColorItem(Color color) {
- this(color, null);
- }
-
- public ColorItem(Color color, String name) {
- this.color = color;
- this.name = name;
- }
-
- public Color getColor() {
- return color;
- }
-
- public void setColor(Color color) {
- if (color == null) {
- throw new IllegalArgumentException("color is null.");
- }
-
- this.color = color;
- }
-
- public void setColor(String color) {
- if (color == null) {
- throw new IllegalArgumentException("color is null.");
- }
-
- setColor(Color.decode(color));
- }
-
- public String getName() {
- String name = this.name;
-
- if (name == null) {
- name = String.format("#%02X%02X%02X", color.getRed(), color.getGreen(),
- color.getBlue());
- }
-
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
+ public ColorItem() {
+ this(Color.BLACK, null);
+ }
+
+ public ColorItem(Color color) {
+ this(color, null);
+ }
+
+ public ColorItem(Color color, String name) {
+ this.color = color;
+ this.name = name;
+ }
+
+ public Color getColor() {
+ return color;
+ }
+
+ public void setColor(Color color) {
+ if (color == null) {
+ throw new IllegalArgumentException("color is null.");
+ }
+
+ this.color = color;
+ }
+
+ public void setColor(String color) {
+ if (color == null) {
+ throw new IllegalArgumentException("color is null.");
+ }
+
+ setColor(Color.decode(color));
+ }
+
+ public String getName() {
+ String name = this.name;
+
+ if (name == null) {
+ name = String.format("#%02X%02X%02X", color.getRed(), color.getGreen(),
+ color.getBlue());
+ }
+
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListButtonColorRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListButtonColorRenderer.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListButtonColorRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListButtonColorRenderer.java Wed May 27 13:41:59 2009
@@ -27,27 +27,27 @@
* @author gbrown
*/
public class ListButtonColorRenderer extends ImageView
- implements Button.DataRenderer {
+ implements Button.DataRenderer {
private ListViewColorRenderer.ColorBadge colorBadge =
- new ListViewColorRenderer.ColorBadge();
+ new ListViewColorRenderer.ColorBadge();
public ListButtonColorRenderer() {
- setImage(colorBadge);
+ setImage(colorBadge);
}
public void render(Object data, Button button, boolean highlighted) {
- Color color;
- if (data instanceof ColorItem) {
- ColorItem colorItem = (ColorItem)data;
- color = colorItem.getColor();
- } else {
- if (data instanceof Color) {
- color = (Color)data;
- } else {
- color = Color.decode(data.toString());
- }
- }
+ Color color;
+ if (data instanceof ColorItem) {
+ ColorItem colorItem = (ColorItem)data;
+ color = colorItem.getColor();
+ } else {
+ if (data instanceof Color) {
+ color = (Color)data;
+ } else {
+ color = Color.decode(data.toString());
+ }
+ }
- colorBadge.setColor(color);
+ colorBadge.setColor(color);
}
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java Wed May 27 13:41:59 2009
@@ -68,7 +68,7 @@
private ListItem listItem = new ListItem(colorBadge);
public ListViewColorRenderer() {
- setShowIcon(true);
+ setShowIcon(true);
}
public void render(Object item, ListView listView, boolean selected,
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/effects/ClipDecorator.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/effects/ClipDecorator.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/effects/ClipDecorator.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/effects/ClipDecorator.java Wed May 27 13:41:59 2009
@@ -28,51 +28,51 @@
* @author gbrown
*/
public class ClipDecorator implements Decorator {
- private int x = 0;
- private int y = 0;
- private int width = 0;
- private int height = 0;
-
- public int getX() {
- return x;
- }
-
- public void setX(int x) {
- this.x = x;
- }
-
- public int getY() {
- return y;
- }
-
- public void setY(int y) {
- this.y = y;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public Graphics2D prepare(Component component, Graphics2D graphics) {
- graphics.clipRect(x, y, width, height);
- return graphics;
- }
-
- public void update() {
- // No-op
- }
+ private int x = 0;
+ private int y = 0;
+ private int width = 0;
+ private int height = 0;
+
+ public int getX() {
+ return x;
+ }
+
+ public void setX(int x) {
+ this.x = x;
+ }
+
+ public int getY() {
+ return y;
+ }
+
+ public void setY(int y) {
+ this.y = y;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ public Graphics2D prepare(Component component, Graphics2D graphics) {
+ graphics.clipRect(x, y, width, height);
+ return graphics;
+ }
+
+ public void update() {
+ // No-op
+ }
public Bounds getBounds(Component component) {
return new Bounds(x, y, width, height);
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/effects/Transition.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/effects/Transition.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/effects/Transition.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/effects/Transition.java Wed May 27 13:41:59 2009
@@ -267,12 +267,12 @@
* {@link TransitionListener#transitionCompleted(Transition)} event.
*/
public void end() {
- if (transitionCallback != null) {
- currentTime = startTime + duration;
- stop();
- update();
- transitionListener.transitionCompleted(this);
- }
+ if (transitionCallback != null) {
+ currentTime = startTime + duration;
+ stop();
+ update();
+ transitionListener.transitionCompleted(this);
+ }
}
/**
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/SliderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/SliderSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/SliderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/SliderSkin.java Wed May 27 13:41:59 2009
@@ -27,30 +27,30 @@
* @author gbrown
*/
public abstract class SliderSkin extends ContainerSkin
- implements SliderListener, SliderValueListener {
- @Override
- public void install(Component component) {
- super.install(component);
+ implements SliderListener, SliderValueListener {
+ @Override
+ public void install(Component component) {
+ super.install(component);
- Slider slider = (Slider)component;
- slider.getSliderListeners().add(this);
- slider.getSliderValueListeners().add(this);
- }
+ Slider slider = (Slider)component;
+ slider.getSliderListeners().add(this);
+ slider.getSliderValueListeners().add(this);
+ }
- @Override
- public void uninstall() {
- Slider slider = (Slider)getComponent();
- slider.getSliderListeners().remove(this);
- slider.getSliderValueListeners().remove(this);
+ @Override
+ public void uninstall() {
+ Slider slider = (Slider)getComponent();
+ slider.getSliderListeners().remove(this);
+ slider.getSliderValueListeners().remove(this);
- super.uninstall();
- }
+ super.uninstall();
+ }
- public void boundsChanged(Slider slider, int previousMinimum, int previousMaximum) {
- invalidateComponent();
- }
+ public void boundsChanged(Slider slider, int previousMinimum, int previousMaximum) {
+ invalidateComponent();
+ }
- public void valueChanged(Slider slider, int previousValue) {
- // No-op
- }
+ public void valueChanged(Slider slider, int previousValue) {
+ // No-op
+ }
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/obsidian/ObsidianTheme.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/obsidian/ObsidianTheme.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/obsidian/ObsidianTheme.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/obsidian/ObsidianTheme.java Wed May 27 13:41:59 2009
@@ -48,10 +48,10 @@
}
public Image getMessageIcon(MessageType messageType) {
- return null;
+ return null;
}
public Image getSmallMessageIcon(MessageType messageType) {
- return null;
+ return null;
}
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java Wed May 27 13:41:59 2009
@@ -57,7 +57,7 @@
*/
public class TerraAccordionSkin extends ContainerSkin
implements AccordionListener, AccordionSelectionListener, AccordionAttributeListener {
- protected class PanelHeader extends Button {
+ protected class PanelHeader extends Button {
public PanelHeader(Component panel) {
super(panel);
@@ -107,7 +107,7 @@
int contentWidth = width;
if (contentWidth != -1) {
contentWidth = Math.max(contentWidth - (buttonPadding.left
- + buttonPadding.right + 2), 0);
+ + buttonPadding.right + 2), 0);
}
int preferredHeight = dataRenderer.getPreferredHeight(contentWidth)
@@ -175,61 +175,61 @@
}
public Font getFont() {
- return buttonFont;
+ return buttonFont;
}
public Color getColor() {
- return buttonColor;
+ return buttonColor;
}
public Color getDisabledColor() {
- return disabledButtonColor;
+ return disabledButtonColor;
}
}
- public class SelectionChangeTransition extends Transition {
- public final Component fromPanel;
- public final Component toPanel;
+ public class SelectionChangeTransition extends Transition {
+ public final Component fromPanel;
+ public final Component toPanel;
- private Easing easing = new Quartic();
+ private Easing easing = new Quartic();
- public SelectionChangeTransition(Component fromPanel, Component toPanel) {
- super(SELECTION_CHANGE_DURATION, SELECTION_CHANGE_RATE, false);
- this.fromPanel = fromPanel;
- this.toPanel = toPanel;
- }
+ public SelectionChangeTransition(Component fromPanel, Component toPanel) {
+ super(SELECTION_CHANGE_DURATION, SELECTION_CHANGE_RATE, false);
+ this.fromPanel = fromPanel;
+ this.toPanel = toPanel;
+ }
public float getEasedPercentComplete() {
return easing.easeOut(getElapsedTime(), 0, 1, getDuration());
}
@Override
- public void start(TransitionListener transitionListener) {
- fromPanel.getDecorators().add(previousSelectedPanelClipDecorator);
- toPanel.getDecorators().add(selectedPanelClipDecorator);
+ public void start(TransitionListener transitionListener) {
+ fromPanel.getDecorators().add(previousSelectedPanelClipDecorator);
+ toPanel.getDecorators().add(selectedPanelClipDecorator);
- getComponent().setEnabled(false);
+ getComponent().setEnabled(false);
- super.start(transitionListener);
- }
+ super.start(transitionListener);
+ }
- @Override
- public void stop() {
- fromPanel.getDecorators().remove(previousSelectedPanelClipDecorator);
- toPanel.getDecorators().remove(selectedPanelClipDecorator);
+ @Override
+ public void stop() {
+ fromPanel.getDecorators().remove(previousSelectedPanelClipDecorator);
+ toPanel.getDecorators().remove(selectedPanelClipDecorator);
- getComponent().setEnabled(true);
+ getComponent().setEnabled(true);
- super.stop();
- }
+ super.stop();
+ }
- @Override
- protected void update() {
- invalidateComponent();
- }
- }
+ @Override
+ protected void update() {
+ invalidateComponent();
+ }
+ }
- private Button.Group panelHeaderGroup = new Button.Group();
+ private Button.Group panelHeaderGroup = new Button.Group();
private ArrayList<PanelHeader> panelHeaders = new ArrayList<PanelHeader>();
private Color borderColor;
@@ -273,8 +273,8 @@
}
};
- private static final int SELECTION_CHANGE_DURATION = 250;
- private static final int SELECTION_CHANGE_RATE = 30;
+ private static final int SELECTION_CHANGE_DURATION = 250;
+ private static final int SELECTION_CHANGE_RATE = 30;
public TerraAccordionSkin() {
TerraTheme theme = (TerraTheme)Theme.getTheme();
@@ -302,16 +302,16 @@
});
}
- @Override
- public void setSize(int width, int height) {
- if (selectionChangeTransition != null) {
- selectionChangeTransition.end();
- }
+ @Override
+ public void setSize(int width, int height) {
+ if (selectionChangeTransition != null) {
+ selectionChangeTransition.end();
+ }
- super.setSize(width, height);
- }
+ super.setSize(width, height);
+ }
- public void install(Component component) {
+ public void install(Component component) {
super.install(component);
Accordion accordion = (Accordion)component;
@@ -361,16 +361,16 @@
// the headers and the panels, plus border
int maxPanelHeaderWidth = 0;
for (PanelHeader panelHeader : panelHeaders) {
- maxPanelHeaderWidth = Math.max(panelHeader.getPreferredWidth(), maxPanelHeaderWidth);
+ maxPanelHeaderWidth = Math.max(panelHeader.getPreferredWidth(), maxPanelHeaderWidth);
}
int maxPanelWidth = 0;
for (Component panel : accordion.getPanels()) {
- maxPanelWidth = Math.max(panel.getPreferredWidth(), maxPanelWidth);
+ maxPanelWidth = Math.max(panel.getPreferredWidth(), maxPanelWidth);
}
int preferredWidth = Math.max(maxPanelHeaderWidth, maxPanelWidth
- + (padding.left + padding.right + 2));
+ + (padding.left + padding.right + 2));
return preferredWidth;
}
@@ -383,16 +383,16 @@
// The preferred height is the sum of the constrained preferred heights
// of the headers and selected panel, plus border
for (PanelHeader panelHeader : panelHeaders) {
- preferredHeight += panelHeader.getPreferredHeight(width) - 1;
+ preferredHeight += panelHeader.getPreferredHeight(width) - 1;
}
- if (width != -1) {
- width = Math.max(0, width - (padding.left + padding.right + 2));
- }
+ if (width != -1) {
+ width = Math.max(0, width - (padding.left + padding.right + 2));
+ }
- int maxPanelHeight = 0;
+ int maxPanelHeight = 0;
for (Component panel : accordion.getPanels()) {
- maxPanelHeight = Math.max(maxPanelHeight, panel.getPreferredHeight(width));
+ maxPanelHeight = Math.max(maxPanelHeight, panel.getPreferredHeight(width));
}
preferredHeight += (maxPanelHeight + padding.top + padding.bottom);
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java Wed May 27 13:41:59 2009
@@ -85,24 +85,24 @@
@Override
public void start(TransitionListener transitionListener) {
- Expander expander = (Expander)getComponent();
- Component content = expander.getContent();
- content.getDecorators().add(clipDecorator);
+ Expander expander = (Expander)getComponent();
+ Component content = expander.getContent();
+ content.getDecorators().add(clipDecorator);
- getComponent().setEnabled(false);
+ getComponent().setEnabled(false);
super.start(transitionListener);
}
@Override
public void stop() {
- Expander expander = (Expander)getComponent();
- Component content = expander.getContent();
- content.getDecorators().remove(clipDecorator);
+ Expander expander = (Expander)getComponent();
+ Component content = expander.getContent();
+ content.getDecorators().remove(clipDecorator);
- getComponent().setEnabled(true);
+ getComponent().setEnabled(true);
- super.stop();
+ super.stop();
}
@Override
@@ -265,16 +265,16 @@
titleFlowPane.add(titleLabel);
}
- @Override
- public void setSize(int width, int height) {
- if (expandTransition != null
- && width != getWidth()) {
- expandTransition.end();
- expandTransition = null;
- }
+ @Override
+ public void setSize(int width, int height) {
+ if (expandTransition != null
+ && width != getWidth()) {
+ expandTransition.end();
+ expandTransition = null;
+ }
- super.setSize(width, height);
- }
+ super.setSize(width, height);
+ }
@Override
public void install(Component component) {
@@ -309,7 +309,7 @@
int preferredWidth;
if (expandTransition == null) {
- preferredWidth = 2;
+ preferredWidth = 2;
Expander expander = (Expander)getComponent();
Component content = expander.getContent();
@@ -338,7 +338,7 @@
preferredWidth += Math.max(titleBarPreferredWidth, contentPreferredWidth);
} else {
- preferredWidth = getWidth();
+ preferredWidth = getWidth();
}
return preferredWidth;
@@ -367,7 +367,7 @@
} else {
float scale = expandTransition.getScale();
preferredHeight += (int)(scale * (float)(padding.top + padding.bottom
- + content.getHeight()));
+ + content.getHeight()));
}
}
}
@@ -394,7 +394,7 @@
titleBarFlowPane.setSize(Math.max(width - 2, 0), titleBarHeight);
titleBarFlowPane.setLocation(1, 1);
} else {
- titleBarHeight = titleBarFlowPane.getHeight();
+ titleBarHeight = titleBarFlowPane.getHeight();
}
if (content != null) {
@@ -408,14 +408,14 @@
int contentHeight = Math.max(height - reservedHeight, 0);
if (expandTransition == null) {
- content.setSize(contentWidth, contentHeight);
+ content.setSize(contentWidth, contentHeight);
} else {
- if (!expandTransition.isRunning()) {
- content.setSize(contentWidth, content.getPreferredHeight(contentWidth));
- }
+ if (!expandTransition.isRunning()) {
+ content.setSize(contentWidth, content.getPreferredHeight(contentWidth));
+ }
- expandTransition.clipDecorator.setWidth(contentWidth);
- expandTransition.clipDecorator.setHeight(contentHeight);
+ expandTransition.clipDecorator.setWidth(contentWidth);
+ expandTransition.clipDecorator.setHeight(contentHeight);
}
int contentX = 1 + padding.left;
@@ -449,7 +449,7 @@
int titleBarHeight = titleBarFlowPane.getHeight();
graphics.setPaint(new GradientPaint(titleBarX + titleBarWidth / 2, titleBarY, titleBarBevelColor,
- titleBarX + titleBarWidth / 2, titleBarY + titleBarHeight, titleBarBackgroundColor));
+ titleBarX + titleBarWidth / 2, titleBarY + titleBarHeight, titleBarBackgroundColor));
graphics.fillRect(titleBarX, titleBarY, titleBarWidth, titleBarHeight);
graphics.setPaint(borderColor);
@@ -629,7 +629,7 @@
if (expander.isShowing()) {
if (expandTransition == null) {
if (expander.isExpanded()
- && expander.getContent() != null) {
+ && expander.getContent() != null) {
expandTransition = new ExpandTransition(true, EXPAND_DURATION, EXPAND_RATE);
layout();
@@ -643,9 +643,9 @@
vote = Vote.DEFER;
}
} else {
- if (expandTransition.isRunning()) {
- vote = Vote.DEFER;
- }
+ if (expandTransition.isRunning()) {
+ vote = Vote.DEFER;
+ }
}
}
@@ -664,7 +664,7 @@
public void expandedChanged(final Expander expander) {
if (expander.isShowing()) {
if (expander.isExpanded()
- && expander.getContent() != null) {
+ && expander.getContent() != null) {
expandTransition = new ExpandTransition(false, EXPAND_DURATION, EXPAND_RATE);
layout();
@@ -688,10 +688,10 @@
}
public void contentChanged(Expander expander, Component previousContent) {
- if (expandTransition != null) {
- expandTransition.stop();
- expandTransition = null;
- }
+ if (expandTransition != null) {
+ expandTransition.stop();
+ expandTransition = null;
+ }
invalidateComponent();
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java Wed May 27 13:41:59 2009
@@ -74,9 +74,9 @@
* @author gbrown
*/
public static class FrameButtonSkin extends TerraPushButtonSkin {
- public FrameButtonSkin() {
- setPadding(3);
- }
+ public FrameButtonSkin() {
+ setPadding(3);
+ }
@Override
public boolean isFocusable() {
@@ -85,8 +85,8 @@
@Override
public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
- super.mouseDown(component, button, x, y);
- return true;
+ super.mouseDown(component, button, x, y);
+ return true;
}
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java Wed May 27 13:41:59 2009
@@ -234,7 +234,7 @@
if (listButton.isEnabled()) {
backgroundColor = this.backgroundColor;
bevelColor = (pressed
- || (listViewPopup.isOpen() && closeTransition == null)) ? pressedBevelColor : this.bevelColor;
+ || (listViewPopup.isOpen() && closeTransition == null)) ? pressedBevelColor : this.bevelColor;
borderColor = this.borderColor;
} else {
backgroundColor = disabledBackgroundColor;
@@ -497,15 +497,15 @@
}
public int getListSize() {
- return listSize;
+ return listSize;
}
public void setListSize(int listSize) {
- if (listSize < -1) {
- throw new IllegalArgumentException("Invalid list size.");
- }
+ if (listSize < -1) {
+ throw new IllegalArgumentException("Invalid list size.");
+ }
- this.listSize = listSize;
+ this.listSize = listSize;
}
public Object getListFont() {
@@ -591,23 +591,23 @@
@Override
public void buttonPressed(Button button) {
- if (!listViewPopup.isOpen()) {
- if (listSize == -1) {
- listViewBorder.setPreferredHeight(-1);
- } else {
- if (!listViewBorder.isPreferredHeightSet()) {
- ListView.ItemRenderer itemRenderer = listView.getItemRenderer();
- int height = itemRenderer.getPreferredHeight(-1) * listSize + 2;
-
- if (listViewBorder.getPreferredHeight() > height) {
- listViewBorder.setPreferredHeight(height);
- } else {
- listViewBorder.setPreferredHeight(-1);
- }
- }
- }
- }
+ if (!listViewPopup.isOpen()) {
+ if (listSize == -1) {
+ listViewBorder.setPreferredHeight(-1);
+ } else {
+ if (!listViewBorder.isPreferredHeightSet()) {
+ ListView.ItemRenderer itemRenderer = listView.getItemRenderer();
+ int height = itemRenderer.getPreferredHeight(-1) * listSize + 2;
+
+ if (listViewBorder.getPreferredHeight() > height) {
+ listViewBorder.setPreferredHeight(height);
+ } else {
+ listViewBorder.setPreferredHeight(-1);
+ }
+ }
+ }
+ }
- super.buttonPressed(button);
+ super.buttonPressed(button);
}
}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java Wed May 27 13:41:59 2009
@@ -142,12 +142,12 @@
}
// Paint the background
- if (backgroundColor != null
- && bevelColor != null) {
+ if (backgroundColor != null
+ && bevelColor != null) {
graphics.setPaint(new GradientPaint(width / 2, 0, bevelColor,
width / 2, height / 2, backgroundColor));
graphics.fillRect(0, 0, width, height);
- }
+ }
// Paint the border
if (borderColor != null) {
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPanoramaSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPanoramaSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPanoramaSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPanoramaSkin.java Wed May 27 13:41:59 2009
@@ -552,12 +552,12 @@
}
public boolean getAlwaysShowScrollButtons() {
- return alwaysShowScrollButtons;
+ return alwaysShowScrollButtons;
}
public void setAlwaysShowScrollButtons(boolean alwaysShowScrollButtons) {
- this.alwaysShowScrollButtons = alwaysShowScrollButtons;
- updateScrollButtonVisibility();
+ this.alwaysShowScrollButtons = alwaysShowScrollButtons;
+ updateScrollButtonVisibility();
}
protected int getMaxScrollTop() {
@@ -595,16 +595,16 @@
int scrollTop = panorama.getScrollTop();
int maxScrollTop = getMaxScrollTop();
northButton.setVisible((alwaysShowScrollButtons
- || mouseOver) && scrollTop > 0);
+ || mouseOver) && scrollTop > 0);
southButton.setVisible((alwaysShowScrollButtons
- || mouseOver) && scrollTop < maxScrollTop);
+ || mouseOver) && scrollTop < maxScrollTop);
int scrollLeft = panorama.getScrollLeft();
int maxScrollLeft = getMaxScrollLeft();
westButton.setVisible((alwaysShowScrollButtons
- || mouseOver) && scrollLeft > 0);
+ || mouseOver) && scrollLeft > 0);
eastButton.setVisible((alwaysShowScrollButtons
- || mouseOver) && scrollLeft < maxScrollLeft);
+ || mouseOver) && scrollLeft < maxScrollLeft);
}
// User input
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java Wed May 27 13:41:59 2009
@@ -77,12 +77,12 @@
}
public int getPreferredWidth(int height) {
- int preferredWidth = 0;
+ int preferredWidth = 0;
- if (height == -1
- && !Float.isNaN(preferredAspectRatio)) {
- preferredWidth = getPreferredSize().width;
- } else {
+ if (height == -1
+ && !Float.isNaN(preferredAspectRatio)) {
+ preferredWidth = getPreferredSize().width;
+ } else {
PushButton pushButton = (PushButton)getComponent();
Button.DataRenderer dataRenderer = pushButton.getDataRenderer();
@@ -103,18 +103,18 @@
&& (float)preferredWidth / (float)height < preferredAspectRatio) {
preferredWidth = (int)((float)height * preferredAspectRatio);
}
- }
+ }
return preferredWidth;
}
public int getPreferredHeight(int width) {
- int preferredHeight = 0;
+ int preferredHeight = 0;
- if (width== -1
- && !Float.isNaN(preferredAspectRatio)) {
- preferredHeight = getPreferredSize().height;
- } else {
+ if (width== -1
+ && !Float.isNaN(preferredAspectRatio)) {
+ preferredHeight = getPreferredSize().height;
+ } else {
PushButton pushButton = (PushButton)getComponent();
Button.DataRenderer dataRenderer = pushButton.getDataRenderer();
@@ -135,7 +135,7 @@
&& (float)width / (float)preferredHeight < preferredAspectRatio) {
preferredHeight = (int)((float)width / preferredAspectRatio);
}
- }
+ }
return preferredHeight;
}
@@ -195,12 +195,12 @@
}
// Paint the background
- if (backgroundColor != null
- && bevelColor != null) {
+ if (backgroundColor != null
+ && bevelColor != null) {
graphics.setPaint(new GradientPaint(width / 2, 0, bevelColor,
width / 2, height / 2, backgroundColor));
graphics.fillRect(0, 0, width, height);
- }
+ }
// Paint the border
if (borderColor != null) {
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRadioButtonSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRadioButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraRadioButtonSkin.java Wed May 27 13:41:59 2009
@@ -180,7 +180,7 @@
graphics.fillOval(0, 0, BUTTON_DIAMETER - 1, BUTTON_DIAMETER - 1);
graphics.setPaint(new GradientPaint(BUTTON_DIAMETER / 2, 0, TerraTheme.darken(buttonColor),
- BUTTON_DIAMETER / 2, BUTTON_DIAMETER / 2, buttonColor));
+ BUTTON_DIAMETER / 2, BUTTON_DIAMETER / 2, buttonColor));
graphics.fillOval(1, 1, BUTTON_DIAMETER - 3, BUTTON_DIAMETER - 3);
if (radioButton.isSelected()) {
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java?rev=779169&r1=779168&r2=779169&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java Wed May 27 13:41:59 2009
@@ -38,23 +38,23 @@
* @author gbrown
*/
public class TerraSliderSkin extends SliderSkin {
- /**
- * Slider thumb component.
- *
- * @author gbrown
- */
- protected class Thumb extends Component {
- public Thumb() {
- setSkin(new ThumbSkin());
- }
- }
-
- /**
- * Slider thumb skin.
- *
- * @author gbrown
- */
- protected class ThumbSkin extends ComponentSkin {
+ /**
+ * Slider thumb component.
+ *
+ * @author gbrown
+ */
+ protected class Thumb extends Component {
+ public Thumb() {
+ setSkin(new ThumbSkin());
+ }
+ }
+
+ /**
+ * Slider thumb skin.
+ *
+ * @author gbrown
+ */
+ protected class ThumbSkin extends ComponentSkin {
private boolean highlighted = false;
@Override
@@ -63,33 +63,33 @@
}
public int getPreferredWidth(int height) {
- return 0;
- }
+ return 0;
+ }
+
+ public int getPreferredHeight(int width) {
+ return 0;
+ }
+
+ public void layout() {
+ // No-op
+ }
+
+ public void paint(Graphics2D graphics) {
+ int width = getWidth();
+ int height = getHeight();
- public int getPreferredHeight(int width) {
- return 0;
- }
-
- public void layout() {
- // No-op
- }
-
- public void paint(Graphics2D graphics) {
- int width = getWidth();
- int height = getHeight();
-
- graphics.setPaint(new GradientPaint(width / 2, 0, buttonBevelColor,
- width / 2, height, buttonBackgroundColor));
- graphics.fillRect(0, 0, width, height);
-
- float alpha = (highlighted
- || dragOffset != null) ? 0.25f : 0.0f;
- graphics.setPaint(new Color(0, 0, 0, alpha));
+ graphics.setPaint(new GradientPaint(width / 2, 0, buttonBevelColor,
+ width / 2, height, buttonBackgroundColor));
+ graphics.fillRect(0, 0, width, height);
+
+ float alpha = (highlighted
+ || dragOffset != null) ? 0.25f : 0.0f;
+ graphics.setPaint(new Color(0, 0, 0, alpha));
graphics.fillRect(0, 0, width, height);
graphics.setPaint(buttonBorderColor);
GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
- }
+ }
@Override
public void enabledChanged(Component component) {
@@ -134,37 +134,37 @@
}
@Override
- public void mouseOver(Component component) {
- super.mouseOver(component);
+ public void mouseOver(Component component) {
+ super.mouseOver(component);
+
+ highlighted = true;
+ repaintComponent();
+ }
- highlighted = true;
- repaintComponent();
- }
-
- @Override
- public void mouseOut(Component component) {
- super.mouseOut(component);
+ @Override
+ public void mouseOut(Component component) {
+ super.mouseOut(component);
highlighted = false;
repaintComponent();
- }
+ }
- @Override
- public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
- boolean consumed = super.mouseDown(component, button, x, y);
-
- if (button == Mouse.Button.LEFT) {
- dragOffset = new Point(x, y);
- Mouse.capture(component);
+ @Override
+ public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
+ boolean consumed = super.mouseDown(component, button, x, y);
+
+ if (button == Mouse.Button.LEFT) {
+ dragOffset = new Point(x, y);
+ Mouse.capture(component);
repaintComponent();
consumed = true;
- }
+ }
- return consumed;
- }
+ return consumed;
+ }
- @Override
+ @Override
public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseUp(component, button, x, y);
@@ -175,109 +175,109 @@
}
return consumed;
- }
- }
+ }
+ }
- private Thumb thumb = new Thumb();
+ private Thumb thumb = new Thumb();
Point dragOffset = null;
private Color trackColor;
private int trackWidth;
private Color buttonBackgroundColor;
private Color buttonBorderColor;
- private int thumbWidth;
- private int thumbHeight;
+ private int thumbWidth;
+ private int thumbHeight;
- // Derived colors
+ // Derived colors
private Color buttonBevelColor;
- public static final int DEFAULT_WIDTH = 120;
- public static final int MINIMUM_THUMB_WIDTH = 4;
- public static final int MINIMUM_THUMB_HEIGHT = 4;
-
- public TerraSliderSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ public static final int DEFAULT_WIDTH = 120;
+ public static final int MINIMUM_THUMB_WIDTH = 4;
+ public static final int MINIMUM_THUMB_HEIGHT = 4;
+
+ public TerraSliderSkin() {
+ TerraTheme theme = (TerraTheme)Theme.getTheme();
+
+ trackColor = theme.getColor(6);
+ trackWidth = 2;
+ buttonBackgroundColor = theme.getColor(10);
+ buttonBorderColor = theme.getColor(7);
- trackColor = theme.getColor(6);
- trackWidth = 2;
- buttonBackgroundColor = theme.getColor(10);
- buttonBorderColor = theme.getColor(7);
+ buttonBevelColor = TerraTheme.brighten(buttonBackgroundColor);
- buttonBevelColor = TerraTheme.brighten(buttonBackgroundColor);
-
- thumbWidth = 8;
- thumbHeight = 16;
- }
+ thumbWidth = 8;
+ thumbHeight = 16;
+ }
- @Override
- public void install(Component component) {
- super.install(component);
+ @Override
+ public void install(Component component) {
+ super.install(component);
- Slider slider = (Slider)component;
- slider.add(thumb);
- }
+ Slider slider = (Slider)component;
+ slider.add(thumb);
+ }
- public void uninstall() {
- Slider slider = (Slider)getComponent();
- slider.remove(thumb);
+ public void uninstall() {
+ Slider slider = (Slider)getComponent();
+ slider.remove(thumb);
- super.uninstall();
- }
+ super.uninstall();
+ }
- public int getPreferredWidth(int height) {
- return DEFAULT_WIDTH;
- }
+ public int getPreferredWidth(int height) {
+ return DEFAULT_WIDTH;
+ }
- public int getPreferredHeight(int width) {
- return thumbHeight;
- }
+ public int getPreferredHeight(int width) {
+ return thumbHeight;
+ }
- public Dimensions getPreferredSize() {
- return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
- }
+ public Dimensions getPreferredSize() {
+ return new Dimensions(getPreferredWidth(-1), getPreferredHeight(-1));
+ }
- public void layout() {
- Slider slider = (Slider)getComponent();
+ public void layout() {
+ Slider slider = (Slider)getComponent();
- int width = getWidth();
- int height = getHeight();
+ int width = getWidth();
+ int height = getHeight();
- int minimum = slider.getMinimum();
- int maximum = slider.getMaximum();
- int value = slider.getValue();
+ int minimum = slider.getMinimum();
+ int maximum = slider.getMaximum();
+ int value = slider.getValue();
- float ratio = (float)(value - minimum) / (maximum - minimum);
+ float ratio = (float)(value - minimum) / (maximum - minimum);
- thumb.setSize(thumbWidth, thumbHeight);
- thumb.setLocation((int)((float)(width - thumbWidth) * ratio),
- (height - thumbHeight) / 2);
- }
+ thumb.setSize(thumbWidth, thumbHeight);
+ thumb.setLocation((int)((float)(width - thumbWidth) * ratio),
+ (height - thumbHeight) / 2);
+ }
- public void paint(Graphics2D graphics) {
- super.paint(graphics);
+ public void paint(Graphics2D graphics) {
+ super.paint(graphics);
- int width = getWidth();
- int height = getHeight();
+ int width = getWidth();
+ int height = getHeight();
- graphics.setColor(trackColor);
+ graphics.setColor(trackColor);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
GraphicsUtilities.drawLine(graphics, 0, (height - trackWidth) / 2,
width, Orientation.HORIZONTAL, trackWidth);
- }
+ }
+
+ public Color getTrackColor() {
+ return trackColor;
+ }
- public Color getTrackColor() {
- return trackColor;
- }
-
- public void setTrackColor(Color trackColor) {
- if (trackColor == null) {
- throw new IllegalArgumentException("trackColor is null.");
- }
-
- this.trackColor = trackColor;
- repaintComponent();
- }
+ public void setTrackColor(Color trackColor) {
+ if (trackColor == null) {
+ throw new IllegalArgumentException("trackColor is null.");
+ }
+
+ this.trackColor = trackColor;
+ repaintComponent();
+ }
public final void setTrackColor(String trackColor) {
if (trackColor == null) {
@@ -288,12 +288,12 @@
}
public int getTrackWidth() {
- return trackWidth;
+ return trackWidth;
}
public void setTrackWidth(int trackWidth) {
- this.trackWidth = trackWidth;
- repaintComponent();
+ this.trackWidth = trackWidth;
+ repaintComponent();
}
public void setTrackWidth(Number trackWidth) {
@@ -305,18 +305,18 @@
}
public Color getButtonBackgroundColor() {
- return buttonBackgroundColor;
- }
+ return buttonBackgroundColor;
+ }
- public void setButtonBackgroundColor(Color buttonBackgroundColor) {
- if (buttonBackgroundColor == null) {
- throw new IllegalArgumentException("buttonBackgroundColor is null.");
- }
-
- this.buttonBackgroundColor = buttonBackgroundColor;
- buttonBevelColor = TerraTheme.brighten(buttonBackgroundColor);
- repaintComponent();
- }
+ public void setButtonBackgroundColor(Color buttonBackgroundColor) {
+ if (buttonBackgroundColor == null) {
+ throw new IllegalArgumentException("buttonBackgroundColor is null.");
+ }
+
+ this.buttonBackgroundColor = buttonBackgroundColor;
+ buttonBevelColor = TerraTheme.brighten(buttonBackgroundColor);
+ repaintComponent();
+ }
public final void setButtonBackgroundColor(String buttonBackgroundColor) {
if (buttonBackgroundColor == null) {
@@ -326,40 +326,40 @@
setButtonBackgroundColor(GraphicsUtilities.decodeColor(buttonBackgroundColor));
}
- public Color getButtonBorderColor() {
- return buttonBorderColor;
- }
-
- public void setButtonBorderColor(Color buttonBorderColor) {
- if (buttonBorderColor == null) {
- throw new IllegalArgumentException("buttonBorderColor is null.");
- }
-
- this.buttonBorderColor = buttonBorderColor;
- repaintComponent();
- }
-
- public final void setButtonBorderColor(String buttonBorderColor) {
- if (buttonBorderColor == null) {
- throw new IllegalArgumentException("buttonBorderColor is null.");
- }
-
- setButtonBorderColor(GraphicsUtilities.decodeColor(buttonBorderColor));
- }
-
- public int getThumbWidth() {
- return thumbWidth;
- }
-
- public void setThumbWidth(int thumbWidth) {
- if (thumbWidth < MINIMUM_THUMB_WIDTH) {
- throw new IllegalArgumentException("thumbWidth must be greater than or equal to "
- + MINIMUM_THUMB_WIDTH);
- }
-
- this.thumbWidth = thumbWidth;
- invalidateComponent();
- }
+ public Color getButtonBorderColor() {
+ return buttonBorderColor;
+ }
+
+ public void setButtonBorderColor(Color buttonBorderColor) {
+ if (buttonBorderColor == null) {
+ throw new IllegalArgumentException("buttonBorderColor is null.");
+ }
+
+ this.buttonBorderColor = buttonBorderColor;
+ repaintComponent();
+ }
+
+ public final void setButtonBorderColor(String buttonBorderColor) {
+ if (buttonBorderColor == null) {
+ throw new IllegalArgumentException("buttonBorderColor is null.");
+ }
+
+ setButtonBorderColor(GraphicsUtilities.decodeColor(buttonBorderColor));
+ }
+
+ public int getThumbWidth() {
+ return thumbWidth;
+ }
+
+ public void setThumbWidth(int thumbWidth) {
+ if (thumbWidth < MINIMUM_THUMB_WIDTH) {
+ throw new IllegalArgumentException("thumbWidth must be greater than or equal to "
+ + MINIMUM_THUMB_WIDTH);
+ }
+
+ this.thumbWidth = thumbWidth;
+ invalidateComponent();
+ }
public void setThumbWidth(Number thumbWidth) {
if (thumbWidth == null) {
@@ -369,19 +369,19 @@
setThumbWidth(thumbWidth.intValue());
}
- public int getThumbHeight() {
- return thumbHeight;
- }
-
- public void setThumbHeight(int thumbHeight) {
- if (thumbHeight < MINIMUM_THUMB_HEIGHT) {
- throw new IllegalArgumentException("thumbHeight must be greater than or equal to "
- + MINIMUM_THUMB_HEIGHT);
- }
-
- this.thumbHeight = thumbHeight;
- invalidateComponent();
- }
+ public int getThumbHeight() {
+ return thumbHeight;
+ }
+
+ public void setThumbHeight(int thumbHeight) {
+ if (thumbHeight < MINIMUM_THUMB_HEIGHT) {
+ throw new IllegalArgumentException("thumbHeight must be greater than or equal to "
+ + MINIMUM_THUMB_HEIGHT);
+ }
+
+ this.thumbHeight = thumbHeight;
+ invalidateComponent();
+ }
public void setThumbHeight(Number thumbHeight) {
if (thumbHeight == null) {
@@ -392,6 +392,6 @@
}
public void valueChanged(Slider slider, int previousValue) {
- layout();
- }
+ layout();
+ }
}