You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/10/05 01:45:53 UTC
svn commit: r1529349 [18/44] - in /pivot/trunk:
charts/src/org/apache/pivot/charts/
charts/src/org/apache/pivot/charts/skin/ core/src/org/apache/pivot/beans/
core/src/org/apache/pivot/collections/
core/src/org/apache/pivot/collections/adapter/ core/src...
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRadioButtonSkin.java Fri Oct 4 23:45:40 2013
@@ -35,9 +35,7 @@ import org.apache.pivot.wtk.Theme;
import org.apache.pivot.wtk.skin.RadioButtonSkin;
/**
- * Terra radio button skin.
- * <p>
- * TODO Button alignment style (vertical only).
+ * Terra radio button skin. <p> TODO Button alignment style (vertical only).
*/
public class TerraRadioButtonSkin extends RadioButtonSkin {
private Font font;
@@ -56,7 +54,7 @@ public class TerraRadioButtonSkin extend
private static final int BUTTON_SELECTION_DIAMETER = 6;
public TerraRadioButtonSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
font = theme.getFont();
color = theme.getColor(1);
disabledColor = theme.getColor(7);
@@ -72,7 +70,7 @@ public class TerraRadioButtonSkin extend
@Override
public int getPreferredWidth(int height) {
- RadioButton radioButton = (RadioButton)getComponent();
+ RadioButton radioButton = (RadioButton) getComponent();
Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
int preferredWidth = BUTTON_DIAMETER;
@@ -80,8 +78,7 @@ public class TerraRadioButtonSkin extend
Object buttonData = radioButton.getButtonData();
if (buttonData != null) {
dataRenderer.render(buttonData, radioButton, false);
- preferredWidth += dataRenderer.getPreferredWidth(height)
- + spacing * 2;
+ preferredWidth += dataRenderer.getPreferredWidth(height) + spacing * 2;
}
return preferredWidth;
@@ -89,7 +86,7 @@ public class TerraRadioButtonSkin extend
@Override
public int getPreferredHeight(int width) {
- RadioButton radioButton = (RadioButton)getComponent();
+ RadioButton radioButton = (RadioButton) getComponent();
Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
int preferredHeight = BUTTON_DIAMETER;
@@ -102,8 +99,7 @@ public class TerraRadioButtonSkin extend
dataRenderer.render(buttonData, radioButton, false);
- preferredHeight = Math.max(preferredHeight,
- dataRenderer.getPreferredHeight(width));
+ preferredHeight = Math.max(preferredHeight, dataRenderer.getPreferredHeight(width));
}
return preferredHeight;
@@ -111,7 +107,7 @@ public class TerraRadioButtonSkin extend
@Override
public Dimensions getPreferredSize() {
- RadioButton radioButton = (RadioButton)getComponent();
+ RadioButton radioButton = (RadioButton) getComponent();
Button.DataRenderer dataRenderer = radioButton.getDataRenderer();
int preferredWidth = BUTTON_DIAMETER;
@@ -120,20 +116,17 @@ public class TerraRadioButtonSkin extend
Object buttonData = radioButton.getButtonData();
if (buttonData != null) {
dataRenderer.render(buttonData, radioButton, false);
- preferredWidth += dataRenderer.getPreferredWidth(-1)
- + spacing * 2;
+ preferredWidth += dataRenderer.getPreferredWidth(-1) + spacing * 2;
- preferredHeight = Math.max(preferredHeight,
- dataRenderer.getPreferredHeight(-1));
+ preferredHeight = Math.max(preferredHeight, dataRenderer.getPreferredHeight(-1));
}
-
return new Dimensions(preferredWidth, preferredHeight);
}
@Override
public int getBaseline(int width, int height) {
- RadioButton radioButton = (RadioButton)getComponent();
+ RadioButton radioButton = (RadioButton) getComponent();
int baseline = -1;
@@ -148,7 +141,7 @@ public class TerraRadioButtonSkin extend
@Override
public void paint(Graphics2D graphics) {
- RadioButton radioButton = (RadioButton)getComponent();
+ RadioButton radioButton = (RadioButton) getComponent();
int width = getWidth();
int height = getHeight();
@@ -164,7 +157,7 @@ public class TerraRadioButtonSkin extend
dataRenderer.render(buttonData, radioButton, false);
dataRenderer.setSize(Math.max(width - (BUTTON_DIAMETER + spacing * 2), 0), height);
- Graphics2D contentGraphics = (Graphics2D)graphics.create();
+ Graphics2D contentGraphics = (Graphics2D) graphics.create();
contentGraphics.translate(BUTTON_DIAMETER + spacing, 0);
contentGraphics.clipRect(0, 0, dataRenderer.getWidth(), dataRenderer.getHeight());
dataRenderer.paint(contentGraphics);
@@ -174,13 +167,12 @@ public class TerraRadioButtonSkin extend
if (radioButton.isFocused()) {
if (buttonData == null) {
Color focusColor = new Color(buttonSelectionColor.getRed(),
- buttonSelectionColor.getGreen(),
- buttonSelectionColor.getBlue(), 0x44);
+ buttonSelectionColor.getGreen(), buttonSelectionColor.getBlue(), 0x44);
graphics.setColor(focusColor);
graphics.fillOval(0, 0, BUTTON_DIAMETER - 1, BUTTON_DIAMETER - 1);
} else {
BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND,
- BasicStroke.JOIN_ROUND, 1.0f, new float[] {0.0f, 2.0f}, 0.0f);
+ BasicStroke.JOIN_ROUND, 1.0f, new float[] { 0.0f, 2.0f }, 0.0f);
graphics.setStroke(dashStroke);
graphics.setColor(buttonBorderColor);
@@ -189,8 +181,7 @@ public class TerraRadioButtonSkin extend
RenderingHints.VALUE_ANTIALIAS_ON);
Rectangle2D focusRectangle = new Rectangle2D.Double(BUTTON_DIAMETER + 1, 0.5,
- dataRenderer.getWidth() + spacing * 2 - 2,
- dataRenderer.getHeight() - 1);
+ dataRenderer.getWidth() + spacing * 2 - 2, dataRenderer.getHeight() - 1);
graphics.draw(focusRectangle);
}
}
@@ -201,19 +192,18 @@ public class TerraRadioButtonSkin extend
Color buttonBorderColorLocal = null;
Color buttonSelectionColorLocal = null;
- Ellipse2D buttonBackgroundCircle = new Ellipse2D.Double(1, 1,
- BUTTON_DIAMETER - 3, BUTTON_DIAMETER - 3);
+ Ellipse2D buttonBackgroundCircle = new Ellipse2D.Double(1, 1, BUTTON_DIAMETER - 3,
+ BUTTON_DIAMETER - 3);
if (enabled) {
- buttonPaint = new RadialGradientPaint((float)buttonBackgroundCircle.getCenterX(),
- (float)buttonBackgroundCircle.getCenterY(),
- (float)buttonBackgroundCircle.getWidth() * 2 / 3,
- new float[] {0f, 1f}, new Color[] {TerraTheme.darken(buttonColor), buttonColor});
+ buttonPaint = new RadialGradientPaint((float) buttonBackgroundCircle.getCenterX(),
+ (float) buttonBackgroundCircle.getCenterY(),
+ (float) buttonBackgroundCircle.getWidth() * 2 / 3, new float[] { 0f, 1f },
+ new Color[] { TerraTheme.darken(buttonColor), buttonColor });
buttonBorderColorLocal = this.buttonBorderColor;
buttonSelectionColorLocal = this.buttonSelectionColor;
- }
- else {
+ } else {
buttonPaint = disabledButtonColor;
buttonBorderColorLocal = disabledButtonBorderColor;
buttonSelectionColorLocal = disabledButtonSelectionColor;
@@ -232,8 +222,8 @@ public class TerraRadioButtonSkin extend
// Paint the selection
if (selected) {
- Ellipse2D buttonSelectionCircle = new Ellipse2D.Double((BUTTON_DIAMETER
- - (BUTTON_SELECTION_DIAMETER - 1)) / 2,
+ Ellipse2D buttonSelectionCircle = new Ellipse2D.Double(
+ (BUTTON_DIAMETER - (BUTTON_SELECTION_DIAMETER - 1)) / 2,
(BUTTON_DIAMETER - (BUTTON_SELECTION_DIAMETER - 1)) / 2,
BUTTON_SELECTION_DIAMETER - 1, BUTTON_SELECTION_DIAMETER - 1);
graphics.setColor(buttonSelectionColorLocal);
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java Fri Oct 4 23:45:40 2013
@@ -124,7 +124,7 @@ public class TerraRollupSkin extends Rol
@Override
public void paint(Graphics2D graphics) {
- Rollup rollup = (Rollup)TerraRollupSkin.this.getComponent();
+ Rollup rollup = (Rollup) TerraRollupSkin.this.getComponent();
graphics.setStroke(new BasicStroke(0));
if (rollup.isEnabled()) {
@@ -138,14 +138,14 @@ public class TerraRollupSkin extends Rol
if (rollup.isCollapsible()) {
if (rollup.isExpanded()) {
// Paint the collapse image
- int[] xPoints = {0, 3, 6};
- int[] yPoints = {0, 6, 0};
+ int[] xPoints = { 0, 3, 6 };
+ int[] yPoints = { 0, 6, 0 };
graphics.fillPolygon(xPoints, yPoints, 3);
graphics.drawPolygon(xPoints, yPoints, 3);
} else {
// Paint the expand image
- int[] xPoints = {0, 6, 0};
- int[] yPoints = {0, 3, 6};
+ int[] xPoints = { 0, 6, 0 };
+ int[] yPoints = { 0, 3, 6 };
graphics.fillPolygon(xPoints, yPoints, 3);
graphics.drawPolygon(xPoints, yPoints, 3);
}
@@ -159,7 +159,7 @@ public class TerraRollupSkin extends Rol
@Override
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
- Rollup rollup = (Rollup)TerraRollupSkin.this.getComponent();
+ Rollup rollup = (Rollup) TerraRollupSkin.this.getComponent();
rollup.setExpanded(!rollup.isExpanded());
return true;
}
@@ -185,9 +185,8 @@ public class TerraRollupSkin extends Rol
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
boolean consumed = false;
- Rollup rollup = (Rollup)getComponent();
- if (headingToggles
- && rollup.isCollapsible()) {
+ Rollup rollup = (Rollup) getComponent();
+ if (headingToggles && rollup.isCollapsible()) {
rollup.setExpanded(!rollup.isExpanded());
consumed = true;
}
@@ -200,7 +199,7 @@ public class TerraRollupSkin extends Rol
private static final int DEFAULT_EXPAND_RATE = 30;
public TerraRollupSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
buttonColor = theme.getColor(1);
disabledButtonColor = theme.getColor(7);
@@ -214,7 +213,7 @@ public class TerraRollupSkin extends Rol
public void install(Component component) {
super.install(component);
- Rollup rollup = (Rollup)component;
+ Rollup rollup = (Rollup) component;
// Add the rollup button
rollupButton = new RollupButton();
@@ -228,7 +227,7 @@ public class TerraRollupSkin extends Rol
@Override
public int getPreferredWidth(int height) {
- Rollup rollup = (Rollup)getComponent();
+ Rollup rollup = (Rollup) getComponent();
Component heading = rollup.getHeading();
Component content = rollup.getContent();
@@ -240,9 +239,7 @@ public class TerraRollupSkin extends Rol
}
if (content != null
- && (rollup.isExpanded()
- || (expandTransition != null
- && !expandTransition.isReversed()))) {
+ && (rollup.isExpanded() || (expandTransition != null && !expandTransition.isReversed()))) {
preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(-1));
}
@@ -253,7 +250,7 @@ public class TerraRollupSkin extends Rol
@Override
public int getPreferredHeight(int width) {
- Rollup rollup = (Rollup)getComponent();
+ Rollup rollup = (Rollup) getComponent();
Component heading = rollup.getHeading();
Component content = rollup.getContent();
@@ -278,7 +275,7 @@ public class TerraRollupSkin extends Rol
}
} else {
float scale = expandTransition.getScale();
- preferredHeight += (int)(scale * (spacing + content.getPreferredHeight(width)));
+ preferredHeight += (int) (scale * (spacing + content.getPreferredHeight(width)));
}
}
@@ -289,7 +286,7 @@ public class TerraRollupSkin extends Rol
@Override
public int getBaseline(int width, int height) {
- Rollup rollup = (Rollup)getComponent();
+ Rollup rollup = (Rollup) getComponent();
Component heading = rollup.getHeading();
int baseline = -1;
@@ -313,7 +310,7 @@ public class TerraRollupSkin extends Rol
@Override
public void layout() {
- Rollup rollup = (Rollup)getComponent();
+ Rollup rollup = (Rollup) getComponent();
Component heading = rollup.getHeading();
Component content = rollup.getContent();
@@ -343,9 +340,7 @@ public class TerraRollupSkin extends Rol
}
if (content != null) {
- if (rollup.isExpanded()
- || (expandTransition != null
- && !expandTransition.isReversed())) {
+ if (rollup.isExpanded() || (expandTransition != null && !expandTransition.isReversed())) {
int contentWidth, contentHeight;
if (fill) {
contentWidth = justifiedWidth;
@@ -376,7 +371,7 @@ public class TerraRollupSkin extends Rol
}
public final void setButtonColor(int color) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setButtonColor(theme.getColor(color));
}
@@ -402,7 +397,7 @@ public class TerraRollupSkin extends Rol
}
public final void setDisabledButtonColor(int color) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setDisabledButtonColor(theme.getColor(color));
}
@@ -433,7 +428,7 @@ public class TerraRollupSkin extends Rol
}
this.spacing = spacing;
- Rollup rollup = (Rollup)getComponent();
+ Rollup rollup = (Rollup) getComponent();
if (rollup.isExpanded()) {
invalidateComponent();
}
@@ -506,9 +501,7 @@ public class TerraRollupSkin extends Rol
public Vote previewExpandedChange(final Rollup rollup) {
Vote vote;
- if (rollup.isShowing()
- && expandTransition == null
- && rollup.getContent() != null) {
+ if (rollup.isShowing() && expandTransition == null && rollup.getContent() != null) {
final boolean expanded = rollup.isExpanded();
expandTransition = new ExpandTransition(expanded);
@@ -521,8 +514,7 @@ public class TerraRollupSkin extends Rol
});
}
- if (expandTransition == null
- || !expandTransition.isRunning()) {
+ if (expandTransition == null || !expandTransition.isRunning()) {
vote = Vote.APPROVE;
} else {
vote = Vote.DEFER;
@@ -533,8 +525,7 @@ public class TerraRollupSkin extends Rol
@Override
public void expandedChangeVetoed(Rollup rollup, Vote reason) {
- if (reason == Vote.DENY
- && expandTransition != null) {
+ if (reason == Vote.DENY && expandTransition != null) {
// NOTE We stop, rather than end, the transition so the completion
// event isn't fired; if the event fires, the listener will set
// the expanded state
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java Fri Oct 4 23:45:40 2013
@@ -37,12 +37,11 @@ import org.apache.pivot.wtk.media.Image;
import org.apache.pivot.wtk.skin.ComponentSkin;
import org.apache.pivot.wtk.skin.ContainerSkin;
-
/**
* Scroll bar skin.
*/
-public class TerraScrollBarSkin extends ContainerSkin
- implements ScrollBarListener, ScrollBarValueListener {
+public class TerraScrollBarSkin extends ContainerSkin implements ScrollBarListener,
+ ScrollBarValueListener {
/**
* Encapsulates the code needed to perform timer-controlled scrolling. This
* class is used by <tt>TerraScrollBarSkin</tt> (automatic block increment
@@ -57,26 +56,21 @@ public class TerraScrollBarSkin extends
private ApplicationContext.ScheduledCallback scheduledScrollCallback = null;
/**
- * Starts scrolling this skin's scroll bar, stopping the scroll when
- * the specified value has been reached.
- *
- * @param directionArgument
- * <tt>1</tt> to adjust the scroll bar's value larger; <tt>-1</tt> to
- * adjust it smaller
- *
- * @param incrementTypeArgument
- * Determines whether we'll use the scroll bar's unit increment or the
- * block increment when scrolling
- *
- * @param stopValueArgument
- * The value which, once reached, will stop the automatic scrolling.
- * Use <tt>-1</tt> to specify no stop value
- *
- * @exception IllegalStateException
- * If automatic scrolling of any scroll bar is already in progress.
- * Only one scroll bar may be automatically scrolled at one time
+ * Starts scrolling this skin's scroll bar, stopping the scroll when the
+ * specified value has been reached.
+ *
+ * @param directionArgument <tt>1</tt> to adjust the scroll bar's value
+ * larger; <tt>-1</tt> to adjust it smaller
+ * @param incrementTypeArgument Determines whether we'll use the scroll
+ * bar's unit increment or the block increment when scrolling
+ * @param stopValueArgument The value which, once reached, will stop the
+ * automatic scrolling. Use <tt>-1</tt> to specify no stop value
+ * @exception IllegalStateException If automatic scrolling of any scroll
+ * bar is already in progress. Only one scroll bar may be automatically
+ * scrolled at one time
*/
- public void start(int directionArgument, Mouse.ScrollType incrementTypeArgument, int stopValueArgument) {
+ public void start(int directionArgument, Mouse.ScrollType incrementTypeArgument,
+ int stopValueArgument) {
if (scheduledScrollCallback != null) {
throw new IllegalStateException("Already running");
}
@@ -108,7 +102,7 @@ public class TerraScrollBarSkin extends
}
private void scroll() {
- ScrollBar scrollBar = (ScrollBar)TerraScrollBarSkin.this.getComponent();
+ ScrollBar scrollBar = (ScrollBar) TerraScrollBarSkin.this.getComponent();
int start = scrollBar.getStart();
int end = scrollBar.getEnd();
@@ -127,8 +121,7 @@ public class TerraScrollBarSkin extends
int newValue = Math.max(value + adjustment, start);
scrollBar.setValue(newValue);
- if (stopValue != -1
- && newValue < stopValue) {
+ if (stopValue != -1 && newValue < stopValue) {
// We've reached the explicit stop value
stop();
}
@@ -141,8 +134,7 @@ public class TerraScrollBarSkin extends
int newValue = Math.min(value + adjustment, end - extent);
scrollBar.setValue(newValue);
- if (stopValue != -1
- && newValue > stopValue) {
+ if (stopValue != -1 && newValue > stopValue) {
// We've reached the explicit stop value
stop();
}
@@ -207,8 +199,8 @@ public class TerraScrollBarSkin extends
@Override
public void paint(Graphics2D graphics) {
// Apply scroll bar styles to the button
- ScrollButton scrollButton = (ScrollButton)getComponent();
- ScrollBar scrollBar = (ScrollBar)TerraScrollBarSkin.this.getComponent();
+ ScrollButton scrollButton = (ScrollButton) getComponent();
+ ScrollBar scrollBar = (ScrollBar) TerraScrollBarSkin.this.getComponent();
Orientation orientation = scrollBar.getOrientation();
int width = getWidth();
@@ -234,11 +226,11 @@ public class TerraScrollBarSkin extends
Color gradientEndColor = pressed ? brightBackgroundColor : backgroundColor;
if (orientation == Orientation.HORIZONTAL) {
- graphics.setPaint(new GradientPaint(0, 1, gradientStartColor,
- 0, height - 2, gradientEndColor));
+ graphics.setPaint(new GradientPaint(0, 1, gradientStartColor, 0, height - 2,
+ gradientEndColor));
} else {
- graphics.setPaint(new GradientPaint(1, 0, gradientStartColor,
- width - 2, 0, gradientEndColor));
+ graphics.setPaint(new GradientPaint(1, 0, gradientStartColor, width - 2, 0,
+ gradientEndColor));
}
graphics.fillRect(1, 1, width - 2, height - 2);
@@ -253,7 +245,7 @@ public class TerraScrollBarSkin extends
int buttonImageHeight = buttonImage.getHeight();
// Paint the image
- Graphics2D imageGraphics = (Graphics2D)graphics.create();
+ Graphics2D imageGraphics = (Graphics2D) graphics.create();
int buttonImageX = (width - buttonImageWidth) / 2;
int buttonImageY = (height - buttonImageHeight) / 2;
imageGraphics.translate(buttonImageX, buttonImageY);
@@ -297,7 +289,7 @@ public class TerraScrollBarSkin extends
boolean consumed = super.mouseDown(component, button, x, y);
if (button == Mouse.Button.LEFT) {
- ScrollButton scrollButton = (ScrollButton)getComponent();
+ ScrollButton scrollButton = (ScrollButton) getComponent();
// Start the automatic scroller. It'll be stopped when we
// mouse up or mouse out
@@ -330,14 +322,14 @@ public class TerraScrollBarSkin extends
protected abstract class ScrollButtonImage extends Image {
@Override
public int getWidth() {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
Orientation orientation = scrollBar.getOrientation();
return (orientation == Orientation.HORIZONTAL ? 5 : 7);
}
@Override
public int getHeight() {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
Orientation orientation = scrollBar.getOrientation();
return (orientation == Orientation.HORIZONTAL ? 7 : 5);
}
@@ -346,7 +338,7 @@ public class TerraScrollBarSkin extends
protected class ScrollUpImage extends ScrollButtonImage {
@Override
public void paint(Graphics2D graphics) {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int width = getWidth();
int height = getHeight();
@@ -376,7 +368,7 @@ public class TerraScrollBarSkin extends
protected class ScrollDownImage extends ScrollButtonImage {
@Override
public void paint(Graphics2D graphics) {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int width = getWidth();
int height = getHeight();
@@ -446,26 +438,25 @@ public class TerraScrollBarSkin extends
@Override
public void paint(Graphics2D graphics) {
- ScrollBar scrollBar = (ScrollBar)TerraScrollBarSkin.this.getComponent();
+ ScrollBar scrollBar = (ScrollBar) TerraScrollBarSkin.this.getComponent();
Orientation orientation = scrollBar.getOrientation();
int width = getWidth();
int height = getHeight();
// Paint the background
- Color backgroundColor = highlighted ?
- scrollButtonHighlightedBackgroundColor :
- scrollButtonBackgroundColor;
+ Color backgroundColor = highlighted ? scrollButtonHighlightedBackgroundColor
+ : scrollButtonBackgroundColor;
Color brightBackgroundColor = TerraTheme.brighten(backgroundColor);
Color darkBackgroundColor = TerraTheme.darken(backgroundColor);
if (orientation == Orientation.HORIZONTAL) {
- graphics.setPaint(new GradientPaint(0, 1, brightBackgroundColor,
- 0, height - 2, backgroundColor));
+ graphics.setPaint(new GradientPaint(0, 1, brightBackgroundColor, 0, height - 2,
+ backgroundColor));
} else {
- graphics.setPaint(new GradientPaint(1, 0, brightBackgroundColor,
- width - 2, 0, backgroundColor));
+ graphics.setPaint(new GradientPaint(1, 0, brightBackgroundColor, width - 2, 0,
+ backgroundColor));
}
graphics.fillRect(1, 1, width - 2, height - 2);
@@ -520,7 +511,7 @@ public class TerraScrollBarSkin extends
boolean consumed = super.mouseMove(component, x, y);
if (Mouse.getCapturer() == component) {
- ScrollBar scrollBar = (ScrollBar)TerraScrollBarSkin.this.getComponent();
+ ScrollBar scrollBar = (ScrollBar) TerraScrollBarSkin.this.getComponent();
Orientation orientation = scrollBar.getOrientation();
// Calculate the new scroll bar value
@@ -531,7 +522,7 @@ public class TerraScrollBarSkin extends
pixelValue = component.getY() - scrollUpButton.getHeight() + y - dragOffset;
}
- int realValue = (int)(pixelValue / getValueScale());
+ int realValue = (int) (pixelValue / getValueScale());
// Bound the value
int start = scrollBar.getStart();
@@ -551,7 +542,7 @@ public class TerraScrollBarSkin extends
boolean consumed = super.mouseDown(component, button, x, y);
if (button == Mouse.Button.LEFT) {
- ScrollBar scrollBar = (ScrollBar)TerraScrollBarSkin.this.getComponent();
+ ScrollBar scrollBar = (ScrollBar) TerraScrollBarSkin.this.getComponent();
Orientation orientation = scrollBar.getOrientation();
dragOffset = (orientation == Orientation.HORIZONTAL ? x : y);
@@ -566,8 +557,7 @@ public class TerraScrollBarSkin extends
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
- && Mouse.getCapturer() == component) {
+ if (button == Mouse.Button.LEFT && Mouse.getCapturer() == component) {
Mouse.release();
}
@@ -593,7 +583,7 @@ public class TerraScrollBarSkin extends
private Color scrollButtonHighlightedBackgroundColor;
public TerraScrollBarSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
minimumHandleLength = 31;
borderColor = theme.getColor(7);
scrollButtonImageColor = theme.getColor(1);
@@ -607,7 +597,7 @@ public class TerraScrollBarSkin extends
public void install(Component component) {
super.install(component);
- ScrollBar scrollBar = (ScrollBar)component;
+ ScrollBar scrollBar = (ScrollBar) component;
scrollBar.getScrollBarListeners().add(this);
scrollBar.getScrollBarValueListeners().add(this);
@@ -615,18 +605,18 @@ public class TerraScrollBarSkin extends
scrollBar.add(scrollDownButton);
scrollBar.add(handle);
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
Color backgroundColor = theme.getColor(9);
Color brightBackgroundColor = TerraTheme.brighten(backgroundColor);
GradientPaint backgroundPaint;
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- backgroundPaint = new GradientPaint(0, 1, backgroundColor,
- 0, DEFAULT_THICKNESS - 2, brightBackgroundColor);
+ backgroundPaint = new GradientPaint(0, 1, backgroundColor, 0, DEFAULT_THICKNESS - 2,
+ brightBackgroundColor);
} else {
- backgroundPaint = new GradientPaint(1, 0, backgroundColor,
- DEFAULT_THICKNESS - 2, 0, brightBackgroundColor);
+ backgroundPaint = new GradientPaint(1, 0, backgroundColor, DEFAULT_THICKNESS - 2, 0,
+ brightBackgroundColor);
}
setBackgroundPaint(backgroundPaint);
@@ -636,14 +626,14 @@ public class TerraScrollBarSkin extends
@Override
public int getPreferredWidth(int height) {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int preferredWidth = 0;
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- preferredWidth = DEFAULT_LENGTH;
+ preferredWidth = DEFAULT_LENGTH;
} else {
- preferredWidth = DEFAULT_THICKNESS;
+ preferredWidth = DEFAULT_THICKNESS;
}
return preferredWidth;
@@ -651,7 +641,7 @@ public class TerraScrollBarSkin extends
@Override
public int getPreferredHeight(int width) {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int preferredHeight = 0;
@@ -666,17 +656,17 @@ public class TerraScrollBarSkin extends
@Override
public Dimensions getPreferredSize() {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int preferredWidth = 0;
int preferredHeight = 0;
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- preferredWidth = DEFAULT_LENGTH;
- preferredHeight = DEFAULT_THICKNESS;
+ preferredWidth = DEFAULT_LENGTH;
+ preferredHeight = DEFAULT_THICKNESS;
} else {
- preferredWidth = DEFAULT_THICKNESS;
- preferredHeight = DEFAULT_LENGTH;
+ preferredWidth = DEFAULT_THICKNESS;
+ preferredHeight = DEFAULT_LENGTH;
}
return new Dimensions(preferredWidth, preferredHeight);
@@ -684,7 +674,7 @@ public class TerraScrollBarSkin extends
@Override
public void layout() {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int width = getWidth();
int height = getHeight();
@@ -696,7 +686,7 @@ public class TerraScrollBarSkin extends
int maxLegalRealValue = end - extent;
int numLegalRealValues = maxLegalRealValue - start + 1;
- float extentPercentage = (float)extent / (float)(end - start);
+ float extentPercentage = (float) extent / (float) (end - start);
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
scrollUpButton.setSize(scrollUpButton.getPreferredWidth(-1), height);
@@ -710,17 +700,16 @@ public class TerraScrollBarSkin extends
// room is left to represent the range of legal values. Note
// that the handle may overlap each scroll button by 1px so
// that its borders merge into the borders of the scroll buttons
- int availableWidth = width - scrollUpButton.getWidth() -
- scrollDownButton.getWidth() + 2;
+ int availableWidth = width - scrollUpButton.getWidth()
+ - scrollDownButton.getWidth() + 2;
int handleWidth = Math.max(minimumHandleLength,
Math.round(extentPercentage * availableWidth));
// Calculate the position of the handle by calculating the
// scale that maps logical value to pixel value
int numLegalPixelValues = availableWidth - handleWidth + 1;
- float valueScale = (float)numLegalPixelValues / (float)numLegalRealValues;
- int handleX = (int)((value - start) * valueScale) +
- scrollUpButton.getWidth() - 1;
+ float valueScale = (float) numLegalPixelValues / (float) numLegalRealValues;
+ int handleX = (int) ((value - start) * valueScale) + scrollUpButton.getWidth() - 1;
if (handleWidth > availableWidth) {
// If we can't fit the handle, we hide it
@@ -746,17 +735,16 @@ public class TerraScrollBarSkin extends
// room is left to represent the range of legal values. Note
// that the handle may overlap each scroll button by 1px so
// that its borders merge into the borders of the scroll buttons
- int availableHeight = height - scrollUpButton.getHeight() -
- scrollDownButton.getHeight() + 2;
+ int availableHeight = height - scrollUpButton.getHeight()
+ - scrollDownButton.getHeight() + 2;
int handleHeight = Math.max(minimumHandleLength,
Math.round(extentPercentage * availableHeight));
// Calculate the position of the handle by calculating the
// scale maps logical value to pixel value
int numLegalPixelValues = availableHeight - handleHeight + 1;
- float valueScale = (float)numLegalPixelValues / (float)numLegalRealValues;
- int handleY = (int)((value - start) * valueScale) +
- scrollUpButton.getHeight() - 1;
+ float valueScale = (float) numLegalPixelValues / (float) numLegalRealValues;
+ int handleY = (int) ((value - start) * valueScale) + scrollUpButton.getHeight() - 1;
if (handleHeight > availableHeight) {
// If we can't fit the handle, we hide it
@@ -777,7 +765,7 @@ public class TerraScrollBarSkin extends
public void paint(Graphics2D graphics) {
super.paint(graphics);
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int width = getWidth();
int height = getHeight();
@@ -789,23 +777,23 @@ public class TerraScrollBarSkin extends
int scrollUpButtonWidth = scrollUpButton.getWidth();
int scrollDownButtonWidth = scrollDownButton.getWidth();
- GraphicsUtilities.drawLine(graphics, scrollUpButtonWidth, 0,
- width - scrollDownButtonWidth - scrollUpButtonWidth, Orientation.HORIZONTAL);
- GraphicsUtilities.drawLine(graphics, scrollUpButtonWidth, height - 1,
- width - scrollDownButtonWidth - scrollUpButtonWidth, Orientation.HORIZONTAL);
+ GraphicsUtilities.drawLine(graphics, scrollUpButtonWidth, 0, width
+ - scrollDownButtonWidth - scrollUpButtonWidth, Orientation.HORIZONTAL);
+ GraphicsUtilities.drawLine(graphics, scrollUpButtonWidth, height - 1, width
+ - scrollDownButtonWidth - scrollUpButtonWidth, Orientation.HORIZONTAL);
} else {
int scrollUpButtonHeight = scrollUpButton.getHeight();
int scrollDownButtonHeight = scrollDownButton.getHeight();
- GraphicsUtilities.drawLine(graphics, 0, scrollUpButtonHeight,
- height - scrollDownButtonHeight - scrollUpButtonHeight, Orientation.VERTICAL);
- GraphicsUtilities.drawLine(graphics, width - 1, scrollUpButtonHeight,
- height - scrollDownButtonHeight - scrollUpButtonHeight, Orientation.VERTICAL);
+ GraphicsUtilities.drawLine(graphics, 0, scrollUpButtonHeight, height
+ - scrollDownButtonHeight - scrollUpButtonHeight, Orientation.VERTICAL);
+ GraphicsUtilities.drawLine(graphics, width - 1, scrollUpButtonHeight, height
+ - scrollDownButtonHeight - scrollUpButtonHeight, Orientation.VERTICAL);
}
}
public final void setBackgroundColor(int backgroundColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setBackgroundColor(theme.getColor(backgroundColor));
}
@@ -846,7 +834,7 @@ public class TerraScrollBarSkin extends
}
public final void setBorderColor(int borderColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setBorderColor(theme.getColor(borderColor));
}
@@ -872,7 +860,7 @@ public class TerraScrollBarSkin extends
}
public final void setScrollButtonImageColor(int scrollButtonImageColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setScrollButtonImageColor(theme.getColor(scrollButtonImageColor));
}
@@ -898,7 +886,7 @@ public class TerraScrollBarSkin extends
}
public final void setScrollButtonBackgroundColor(int scrollButtonBackgroundColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setScrollButtonBackgroundColor(theme.getColor(scrollButtonBackgroundColor));
}
@@ -915,7 +903,8 @@ public class TerraScrollBarSkin extends
repaintComponent();
}
- public final void setScrollButtonDisabledBackgroundColor(String scrollButtonDisabledBackgroundColor) {
+ public final void setScrollButtonDisabledBackgroundColor(
+ String scrollButtonDisabledBackgroundColor) {
if (scrollButtonDisabledBackgroundColor == null) {
throw new IllegalArgumentException("scrollButtonDisabledBackgroundColor is null");
}
@@ -924,7 +913,7 @@ public class TerraScrollBarSkin extends
}
public final void setScrollButtonDisabledBackgroundColor(int scrollButtonDisabledBackgroundColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setScrollButtonDisabledBackgroundColor(theme.getColor(scrollButtonDisabledBackgroundColor));
}
@@ -941,7 +930,8 @@ public class TerraScrollBarSkin extends
repaintComponent();
}
- public final void setScrollButtonPressedBackgroundColor(String scrollButtonPressedBackgroundColor) {
+ public final void setScrollButtonPressedBackgroundColor(
+ String scrollButtonPressedBackgroundColor) {
if (scrollButtonPressedBackgroundColor == null) {
throw new IllegalArgumentException("scrollButtonPressedBackgroundColor is null");
}
@@ -950,7 +940,7 @@ public class TerraScrollBarSkin extends
}
public final void setScrollButtonPressedBackgroundColor(int scrollButtonPressedBackgroundColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setScrollButtonPressedBackgroundColor(theme.getColor(scrollButtonPressedBackgroundColor));
}
@@ -958,7 +948,8 @@ public class TerraScrollBarSkin extends
return scrollButtonHighlightedBackgroundColor;
}
- public void setScrollButtonHighlightedBackgroundColor(Color scrollButtonHighlightedBackgroundColor) {
+ public void setScrollButtonHighlightedBackgroundColor(
+ Color scrollButtonHighlightedBackgroundColor) {
if (scrollButtonHighlightedBackgroundColor == null) {
throw new IllegalArgumentException("scrollButtonHighlightedBackgroundColor is null");
}
@@ -967,7 +958,8 @@ public class TerraScrollBarSkin extends
repaintComponent();
}
- public final void setScrollButtonHighlightedBackgroundColor(String scrollButtonHighlightedBackgroundColor) {
+ public final void setScrollButtonHighlightedBackgroundColor(
+ String scrollButtonHighlightedBackgroundColor) {
if (scrollButtonHighlightedBackgroundColor == null) {
throw new IllegalArgumentException("scrollButtonHighlightedBackgroundColor is null");
}
@@ -975,8 +967,9 @@ public class TerraScrollBarSkin extends
setScrollButtonHighlightedBackgroundColor(GraphicsUtilities.decodeColor(scrollButtonHighlightedBackgroundColor));
}
- public final void setScrollButtonHighlightedBackgroundColor(int scrollButtonHighlightedBackgroundColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ public final void setScrollButtonHighlightedBackgroundColor(
+ int scrollButtonHighlightedBackgroundColor) {
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setScrollButtonHighlightedBackgroundColor(theme.getColor(scrollButtonHighlightedBackgroundColor));
}
@@ -991,26 +984,20 @@ public class TerraScrollBarSkin extends
* Initiates automatic block scrolling. This only happens if the handle is
* visible since whether the user clicked before or after the handle
* determines the direction of the scrolling.
- *
- * @param component
- * The scroll bar.
- *
- * @param button
- * The button that was pressed.
- *
- * @param x
- * The x-coordinate of the event in the scroll bar's coordinate space.
- *
- * @param y
- * The y-coordinate of the event in the scroll bar's coordinate space.
+ *
+ * @param component The scroll bar.
+ * @param button The button that was pressed.
+ * @param x The x-coordinate of the event in the scroll bar's coordinate
+ * space.
+ * @param y The y-coordinate of the event in the scroll bar's coordinate
+ * space.
*/
@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
- && handle.isVisible()) {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ if (button == Mouse.Button.LEFT && handle.isVisible()) {
+ ScrollBar scrollBar = (ScrollBar) getComponent();
// Begin automatic block scrolling. Calculate the direction of
// the scroll by checking to see if the user pressed the mouse
@@ -1030,7 +1017,7 @@ public class TerraScrollBarSkin extends
pixelStopValue -= handle.getWidth();
}
- realStopValue = (int)(pixelStopValue / getValueScale());
+ realStopValue = (int) (pixelStopValue / getValueScale());
} else {
direction = y < handle.getY() ? -1 : 1;
@@ -1043,7 +1030,7 @@ public class TerraScrollBarSkin extends
pixelStopValue -= handle.getHeight();
}
- realStopValue = (int)(pixelStopValue / getValueScale());
+ realStopValue = (int) (pixelStopValue / getValueScale());
}
// Start the automatic scroller
@@ -1056,18 +1043,13 @@ public class TerraScrollBarSkin extends
/**
* Cancels automatic block scrolling.
- *
- * @param component
- * The scroll bar.
- *
- * @param button
- * The button that was released.
- *
- * @param x
- * The x-coordinate of the event in the scroll bar's coordinate space.
- *
- * @param y
- * The y-coordinate of the event in the scroll bar's coordinate space.
+ *
+ * @param component The scroll bar.
+ * @param button The button that was released.
+ * @param x The x-coordinate of the event in the scroll bar's coordinate
+ * space.
+ * @param y The y-coordinate of the event in the scroll bar's coordinate
+ * space.
*/
@Override
public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
@@ -1082,36 +1064,27 @@ public class TerraScrollBarSkin extends
/**
* Updates the scroll bar's value.
- *
- * @param component
- * The scroll bar.
- *
- * @param scrollType
- * Unit or block scrolling.
- *
- * @param scrollAmount
- * The amount of scrolling.
- *
- * @param wheelRotation
- * <tt>-1</tt> or <tt>1</tt> for backward or forward scrolling,
- * respectively.
- *
- * @param x
- * The x-coordinate of the event in the scroll bar's coordinate space.
- *
- * @param y
- * The y-coordinate of the event in the scroll bar's coordinate space.
+ *
+ * @param component The scroll bar.
+ * @param scrollType Unit or block scrolling.
+ * @param scrollAmount The amount of scrolling.
+ * @param wheelRotation <tt>-1</tt> or <tt>1</tt> for backward or forward
+ * scrolling, respectively.
+ * @param x The x-coordinate of the event in the scroll bar's coordinate
+ * space.
+ * @param y The y-coordinate of the event in the scroll bar's coordinate
+ * space.
*/
@Override
public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount,
int wheelRotation, int x, int y) {
boolean consumed = false;
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
int previousValue = scrollBar.getValue();
- int newValue = previousValue + (scrollAmount * wheelRotation *
- scrollBar.getUnitIncrement());
+ int newValue = previousValue
+ + (scrollAmount * wheelRotation * scrollBar.getUnitIncrement());
if (wheelRotation > 0) {
int maxValue = scrollBar.getEnd() - scrollBar.getExtent();
@@ -1138,17 +1111,15 @@ public class TerraScrollBarSkin extends
* bar values and vice versa. This assumes that the range of pixels spans
* from the last pixel of <tt>scrollUpButton</tt> to the first pixel of
* <tt>scrollDownButton</tt> and excludes the pixels taken up by
- * <tt>handle</tt>.
- * <p>
- * To map from scroll bar values (<i>real values</i>) to pixel values, you
- * multiply by the value scale. To map from pixel values back to real
- * values, you divide by the value scale.
- *
- * @return
- * <tt><number of legal pixel values> / <number of legal real values></tt>
+ * <tt>handle</tt>. <p> To map from scroll bar values (<i>real values</i>)
+ * to pixel values, you multiply by the value scale. To map from pixel
+ * values back to real values, you divide by the value scale.
+ *
+ * @return <tt><number of legal pixel values> / <number of legal
+ * real values></tt>
*/
private float getValueScale() {
- ScrollBar scrollBar = (ScrollBar)getComponent();
+ ScrollBar scrollBar = (ScrollBar) getComponent();
float valueScale;
@@ -1161,26 +1132,25 @@ public class TerraScrollBarSkin extends
int numLegalPixelValues;
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- int availableWidth = getWidth() - scrollUpButton.getWidth() -
- scrollDownButton.getWidth() + 2;
+ int availableWidth = getWidth() - scrollUpButton.getWidth()
+ - scrollDownButton.getWidth() + 2;
numLegalPixelValues = availableWidth - handle.getWidth() + 1;
} else {
- int availableHeight = getHeight() - scrollUpButton.getHeight() -
- scrollDownButton.getHeight() + 2;
+ int availableHeight = getHeight() - scrollUpButton.getHeight()
+ - scrollDownButton.getHeight() + 2;
numLegalPixelValues = availableHeight - handle.getHeight() + 1;
}
// the number of segments is one less than the number of values
- valueScale = numLegalPixelValues / ((float)numLegalRealValues - 1);
+ valueScale = numLegalPixelValues / ((float) numLegalRealValues - 1);
return valueScale;
}
/**
* Propagates the scroll bar's enabled state to the scroll buttons.
- *
- * @param component
- * The scroll bar.
+ *
+ * @param component The scroll bar.
*/
@Override
public void enabledChanged(Component component) {
@@ -1223,20 +1193,20 @@ public class TerraScrollBarSkin extends
// would be overkill. If all that has changed is the value, we can just
// update the handle's location and save the work of full invalidation.
if (handle.isVisible()) {
- int start = scrollBar.getStart();
- int value = scrollBar.getValue();
+ int start = scrollBar.getStart();
+ int value = scrollBar.getValue();
- if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- int handleX = (int)((value - start) * getValueScale()) +
- scrollUpButton.getWidth() - 1;
-
- handle.setLocation(handleX, 0);
- } else {
- int handleY = (int)((value - start) * getValueScale()) +
- scrollUpButton.getHeight() - 1;
+ if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
+ int handleX = (int) ((value - start) * getValueScale()) + scrollUpButton.getWidth()
+ - 1;
+
+ handle.setLocation(handleX, 0);
+ } else {
+ int handleY = (int) ((value - start) * getValueScale())
+ + scrollUpButton.getHeight() - 1;
- handle.setLocation(0, handleY);
- }
+ handle.setLocation(0, handleY);
+ }
}
}
}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneCornerSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneCornerSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneCornerSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneCornerSkin.java Fri Oct 4 23:45:40 2013
@@ -32,7 +32,7 @@ public class TerraScrollPaneCornerSkin e
private Color backgroundColor;
public TerraScrollPaneCornerSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
backgroundColor = theme.getColor(11);
}
@@ -88,7 +88,7 @@ public class TerraScrollPaneCornerSkin e
}
public final void setBackgroundColor(int backgroundColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setBackgroundColor(theme.getColor(backgroundColor));
}
}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java Fri Oct 4 23:45:40 2013
@@ -24,7 +24,7 @@ import org.apache.pivot.wtk.skin.ScrollP
*/
public class TerraScrollPaneSkin extends ScrollPaneSkin {
public final void setBackgroundColor(int backgroundColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setBackgroundColor(theme.getColor(backgroundColor));
}
}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSeparatorSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSeparatorSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSeparatorSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSeparatorSkin.java Fri Oct 4 23:45:40 2013
@@ -24,18 +24,18 @@ import org.apache.pivot.wtk.skin.Separat
*/
public class TerraSeparatorSkin extends SeparatorSkin {
public TerraSeparatorSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setColor(theme.getColor(7));
setHeadingColor(theme.getColor(12));
}
public void setColor(int color) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setColor(theme.getColor(color));
}
public void setHeadingColor(int headingColor) {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
setHeadingColor(theme.getColor(headingColor));
}
}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java Fri Oct 4 23:45:40 2013
@@ -34,15 +34,15 @@ import org.apache.pivot.wtk.GraphicsUtil
import org.apache.pivot.wtk.ImageView;
import org.apache.pivot.wtk.Insets;
import org.apache.pivot.wtk.Keyboard;
+import org.apache.pivot.wtk.Keyboard.KeyCode;
import org.apache.pivot.wtk.Mouse;
+import org.apache.pivot.wtk.Mouse.Button;
import org.apache.pivot.wtk.Orientation;
import org.apache.pivot.wtk.Point;
import org.apache.pivot.wtk.Sheet;
import org.apache.pivot.wtk.SheetStateListener;
import org.apache.pivot.wtk.Theme;
import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtk.Keyboard.KeyCode;
-import org.apache.pivot.wtk.Mouse.Button;
import org.apache.pivot.wtk.effects.DropShadowDecorator;
import org.apache.pivot.wtk.effects.Transition;
import org.apache.pivot.wtk.effects.TransitionListener;
@@ -70,7 +70,7 @@ public class TerraSheetSkin extends Wind
@Override
public void start(TransitionListener transitionListener) {
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
sheet.getDecorators().add(translationDecorator);
dx = 0;
@@ -81,7 +81,7 @@ public class TerraSheetSkin extends Wind
@Override
public void stop() {
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
sheet.getDecorators().remove(translationDecorator);
super.stop();
@@ -89,7 +89,7 @@ public class TerraSheetSkin extends Wind
@Override
public void update() {
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
float scale;
if (isReversed()) {
@@ -101,22 +101,22 @@ public class TerraSheetSkin extends Wind
Display display = sheet.getDisplay();
if (display != null) {
Bounds decoratedBounds = sheet.getDecoratedBounds();
- display.repaint(decoratedBounds.x, decoratedBounds.y,
- decoratedBounds.width + dx, decoratedBounds.height + dy);
+ display.repaint(decoratedBounds.x, decoratedBounds.y, decoratedBounds.width + dx,
+ decoratedBounds.height + dy);
Dimensions size = sheet.getPreferredSize();
switch (slideSource) {
case NORTH:
- dy = -(int)(size.height * scale);
+ dy = -(int) (size.height * scale);
break;
case EAST:
- dx = (int)(size.width * scale);
+ dx = (int) (size.width * scale);
break;
case SOUTH:
- dy = (int)(size.height * scale);
+ dy = (int) (size.height * scale);
break;
case WEST:
- dx = -(int)(size.width * scale);
+ dx = -(int) (size.width * scale);
break;
default:
throw new IllegalStateException(
@@ -126,8 +126,8 @@ public class TerraSheetSkin extends Wind
translationDecorator.setX(dx);
translationDecorator.setY(dy);
- display.repaint(decoratedBounds.x, decoratedBounds.y,
- decoratedBounds.width + dx, decoratedBounds.height + dy);
+ display.repaint(decoratedBounds.x, decoratedBounds.y, decoratedBounds.width + dx,
+ decoratedBounds.height + dy);
}
}
}
@@ -155,9 +155,8 @@ public class TerraSheetSkin extends Wind
graphics.fillRect(0, 3, 2, 1);
graphics.fillRect(3, 3, 2, 1);
- graphics.setPaint(new Color(borderColor.getRed(),
- borderColor.getGreen(), borderColor.getBlue(),
- ALPHA));
+ graphics.setPaint(new Color(borderColor.getRed(), borderColor.getGreen(),
+ borderColor.getBlue(), ALPHA));
graphics.fillRect(3, 1, 2, 1);
graphics.fillRect(0, 4, 2, 1);
graphics.fillRect(3, 4, 2, 1);
@@ -206,7 +205,7 @@ public class TerraSheetSkin extends Wind
public boolean mouseDown(Container display, Mouse.Button button, int x, int y) {
boolean consumed = false;
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
if (isMouseOverOwnerClientArea(display, x, y)) {
Window rootOwner = sheet.getRootOwner();
rootOwner.moveToFront();
@@ -224,15 +223,15 @@ public class TerraSheetSkin extends Wind
}
@Override
- public boolean mouseWheel(Container display, Mouse.ScrollType scrollType,
- int scrollAmount, int wheelRotation, int x, int y) {
+ public boolean mouseWheel(Container display, Mouse.ScrollType scrollType, int scrollAmount,
+ int wheelRotation, int x, int y) {
return isMouseOverOwnerClientArea(display, x, y);
}
private boolean isMouseOverOwnerClientArea(Container display, int x, int y) {
boolean mouseOverOwnerClientArea = false;
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
Component descendant = display.getDescendantAt(x, y);
if (descendant != display) {
@@ -256,7 +255,7 @@ public class TerraSheetSkin extends Wind
private static final int DEFAULT_STATE_TRANSITION_RATE = 30;
public TerraSheetSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
Color backgroundColor = theme.getColor(11);
backgroundColor = new Color(backgroundColor.getRed(), backgroundColor.getGreen(),
@@ -275,7 +274,7 @@ public class TerraSheetSkin extends Wind
public void install(Component component) {
super.install(component);
- Sheet sheet = (Sheet)component;
+ Sheet sheet = (Sheet) component;
sheet.getSheetStateListeners().add(this);
// Attach the drop-shadow decorator
@@ -289,7 +288,7 @@ public class TerraSheetSkin extends Wind
public int getPreferredWidth(int height) {
int preferredWidth = 0;
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
Component content = sheet.getContent();
if (content != null) {
@@ -309,7 +308,7 @@ public class TerraSheetSkin extends Wind
public int getPreferredHeight(int width) {
int preferredHeight = 0;
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
Component content = sheet.getContent();
if (content != null) {
@@ -330,7 +329,7 @@ public class TerraSheetSkin extends Wind
int preferredWidth = 0;
int preferredHeight = 0;
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
Component content = sheet.getContent();
if (content != null) {
@@ -352,16 +351,14 @@ public class TerraSheetSkin extends Wind
int width = getWidth();
int height = getHeight();
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
// Size/position resize handle
resizeHandle.setSize(resizeHandle.getPreferredSize());
resizeHandle.setLocation(width - resizeHandle.getWidth() - 2,
height - resizeHandle.getHeight() - 2);
- resizeHandle.setVisible(resizable
- && !sheet.isMaximized()
- && (sheet.isPreferredWidthSet()
- || sheet.isPreferredHeightSet()));
+ resizeHandle.setVisible(resizable && !sheet.isMaximized()
+ && (sheet.isPreferredWidthSet() || sheet.isPreferredHeightSet()));
Component content = sheet.getContent();
if (content != null) {
@@ -399,7 +396,7 @@ public class TerraSheetSkin extends Wind
boolean consumed = super.mouseMove(component, x, y);
if (Mouse.getCapturer() == component) {
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
Display display = sheet.getDisplay();
Point location = sheet.mapPointToAncestor(display, x, y);
@@ -439,8 +436,7 @@ public class TerraSheetSkin extends Wind
boolean preferredWidthSet = component.isPreferredWidthSet();
boolean preferredHeightSet = component.isPreferredHeightSet();
- if (preferredWidthSet
- && preferredHeightSet) {
+ if (preferredWidthSet && preferredHeightSet) {
cursor = Cursor.RESIZE_SOUTH_EAST;
} else if (preferredWidthSet) {
cursor = Cursor.RESIZE_EAST;
@@ -459,7 +455,7 @@ public class TerraSheetSkin extends Wind
@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
- Sheet sheet = (Sheet)container;
+ Sheet sheet = (Sheet) container;
if (!sheet.isTopMost()) {
Window owner = sheet.getOwner();
owner.moveToFront();
@@ -499,7 +495,7 @@ public class TerraSheetSkin extends Wind
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = false;
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
if (keyCode == Keyboard.KeyCode.ENTER) {
sheet.close(true);
@@ -662,9 +658,7 @@ public class TerraSheetSkin extends Wind
// Don't start the transition if the sheet is being closed as a result
// of the owner closing
Window owner = sheet.getOwner();
- if (!(owner.isClosing()
- || owner.isClosed()
- || doingFinalClose)) {
+ if (!(owner.isClosing() || owner.isClosed() || doingFinalClose)) {
if (openTransition == null) {
// Setup for the close transition
// Don't start it until we know that everyone
@@ -686,14 +680,10 @@ public class TerraSheetSkin extends Wind
@Override
public void sheetCloseVetoed(final Sheet sheet, Vote reason) {
- if (reason == Vote.DENY
- && openTransition != null) {
+ if (reason == Vote.DENY && openTransition != null) {
openTransition.stop();
openTransition = null;
- } else
- if (reason == Vote.DEFER
- && openTransition != null
- && !openTransition.isRunning()) {
+ } else if (reason == Vote.DEFER && openTransition != null && !openTransition.isRunning()) {
openTransition.start(new TransitionListener() {
@Override
public void transitionCompleted(Transition transition) {
@@ -712,7 +702,7 @@ public class TerraSheetSkin extends Wind
}
public void alignToOwner() {
- Sheet sheet = (Sheet)getComponent();
+ Sheet sheet = (Sheet) getComponent();
Window owner = sheet.getOwner();
if (owner != null) {
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java Fri Oct 4 23:45:40 2013
@@ -26,12 +26,12 @@ import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.Dimensions;
import org.apache.pivot.wtk.GraphicsUtilities;
import org.apache.pivot.wtk.Keyboard;
+import org.apache.pivot.wtk.Keyboard.KeyCode;
import org.apache.pivot.wtk.Mouse;
import org.apache.pivot.wtk.Orientation;
import org.apache.pivot.wtk.Point;
import org.apache.pivot.wtk.Slider;
import org.apache.pivot.wtk.Theme;
-import org.apache.pivot.wtk.Keyboard.KeyCode;
import org.apache.pivot.wtk.skin.ComponentSkin;
import org.apache.pivot.wtk.skin.SliderSkin;
@@ -79,8 +79,8 @@ public class TerraSliderSkin extends Sli
int width = getWidth();
int height = getHeight();
- graphics.setPaint(new GradientPaint(width / 2f, 0, buttonBevelColor,
- width / 2f, height, buttonBackgroundColor));
+ graphics.setPaint(new GradientPaint(width / 2f, 0, buttonBevelColor, width / 2f,
+ height, buttonBackgroundColor));
graphics.fillRect(0, 0, width, height);
float alpha = (highlighted || dragOffset != null) ? 0.25f : 0.0f;
@@ -111,7 +111,7 @@ public class TerraSliderSkin extends Sli
boolean consumed = super.mouseMove(component, x, y);
if (Mouse.getCapturer() == component) {
- Slider slider = (Slider)TerraSliderSkin.this.getComponent();
+ Slider slider = (Slider) TerraSliderSkin.this.getComponent();
if (slider.getOrientation() == Orientation.HORIZONTAL) {
int sliderWidth = slider.getWidth();
int thumbWidthLocal = thumb.getWidth();
@@ -129,12 +129,13 @@ public class TerraSliderSkin extends Sli
sliderX = maxX;
}
- float ratio = (float)(sliderX - dragOffset.x) / (sliderWidth - thumbWidthLocal);
+ float ratio = (float) (sliderX - dragOffset.x)
+ / (sliderWidth - thumbWidthLocal);
int start = slider.getStart();
int end = slider.getEnd();
- int value = (int)(start + (end - start) * ratio);
+ int value = (int) (start + (end - start) * ratio);
slider.setValue(value);
} else {
int sliderHeight = slider.getHeight();
@@ -153,12 +154,13 @@ public class TerraSliderSkin extends Sli
sliderY = maxY;
}
- float ratio = (float)(sliderY - dragOffset.y) / (sliderHeight - thumbHeightLocal);
+ float ratio = (float) (sliderY - dragOffset.y)
+ / (sliderHeight - thumbHeightLocal);
int start = slider.getStart();
int end = slider.getEnd();
- int value = (int)(start + (end - start) * ratio);
+ int value = (int) (start + (end - start) * ratio);
slider.setValue(value);
}
}
@@ -213,16 +215,15 @@ public class TerraSliderSkin extends Sli
}
/**
- * {@link KeyCode#LEFT LEFT} or {@link KeyCode#DOWN DOWN} Decrement
- * the slider's value.<br>
- * {@link KeyCode#RIGHT RIGHT} or {@link KeyCode#UP UP} Increment
- * the slider's value.
+ * {@link KeyCode#LEFT LEFT} or {@link KeyCode#DOWN DOWN} Decrement the
+ * slider's value.<br> {@link KeyCode#RIGHT RIGHT} or {@link KeyCode#UP
+ * UP} Increment the slider's value.
*/
@Override
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = super.keyPressed(component, keyCode, keyLocation);
- Slider slider = (Slider)TerraSliderSkin.this.getComponent();
+ Slider slider = (Slider) TerraSliderSkin.this.getComponent();
int start = slider.getStart();
int end = slider.getEnd();
@@ -231,12 +232,10 @@ public class TerraSliderSkin extends Sli
int value = slider.getValue();
int increment = length / 10;
- if (keyCode == Keyboard.KeyCode.LEFT
- || keyCode == Keyboard.KeyCode.DOWN) {
+ if (keyCode == Keyboard.KeyCode.LEFT || keyCode == Keyboard.KeyCode.DOWN) {
slider.setValue(Math.max(start, value - increment));
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.RIGHT
- || keyCode == Keyboard.KeyCode.UP) {
+ } else if (keyCode == Keyboard.KeyCode.RIGHT || keyCode == Keyboard.KeyCode.UP) {
slider.setValue(Math.min(end, value + increment));
consumed = true;
}
@@ -264,7 +263,7 @@ public class TerraSliderSkin extends Sli
public static final int MINIMUM_THUMB_HEIGHT = 4;
public TerraSliderSkin() {
- TerraTheme theme = (TerraTheme)Theme.getTheme();
+ TerraTheme theme = (TerraTheme) Theme.getTheme();
trackColor = theme.getColor(6);
trackWidth = 2;
@@ -283,13 +282,13 @@ public class TerraSliderSkin extends Sli
public void install(Component component) {
super.install(component);
- Slider slider = (Slider)component;
+ Slider slider = (Slider) component;
slider.add(thumb);
}
@Override
public int getPreferredWidth(int height) {
- Slider slider = (Slider)getComponent();
+ Slider slider = (Slider) getComponent();
int preferredWidth;
if (slider.getOrientation() == Orientation.HORIZONTAL) {
@@ -303,7 +302,7 @@ public class TerraSliderSkin extends Sli
@Override
public int getPreferredHeight(int width) {
- Slider slider = (Slider)getComponent();
+ Slider slider = (Slider) getComponent();
int preferredHeight;
if (slider.getOrientation() == Orientation.HORIZONTAL) {
@@ -322,7 +321,7 @@ public class TerraSliderSkin extends Sli
@Override
public void layout() {
- Slider slider = (Slider)getComponent();
+ Slider slider = (Slider) getComponent();
int width = getWidth();
int height = getHeight();
@@ -331,15 +330,15 @@ public class TerraSliderSkin extends Sli
int end = slider.getEnd();
int value = slider.getValue();
- float ratio = (float)(value - start) / (end - start);
+ float ratio = (float) (value - start) / (end - start);
if (slider.getOrientation() == Orientation.HORIZONTAL) {
thumb.setSize(thumbWidth, thumbHeight);
- thumb.setLocation((int)((width - thumbWidth) * ratio), (height - thumbHeight) / 2);
+ thumb.setLocation((int) ((width - thumbWidth) * ratio), (height - thumbHeight) / 2);
} else {
thumb.setSize(thumbHeight, thumbWidth);
- thumb.setLocation((width - thumbHeight) / 2, (int)((height - thumbWidth) * ratio));
+ thumb.setLocation((width - thumbHeight) / 2, (int) ((height - thumbWidth) * ratio));
}
}
@@ -350,7 +349,7 @@ public class TerraSliderSkin extends Sli
public void paint(Graphics2D graphics) {
super.paint(graphics);
- Slider slider = (Slider)getComponent();
+ Slider slider = (Slider) getComponent();
int width = getWidth();
int height = getHeight();
@@ -365,7 +364,7 @@ public class TerraSliderSkin extends Sli
int end = slider.getEnd();
int value = start;
while (value <= end) {
- float ratio = (float)(value - start) / (end - start);
+ float ratio = (float) (value - start) / (end - start);
int x = (int) (width * ratio);
graphics.drawLine(x, height / 3, x, height * 2 / 3);
value += tickSpacing;
@@ -378,7 +377,7 @@ public class TerraSliderSkin extends Sli
int end = slider.getEnd();
int value = start;
while (value <= end) {
- float ratio = (float)(value - start) / (end - start);
+ float ratio = (float) (value - start) / (end - start);
int y = (int) (height * ratio);
graphics.drawLine(width / 3, y, width * 2 / 3, y);
value += tickSpacing;