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 [40/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/src/org/apache/pivot/wtk/skin/FillPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java Fri Oct 4 23:45:40 2013
@@ -27,8 +27,7 @@ import org.apache.pivot.wtk.Orientation;
/**
* Fill pane skin.
*/
-public class FillPaneSkin extends ContainerSkin
- implements FillPaneListener {
+public class FillPaneSkin extends ContainerSkin implements FillPaneListener {
private Insets padding = Insets.NONE;
private int spacing = 4;
@@ -36,13 +35,13 @@ public class FillPaneSkin extends Contai
public void install(Component component) {
super.install(component);
- FillPane fillPane = (FillPane)component;
+ FillPane fillPane = (FillPane) component;
fillPane.getFillPaneListeners().add(this);
}
@Override
public int getPreferredWidth(int height) {
- FillPane fillPane = (FillPane)getComponent();
+ FillPane fillPane = (FillPane) getComponent();
int preferredWidth = 0;
@@ -54,7 +53,8 @@ public class FillPaneSkin extends Contai
heightUpdated = Math.max(heightUpdated - (padding.top + padding.bottom), 0);
}
- // Preferred width is the sum of the preferred widths of all components
+ // Preferred width is the sum of the preferred widths of all
+ // components
int j = 0;
for (int i = 0, n = fillPane.getLength(); i < n; i++) {
Component component = fillPane.get(i);
@@ -75,8 +75,7 @@ public class FillPaneSkin extends Contai
Component component = fillPane.get(i);
if (component.isVisible()) {
- preferredWidth = Math.max(preferredWidth,
- component.getPreferredWidth());
+ preferredWidth = Math.max(preferredWidth, component.getPreferredWidth());
}
}
}
@@ -89,19 +88,19 @@ public class FillPaneSkin extends Contai
@Override
public int getPreferredHeight(int width) {
- FillPane fillPane = (FillPane)getComponent();
+ FillPane fillPane = (FillPane) getComponent();
int preferredHeight = 0;
Orientation orientation = fillPane.getOrientation();
if (orientation == Orientation.HORIZONTAL) {
- // Preferred height is the maximum preferred height of all components
+ // Preferred height is the maximum preferred height of all
+ // components
for (int i = 0, n = fillPane.getLength(); i < n; i++) {
Component component = fillPane.get(i);
if (component.isVisible()) {
- preferredHeight = Math.max(preferredHeight,
- component.getPreferredHeight());
+ preferredHeight = Math.max(preferredHeight, component.getPreferredHeight());
}
}
} else {
@@ -111,7 +110,8 @@ public class FillPaneSkin extends Contai
widthUpdated = Math.max(widthUpdated - (padding.left + padding.right), 0);
}
- // Preferred height is the sum of the preferred heights of all components
+ // Preferred height is the sum of the preferred heights of all
+ // components
int j = 0;
for (int i = 0, n = fillPane.getLength(); i < n; i++) {
Component component = fillPane.get(i);
@@ -136,14 +136,15 @@ public class FillPaneSkin extends Contai
@Override
public Dimensions getPreferredSize() {
- FillPane fillPane = (FillPane)getComponent();
+ FillPane fillPane = (FillPane) getComponent();
int preferredWidth = 0;
int preferredHeight = 0;
switch (fillPane.getOrientation()) {
case HORIZONTAL: {
- // Preferred width is the sum of the preferred widths of all components
+ // Preferred width is the sum of the preferred widths of all
+ // components
int j = 0;
for (int i = 0, n = fillPane.getLength(); i < n; i++) {
Component component = fillPane.get(i);
@@ -165,7 +166,8 @@ public class FillPaneSkin extends Contai
}
case VERTICAL: {
- // Preferred height is the sum of the preferred heights of all components
+ // Preferred height is the sum of the preferred heights of all
+ // components
int j = 0;
for (int i = 0, n = fillPane.getLength(); i < n; i++) {
Component component = fillPane.get(i);
@@ -200,7 +202,7 @@ public class FillPaneSkin extends Contai
@Override
public int getBaseline(int width, int height) {
- FillPane fillPane = (FillPane)getComponent();
+ FillPane fillPane = (FillPane) getComponent();
int baseline = -1;
int contentHeight = 0;
@@ -212,7 +214,8 @@ public class FillPaneSkin extends Contai
for (Component component : fillPane) {
if (component.isVisible()) {
int componentWidth = component.getPreferredWidth(clientHeight);
- baseline = Math.max(baseline, component.getBaseline(componentWidth, clientHeight));
+ baseline = Math.max(baseline,
+ component.getBaseline(componentWidth, clientHeight));
}
}
@@ -256,7 +259,7 @@ public class FillPaneSkin extends Contai
@Override
public void layout() {
- FillPane fillPane = (FillPane)getComponent();
+ FillPane fillPane = (FillPane) getComponent();
// n is the number of 'visible' components
// len is the total number of components
int n = 0;
@@ -293,8 +296,7 @@ public class FillPaneSkin extends Contai
if (j == n - 1)
componentWidth += leftoverWidth;
- int componentHeight = Math.max(height - (padding.top
- + padding.bottom), 0);
+ int componentHeight = Math.max(height - (padding.top + padding.bottom), 0);
int y = padding.top;
@@ -325,8 +327,7 @@ public class FillPaneSkin extends Contai
if (j == n - 1)
componentHeight += leftoverHeight;
- int componentWidth = Math.max(width - (padding.left
- + padding.right), 0);
+ int componentWidth = Math.max(width - (padding.left + padding.right), 0);
int x = padding.left;
@@ -343,14 +344,16 @@ public class FillPaneSkin extends Contai
}
/**
- * Returns the amount of space between the edge of the FillPane and its components.
+ * Returns the amount of space between the edge of the FillPane and its
+ * components.
*/
public Insets getPadding() {
return padding;
}
/**
- * Sets the amount of space to leave between the edge of the FillPane and its components.
+ * Sets the amount of space to leave between the edge of the FillPane and
+ * its components.
*/
public void setPadding(Insets padding) {
if (padding == null) {
@@ -362,9 +365,11 @@ public class FillPaneSkin extends Contai
}
/**
- * Sets the amount of space to leave between the edge of the FillPane and its components.
- *
- * @param padding A dictionary with keys in the set {left, top, bottom, right}.
+ * Sets the amount of space to leave between the edge of the FillPane and
+ * its components.
+ *
+ * @param padding A dictionary with keys in the set {left, top, bottom,
+ * right}.
*/
public final void setPadding(Dictionary<String, ?> padding) {
if (padding == null) {
@@ -375,16 +380,16 @@ public class FillPaneSkin extends Contai
}
/**
- * Sets the amount of space to leave between the edge of the FillPane and its components,
- * uniformly on all four edges.
+ * Sets the amount of space to leave between the edge of the FillPane and
+ * its components, uniformly on all four edges.
*/
public final void setPadding(int padding) {
setPadding(new Insets(padding));
}
/**
- * Sets the amount of space to leave between the edge of the FillPane and its components,
- * uniformly on all four edges.
+ * Sets the amount of space to leave between the edge of the FillPane and
+ * its components, uniformly on all four edges.
*/
public final void setPadding(Number padding) {
if (padding == null) {
@@ -395,10 +400,11 @@ public class FillPaneSkin extends Contai
}
/**
- * Sets the amount of space to leave between the edge of the FillPane and its components.
- *
- * @param padding A string containing an integer or a JSON dictionary with keys
- * left, top, bottom, and/or right.
+ * Sets the amount of space to leave between the edge of the FillPane and
+ * its components.
+ *
+ * @param padding A string containing an integer or a JSON dictionary with
+ * keys left, top, bottom, and/or right.
*/
public final void setPadding(String padding) {
if (padding == null) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java Fri Oct 4 23:45:40 2013
@@ -44,7 +44,7 @@ public class FlowPaneSkin extends Contai
@Override
public int getPreferredWidth(int height) {
- FlowPane flowPane = (FlowPane)getComponent();
+ FlowPane flowPane = (FlowPane) getComponent();
int preferredWidth = 0;
@@ -73,7 +73,7 @@ public class FlowPaneSkin extends Contai
@Override
public int getPreferredHeight(int width) {
- FlowPane flowPane = (FlowPane)getComponent();
+ FlowPane flowPane = (FlowPane) getComponent();
int preferredHeight;
@@ -83,7 +83,8 @@ public class FlowPaneSkin extends Contai
Dimensions preferredSize = getPreferredSize();
preferredHeight = preferredSize.height;
} else {
- // Preferred height is the maximum preferred height of all components
+ // Preferred height is the maximum preferred height of all
+ // components
preferredHeight = 0;
for (int i = 0, n = flowPane.getLength(); i < n; i++) {
@@ -112,9 +113,9 @@ public class FlowPaneSkin extends Contai
if (component.isVisible()) {
Dimensions size = component.getPreferredSize();
- if (rowWidth + size.width > contentWidth
- && rowWidth > 0) {
- // The component is too big to fit in the remaining space,
+ if (rowWidth + size.width > contentWidth && rowWidth > 0) {
+ // The component is too big to fit in the remaining
+ // space,
// and it is not the only component in this row; wrap
preferredHeight += rowAscent + rowDescent;
@@ -157,7 +158,7 @@ public class FlowPaneSkin extends Contai
@Override
public Dimensions getPreferredSize() {
- FlowPane flowPane = (FlowPane)getComponent();
+ FlowPane flowPane = (FlowPane) getComponent();
int preferredWidth = 0;
@@ -192,20 +193,20 @@ public class FlowPaneSkin extends Contai
// Include padding
preferredWidth += padding.left + padding.right;
- return new Dimensions(preferredWidth, ascent + descent
- + padding.top + padding.bottom);
+ return new Dimensions(preferredWidth, ascent + descent + padding.top + padding.bottom);
}
@Override
public int getBaseline(int width, int height) {
- FlowPane flowPane = (FlowPane)getComponent();
+ FlowPane flowPane = (FlowPane) getComponent();
int baseline = -1;
if (alignToBaseline) {
int contentWidth = Math.max(width - (padding.left + padding.right), 0);
- // Break the components into multiple rows, and calculate the baseline of the
+ // Break the components into multiple rows, and calculate the
+ // baseline of the
// first row
int rowWidth = 0;
for (int i = 0, n = flowPane.getLength(); i < n; i++) {
@@ -214,9 +215,9 @@ public class FlowPaneSkin extends Contai
if (component.isVisible()) {
Dimensions size = component.getPreferredSize();
- if (rowWidth + size.width > contentWidth
- && rowWidth > 0) {
- // The component is too big to fit in the remaining space,
+ if (rowWidth + size.width > contentWidth && rowWidth > 0) {
+ // The component is too big to fit in the remaining
+ // space,
// and it is not the only component in this row; wrap
break;
}
@@ -235,7 +236,7 @@ public class FlowPaneSkin extends Contai
@Override
public void layout() {
- FlowPane flowPane = (FlowPane)getComponent();
+ FlowPane flowPane = (FlowPane) getComponent();
int width = getWidth();
int contentWidth = Math.max(width - (padding.left + padding.right), 0);
@@ -252,8 +253,7 @@ public class FlowPaneSkin extends Contai
Dimensions componentSize = component.getPreferredSize();
component.setSize(componentSize);
- if (rowWidth + componentSize.width > contentWidth
- && rowWidth > 0) {
+ if (rowWidth + componentSize.width > contentWidth && rowWidth > 0) {
// The component is too big to fit in the remaining space,
// and it is not the only component in this row
rows.add(row);
@@ -285,8 +285,8 @@ public class FlowPaneSkin extends Contai
for (Component component : row) {
rowWidth += component.getWidth();
rowHeight = Math.max(rowHeight, component.getHeight());
- baseline = Math.max(baseline, component.getBaseline(component.getWidth(),
- component.getHeight()));
+ baseline = Math.max(baseline,
+ component.getBaseline(component.getWidth(), component.getHeight()));
}
rowWidth += horizontalSpacing * (row.getLength() - 1);
@@ -314,9 +314,7 @@ public class FlowPaneSkin extends Contai
int y;
int componentBaseline = component.getBaseline(component.getWidth(),
component.getHeight());
- if (alignToBaseline
- && baseline != -1
- && componentBaseline != -1) {
+ if (alignToBaseline && baseline != -1 && componentBaseline != -1) {
// Align to baseline
y = baseline - componentBaseline;
} else {
@@ -346,14 +344,16 @@ public class FlowPaneSkin extends Contai
}
/**
- * Returns the amount of space between the edge of the FlowPane and its components.
+ * Returns the amount of space between the edge of the FlowPane and its
+ * components.
*/
public Insets getPadding() {
return padding;
}
/**
- * Sets the amount of space to leave between the edge of the FlowPane and its components.
+ * Sets the amount of space to leave between the edge of the FlowPane and
+ * its components.
*/
public void setPadding(Insets padding) {
if (padding == null) {
@@ -365,9 +365,11 @@ public class FlowPaneSkin extends Contai
}
/**
- * Sets the amount of space to leave between the edge of the FlowPane and its components.
- *
- * @param padding A dictionary with keys in the set {left, top, bottom, right}.
+ * Sets the amount of space to leave between the edge of the FlowPane and
+ * its components.
+ *
+ * @param padding A dictionary with keys in the set {left, top, bottom,
+ * right}.
*/
public final void setPadding(Dictionary<String, ?> padding) {
if (padding == null) {
@@ -378,16 +380,16 @@ public class FlowPaneSkin extends Contai
}
/**
- * Sets the amount of space to leave between the edge of the FlowPane and its components,
- * uniformly on all four edges.
+ * Sets the amount of space to leave between the edge of the FlowPane and
+ * its components, uniformly on all four edges.
*/
public final void setPadding(int padding) {
setPadding(new Insets(padding));
}
/**
- * Sets the amount of space to leave between the edge of the FlowPane and its components,
- * uniformly on all four edges.
+ * Sets the amount of space to leave between the edge of the FlowPane and
+ * its components, uniformly on all four edges.
*/
public final void setPadding(Number padding) {
if (padding == null) {
@@ -398,10 +400,11 @@ public class FlowPaneSkin extends Contai
}
/**
- * Sets the amount of space to leave between the edge of the FlowPane and its components.
- *
- * @param padding A string containing an integer or a JSON dictionary with keys
- * left, top, bottom, and/or right.
+ * Sets the amount of space to leave between the edge of the FlowPane and
+ * its components.
+ *
+ * @param padding A string containing an integer or a JSON dictionary with
+ * keys left, top, bottom, and/or right.
*/
public final void setPadding(String padding) {
if (padding == null) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java Fri Oct 4 23:45:40 2013
@@ -46,7 +46,7 @@ public class GridPaneSkin extends Contai
private boolean[] visibleColumns;
public Metadata() {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
@@ -65,8 +65,7 @@ public class GridPaneSkin extends Contai
for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) {
Component component = row.get(j);
- if (component != null
- && component.isVisible()) {
+ if (component != null && component.isVisible()) {
if (!visibleRows[i]) {
visibleRowCountLocal++;
visibleRows[i] = true;
@@ -111,13 +110,13 @@ public class GridPaneSkin extends Contai
public void install(Component component) {
super.install(component);
- GridPane gridPane = (GridPane)component;
+ GridPane gridPane = (GridPane) component;
gridPane.getGridPaneListeners().add(this);
}
@Override
public int getPreferredWidth(int height) {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
@@ -135,8 +134,7 @@ public class GridPaneSkin extends Contai
for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) {
Component component = row.get(j);
- if (component != null
- && component.isVisible()) {
+ if (component != null && component.isVisible()) {
preferredCellWidth = Math.max(preferredCellWidth,
component.getPreferredWidth(cellHeightLocal));
}
@@ -146,8 +144,8 @@ public class GridPaneSkin extends Contai
// The preferred width of the grid pane is the sum of the column
// widths, plus padding and spacing
- int preferredWidth = padding.left + padding.right
- + metadata.visibleColumnCount * preferredCellWidth;
+ int preferredWidth = padding.left + padding.right + metadata.visibleColumnCount
+ * preferredCellWidth;
if (metadata.visibleColumnCount > 1) {
preferredWidth += (metadata.visibleColumnCount - 1) * horizontalSpacing;
@@ -158,7 +156,7 @@ public class GridPaneSkin extends Contai
@Override
public int getPreferredHeight(int width) {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
@@ -176,8 +174,7 @@ public class GridPaneSkin extends Contai
for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) {
Component component = row.get(j);
- if (component != null
- && component.isVisible()) {
+ if (component != null && component.isVisible()) {
preferredCellHeight = Math.max(preferredCellHeight,
component.getPreferredHeight(cellWidthLocal));
}
@@ -187,8 +184,8 @@ public class GridPaneSkin extends Contai
// The preferred height of the grid pane is the sum of the row
// heights, plus padding and spacing
- int preferredHeight = padding.top + padding.bottom
- + metadata.visibleRowCount * preferredCellHeight;
+ int preferredHeight = padding.top + padding.bottom + metadata.visibleRowCount
+ * preferredCellHeight;
if (metadata.visibleRowCount > 1) {
preferredHeight += (metadata.visibleRowCount - 1) * verticalSpacing;
@@ -199,7 +196,7 @@ public class GridPaneSkin extends Contai
@Override
public Dimensions getPreferredSize() {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
@@ -217,8 +214,7 @@ public class GridPaneSkin extends Contai
for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) {
Component component = row.get(j);
- if (component != null
- && component.isVisible()) {
+ if (component != null && component.isVisible()) {
Dimensions d = component.getPreferredSize();
preferredCellHeight = Math.max(preferredCellHeight, d.height);
preferredCellWidth = Math.max(preferredCellWidth, d.width);
@@ -229,8 +225,8 @@ public class GridPaneSkin extends Contai
// The preferred width of the grid pane is the sum of the column
// widths, plus padding and spacing
- int preferredWidth = padding.left + padding.right
- + metadata.visibleColumnCount * preferredCellWidth;
+ int preferredWidth = padding.left + padding.right + metadata.visibleColumnCount
+ * preferredCellWidth;
if (metadata.visibleColumnCount > 1) {
preferredWidth += (metadata.visibleColumnCount - 1) * horizontalSpacing;
@@ -239,8 +235,8 @@ public class GridPaneSkin extends Contai
// The preferred height of the grid pane is the sum of the row
// heights, plus padding and spacing
- int preferredHeight = padding.top + padding.bottom
- + metadata.visibleRowCount * preferredCellHeight;
+ int preferredHeight = padding.top + padding.bottom + metadata.visibleRowCount
+ * preferredCellHeight;
if (metadata.visibleRowCount > 1) {
preferredHeight += (metadata.visibleRowCount - 1) * verticalSpacing;
@@ -251,7 +247,7 @@ public class GridPaneSkin extends Contai
@Override
public int getBaseline(int width, int height) {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
@@ -263,7 +259,8 @@ public class GridPaneSkin extends Contai
int cellWidthLocal = getCellWidth(width, metadata);
int cellHeightLocal = getCellHeight(height, metadata);
- // Return the first available baseline by traversing cells top left to bottom right
+ // Return the first available baseline by traversing cells top left to
+ // bottom right
int baseline = -1;
@@ -276,8 +273,7 @@ public class GridPaneSkin extends Contai
for (int j = 0, n = row.getLength(); j < n && j < columnCount && baseline == -1; j++) {
Component component = row.get(j);
- if (component != null
- && component.isVisible()) {
+ if (component != null && component.isVisible()) {
baseline = component.getBaseline(cellWidthLocal, cellHeightLocal);
if (baseline != -1) {
@@ -295,7 +291,7 @@ public class GridPaneSkin extends Contai
@Override
public void layout() {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
@@ -319,8 +315,7 @@ public class GridPaneSkin extends Contai
for (int j = 0, n = row.getLength(); j < n && j < columnCount; j++) {
Component component = row.get(j);
- if (component != null
- && component.isVisible()) {
+ if (component != null && component.isVisible()) {
component.setLocation(componentX, componentY);
component.setSize(cellWidth, cellHeight);
}
@@ -339,7 +334,7 @@ public class GridPaneSkin extends Contai
public void paint(Graphics2D graphics) {
super.paint(graphics);
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
@@ -351,36 +346,30 @@ public class GridPaneSkin extends Contai
Metadata metadata = new Metadata();
- if (showHorizontalGridLines
- && verticalSpacing > 0
- && rowCount > 1) {
+ if (showHorizontalGridLines && verticalSpacing > 0 && rowCount > 1) {
graphics.setPaint(horizontalGridColor);
int rowY = padding.top + (cellHeight + verticalSpacing);
for (int i = 1; i < rowCount; i++) {
if (metadata.isRowVisible(i - 1)) {
- int gridY = Math.max(rowY - (int)Math.ceil(verticalSpacing * 0.5f), 0);
- GraphicsUtilities.drawLine(graphics, 0, gridY,
- width, Orientation.HORIZONTAL);
+ int gridY = Math.max(rowY - (int) Math.ceil(verticalSpacing * 0.5f), 0);
+ GraphicsUtilities.drawLine(graphics, 0, gridY, width, Orientation.HORIZONTAL);
rowY += (cellHeight + verticalSpacing);
}
}
}
- if (showVerticalGridLines
- && horizontalSpacing > 0
- && columnCount > 1) {
+ if (showVerticalGridLines && horizontalSpacing > 0 && columnCount > 1) {
graphics.setPaint(verticalGridColor);
int columnX = padding.left + (cellWidth + horizontalSpacing);
for (int j = 1; j < columnCount; j++) {
if (metadata.isColumnVisible(j - 1)) {
- int gridX = Math.max(columnX - (int)Math.ceil(horizontalSpacing * 0.5f), 0);
- GraphicsUtilities.drawLine(graphics, gridX, 0,
- height, Orientation.VERTICAL);
+ int gridX = Math.max(columnX - (int) Math.ceil(horizontalSpacing * 0.5f), 0);
+ GraphicsUtilities.drawLine(graphics, gridX, 0, height, Orientation.VERTICAL);
columnX += (cellWidth + horizontalSpacing);
}
@@ -403,8 +392,8 @@ public class GridPaneSkin extends Contai
clientWidth = Math.max(0, clientWidth);
- cellWidthLocal = (metadata.visibleColumnCount == 0) ? 0 :
- clientWidth / metadata.visibleColumnCount;
+ cellWidthLocal = (metadata.visibleColumnCount == 0) ? 0 : clientWidth
+ / metadata.visibleColumnCount;
}
return cellWidthLocal;
@@ -425,8 +414,8 @@ public class GridPaneSkin extends Contai
clientHeight = Math.max(0, clientHeight);
- cellHeightLocal = (metadata.visibleRowCount == 0) ? 0 :
- clientHeight / metadata.visibleRowCount;
+ cellHeightLocal = (metadata.visibleRowCount == 0) ? 0 : clientHeight
+ / metadata.visibleRowCount;
}
return cellHeightLocal;
@@ -498,16 +487,16 @@ public class GridPaneSkin extends Contai
}
/**
- * Gets the spacing that will be applied in between the grid pane's
- * columns during layout.
+ * Gets the spacing that will be applied in between the grid pane's columns
+ * during layout.
*/
public int getHorizontalSpacing() {
return horizontalSpacing;
}
/**
- * Sets the spacing that will be applied in between the grid pane's
- * columns during layout.
+ * Sets the spacing that will be applied in between the grid pane's columns
+ * during layout.
*/
public void setHorizontalSpacing(int horizontalSpacing) {
if (horizontalSpacing < 0) {
@@ -540,16 +529,16 @@ public class GridPaneSkin extends Contai
}
/**
- * Tells whether or not horizontal grid lines will be painted in between
- * the grid pane's rows.
+ * Tells whether or not horizontal grid lines will be painted in between the
+ * grid pane's rows.
*/
public boolean getShowHorizontalGridLines() {
return showHorizontalGridLines;
}
/**
- * Sets whether or not horizontal grid lines will be painted in between
- * the grid pane's rows.
+ * Sets whether or not horizontal grid lines will be painted in between the
+ * grid pane's rows.
*/
public void setShowHorizontalGridLines(boolean showHorizontalGridLines) {
this.showHorizontalGridLines = showHorizontalGridLines;
@@ -557,16 +546,16 @@ public class GridPaneSkin extends Contai
}
/**
- * Tells whether or not vertical grid lines will be painted in between
- * the grid pane's columns.
+ * Tells whether or not vertical grid lines will be painted in between the
+ * grid pane's columns.
*/
public boolean getShowVerticalGridLines() {
return showVerticalGridLines;
}
/**
- * Sets whether or not vertical grid lines will be painted in between
- * the grid pane's columns.
+ * Sets whether or not vertical grid lines will be painted in between the
+ * grid pane's columns.
*/
public void setShowVerticalGridLines(boolean showVerticalGridLines) {
this.showVerticalGridLines = showVerticalGridLines;
@@ -597,8 +586,10 @@ public class GridPaneSkin extends Contai
/**
* Sets the color used to paint the grid pane's horizontal grid lines.
+ *
* @param horizontalGridColor Any of the
- * {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ * {@linkplain GraphicsUtilities#decodeColor color values recognized by
+ * Pivot}.
*/
public final void setHorizontalGridColor(String horizontalGridColor) {
if (horizontalGridColor == null) {
@@ -632,8 +623,10 @@ public class GridPaneSkin extends Contai
/**
* Sets the color used to paint the grid pane's vertical grid lines.
+ *
* @param verticalGridColor Any of the
- * {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ * {@linkplain GraphicsUtilities#decodeColor color values recognized by
+ * Pivot}.
*/
public final void setVerticalGridColor(String verticalGridColor) {
if (verticalGridColor == null) {
@@ -647,7 +640,7 @@ public class GridPaneSkin extends Contai
@Override
public int getRowAt(int y) {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
int rowCount = rows.getLength();
@@ -670,13 +663,12 @@ public class GridPaneSkin extends Contai
@Override
public Bounds getRowBounds(int row) {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
GridPane.RowSequence rows = gridPane.getRows();
int rowCount = rows.getLength();
- if (row < 0
- || row >= rowCount) {
+ if (row < 0 || row >= rowCount) {
throw new IndexOutOfBoundsException(String.valueOf(row));
}
@@ -691,7 +683,7 @@ public class GridPaneSkin extends Contai
@Override
public int getColumnAt(int x) {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
int columnCount = gridPane.getColumnCount();
int columnIndex = -1;
@@ -711,11 +703,10 @@ public class GridPaneSkin extends Contai
@Override
public Bounds getColumnBounds(int column) {
- GridPane gridPane = (GridPane)getComponent();
+ GridPane gridPane = (GridPane) getComponent();
int columnCount = gridPane.getColumnCount();
- if (column < 0
- || column >= columnCount) {
+ if (column < 0 || column >= columnCount) {
throw new IndexOutOfBoundsException(String.valueOf(column));
}
@@ -750,14 +741,12 @@ public class GridPaneSkin extends Contai
}
@Override
- public void cellsRemoved(GridPane.Row row, int column,
- Sequence<Component> removed) {
+ public void cellsRemoved(GridPane.Row row, int column, Sequence<Component> removed) {
invalidateComponent();
}
@Override
- public void cellUpdated(GridPane.Row row, int column,
- Component previousComponent) {
+ public void cellUpdated(GridPane.Row row, int column, Component previousComponent) {
invalidateComponent();
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java Fri Oct 4 23:45:40 2013
@@ -34,9 +34,7 @@ import org.apache.pivot.wtk.media.Image;
import org.apache.pivot.wtk.media.ImageListener;
/**
- * Image view skin.
- * <p>
- * TODO Add a rotation (float) style.
+ * Image view skin. <p> TODO Add a rotation (float) style.
*/
public class ImageViewSkin extends ComponentSkin implements ImageViewListener {
private Color backgroundColor = null;
@@ -67,10 +65,9 @@ public class ImageViewSkin extends Compo
public void regionUpdated(Image image, int x, int y, int width, int height) {
// TODO A rounding error is causing an off-by-one error; we're
// accounting for it here by adding 1 to width and height
- Bounds bounds = new Bounds(imageX + (int)Math.floor(x * scaleX),
- imageY + (int)Math.floor(y * scaleY),
- (int)Math.ceil(width * scaleX) + 1,
- (int)Math.ceil(height * scaleY) + 1);
+ Bounds bounds = new Bounds(imageX + (int) Math.floor(x * scaleX), imageY
+ + (int) Math.floor(y * scaleY), (int) Math.ceil(width * scaleX) + 1,
+ (int) Math.ceil(height * scaleY) + 1);
repaintComponent(bounds);
}
};
@@ -79,7 +76,7 @@ public class ImageViewSkin extends Compo
public void install(Component component) {
super.install(component);
- ImageView imageView = (ImageView)component;
+ ImageView imageView = (ImageView) component;
imageView.getImageViewListeners().add(this);
Image image = imageView.getImage();
@@ -90,7 +87,7 @@ public class ImageViewSkin extends Compo
@Override
public int getPreferredWidth(int height) {
- ImageView imageView = (ImageView)getComponent();
+ ImageView imageView = (ImageView) getComponent();
Image image = imageView.getImage();
return (image == null) ? 0 : image.getWidth();
@@ -98,7 +95,7 @@ public class ImageViewSkin extends Compo
@Override
public int getPreferredHeight(int width) {
- ImageView imageView = (ImageView)getComponent();
+ ImageView imageView = (ImageView) getComponent();
Image image = imageView.getImage();
return (image == null) ? 0 : image.getHeight();
@@ -106,7 +103,7 @@ public class ImageViewSkin extends Compo
@Override
public Dimensions getPreferredSize() {
- ImageView imageView = (ImageView)getComponent();
+ ImageView imageView = (ImageView) getComponent();
Image image = imageView.getImage();
return (image == null) ? new Dimensions(0, 0) : new Dimensions(image.getWidth(),
@@ -115,7 +112,7 @@ public class ImageViewSkin extends Compo
@Override
public int getBaseline(int width, int height) {
- ImageView imageView = (ImageView)getComponent();
+ ImageView imageView = (ImageView) getComponent();
Image image = imageView.getImage();
int baseline = -1;
@@ -129,18 +126,18 @@ public class ImageViewSkin extends Compo
if (fill) {
// Scale to fit
if (preserveAspectRatio) {
- float aspectRatio = (float)width / (float)height;
- float imageAspectRatio = (float)imageSize.width / (float)imageSize.height;
+ float aspectRatio = (float) width / (float) height;
+ float imageAspectRatio = (float) imageSize.width / (float) imageSize.height;
if (aspectRatio > imageAspectRatio) {
- baseline *= (float)height / (float)imageSize.height;
+ baseline *= (float) height / (float) imageSize.height;
} else {
- float scaleYLocal = (float)width / (float)imageSize.width;
+ float scaleYLocal = (float) width / (float) imageSize.width;
baseline *= scaleYLocal;
- baseline += (int)(height - imageSize.height * scaleYLocal) / 2;
+ baseline += (int) (height - imageSize.height * scaleYLocal) / 2;
}
} else {
- baseline *= (float)height / (float)imageSize.height;
+ baseline *= (float) height / (float) imageSize.height;
}
} else {
if (verticalAlignment == VerticalAlignment.CENTER) {
@@ -157,7 +154,7 @@ public class ImageViewSkin extends Compo
@Override
public void layout() {
- ImageView imageView = (ImageView)getComponent();
+ ImageView imageView = (ImageView) getComponent();
Image image = imageView.getImage();
if (image != null) {
@@ -169,28 +166,28 @@ public class ImageViewSkin extends Compo
if (fill) {
// Scale to fit
if (preserveAspectRatio) {
- float aspectRatio = (float)width / (float)height;
- float imageAspectRatio = (float)imageSize.width / (float)imageSize.height;
+ float aspectRatio = (float) width / (float) height;
+ float imageAspectRatio = (float) imageSize.width / (float) imageSize.height;
if (aspectRatio > imageAspectRatio) {
imageY = 0;
- scaleY = (float)height / (float)imageSize.height;
+ scaleY = (float) height / (float) imageSize.height;
- imageX = (int)(width - imageSize.width * scaleY) / 2;
+ imageX = (int) (width - imageSize.width * scaleY) / 2;
scaleX = scaleY;
} else {
imageX = 0;
- scaleX = (float)width / (float)imageSize.width;
+ scaleX = (float) width / (float) imageSize.width;
- imageY = (int)(height - imageSize.height * scaleX) / 2;
+ imageY = (int) (height - imageSize.height * scaleX) / 2;
scaleY = scaleX;
}
} else {
imageX = 0;
- scaleX = (float)width / (float)imageSize.width;
+ scaleX = (float) width / (float) imageSize.width;
imageY = 0;
- scaleY = (float)height / (float)imageSize.height;
+ scaleY = (float) height / (float) imageSize.height;
}
} else {
if (horizontalAlignment == HorizontalAlignment.CENTER) {
@@ -218,7 +215,7 @@ public class ImageViewSkin extends Compo
@Override
public void paint(Graphics2D graphics) {
- ImageView imageView = (ImageView)getComponent();
+ ImageView imageView = (ImageView) getComponent();
Image image = imageView.getImage();
int width = getWidth();
@@ -230,7 +227,7 @@ public class ImageViewSkin extends Compo
}
if (image != null) {
- Graphics2D imageGraphics = (Graphics2D)graphics.create();
+ Graphics2D imageGraphics = (Graphics2D) graphics.create();
imageGraphics.translate(imageX, imageY);
imageGraphics.scale(scaleX, scaleY);
@@ -240,12 +237,13 @@ public class ImageViewSkin extends Compo
Composite composite = imageGraphics.getComposite();
if (composite instanceof AlphaComposite) {
- AlphaComposite alphaComposite = (AlphaComposite)composite;
+ AlphaComposite alphaComposite = (AlphaComposite) composite;
alpha = alphaComposite.getAlpha();
}
if (opacity < alpha) {
- imageGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
+ imageGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
+ opacity));
}
image.paint(imageGraphics);
@@ -254,8 +252,7 @@ public class ImageViewSkin extends Compo
}
/**
- * @return
- * <tt>false</tt>; image views are not focusable.
+ * @return <tt>false</tt>; image views are not focusable.
*/
@Override
public boolean isFocusable() {
@@ -264,8 +261,7 @@ public class ImageViewSkin extends Compo
@Override
public boolean isOpaque() {
- return (backgroundColor != null
- && backgroundColor.getTransparency() == Transparency.OPAQUE);
+ return (backgroundColor != null && backgroundColor.getTransparency() == Transparency.OPAQUE);
}
/**
@@ -285,8 +281,10 @@ public class ImageViewSkin extends Compo
/**
* Sets the color that is painted behind the image
+ *
* @param backgroundColor Any of the
- * {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ * {@linkplain GraphicsUtilities#decodeColor color values recognized by
+ * Pivot}.
*/
public final void setBackgroundColor(String backgroundColor) {
if (backgroundColor == null) {
@@ -305,6 +303,7 @@ public class ImageViewSkin extends Compo
/**
* Sets the opacity of the image.
+ *
* @param opacity A number between 0 (transparent) and 1 (opaque)
*/
public void setOpacity(float opacity) {
@@ -318,6 +317,7 @@ public class ImageViewSkin extends Compo
/**
* Sets the opacity of the image.
+ *
* @param opacity A number between 0 (transparent) and 1 (opaque)
*/
public final void setOpacity(Number opacity) {
@@ -336,8 +336,8 @@ public class ImageViewSkin extends Compo
}
/**
- * Sets the horizontal alignment of the image.
- * Ignored if the <code>fill</code> style is true.
+ * Sets the horizontal alignment of the image. Ignored if the
+ * <code>fill</code> style is true.
*/
public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
if (horizontalAlignment == null) {
@@ -357,8 +357,8 @@ public class ImageViewSkin extends Compo
}
/**
- * Sets the vertical alignment of the image.
- * Ignored if the <code>fill</code> style is true.
+ * Sets the vertical alignment of the image. Ignored if the
+ * <code>fill</code> style is true.
*/
public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
if (verticalAlignment == null) {
@@ -371,18 +371,18 @@ public class ImageViewSkin extends Compo
}
/**
- * Returns a boolean indicating whether the image will be scaled to fit
- * the space in which it is placed.
+ * Returns a boolean indicating whether the image will be scaled to fit the
+ * space in which it is placed.
*/
public boolean getFill() {
return fill;
}
/**
- * Sets a boolean indicating whether the image will be scaled to fit
- * the space in which it is placed. Note that for scaling to occur,
- * the ImageView must specify a preferred size or be placed
- * in a container that constrains its size.
+ * Sets a boolean indicating whether the image will be scaled to fit the
+ * space in which it is placed. Note that for scaling to occur, the
+ * ImageView must specify a preferred size or be placed in a container that
+ * constrains its size.
*/
public void setFill(boolean fill) {
this.fill = fill;
@@ -391,17 +391,16 @@ public class ImageViewSkin extends Compo
}
/**
- * Returns a boolean indicating whether, when the image is scaled,
- * its aspect ratio is preserved.
+ * Returns a boolean indicating whether, when the image is scaled, its
+ * aspect ratio is preserved.
*/
public boolean getPreserveAspectRatio() {
return preserveAspectRatio;
}
/**
- * Sets a boolean indicating whether, when the image is scaled,
- * its aspect ratio is preserved.
- * Ignored if the <code>fill</code> style is false.
+ * Sets a boolean indicating whether, when the image is scaled, its aspect
+ * ratio is preserved. Ignored if the <code>fill</code> style is false.
*/
public void setPreserveAspectRatio(boolean preserveAspectRatio) {
this.preserveAspectRatio = preserveAspectRatio;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java Fri Oct 4 23:45:40 2013
@@ -77,13 +77,13 @@ public class LabelSkin extends Component
public void install(Component component) {
super.install(component);
- Label label = (Label)getComponent();
+ Label label = (Label) getComponent();
label.getLabelListeners().add(this);
}
@Override
public int getPreferredWidth(int height) {
- Label label = (Label)getComponent();
+ Label label = (Label) getComponent();
String text = label.getText();
int preferredWidth = 0;
@@ -98,7 +98,7 @@ public class LabelSkin extends Component
for (String line : str) {
Rectangle2D stringBounds = font.getStringBounds(line, fontRenderContext);
- int w = (int)Math.ceil(stringBounds.getWidth());
+ int w = (int) Math.ceil(stringBounds.getWidth());
if (w > preferredWidth) {
preferredWidth = w;
@@ -113,7 +113,7 @@ public class LabelSkin extends Component
@Override
public int getPreferredHeight(int width) {
- Label label = (Label)getComponent();
+ Label label = (Label) getComponent();
String text = label.getText();
float preferredHeight;
@@ -126,9 +126,7 @@ public class LabelSkin extends Component
preferredHeight = lineHeight;
int n = text.length();
- if (n > 0
- && wrapText
- && widthUpdated != -1) {
+ if (n > 0 && wrapText && widthUpdated != -1) {
// Adjust width for padding
widthUpdated -= (padding.left + padding.right);
@@ -152,8 +150,7 @@ public class LabelSkin extends Component
fontRenderContext);
lineWidth += characterBounds.getWidth();
- if (lineWidth > widthUpdated
- && lastWhitespaceIndex != -1) {
+ if (lineWidth > widthUpdated && lastWhitespaceIndex != -1) {
i = lastWhitespaceIndex;
lineWidth = 0;
@@ -172,18 +169,18 @@ public class LabelSkin extends Component
preferredHeight += (padding.top + padding.bottom);
- return (int)Math.ceil(preferredHeight);
+ return (int) Math.ceil(preferredHeight);
}
@Override
public Dimensions getPreferredSize() {
- Label label = (Label)getComponent();
+ Label label = (Label) getComponent();
String text = label.getText();
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
LineMetrics lm = font.getLineMetrics("", fontRenderContext);
- int lineHeight = (int)Math.ceil(lm.getHeight());
+ int lineHeight = (int) Math.ceil(lm.getHeight());
int preferredHeight = 0;
int preferredWidth = 0;
@@ -198,7 +195,7 @@ public class LabelSkin extends Component
for (String line : str) {
Rectangle2D stringBounds = font.getStringBounds(line, fontRenderContext);
- int w = (int)Math.ceil(stringBounds.getWidth());
+ int w = (int) Math.ceil(stringBounds.getWidth());
if (w > preferredWidth) {
preferredWidth = w;
@@ -223,9 +220,10 @@ public class LabelSkin extends Component
float textHeightLocal;
if (wrapText) {
- textHeightLocal = Math.max(getPreferredHeight(width) - (padding.top + padding.bottom), 0);
+ textHeightLocal = Math.max(getPreferredHeight(width) - (padding.top + padding.bottom),
+ 0);
} else {
- textHeightLocal = (int)Math.ceil(lm.getHeight());
+ textHeightLocal = (int) Math.ceil(lm.getHeight());
}
int baseline = -1;
@@ -255,7 +253,7 @@ public class LabelSkin extends Component
@Override
public void layout() {
- Label label = (Label)getComponent();
+ Label label = (Label) getComponent();
String text = label.getText();
glyphVectors = new ArrayList<>();
@@ -275,10 +273,14 @@ public class LabelSkin extends Component
float lineWidth = 0;
int lastWhitespaceIndex = -1;
- // NOTE We use a character iterator here only because it is the most
- // efficient way to measure the character bounds (as of Java 6, the version
- // of Font#getStringBounds() that takes a String performs a string copy,
- // whereas the version that takes a character iterator does not)
+ // NOTE We use a character iterator here only because it is
+ // the most
+ // efficient way to measure the character bounds (as of Java
+ // 6, the version
+ // of Font#getStringBounds() that takes a String performs a
+ // string copy,
+ // whereas the version that takes a character iterator does
+ // not)
StringCharacterIterator ci = new StringCharacterIterator(text);
while (i < n) {
char c = text.charAt(i);
@@ -293,11 +295,11 @@ public class LabelSkin extends Component
lastWhitespaceIndex = i;
}
- Rectangle2D characterBounds = font.getStringBounds(ci, i, i + 1, fontRenderContext);
+ Rectangle2D characterBounds = font.getStringBounds(ci, i, i + 1,
+ fontRenderContext);
lineWidth += characterBounds.getWidth();
- if (lineWidth > width
- && lastWhitespaceIndex != -1) {
+ if (lineWidth > width && lastWhitespaceIndex != -1) {
appendLine(text, start, lastWhitespaceIndex, fontRenderContext);
i = lastWhitespaceIndex;
@@ -329,7 +331,7 @@ public class LabelSkin extends Component
@Override
public void paint(Graphics2D graphics) {
- Label label = (Label)this.getComponent();
+ Label label = (Label) this.getComponent();
int width = getWidth();
int height = getHeight();
@@ -381,7 +383,7 @@ public class LabelSkin extends Component
GlyphVector glyphVector = glyphVectors.get(i);
Rectangle2D textBounds = glyphVector.getLogicalBounds();
- float lineWidth = (float)textBounds.getWidth();
+ float lineWidth = (float) textBounds.getWidth();
float x = 0;
switch (horizontalAlignment) {
@@ -408,8 +410,7 @@ public class LabelSkin extends Component
if (text != null && text.length() > 0) {
graphics.drawString(text, x, y + ascent);
}
- }
- else {
+ } else {
graphics.drawGlyphVector(glyphVector, x, y + ascent);
}
@@ -443,8 +444,7 @@ public class LabelSkin extends Component
}
/**
- * @return
- * <tt>false</tt>; labels are not focusable.
+ * @return <tt>false</tt>; labels are not focusable.
*/
@Override
public boolean isFocusable() {
@@ -453,8 +453,7 @@ public class LabelSkin extends Component
@Override
public boolean isOpaque() {
- return (backgroundColor != null
- && backgroundColor.getTransparency() == Transparency.OPAQUE);
+ return (backgroundColor != null && backgroundColor.getTransparency() == Transparency.OPAQUE);
}
/**
@@ -478,6 +477,7 @@ public class LabelSkin extends Component
/**
* Sets the font used in rendering the Label's text
+ *
* @param font A {@link ComponentSkin#decodeFont(String) font specification}
*/
public final void setFont(String font) {
@@ -490,6 +490,7 @@ public class LabelSkin extends Component
/**
* Sets the font used in rendering the Label's text
+ *
* @param font A dictionary {@link Theme#deriveFont describing a font}
*/
public final void setFont(Dictionary<String, ?> font) {
@@ -521,7 +522,9 @@ public class LabelSkin extends Component
/**
* Sets the foreground color of the text of the label.
- * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ *
+ * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+ * values recognized by Pivot}.
*/
public final void setColor(String color) {
if (color == null) {
@@ -552,7 +555,9 @@ public class LabelSkin extends Component
/**
* Sets the foreground color of the text of the label when disabled.
- * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ *
+ * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+ * values recognized by Pivot}.
*/
public final void setDisabledColor(String color) {
if (color == null) {
@@ -579,7 +584,10 @@ public class LabelSkin extends Component
/**
* Sets the background color of the label.
- * @param backgroundColor Any of the {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ *
+ * @param backgroundColor Any of the
+ * {@linkplain GraphicsUtilities#decodeColor color values recognized by
+ * Pivot}.
*/
public final void setBackgroundColor(String backgroundColor) {
if (backgroundColor == null) {
@@ -625,14 +633,16 @@ public class LabelSkin extends Component
}
/**
- * Returns the amount of space to leave between the edge of the Label and its text.
+ * Returns the amount of space to leave between the edge of the Label and
+ * its text.
*/
public Insets getPadding() {
return padding;
}
/**
- * Sets the amount of space to leave between the edge of the Label and its text.
+ * Sets the amount of space to leave between the edge of the Label and its
+ * text.
*/
public void setPadding(Insets padding) {
if (padding == null) {
@@ -644,8 +654,11 @@ public class LabelSkin extends Component
}
/**
- * Sets the amount of space to leave between the edge of the Label and its text.
- * @param padding A dictionary with keys in the set {left, top, bottom, right}.
+ * Sets the amount of space to leave between the edge of the Label and its
+ * text.
+ *
+ * @param padding A dictionary with keys in the set {left, top, bottom,
+ * right}.
*/
public final void setPadding(Dictionary<String, ?> padding) {
if (padding == null) {
@@ -656,16 +669,16 @@ public class LabelSkin extends Component
}
/**
- * Sets the amount of space to leave between the edge of the Label and its text,
- * uniformly on all four edges.
+ * Sets the amount of space to leave between the edge of the Label and its
+ * text, uniformly on all four edges.
*/
public final void setPadding(int padding) {
setPadding(new Insets(padding));
}
/**
- * Sets the amount of space to leave between the edge of the Label and its text,
- * uniformly on all four edges.
+ * Sets the amount of space to leave between the edge of the Label and its
+ * text, uniformly on all four edges.
*/
public final void setPadding(Number padding) {
if (padding == null) {
@@ -676,10 +689,11 @@ public class LabelSkin extends Component
}
/**
- * Sets the amount of space to leave between the edge of the Label and its text.
- *
- * @param padding A string containing an integer or a JSON dictionary with keys
- * left, top, bottom, and/or right.
+ * Sets the amount of space to leave between the edge of the Label and its
+ * text.
+ *
+ * @param padding A string containing an integer or a JSON dictionary with
+ * keys left, top, bottom, and/or right.
*/
public final void setPadding(String padding) {
if (padding == null) {
@@ -690,18 +704,19 @@ public class LabelSkin extends Component
}
/**
- * Returns true if the text of the label will be wrapped to fit the Label's width.
+ * Returns true if the text of the label will be wrapped to fit the Label's
+ * width.
*/
public boolean getWrapText() {
return wrapText;
}
/**
- * Sets whether the text of the label will be wrapped to fit the Label's width.
- * Note that for wrapping to occur, the Label must specify a preferred width or
- * be placed in a container that constrains its width.
- * Also note that newline characters (if wrapping is set true) will cause a hard
- * line break.
+ * Sets whether the text of the label will be wrapped to fit the Label's
+ * width. Note that for wrapping to occur, the Label must specify a
+ * preferred width or be placed in a container that constrains its width.
+ * Also note that newline characters (if wrapping is set true) will cause a
+ * hard line break.
*/
public void setWrapText(boolean wrapText) {
this.wrapText = wrapText;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LinkButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LinkButtonSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LinkButtonSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LinkButtonSkin.java Fri Oct 4 23:45:40 2013
@@ -39,7 +39,7 @@ public abstract class LinkButtonSkin ext
boolean consumed = super.mouseClick(component, button, x, y, count);
if (button == Mouse.Button.LEFT) {
- LinkButton linkButton = (LinkButton)getComponent();
+ LinkButton linkButton = (LinkButton) getComponent();
linkButton.press();
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java Fri Oct 4 23:45:40 2013
@@ -40,15 +40,15 @@ import org.apache.pivot.wtk.WindowStateL
/**
* Abstract base class for list button skins.
*/
-public abstract class ListButtonSkin extends ButtonSkin
- implements ListButton.Skin, ListButtonListener, ListButtonSelectionListener {
+public abstract class ListButtonSkin extends ButtonSkin implements ListButton.Skin,
+ ListButtonListener, ListButtonSelectionListener {
protected ListView listView;
protected Window listViewPopup;
private ComponentMouseButtonListener listViewPopupMouseButtonListener = new ComponentMouseButtonListener.Adapter() {
@Override
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
- ListButton listButton = (ListButton)getComponent();
+ ListButton listButton = (ListButton) getComponent();
listViewPopup.close();
@@ -68,13 +68,13 @@ public abstract class ListButtonSkin ext
* {@link KeyCode#ESCAPE ESCAPE} Close the popup.<br>
* {@link KeyCode#ENTER ENTER} Choose the selected list item.<br>
* {@link KeyCode#TAB TAB} Choose the selected list item and transfer
- * focus forwards.<br>
- * {@link KeyCode#TAB TAB} + {@link Keyboard.Modifier#SHIFT SHIFT} Choose the
- * selected list item and transfer focus backwards.
+ * focus forwards.<br> {@link KeyCode#TAB TAB} +
+ * {@link Keyboard.Modifier#SHIFT SHIFT} Choose the selected list item
+ * and transfer focus backwards.
*/
@Override
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
- ListButton listButton = (ListButton)getComponent();
+ ListButton listButton = (ListButton) getComponent();
switch (keyCode) {
case Keyboard.KeyCode.ENTER: {
@@ -96,8 +96,8 @@ public abstract class ListButtonSkin ext
int index = listView.getSelectedIndex();
listButton.setSelectedIndex(index);
- FocusTraversalDirection direction = (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) ?
- FocusTraversalDirection.BACKWARD : FocusTraversalDirection.FORWARD;
+ FocusTraversalDirection direction = (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) ? FocusTraversalDirection.BACKWARD
+ : FocusTraversalDirection.FORWARD;
listButton.transferFocus(direction);
break;
@@ -147,9 +147,7 @@ public abstract class ListButtonSkin ext
display.getContainerMouseListeners().remove(displayMouseListener);
Window componentWindow = getComponent().getWindow();
- if (componentWindow != null
- && componentWindow.isOpen()
- && !componentWindow.isClosing()) {
+ if (componentWindow != null && componentWindow.isOpen() && !componentWindow.isClosing()) {
componentWindow.moveToFront();
}
}
@@ -158,7 +156,7 @@ public abstract class ListButtonSkin ext
private ContainerMouseListener displayMouseListener = new ContainerMouseListener.Adapter() {
@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
- Display display = (Display)container;
+ Display display = (Display) container;
Component descendant = display.getDescendantAt(x, y);
if (!listViewPopup.isAncestor(descendant)
@@ -174,8 +172,8 @@ public abstract class ListButtonSkin ext
int scrollAmount, int wheelRotation, int x, int y) {
boolean consumed = false;
- Display display = (Display)container;
- Window window = (Window)display.getComponentAt(x, y);
+ Display display = (Display) container;
+ Window window = (Window) display.getComponentAt(x, y);
if (window != listViewPopup) {
consumed = true;
@@ -200,7 +198,7 @@ public abstract class ListButtonSkin ext
public void install(Component component) {
super.install(component);
- ListButton listButton = (ListButton)component;
+ ListButton listButton = (ListButton) component;
listButton.getListButtonListeners().add(this);
listButton.getListButtonSelectionListeners().add(this);
@@ -263,7 +261,7 @@ public abstract class ListButtonSkin ext
pressed = true;
repaintComponent();
- ListButton listButton = (ListButton)component;
+ ListButton listButton = (ListButton) component;
if (listViewPopup.isOpen()) {
listViewPopup.close();
@@ -288,7 +286,7 @@ public abstract class ListButtonSkin ext
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
boolean consumed = super.mouseClick(component, button, x, y, count);
- ListButton listButton = (ListButton)getComponent();
+ ListButton listButton = (ListButton) getComponent();
if (listButton.isRepeatable() && !getTriggerBounds().contains(x, y)) {
listButton.press();
}
@@ -298,10 +296,10 @@ public abstract class ListButtonSkin ext
/**
* {@link KeyCode#SPACE SPACE} Repaints the component to reflect the pressed
- * state and opens the popup.<br>
- * {@link KeyCode#UP UP} Selects the previous enabled list item.<br>
- * {@link KeyCode#DOWN DOWN} Selects the next enabled list item.
- *
+ * state and opens the popup.<br> {@link KeyCode#UP UP} Selects the previous
+ * enabled list item.<br> {@link KeyCode#DOWN DOWN} Selects the next enabled
+ * list item.
+ *
* @see #keyReleased(Component, int,
* org.apache.pivot.wtk.Keyboard.KeyLocation)
*/
@@ -309,7 +307,7 @@ public abstract class ListButtonSkin ext
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = false;
- ListButton listButton = (ListButton)getComponent();
+ ListButton listButton = (ListButton) getComponent();
if (keyCode == Keyboard.KeyCode.SPACE) {
pressed = true;
@@ -317,7 +315,7 @@ public abstract class ListButtonSkin ext
if (listViewPopup.isOpen()) {
listViewPopup.close();
- } else if (!listButton.isRepeatable()){
+ } else if (!listButton.isRepeatable()) {
listViewPopup.open(component.getWindow());
}
} else if (keyCode == Keyboard.KeyCode.UP) {
@@ -325,8 +323,7 @@ public abstract class ListButtonSkin ext
do {
index--;
- } while (index >= 0
- && listButton.isItemDisabled(index));
+ } while (index >= 0 && listButton.isItemDisabled(index));
if (index >= 0) {
listButton.setSelectedIndex(index);
@@ -343,8 +340,7 @@ public abstract class ListButtonSkin ext
do {
index++;
- } while (index < count
- && listView.isItemDisabled(index));
+ } while (index < count && listView.isItemDisabled(index));
if (index < count) {
listButton.setSelectedIndex(index);
@@ -365,7 +361,7 @@ public abstract class ListButtonSkin ext
public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = false;
- ListButton listButton = (ListButton)getComponent();
+ ListButton listButton = (ListButton) getComponent();
if (keyCode == Keyboard.KeyCode.SPACE) {
pressed = false;
@@ -389,7 +385,7 @@ public abstract class ListButtonSkin ext
public boolean keyTyped(Component component, char character) {
boolean consumed = super.keyTyped(component, character);
- ListButton listButton = (ListButton)getComponent();
+ ListButton listButton = (ListButton) getComponent();
List<?> listData = listButton.getListData();
ListView.ItemRenderer itemRenderer = listButton.getItemRenderer();
@@ -400,8 +396,7 @@ public abstract class ListButtonSkin ext
if (!listButton.isItemDisabled(i)) {
String string = itemRenderer.toString(listData.get(i));
- if (string != null
- && string.length() > 0) {
+ if (string != null && string.length() > 0) {
char first = Character.toUpperCase(string.charAt(0));
if (first == characterUpper) {
@@ -425,7 +420,8 @@ public abstract class ListButtonSkin ext
}
@Override
- public void itemRendererChanged(ListButton listButton, ListView.ItemRenderer previousItemRenderer) {
+ public void itemRendererChanged(ListButton listButton,
+ ListView.ItemRenderer previousItemRenderer) {
listView.setItemRenderer(listButton.getItemRenderer());
}
@@ -435,7 +431,8 @@ public abstract class ListButtonSkin ext
}
@Override
- public void disabledItemFilterChanged(ListButton listButton, Filter<?> previousDisabledItemFilter) {
+ public void disabledItemFilterChanged(ListButton listButton,
+ Filter<?> previousDisabledItemFilter) {
listView.setDisabledItemFilter(listButton.getDisabledItemFilter());
}
@@ -451,7 +448,8 @@ public abstract class ListButtonSkin ext
if (selectedIndex != previousSelectedIndex) {
// This was not an indirect selection change
- Object buttonData = (selectedIndex == -1) ? null : listButton.getListData().get(selectedIndex);
+ Object buttonData = (selectedIndex == -1) ? null : listButton.getListData().get(
+ selectedIndex);
listButton.setButtonData(buttonData);
listView.setSelectedIndex(selectedIndex);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuBarItemSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuBarItemSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuBarItemSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuBarItemSkin.java Fri Oct 4 23:45:40 2013
@@ -41,26 +41,24 @@ public abstract class MenuBarItemSkin ex
private ComponentKeyListener menuPopupComponentKeyListener = new ComponentKeyListener.Adapter() {
/**
* {@link KeyCode#LEFT LEFT} or {@link KeyCode#TAB TAB} +
- * {@link Keyboard.Modifier#SHIFT SHIFT} Activate the menu to the left of the
- * current menu.<br>
- * {@link KeyCode#RIGHT RIGHT} or {@link KeyCode#TAB TAB} Activate
- * the menu to the right of the current menu.<br>
+ * {@link Keyboard.Modifier#SHIFT SHIFT} Activate the menu to the left
+ * of the current menu.<br> {@link KeyCode#RIGHT RIGHT} or
+ * {@link KeyCode#TAB TAB} Activate the menu to the right of the current
+ * menu.<br>
*/
@Override
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = false;
- MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();
- MenuBar menuBar = (MenuBar)menuBarItem.getParent();
+ MenuBar.Item menuBarItem = (MenuBar.Item) getComponent();
+ MenuBar menuBar = (MenuBar) menuBarItem.getParent();
if (keyCode == Keyboard.KeyCode.LEFT
- || (keyCode == Keyboard.KeyCode.TAB
- && Keyboard.isPressed(Keyboard.Modifier.SHIFT))) {
+ || (keyCode == Keyboard.KeyCode.TAB && Keyboard.isPressed(Keyboard.Modifier.SHIFT))) {
menuBar.activatePreviousItem();
consumed = true;
- } else if (keyCode == Keyboard.KeyCode.RIGHT
- || keyCode == Keyboard.KeyCode.TAB) {
+ } else if (keyCode == Keyboard.KeyCode.RIGHT || keyCode == Keyboard.KeyCode.TAB) {
menuBar.activateNextItem();
consumed = true;
}
@@ -78,12 +76,12 @@ public abstract class MenuBarItemSkin ex
@Override
public void windowClosed(Window window, Display display, Window owner) {
- MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();
+ MenuBar.Item menuBarItem = (MenuBar.Item) getComponent();
menuBarItem.setActive(false);
// If the menu bar is no longer active, move the window to the
// front to restore focus
- MenuBar menuBar = (MenuBar)menuBarItem.getParent();
+ MenuBar menuBar = (MenuBar) menuBarItem.getParent();
if (menuBar.getActiveItem() == null) {
Window menuBarWindow = menuBar.getWindow();
@@ -101,7 +99,7 @@ public abstract class MenuBarItemSkin ex
private ContainerMouseListener displayMouseListener = new ContainerMouseListener.Adapter() {
@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
- Display display = (Display)container;
+ Display display = (Display) container;
Component descendant = display.getDescendantAt(x, y);
if (!menuPopup.isAncestor(descendant)
@@ -123,7 +121,7 @@ public abstract class MenuBarItemSkin ex
public void install(Component component) {
super.install(component);
- MenuBar.Item menuBarItem = (MenuBar.Item)component;
+ MenuBar.Item menuBarItem = (MenuBar.Item) component;
menuBarItem.getItemListeners().add(this);
menuPopup.setMenu(menuBarItem.getMenu());
@@ -138,8 +136,8 @@ public abstract class MenuBarItemSkin ex
public void mouseOver(Component component) {
super.mouseOver(component);
- MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();
- MenuBar menuBar = (MenuBar)menuBarItem.getParent();
+ MenuBar.Item menuBarItem = (MenuBar.Item) getComponent();
+ MenuBar menuBar = (MenuBar) menuBarItem.getParent();
if (menuBar.getActiveItem() != null) {
menuBarItem.setActive(true);
@@ -150,7 +148,7 @@ public abstract class MenuBarItemSkin ex
public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseDown(component, button, x, y);
- MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();
+ MenuBar.Item menuBarItem = (MenuBar.Item) getComponent();
closeMenuPopup = menuBarItem.isActive();
menuBarItem.setActive(true);
@@ -172,7 +170,7 @@ public abstract class MenuBarItemSkin ex
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
boolean consumed = super.mouseClick(component, button, x, y, count);
- MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();
+ MenuBar.Item menuBarItem = (MenuBar.Item) getComponent();
menuBarItem.press();
return consumed;
@@ -197,7 +195,8 @@ public abstract class MenuBarItemSkin ex
Display display = menuBarItem.getDisplay();
Point menuBarItemLocation = menuBarItem.mapPointToAncestor(display, 0, getHeight());
- // TODO Ensure that the popup remains within the bounds of the display
+ // TODO Ensure that the popup remains within the bounds of the
+ // display
menuPopup.setLocation(menuBarItemLocation.x, menuBarItemLocation.y);
menuPopup.open(menuBarItem.getWindow());
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java Fri Oct 4 23:45:40 2013
@@ -22,6 +22,7 @@ import org.apache.pivot.wtk.Container;
import org.apache.pivot.wtk.ContainerMouseListener;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Keyboard;
+import org.apache.pivot.wtk.Keyboard.KeyCode;
import org.apache.pivot.wtk.Menu;
import org.apache.pivot.wtk.MenuButton;
import org.apache.pivot.wtk.MenuButtonListener;
@@ -30,13 +31,12 @@ import org.apache.pivot.wtk.MenuPopupSta
import org.apache.pivot.wtk.Mouse;
import org.apache.pivot.wtk.Window;
import org.apache.pivot.wtk.WindowStateListener;
-import org.apache.pivot.wtk.Keyboard.KeyCode;
/**
* Abstract base class for menu button skins.
*/
-public abstract class MenuButtonSkin extends ButtonSkin
- implements MenuButton.Skin, MenuButtonListener {
+public abstract class MenuButtonSkin extends ButtonSkin implements MenuButton.Skin,
+ MenuButtonListener {
protected boolean pressed = false;
protected MenuPopup menuPopup = new MenuPopup();
@@ -54,9 +54,7 @@ public abstract class MenuButtonSkin ext
display.getContainerMouseListeners().remove(displayMouseListener);
Window componentWindow = getComponent().getWindow();
- if (componentWindow != null
- && componentWindow.isOpen()
- && !componentWindow.isClosing()) {
+ if (componentWindow != null && componentWindow.isOpen() && !componentWindow.isClosing()) {
componentWindow.moveToFront();
}
@@ -86,7 +84,7 @@ public abstract class MenuButtonSkin ext
private ContainerMouseListener displayMouseListener = new ContainerMouseListener.Adapter() {
@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
- Display display = (Display)container;
+ Display display = (Display) container;
Component descendant = display.getDescendantAt(x, y);
if (!menuPopup.isAncestor(descendant)
@@ -102,7 +100,7 @@ public abstract class MenuButtonSkin ext
public void install(Component component) {
super.install(component);
- MenuButton menuButton = (MenuButton)getComponent();
+ MenuButton menuButton = (MenuButton) getComponent();
menuButton.getMenuButtonListeners().add(this);
menuPopup.setMenu(menuButton.getMenu());
@@ -170,7 +168,7 @@ public abstract class MenuButtonSkin ext
/**
* {@link KeyCode#SPACE SPACE} Repaints the component to reflect the pressed
* state.
- *
+ *
* @see #keyReleased(Component, int,
* org.apache.pivot.wtk.Keyboard.KeyLocation)
*/
@@ -203,7 +201,7 @@ public abstract class MenuButtonSkin ext
public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
boolean consumed = false;
- MenuButton menuButton = (MenuButton)getComponent();
+ MenuButton menuButton = (MenuButton) getComponent();
if (keyCode == Keyboard.KeyCode.SPACE) {
pressed = false;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuItemSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuItemSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuItemSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuItemSkin.java Fri Oct 4 23:45:40 2013
@@ -52,11 +52,10 @@ public abstract class MenuItemSkin exten
private ContainerMouseListener displayMouseListener = new ContainerMouseListener.Adapter() {
@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
- Display display = (Display)container;
+ Display display = (Display) container;
Component descendant = display.getDescendantAt(x, y);
- if (!menuPopup.isAncestor(descendant)
- && descendant != MenuItemSkin.this.getComponent()) {
+ if (!menuPopup.isAncestor(descendant) && descendant != MenuItemSkin.this.getComponent()) {
menuPopup.close();
}
@@ -75,7 +74,7 @@ public abstract class MenuItemSkin exten
public void install(Component component) {
super.install(component);
- Menu.Item menuItem = (Menu.Item)component;
+ Menu.Item menuItem = (Menu.Item) component;
menuItem.getItemListeners().add(this);
menuPopup.setMenu(menuItem.getMenu());
@@ -90,7 +89,7 @@ public abstract class MenuItemSkin exten
public void mouseOver(Component component) {
super.mouseOver(component);
- final Menu.Item menuItem = (Menu.Item)getComponent();
+ final Menu.Item menuItem = (Menu.Item) getComponent();
menuItem.setActive(true);
if (buttonPressCallback != null) {
@@ -118,7 +117,7 @@ public abstract class MenuItemSkin exten
}
if (!menuPopup.isOpen()) {
- Menu.Item menuItem = (Menu.Item)getComponent();
+ Menu.Item menuItem = (Menu.Item) getComponent();
menuItem.setActive(false);
}
}
@@ -139,7 +138,7 @@ public abstract class MenuItemSkin exten
public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
boolean consumed = super.mouseDown(component, button, x, y);
- Menu.Item menuItem = (Menu.Item)getComponent();
+ Menu.Item menuItem = (Menu.Item) getComponent();
if (menuItem.isActive()) {
menuItem.press();
}
@@ -156,11 +155,10 @@ public abstract class MenuItemSkin exten
@Override
public void buttonPressed(Button button) {
- Menu.Item menuItem = (Menu.Item)getComponent();
+ Menu.Item menuItem = (Menu.Item) getComponent();
Menu menu = menuItem.getMenu();
- if (menu != null
- && !menuPopup.isOpen()) {
+ if (menu != null && !menuPopup.isOpen()) {
// Size and position the popup
Display display = menuItem.getDisplay();
Dimensions displaySize = display.getSize();
@@ -178,7 +176,6 @@ public abstract class MenuItemSkin exten
menuPopup.setX(location.x - width - popupWidth);
}
-
menuPopup.open(menuItem.getWindow());
menuPopup.requestFocus();
}