PIVOT-1032: Fix the "AvoidNestedBlocks" style errors, as well as many other
errors in those files (mostly FinalParameters).
git-svn-id: https://svn.apache.org/repos/asf/pivot/trunk@1838738 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/org/apache/pivot/xml/XMLSerializer.java b/core/src/org/apache/pivot/xml/XMLSerializer.java
index 47723e4..d976e0c 100644
--- a/core/src/org/apache/pivot/xml/XMLSerializer.java
+++ b/core/src/org/apache/pivot/xml/XMLSerializer.java
@@ -52,13 +52,17 @@
public static final String DEFAULT_CHARSET_NAME = "UTF-8";
public static final String XML_EXTENSION = "xml";
public static final String MIME_TYPE = "text/xml";
- public static final int BUFFER_SIZE = 2048;
+ /**
+ * Buffer size to use while reading and writing (should be bigger than the default for
+ * BufferedReader or BufferedWriter, which seems to be 8192 as of Java 7).
+ */
+ public static final int BUFFER_SIZE = 16384;
public XMLSerializer() {
this(Charset.forName(DEFAULT_CHARSET_NAME));
}
- public XMLSerializer(Charset charset) {
+ public XMLSerializer(final Charset charset) {
Utils.checkNull(charset, "charset");
this.charset = charset;
@@ -69,7 +73,7 @@
}
@Override
- public Element readObject(InputStream inputStream) throws IOException, SerializationException {
+ public Element readObject(final InputStream inputStream) throws IOException, SerializationException {
Utils.checkNull(inputStream, "inputStream");
Reader reader = new BufferedReader(new InputStreamReader(inputStream, charset), BUFFER_SIZE);
@@ -78,7 +82,7 @@
return element;
}
- public Element readObject(Reader reader) throws SerializationException {
+ public Element readObject(final Reader reader) throws SerializationException {
Utils.checkNull(reader, "reader");
// Parse the XML stream
@@ -96,7 +100,7 @@
int event = xmlStreamReader.next();
switch (event) {
- case XMLStreamConstants.CHARACTERS: {
+ case XMLStreamConstants.CHARACTERS:
if (!xmlStreamReader.isWhiteSpace()) {
TextNode textNode = new TextNode(xmlStreamReader.getText());
@@ -111,9 +115,8 @@
}
break;
- }
- case XMLStreamConstants.START_ELEMENT: {
+ case XMLStreamConstants.START_ELEMENT:
// Create the element
String prefix = xmlStreamReader.getPrefix();
if (prefix != null && prefix.length() == 0) {
@@ -165,9 +168,8 @@
current = element;
break;
- }
- case XMLStreamConstants.END_ELEMENT: {
+ case XMLStreamConstants.END_ELEMENT:
// Notify listeners
if (xmlSerializerListeners != null) {
xmlSerializerListeners.endElement(this);
@@ -179,11 +181,9 @@
}
break;
- }
- default: {
+ default:
break;
- }
}
}
} catch (XMLStreamException exception) {
@@ -194,7 +194,7 @@
}
@Override
- public void writeObject(Element element, OutputStream outputStream) throws IOException,
+ public void writeObject(final Element element, final OutputStream outputStream) throws IOException,
SerializationException {
Utils.checkNull(outputStream, "outputStream");
@@ -204,7 +204,7 @@
writer.flush();
}
- public void writeObject(Element element, Writer writer) throws SerializationException {
+ public void writeObject(final Element element, final Writer writer) throws SerializationException {
Utils.checkNull(writer, "writer");
Utils.checkNull(element, "element");
@@ -220,7 +220,7 @@
}
}
- private void writeElement(Element element, XMLStreamWriter xmlStreamWriter)
+ private void writeElement(final Element element, final XMLStreamWriter xmlStreamWriter)
throws XMLStreamException, SerializationException {
String namespacePrefix = element.getNamespacePrefix();
String localName = element.getLocalName();
@@ -286,13 +286,13 @@
}
}
- private static void writeTextNode(TextNode textNode, XMLStreamWriter xmlStreamWriter)
+ private static void writeTextNode(final TextNode textNode, final XMLStreamWriter xmlStreamWriter)
throws XMLStreamException {
xmlStreamWriter.writeCharacters(textNode.getText());
}
@Override
- public String getMIMEType(Element object) {
+ public String getMIMEType(final Element object) {
return MIME_TYPE;
}
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
index 1198807..a8877ea 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
@@ -759,62 +759,52 @@
switch (keyCode) {
case KeyCode.KEYPAD_1:
- case KeyCode.N1: {
+ case KeyCode.N1:
selectedIndex = 0;
break;
- }
case KeyCode.KEYPAD_2:
- case KeyCode.N2: {
+ case KeyCode.N2:
selectedIndex = 1;
break;
- }
case KeyCode.KEYPAD_3:
- case KeyCode.N3: {
+ case KeyCode.N3:
selectedIndex = 2;
break;
- }
case KeyCode.KEYPAD_4:
- case KeyCode.N4: {
+ case KeyCode.N4:
selectedIndex = 3;
break;
- }
case KeyCode.KEYPAD_5:
- case KeyCode.N5: {
+ case KeyCode.N5:
selectedIndex = 4;
break;
- }
case KeyCode.KEYPAD_6:
- case KeyCode.N6: {
+ case KeyCode.N6:
selectedIndex = 5;
break;
- }
case KeyCode.KEYPAD_7:
- case KeyCode.N7: {
+ case KeyCode.N7:
selectedIndex = 6;
break;
- }
case KeyCode.KEYPAD_8:
- case KeyCode.N8: {
+ case KeyCode.N8:
selectedIndex = 7;
break;
- }
case KeyCode.KEYPAD_9:
- case KeyCode.N9: {
+ case KeyCode.N9:
selectedIndex = 8;
break;
- }
- default: {
+ default:
break;
- }
}
if (selectedIndex >= 0 && selectedIndex < panels.getLength()
@@ -827,25 +817,22 @@
int selectedIndex = accordion.getSelectedIndex();
switch (keyCode) {
- case KeyCode.UP: {
+ case KeyCode.UP:
do {
selectedIndex--;
} while (selectedIndex >= 0 && !panels.get(selectedIndex).isEnabled());
break;
- }
- case KeyCode.DOWN: {
+ case KeyCode.DOWN:
do {
selectedIndex++;
} while (selectedIndex < n && !panels.get(selectedIndex).isEnabled());
break;
- }
- default: {
+ default:
break;
- }
}
if (selectedIndex >= 0 && selectedIndex < n
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
index 46e151c..cefc1ed 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
@@ -251,39 +251,39 @@
int columnIndex = cellIndex % 7;
Component nextButton;
+ TablePane.Row row;
+
switch (keyCode) {
- case KeyCode.UP: {
+ case KeyCode.UP:
do {
rowIndex--;
if (rowIndex < 0) {
rowIndex = 5;
}
- TablePane.Row row = calendarTablePane.getRows().get(rowIndex + 2);
+ row = calendarTablePane.getRows().get(rowIndex + 2);
nextButton = row.get(columnIndex);
} while (!nextButton.isEnabled());
nextButton.requestFocus();
break;
- }
- case KeyCode.DOWN: {
+ case KeyCode.DOWN:
do {
rowIndex++;
if (rowIndex > 5) {
rowIndex = 0;
}
- TablePane.Row row = calendarTablePane.getRows().get(rowIndex + 2);
+ row = calendarTablePane.getRows().get(rowIndex + 2);
nextButton = row.get(columnIndex);
} while (!nextButton.isEnabled());
nextButton.requestFocus();
break;
- }
- case KeyCode.LEFT: {
- TablePane.Row row = calendarTablePane.getRows().get(rowIndex + 2);
+ case KeyCode.LEFT:
+ row = calendarTablePane.getRows().get(rowIndex + 2);
do {
columnIndex--;
@@ -296,10 +296,9 @@
nextButton.requestFocus();
break;
- }
- case KeyCode.RIGHT: {
- TablePane.Row row = calendarTablePane.getRows().get(rowIndex + 2);
+ case KeyCode.RIGHT:
+ row = calendarTablePane.getRows().get(rowIndex + 2);
do {
columnIndex++;
@@ -312,11 +311,9 @@
nextButton.requestFocus();
break;
- }
- default: {
+ default:
break;
- }
}
consumed = true;
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
index bea44f9..25600df 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
@@ -285,12 +285,11 @@
switch (mode) {
case OPEN:
case OPEN_MULTIPLE:
- case SAVE_TO: {
+ case SAVE_TO:
fileBrowserSheet.setSelectedFiles(fileBrowser.getSelectedFiles());
break;
- }
- case SAVE_AS: {
+ case SAVE_AS:
String fileName = saveAsTextInput.getText();
// Contents of the entry field could be:
// 1. Just a new file name in the current root directory
@@ -339,11 +338,9 @@
fileBrowserSheet.setSelectedFiles(new ArrayList<>(selectedFile));
}
break;
- }
- default: {
+ default:
break;
- }
}
updatingSelection = false;
@@ -364,33 +361,28 @@
(mode != FileBrowserSheet.Mode.SAVE_TO));
switch (mode) {
- case OPEN: {
+ case OPEN:
saveAsBoxPane.setVisible(false);
fileBrowser.setMultiSelect(false);
break;
- }
- case OPEN_MULTIPLE: {
+ case OPEN_MULTIPLE:
saveAsBoxPane.setVisible(false);
fileBrowser.setMultiSelect(true);
break;
- }
- case SAVE_AS: {
+ case SAVE_AS:
saveAsBoxPane.setVisible(true);
fileBrowser.setMultiSelect(false);
break;
- }
- case SAVE_TO: {
+ case SAVE_TO:
saveAsBoxPane.setVisible(false);
fileBrowser.setMultiSelect(false);
break;
- }
- default: {
+ default:
break;
- }
}
updateDisabledFileFilter();
@@ -451,24 +443,20 @@
switch (mode) {
case OPEN:
- case OPEN_MULTIPLE: {
+ case OPEN_MULTIPLE:
okButton.setEnabled(selectedFiles.getLength() > 0 && selectedDirectoryCount == 0);
break;
- }
- case SAVE_AS: {
+ case SAVE_AS:
okButton.setEnabled(saveAsTextInput.getCharacterCount() > 0);
break;
- }
- case SAVE_TO: {
+ case SAVE_TO:
okButton.setEnabled(selectedDirectoryCount > 0);
break;
- }
- default: {
+ default:
break;
- }
}
}
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
index 1ded90a..4c446ec 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
@@ -129,33 +129,28 @@
Color messageBackgroundColor = null;
switch (messageType) {
- case ERROR: {
+ case ERROR:
messageColor = errorMessageColor;
messageBackgroundColor = errorMessageBackgroundColor;
break;
- }
- case WARNING: {
+ case WARNING:
messageColor = warningMessageColor;
messageBackgroundColor = warningMessageBackgroundColor;
break;
- }
- case QUESTION: {
+ case QUESTION:
messageColor = questionMessageColor;
messageBackgroundColor = questionMessageBackgroundColor;
break;
- }
- case INFO: {
+ case INFO:
messageColor = infoMessageColor;
messageBackgroundColor = infoMessageBackgroundColor;
break;
- }
- default: {
+ default:
break;
- }
}
// Draw the label
@@ -263,33 +258,28 @@
Color color = null;
Color backgroundColor = null;
switch (messageType) {
- case ERROR: {
+ case ERROR:
color = errorMessageColor;
backgroundColor = errorMessageBackgroundColor;
break;
- }
- case WARNING: {
+ case WARNING:
color = warningMessageColor;
backgroundColor = warningMessageBackgroundColor;
break;
- }
- case QUESTION: {
+ case QUESTION:
color = questionMessageColor;
backgroundColor = questionMessageBackgroundColor;
break;
- }
- case INFO: {
+ case INFO:
color = infoMessageColor;
backgroundColor = infoMessageBackgroundColor;
break;
- }
- default: {
+ default:
break;
- }
}
flagMessageLabel.getStyles().put(Style.color, color);
@@ -828,26 +818,21 @@
Image flagIcon = null;
switch (messageType) {
- case ERROR: {
+ case ERROR:
flagIcon = errorIcon;
break;
- }
- case WARNING: {
+ case WARNING:
flagIcon = warningIcon;
break;
- }
- case QUESTION: {
+ case QUESTION:
flagIcon = questionIcon;
break;
- }
- case INFO: {
+ case INFO:
flagIcon = infoIcon;
break;
- }
- default: {
+ default:
flagIcon = infoIcon;
break;
- }
}
Label label = labels.get(sectionIndex).get(fieldIndex);
@@ -865,29 +850,24 @@
Color highlightColor = null;
switch (messageType) {
- case ERROR: {
+ case ERROR:
highlightColor = errorHighlightColor;
break;
- }
- case WARNING: {
+ case WARNING:
highlightColor = warningHighlightColor;
break;
- }
- case QUESTION: {
+ case QUESTION:
highlightColor = questionHighlightColor;
break;
- }
- case INFO: {
+ case INFO:
highlightColor = infoHighlightColor;
break;
- }
- default: {
+ default:
break;
- }
}
Bounds fieldBounds = field.getBounds();
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSplitPaneSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSplitPaneSkin.java
index 76f6ab7..c823193 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSplitPaneSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSplitPaneSkin.java
@@ -551,45 +551,36 @@
if (!splitPane.isLocked()) {
switch (splitPane.getOrientation()) {
- case HORIZONTAL: {
+ case HORIZONTAL:
switch (splitPane.getPrimaryRegion()) {
- case TOP_LEFT: {
+ case TOP_LEFT:
cursor = Cursor.RESIZE_EAST;
break;
- }
- case BOTTOM_RIGHT: {
+ case BOTTOM_RIGHT:
cursor = Cursor.RESIZE_WEST;
break;
- }
- default: {
+ default:
break;
- }
}
break;
- }
- case VERTICAL: {
+ case VERTICAL:
switch (splitPane.getPrimaryRegion()) {
- case TOP_LEFT: {
+ case TOP_LEFT:
cursor = Cursor.RESIZE_SOUTH;
break;
- }
- case BOTTOM_RIGHT: {
+ case BOTTOM_RIGHT:
cursor = Cursor.RESIZE_NORTH;
break;
- }
- default: {
+ default:
break;
- }
}
break;
- }
- default: {
+ default:
break;
- }
}
}
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
index 19d0d42..7e3e897 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
@@ -160,7 +160,7 @@
TextInput textInput = suggestionPopup.getTextInput();
switch (keyCode) {
- case KeyCode.TAB: {
+ case KeyCode.TAB:
returnFocusToTextInput = false;
suggestionPopup.close(true);
@@ -169,11 +169,9 @@
textInput.transferFocus(direction);
break;
- }
- default: {
+ default:
break;
- }
}
return false;
@@ -300,19 +298,16 @@
SuggestionPopup suggestionPopup = (SuggestionPopup) getComponent();
switch (keyCode) {
- case KeyCode.ENTER: {
+ case KeyCode.ENTER:
suggestionPopup.close(true);
break;
- }
- case KeyCode.ESCAPE: {
+ case KeyCode.ESCAPE:
suggestionPopup.close(false);
break;
- }
- default: {
+ default:
break;
- }
}
return false;
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
index 0712d2b..10150fd 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
@@ -162,7 +162,7 @@
int preferredWidth = 0;
int preferredHeight = 0;
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
preferredWidth = preferredContentSize.width + buttonPadding.left
+ buttonPadding.right + 2;
@@ -174,9 +174,8 @@
}
break;
- }
- case VERTICAL: {
+ case VERTICAL:
preferredWidth = preferredContentSize.height + buttonPadding.top
+ buttonPadding.bottom + 2;
@@ -188,11 +187,9 @@
}
break;
- }
- default: {
+ default:
break;
- }
}
Dimensions preferredSize = new Dimensions(preferredWidth, preferredHeight);
@@ -242,89 +239,75 @@
if (!themeIsFlat()) {
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
graphics.setPaint(new GradientPaint(width / 2f, 0, buttonBevelColor,
width / 2f, height / 2f, backgroundColor));
graphics.fill(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height - 1
+ buttonCornerRadius, buttonCornerRadius, buttonCornerRadius));
break;
- }
- case VERTICAL: {
+ case VERTICAL:
graphics.setPaint(new GradientPaint(0, height / 2f, buttonBevelColor,
width / 2f, height / 2f, backgroundColor));
graphics.fill(new RoundRectangle2D.Double(0.5, 0.5, width - 1
+ buttonCornerRadius, height - 1, buttonCornerRadius, buttonCornerRadius));
break;
- }
- default: {
+ default:
break;
- }
}
// Draw the border
- graphics.setPaint((tabButton.isSelected() || active) ? borderColor
- : inactiveBorderColor);
+ graphics.setPaint((tabButton.isSelected() || active) ? borderColor : inactiveBorderColor);
graphics.setStroke(new BasicStroke(1));
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height
+ buttonCornerRadius - 1, buttonCornerRadius, buttonCornerRadius));
break;
- }
- case VERTICAL: {
+ case VERTICAL:
graphics.draw(new RoundRectangle2D.Double(0.5, 0.5, width + buttonCornerRadius
- 1, height - 1, buttonCornerRadius, buttonCornerRadius));
break;
- }
- default: {
+ default:
break;
- }
}
if (!(tabButton.isSelected() || active)) {
graphics.setPaint(borderColor);
// Draw divider
switch (tabOrientation) {
- case HORIZONTAL: {
- graphics.draw(new Line2D.Double(0.5, height - 0.5, width - 0.5,
- height - 0.5));
+ case HORIZONTAL:
+ graphics.draw(new Line2D.Double(0.5, height - 0.5, width - 0.5, height - 0.5));
break;
- }
- case VERTICAL: {
+ case VERTICAL:
graphics.draw(new Line2D.Double(width - 0.5, 0.5, width - 0.5, height - 0.5));
break;
- }
- default: {
+ default:
break;
- }
}
}
} else {
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
graphics.setPaint(backgroundColor);
graphics.fill(new RoundRectangle2D.Double(0.5, 0.5, width - 1, height - 1
+ buttonCornerRadius, buttonCornerRadius, buttonCornerRadius));
break;
- }
- case VERTICAL: {
+ case VERTICAL:
graphics.setPaint(backgroundColor);
graphics.fill(new RoundRectangle2D.Double(0.5, 0.5, width - 1
+ buttonCornerRadius, height - 1, buttonCornerRadius, buttonCornerRadius));
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -336,40 +319,39 @@
Graphics2D contentGraphics = (Graphics2D) graphics.create();
GraphicsUtilities.setAntialiasingOff(contentGraphics);
+ int contentWidth;
+
switch (tabOrientation) {
- case HORIZONTAL: {
- int contentWidth = getWidth() - (buttonPadding.left + buttonPadding.right + 2);
+ case HORIZONTAL:
+ contentWidth = getWidth() - (buttonPadding.getWidth() + 2);
if (tabPane.isCloseable() && tabButton.isSelected()) {
contentWidth -= (CLOSE_TRIGGER_SIZE + buttonSpacing);
}
dataRenderer.setSize(Math.max(contentWidth, 0),
- Math.max(getHeight() - (buttonPadding.top + buttonPadding.bottom + 2), 0));
+ Math.max(getHeight() - (buttonPadding.getHeight() + 2), 0));
contentGraphics.translate(buttonPadding.left + 1, buttonPadding.top + 1);
break;
- }
- case VERTICAL: {
- int contentWidth = getHeight() - (buttonPadding.top + buttonPadding.bottom + 2);
+ case VERTICAL:
+ contentWidth = getHeight() - (buttonPadding.getHeight() + 2);
if (tabPane.isCloseable() && tabButton.isSelected()) {
contentWidth -= (CLOSE_TRIGGER_SIZE + buttonSpacing);
}
dataRenderer.setSize(Math.max(contentWidth, 0),
- Math.max(getWidth() - (buttonPadding.left + buttonPadding.right + 2), 0));
+ Math.max(getWidth() - (buttonPadding.getWidth() + 2), 0));
contentGraphics.translate(buttonPadding.top + 1, buttonPadding.left + 1);
contentGraphics.rotate(-Math.PI / 2d);
contentGraphics.translate(-dataRenderer.getWidth(), 0);
break;
- }
- default: {
+ default:
break;
- }
}
contentGraphics.clipRect(0, 0, dataRenderer.getWidth(), dataRenderer.getHeight());
@@ -384,27 +366,24 @@
int x = 0;
int y = 0;
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
x = width - (buttonPadding.right + CLOSE_TRIGGER_SIZE + 1);
y = (height - CLOSE_TRIGGER_SIZE) / 2;
break;
- }
- case VERTICAL: {
+ case VERTICAL:
x = (width - CLOSE_TRIGGER_SIZE) / 2;
y = height - (buttonPadding.bottom + CLOSE_TRIGGER_SIZE + 1);
break;
- }
- default: {
+ default:
break;
- }
}
- graphics.draw(new Line2D.Double(x, y, x + CLOSE_TRIGGER_SIZE - 1, y
- + CLOSE_TRIGGER_SIZE - 1));
- graphics.draw(new Line2D.Double(x, y + CLOSE_TRIGGER_SIZE - 1, x
- + CLOSE_TRIGGER_SIZE - 1, y));
+ graphics.draw(new Line2D.Double(x, y, x + CLOSE_TRIGGER_SIZE - 1,
+ y + CLOSE_TRIGGER_SIZE - 1));
+ graphics.draw(new Line2D.Double(x, y + CLOSE_TRIGGER_SIZE - 1,
+ x + CLOSE_TRIGGER_SIZE - 1, y));
}
}
@@ -453,23 +432,20 @@
// Include an extra 2 pixels around the trigger for ease of use
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
bounds = new Bounds(getWidth() - (CLOSE_TRIGGER_SIZE + buttonPadding.right + 1)
- 2, (getHeight() - CLOSE_TRIGGER_SIZE) / 2 - 2, CLOSE_TRIGGER_SIZE + 4,
CLOSE_TRIGGER_SIZE + 4);
break;
- }
- case VERTICAL: {
+ case VERTICAL:
bounds = new Bounds((getWidth() - CLOSE_TRIGGER_SIZE) / 2 - 2, getHeight()
- (CLOSE_TRIGGER_SIZE + buttonPadding.bottom + 1) - 2,
CLOSE_TRIGGER_SIZE + 4, CLOSE_TRIGGER_SIZE + 4);
break;
- }
- default: {
+ default:
break;
- }
}
return bounds;
@@ -646,7 +622,7 @@
Component corner = tabPane.getCorner();
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
if (height != -1) {
if (corner != null) {
height = Math.max(
@@ -671,9 +647,8 @@
preferredWidth = Math.max(preferredWidth, buttonAreaPreferredWidth);
break;
- }
- case VERTICAL: {
+ case VERTICAL:
if (height != -1) {
height = Math.max(height - (padding.top + padding.bottom + 2), 0);
}
@@ -699,11 +674,9 @@
}
break;
- }
- default: {
+ default:
break;
- }
}
return preferredWidth;
@@ -719,7 +692,7 @@
Component corner = tabPane.getCorner();
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
if (width != -1) {
width = Math.max(width - (padding.left + padding.right + 2), 0);
}
@@ -745,9 +718,8 @@
}
break;
- }
- case VERTICAL: {
+ case VERTICAL:
if (width != -1) {
if (corner != null) {
width = Math.max(
@@ -771,11 +743,9 @@
preferredHeight = Math.max(preferredHeight, buttonAreaPreferredHeight);
break;
- }
- default: {
+ default:
break;
- }
}
return preferredHeight;
@@ -792,7 +762,7 @@
Component corner = tabPane.getCorner();
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
if (selectedTab == null && selectionChangeTransition == null) {
preferredWidth = getPreferredTabWidth(-1) + (padding.left + padding.right + 2);
preferredHeight = 1;
@@ -823,9 +793,8 @@
preferredWidth = Math.max(preferredWidth, buttonAreaPreferredWidth);
break;
- }
- case VERTICAL: {
+ case VERTICAL:
if (selectedTab == null && selectionChangeTransition == null) {
preferredWidth = 1;
preferredHeight = getPreferredTabHeight(-1)
@@ -858,12 +827,11 @@
preferredHeight = Math.max(preferredHeight, buttonAreaPreferredHeight);
break;
- }
- default: {
+ default:
preferredWidth = 0;
preferredHeight = 0;
- }
+ break;
}
return new Dimensions(preferredWidth, preferredHeight);
@@ -933,12 +901,14 @@
Component corner = tabPane.getCorner();
Dimensions buttonPanoramaSize = tabButtonPanorama.getPreferredSize();
+ int buttonPanoramaWidth, buttonPanoramaHeight;
+ int buttonPanoramaX, buttonPanoramaY;
switch (tabOrientation) {
- case HORIZONTAL: {
- int buttonPanoramaWidth = Math.min(width, buttonPanoramaSize.width);
- int buttonPanoramaHeight = buttonPanoramaSize.height;
- int buttonPanoramaY = 0;
+ case HORIZONTAL:
+ buttonPanoramaWidth = Math.min(width, buttonPanoramaSize.width);
+ buttonPanoramaHeight = buttonPanoramaSize.height;
+ buttonPanoramaY = 0;
if (corner != null) {
int cornerWidth = Math.max(width - buttonPanoramaWidth - 2,
@@ -972,12 +942,11 @@
0);
break;
- }
- case VERTICAL: {
- int buttonPanoramaWidth = buttonPanoramaSize.width;
- int buttonPanoramaHeight = Math.min(height, buttonPanoramaSize.height);
- int buttonPanoramaX = 0;
+ case VERTICAL:
+ buttonPanoramaWidth = buttonPanoramaSize.width;
+ buttonPanoramaHeight = Math.min(height, buttonPanoramaSize.height);
+ buttonPanoramaX = 0;
if (corner != null) {
int cornerHeight = Math.max(height - buttonPanoramaHeight - 2,
@@ -1009,11 +978,9 @@
tabHeight = Math.max(height - (padding.top + padding.bottom + 2), 0);
break;
- }
- default: {
+ default:
break;
- }
}
// Lay out the tabs
@@ -1024,19 +991,16 @@
clipDecorator.setSize(tabWidth, tabHeight);
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
tab.setSize(tabWidth, getPreferredTabHeight(tabWidth));
break;
- }
- case VERTICAL: {
+ case VERTICAL:
tab.setSize(getPreferredTabWidth(tabHeight), tabHeight);
break;
- }
- default: {
+ default:
break;
- }
}
} else {
tab.setSize(tabWidth, tabHeight);
@@ -1060,27 +1024,24 @@
int height = 0;
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
x = 0;
y = Math.max(tabButtonPanorama.getY() + tabButtonPanorama.getHeight() - 1, 0);
width = tabPaneBounds.width;
height = Math.max(tabPaneBounds.height - y, 0);
break;
- }
- case VERTICAL: {
+ case VERTICAL:
x = Math.max(tabButtonPanorama.getX() + tabButtonPanorama.getWidth() - 1, 0);
y = 0;
width = Math.max(tabPaneBounds.width - x, 0);
height = tabPaneBounds.height;
break;
- }
- default: {
+ default:
break;
- }
}
TabButton activeTabButton;
@@ -1114,36 +1075,32 @@
graphics.draw(new Line2D.Double(left, bottom, right, bottom));
// Draw the left and top borders
+ Point selectedTabButtonLocation;
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
graphics.draw(new Line2D.Double(left, top, left, bottom));
- Point selectedTabButtonLocation = activeTabButton.mapPointToAncestor(tabPane,
- 0, 0);
+ selectedTabButtonLocation = activeTabButton.mapPointToAncestor(tabPane, 0, 0);
graphics.draw(new Line2D.Double(left, top, selectedTabButtonLocation.x + 0.5,
top));
graphics.draw(new Line2D.Double(selectedTabButtonLocation.x
+ activeTabButton.getWidth() - 0.5, top, right, top));
break;
- }
- case VERTICAL: {
+ case VERTICAL:
graphics.draw(new Line2D.Double(left, top, right, top));
- Point selectedTabButtonLocation = activeTabButton.mapPointToAncestor(tabPane,
- 0, 0);
+ selectedTabButtonLocation = activeTabButton.mapPointToAncestor(tabPane, 0, 0);
graphics.draw(new Line2D.Double(left, top, left,
selectedTabButtonLocation.y + 0.5));
graphics.draw(new Line2D.Double(left, selectedTabButtonLocation.y
+ activeTabButton.getHeight() - 0.5, left, bottom));
break;
- }
- default: {
+ default:
break;
- }
}
}
}
@@ -1377,17 +1334,14 @@
tabButtonBoxPane.setOrientation(tabOrientation);
switch (tabOrientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
tabButtonBoxPane.getStyles().put(Style.horizontalAlignment, HorizontalAlignment.LEFT);
break;
- }
- case VERTICAL: {
+ case VERTICAL:
tabButtonBoxPane.getStyles().put(Style.verticalAlignment, VerticalAlignment.TOP);
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -1431,58 +1385,49 @@
switch (keyCode) {
case KeyCode.KEYPAD_1:
- case KeyCode.N1: {
+ case KeyCode.N1:
selectedIndex = 0;
break;
- }
case KeyCode.KEYPAD_2:
- case KeyCode.N2: {
+ case KeyCode.N2:
selectedIndex = 1;
break;
- }
case KeyCode.KEYPAD_3:
- case KeyCode.N3: {
+ case KeyCode.N3:
selectedIndex = 2;
break;
- }
case KeyCode.KEYPAD_4:
- case KeyCode.N4: {
+ case KeyCode.N4:
selectedIndex = 3;
break;
- }
case KeyCode.KEYPAD_5:
- case KeyCode.N5: {
+ case KeyCode.N5:
selectedIndex = 4;
break;
- }
case KeyCode.KEYPAD_6:
- case KeyCode.N6: {
+ case KeyCode.N6:
selectedIndex = 5;
break;
- }
case KeyCode.KEYPAD_7:
- case KeyCode.N7: {
+ case KeyCode.N7:
selectedIndex = 6;
break;
- }
case KeyCode.KEYPAD_8:
- case KeyCode.N8: {
+ case KeyCode.N8:
selectedIndex = 7;
break;
- }
case KeyCode.KEYPAD_9:
- case KeyCode.N9: {
+ case KeyCode.N9:
selectedIndex = 8;
break;
- }
case KeyCode.TAB:
selectedIndex = tabPane.getSelectedIndex();
@@ -1501,9 +1446,8 @@
}
break;
- default: {
+ default:
break;
- }
}
if (selectedIndex >= 0 && selectedIndex < tabs.getLength()
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
index a32919f..44953c0 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
@@ -74,23 +74,20 @@
GeneralPath shape = new GeneralPath();
switch (sortDirection) {
- case ASCENDING: {
+ case ASCENDING:
shape.moveTo(0, 3);
shape.lineTo(3, 0);
shape.lineTo(6, 3);
break;
- }
- case DESCENDING: {
+ case DESCENDING:
shape.moveTo(0, 0);
shape.lineTo(3, 3);
shape.lineTo(6, 0);
break;
- }
- default: {
+ default:
break;
- }
}
shape.closePath();
@@ -325,19 +322,16 @@
if (sortDirection != null) {
switch (sortDirection) {
- case ASCENDING: {
+ case ASCENDING:
sortImage = sortAscendingImage;
break;
- }
- case DESCENDING: {
+ case DESCENDING:
sortImage = sortDescendingImage;
break;
- }
- default: {
+ default:
break;
- }
}
}
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
index 2ede143..b8be961 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
@@ -448,25 +448,26 @@
private int getAlignmentDeltaX(final TextLayout textLayout) {
int alignmentDeltaX = 0;
+
+ TextInput textInput;
+ int txtWidth, availWidth;
+
switch (horizontalAlignment) {
case LEFT:
default:
break;
- case CENTER: {
- TextInput textInput = (TextInput) getComponent();
- int txtWidth = getTextWidth(textLayout);
- int availWidth = textInput.getWidth() - (padding.getWidth() + 2);
+ case CENTER:
+ textInput = (TextInput) getComponent();
+ txtWidth = getTextWidth(textLayout);
+ availWidth = textInput.getWidth() - (padding.getWidth() + 2);
alignmentDeltaX = (availWidth - txtWidth) / 2;
break;
- }
- case RIGHT: {
- TextInput textInput = (TextInput) getComponent();
- int txtWidth = getTextWidth(textLayout);
- int availWidth = textInput.getWidth()
- - (padding.getWidth() + 2 + caret.width);
+ case RIGHT:
+ textInput = (TextInput) getComponent();
+ txtWidth = getTextWidth(textLayout);
+ availWidth = textInput.getWidth() - (padding.getWidth() + 2 + caret.width);
alignmentDeltaX = (availWidth - txtWidth);
break;
- }
}
return alignmentDeltaX;
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
index 7c4f956..57d508f 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
@@ -1673,7 +1673,7 @@
SelectMode selectMode = treeView.getSelectMode();
switch (keyCode) {
- case KeyCode.UP: {
+ case KeyCode.UP:
if (selectMode != SelectMode.NONE) {
Path firstSelectedPath = treeView.getFirstSelectedPath();
@@ -1703,9 +1703,8 @@
consumed = true;
}
break;
- }
- case KeyCode.DOWN: {
+ case KeyCode.DOWN:
if (selectMode != SelectMode.NONE) {
Path lastSelectedPath = treeView.getLastSelectedPath();
@@ -1736,9 +1735,8 @@
consumed = true;
}
break;
- }
- case KeyCode.LEFT: {
+ case KeyCode.LEFT:
if (showBranchControls) {
Sequence<Path> paths = treeView.getSelectedPaths();
@@ -1755,9 +1753,8 @@
}
}
break;
- }
- case KeyCode.RIGHT: {
+ case KeyCode.RIGHT:
if (showBranchControls) {
Sequence<Path> paths = treeView.getSelectedPaths();
@@ -1774,7 +1771,6 @@
}
}
break;
- }
default:
consumed = super.keyPressed(component, keyCode, keyLocation);
diff --git a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java
index 46d6f39..2609c44 100644
--- a/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java
+++ b/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraVFSBrowserSheetSkin.java
@@ -360,16 +360,15 @@
switch (mode) {
case OPEN:
case OPEN_MULTIPLE:
- case SAVE_TO: {
+ case SAVE_TO:
try {
fileBrowserSheet.setSelectedFiles(fileBrowser.getSelectedFiles());
} catch (FileSystemException fse) {
throw new RuntimeException(fse);
}
break;
- }
- case SAVE_AS: {
+ case SAVE_AS:
String fileName = saveAsTextInput.getText();
// Contents of the entry field could be:
// 1. Just a new file name in the current root directory
@@ -427,7 +426,7 @@
vote = Vote.DENY;
}
break;
- }
+
default:
break;
}
@@ -455,29 +454,26 @@
(mode != VFSBrowserSheet.Mode.SAVE_TO));
switch (mode) {
- case OPEN: {
+ case OPEN:
saveAsBoxPane.setVisible(false);
fileBrowser.setMultiSelect(false);
break;
- }
- case OPEN_MULTIPLE: {
+ case OPEN_MULTIPLE:
saveAsBoxPane.setVisible(false);
fileBrowser.setMultiSelect(true);
break;
- }
- case SAVE_AS: {
+ case SAVE_AS:
saveAsBoxPane.setVisible(true);
fileBrowser.setMultiSelect(false);
break;
- }
- case SAVE_TO: {
+ case SAVE_TO:
saveAsBoxPane.setVisible(false);
fileBrowser.setMultiSelect(false);
break;
- }
+
default:
break;
}
@@ -525,8 +521,7 @@
if (fileBrowser.getSelectedFiles().getLength() == 0 && selectedFiles.getLength() == 1) {
// The file does not currently exist; set the file name in the
- // text input if the parent directory is the same as the root
- // directory
+ // text input if the parent directory is the same as the root directory
FileObject selectedFile = selectedFiles.get(0);
try {
@@ -567,20 +562,18 @@
switch (mode) {
case OPEN:
- case OPEN_MULTIPLE: {
+ case OPEN_MULTIPLE:
okButton.setEnabled(selectedFiles.getLength() > 0 && selectedDirectoryCount == 0);
break;
- }
- case SAVE_AS: {
+ case SAVE_AS:
okButton.setEnabled(saveAsTextInput.getCharacterCount() > 0);
break;
- }
- case SAVE_TO: {
+ case SAVE_TO:
okButton.setEnabled(selectedDirectoryCount > 0);
break;
- }
+
default:
break;
}
diff --git a/wtk/src/org/apache/pivot/wtk/ApplicationContext.java b/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
index f3a1816..59fc0c3 100644
--- a/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
+++ b/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
@@ -957,20 +957,17 @@
super.processComponentEvent(event);
switch (event.getID()) {
- case ComponentEvent.COMPONENT_RESIZED: {
+ case ComponentEvent.COMPONENT_RESIZED:
if (scale == 1) {
display.setSize(Math.max(getWidth(), 0), Math.max(getHeight(), 0));
} else {
display.setSize(Math.max((int) Math.ceil(getWidth() / scale), 0),
Math.max((int) Math.ceil(getHeight() / scale), 0));
}
-
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -979,25 +976,20 @@
super.processFocusEvent(event);
switch (event.getID()) {
- case FocusEvent.FOCUS_GAINED: {
+ case FocusEvent.FOCUS_GAINED:
if (focusedComponent != null && focusedComponent.isShowing()
&& !focusedComponent.isBlocked()) {
focusedComponent.requestFocus();
}
-
break;
- }
- case FocusEvent.FOCUS_LOST: {
+ case FocusEvent.FOCUS_LOST:
focusedComponent = Component.getFocusedComponent();
Component.clearFocus();
-
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -1034,24 +1026,20 @@
// Get the button associated with this event
Mouse.Button button = null;
switch (event.getButton()) {
- case MouseEvent.BUTTON1: {
+ case MouseEvent.BUTTON1:
button = Mouse.Button.LEFT;
break;
- }
- case MouseEvent.BUTTON2: {
+ case MouseEvent.BUTTON2:
button = Mouse.Button.MIDDLE;
break;
- }
- case MouseEvent.BUTTON3: {
+ case MouseEvent.BUTTON3:
button = Mouse.Button.RIGHT;
break;
- }
- default: {
+ default:
break;
- }
}
// Process the event
@@ -1059,19 +1047,16 @@
if (eventID == MouseEvent.MOUSE_ENTERED || eventID == MouseEvent.MOUSE_EXITED) {
try {
switch (eventID) {
- case MouseEvent.MOUSE_ENTERED: {
+ case MouseEvent.MOUSE_ENTERED:
display.mouseOver();
break;
- }
- case MouseEvent.MOUSE_EXITED: {
+ case MouseEvent.MOUSE_EXITED:
display.mouseOut();
break;
- }
- default: {
+ default:
break;
- }
}
} catch (Throwable exception) {
handleUncaughtException(exception);
@@ -1096,12 +1081,14 @@
// Delegate the event to the owner
try {
+ boolean consumed;
+
switch (eventID) {
- case MouseEvent.MOUSE_PRESSED: {
+ case MouseEvent.MOUSE_PRESSED:
requestFocus();
requestFocusInWindow();
- boolean consumed = mouseOwner.mouseDown(button, x, y);
+ consumed = mouseOwner.mouseDown(button, x, y);
if (button == Mouse.Button.LEFT) {
dragLocation = new Point(x, y);
@@ -1138,8 +1125,7 @@
}
} while (component != null && component.isEnabled());
- // Show the context menu if it contains any
- // sections
+ // Show the context menu if it contains any sections
if (menu.getSections().getLength() > 0) {
menuPopup = new MenuPopup(menu);
@@ -1173,11 +1159,10 @@
}
break;
- }
- case MouseEvent.MOUSE_RELEASED: {
+ case MouseEvent.MOUSE_RELEASED:
if (dragDescendant == null) {
- boolean consumed = mouseOwner.mouseUp(button, x, y);
+ consumed = mouseOwner.mouseUp(button, x, y);
if (consumed) {
event.consume();
@@ -1212,11 +1197,9 @@
dragLocation = null;
break;
- }
- default: {
+ default:
break;
- }
}
} catch (Throwable exception) {
handleUncaughtException(exception);
@@ -1235,7 +1218,7 @@
try {
switch (event.getID()) {
case MouseEvent.MOUSE_MOVED:
- case MouseEvent.MOUSE_DRAGGED: {
+ case MouseEvent.MOUSE_DRAGGED:
if (dragDescendant == null) {
// A drag is not active
Component mouseCapturer = Mouse.getCapturer();
@@ -1254,8 +1237,7 @@
if (dragLocation != null
&& (Math.abs(x - dragLocation.x) > dragThreshold
|| Math.abs(y - dragLocation.y) > dragThreshold)) {
- // The user has dragged the mouse past the
- // drag threshold; try
+ // The user has dragged the mouse past the drag threshold; try
// to find a drag source
dragDescendant = display.getDescendantAt(dragLocation.x,
dragLocation.y);
@@ -1266,14 +1248,12 @@
}
if (dragDescendant == null || dragDescendant.isBlocked()) {
- // There was nothing to drag, so clear
- // the drag location
+ // There was nothing to drag, so clear the drag location
dragDescendant = null;
dragLocation = null;
} else {
DragSource dragSource = dragDescendant.getDragSource();
- dragLocation = dragDescendant.mapPointFromAncestor(display,
- x, y);
+ dragLocation = dragDescendant.mapPointFromAncestor(display, x, y);
if (dragLocation == null) {
dragLocation = display.getMouseLocation();
}
@@ -1283,11 +1263,9 @@
dragLocation.x, dragLocation.y)) {
// A drag has started
if (dragSource.isNative()) {
- startNativeDrag(dragSource, dragDescendant,
- event);
+ startNativeDrag(dragSource, dragDescendant, event);
- // Clear the drag state since it
- // is not used for
+ // Clear the drag state since it is not used for
// native drags
dragDescendant = null;
dragLocation = null;
@@ -1306,8 +1284,7 @@
// Get the drag content
dragManifest = dragSource.getContent();
- // Get the initial user drop
- // action
+ // Get the initial user drop action
userDropAction = getUserDropAction(event);
// Repaint the drag visual
@@ -1341,8 +1318,7 @@
if (dragLocation != null) {
DragSource dragSource = dragDescendant.getDragSource();
- // Get the previous and current drop descendant
- // and call
+ // Get the previous and current drop descendant and call
// move or exit/enter as appropriate
Component previousDropDescendant = dropDescendant;
dropDescendant = getDropDescendant(x, y);
@@ -1390,11 +1366,9 @@
}
break;
- }
- default: {
+ default:
break;
- }
}
} catch (Throwable exception) {
handleUncaughtException(exception);
@@ -1412,25 +1386,22 @@
// Get the scroll type
Mouse.ScrollType scrollType = null;
switch (event.getScrollType()) {
- case MouseWheelEvent.WHEEL_BLOCK_SCROLL: {
+ case MouseWheelEvent.WHEEL_BLOCK_SCROLL:
scrollType = Mouse.ScrollType.BLOCK;
break;
- }
- case MouseWheelEvent.WHEEL_UNIT_SCROLL: {
+ case MouseWheelEvent.WHEEL_UNIT_SCROLL:
scrollType = Mouse.ScrollType.UNIT;
break;
- }
- default: {
+ default:
break;
- }
}
// Process the event
try {
switch (event.getID()) {
- case MouseEvent.MOUSE_WHEEL: {
+ case MouseEvent.MOUSE_WHEEL:
if (Keyboard.isPressed(Keyboard.Modifier.CTRL)
&& Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
// Mouse wheel scaling
@@ -1466,11 +1437,9 @@
}
}
break;
- }
- default: {
+ default:
break;
- }
}
} catch (Throwable exception) {
handleUncaughtException(exception);
@@ -1510,40 +1479,36 @@
// Get the key location
Keyboard.KeyLocation keyLocation = null;
switch (awtKeyLocation) {
- case KeyEvent.KEY_LOCATION_STANDARD: {
+ case KeyEvent.KEY_LOCATION_STANDARD:
keyLocation = Keyboard.KeyLocation.STANDARD;
break;
- }
- case KeyEvent.KEY_LOCATION_LEFT: {
+ case KeyEvent.KEY_LOCATION_LEFT:
keyLocation = Keyboard.KeyLocation.LEFT;
break;
- }
- case KeyEvent.KEY_LOCATION_RIGHT: {
+ case KeyEvent.KEY_LOCATION_RIGHT:
keyLocation = Keyboard.KeyLocation.RIGHT;
break;
- }
- case KeyEvent.KEY_LOCATION_NUMPAD: {
+ case KeyEvent.KEY_LOCATION_NUMPAD:
keyLocation = Keyboard.KeyLocation.KEYPAD;
break;
- }
- default: {
+ default:
break;
- }
}
if (dragDescendant == null) {
// Process the event
Component focusedComponentLocal = Component.getFocusedComponent();
- switch (event.getID()) {
- case KeyEvent.KEY_PRESSED: {
- boolean consumed = false;
+ boolean consumed = false;
+ int keyCode;
- int keyCode = event.getKeyCode();
+ switch (event.getID()) {
+ case KeyEvent.KEY_PRESSED:
+ keyCode = event.getKeyCode();
if (Keyboard.isPressed(Keyboard.Modifier.CTRL)
&& Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
@@ -1581,12 +1546,9 @@
}
break;
- }
- case KeyEvent.KEY_RELEASED: {
- boolean consumed = false;
-
- int keyCode = event.getKeyCode();
+ case KeyEvent.KEY_RELEASED:
+ keyCode = event.getKeyCode();
try {
if (focusedComponentLocal == null) {
@@ -1612,11 +1574,8 @@
}
break;
- }
- case KeyEvent.KEY_TYPED: {
- boolean consumed = false;
-
+ case KeyEvent.KEY_TYPED:
char keyChar = event.getKeyChar();
try {
@@ -1642,11 +1601,9 @@
}
break;
- }
- default: {
+ default:
break;
- }
}
} else {
DragSource dragSource = dragDescendant.getDragSource();
@@ -2183,24 +2140,20 @@
DropAction dropAction = null;
switch (nativeDropAction) {
- case DnDConstants.ACTION_COPY: {
+ case DnDConstants.ACTION_COPY:
dropAction = DropAction.COPY;
break;
- }
- case DnDConstants.ACTION_MOVE: {
+ case DnDConstants.ACTION_MOVE:
dropAction = DropAction.MOVE;
break;
- }
- case DnDConstants.ACTION_LINK: {
+ case DnDConstants.ACTION_LINK:
dropAction = DropAction.LINK;
break;
- }
- default: {
+ default:
break;
- }
}
return dropAction;
@@ -2229,21 +2182,20 @@
if (dropAction != null) {
switch (dropAction) {
- case COPY: {
+ case COPY:
nativeDropAction = DnDConstants.ACTION_COPY;
break;
- }
- case MOVE: {
+
+ case MOVE:
nativeDropAction = DnDConstants.ACTION_MOVE;
break;
- }
- case LINK: {
+
+ case LINK:
nativeDropAction = DnDConstants.ACTION_LINK;
break;
- }
- default: {
+
+ default:
break;
- }
}
}
@@ -2258,21 +2210,20 @@
// Show the cursor for the drop action returned by the
// drop target
switch (dropAction) {
- case COPY: {
+ case COPY:
cursor = java.awt.dnd.DragSource.DefaultCopyDrop;
break;
- }
- case MOVE: {
+
+ case MOVE:
cursor = java.awt.dnd.DragSource.DefaultMoveDrop;
break;
- }
- case LINK: {
+
+ case LINK:
cursor = java.awt.dnd.DragSource.DefaultLinkDrop;
break;
- }
- default: {
+
+ default:
break;
- }
}
}
diff --git a/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java b/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
index 6bf14b5..7bb126c 100644
--- a/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
+++ b/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
@@ -240,17 +240,14 @@
super.processWindowEvent(event);
switch (event.getID()) {
- case WindowEvent.WINDOW_CLOSING: {
+ case WindowEvent.WINDOW_CLOSING:
exit();
break;
- }
- case WindowEvent.WINDOW_CLOSED: {
+ case WindowEvent.WINDOW_CLOSED:
System.exit(0);
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -259,25 +256,22 @@
super.processWindowStateEvent(event);
switch (event.getID()) {
- case WindowEvent.WINDOW_ICONIFIED: {
+ case WindowEvent.WINDOW_ICONIFIED:
try {
application.suspend();
} catch (Throwable exception) {
handleUncaughtException(exception);
}
break;
- }
- case WindowEvent.WINDOW_DEICONIFIED: {
+ case WindowEvent.WINDOW_DEICONIFIED:
try {
application.resume();
} catch (Throwable exception) {
handleUncaughtException(exception);
}
break;
- }
- default: {
+ default:
break;
- }
}
}
}
@@ -331,9 +325,10 @@
public void processWindowEvent(WindowEvent event) {
super.processWindowEvent(event);
+ Display display;
switch (event.getID()) {
- case WindowEvent.WINDOW_OPENED: {
- Display display = this.displayHost.getDisplay();
+ case WindowEvent.WINDOW_OPENED:
+ display = this.displayHost.getDisplay();
displays.add(display);
if (this.displayCloseListener != null) {
@@ -341,26 +336,20 @@
}
this.displayHost.requestFocus();
-
break;
- }
- case WindowEvent.WINDOW_CLOSING: {
+ case WindowEvent.WINDOW_CLOSING:
dispose();
break;
- }
- case WindowEvent.WINDOW_CLOSED: {
- Display display = this.displayHost.getDisplay();
+ case WindowEvent.WINDOW_CLOSED:
+ display = this.displayHost.getDisplay();
displays.remove(display);
if (this.displayCloseListener != null) {
this.displayCloseListener.hostWindowClosed(display);
}
-
break;
- }
- default: {
+ default:
break;
- }
}
}
}
@@ -893,9 +882,12 @@
/**
* Utility method to make it easier to define <tt>main()</tt> entry-points
- * into applications. For example: <code> public class MyApp implements
- * Application { public static void main(String[] args) throws Exception {
- * DesktopApplicationContext.main(MyApp.class, args); } } </code>
+ * into applications. For example:
+ * <pre> public class MyApp implements Application {
+ * public static void main(String[] args) throws Exception {
+ * DesktopApplicationContext.main(MyApp.class, args);
+ * }
+ * } </pre>
*
* @param applicationClass the class of Application entry point
* @param applicationArgs application arguments
diff --git a/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java b/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
index abadcce..2f66de8 100644
--- a/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
+++ b/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
@@ -95,17 +95,14 @@
final int length, final Orientation orientation, final int thickness) {
if (length > 0 && thickness > 0) {
switch (orientation) {
- case HORIZONTAL: {
+ case HORIZONTAL:
graphics.fillRect(x, y, length, thickness);
break;
- }
- case VERTICAL: {
+ case VERTICAL:
graphics.fillRect(x, y, thickness, length);
break;
- }
- default: {
+ default:
break;
- }
}
}
}
@@ -199,7 +196,7 @@
* formats listed above.
* @see CSSColor
*/
- public static Color decodeColor(final String value, String argument) throws NumberFormatException {
+ public static Color decodeColor(final String value, final String argument) throws NumberFormatException {
Utils.checkNullOrEmpty(value, argument == null ? "color" : argument);
Color color = null;
@@ -272,7 +269,7 @@
* @param alpha The opacity value (0.0 - 1.0).
* @return The full color value from these two parts.
*/
- public static Color getColor(int rgb, float alpha) {
+ public static Color getColor(final int rgb, final float alpha) {
float red = ((rgb >> 16) & 0xff) / 255f;
float green = ((rgb >> 8) & 0xff) / 255f;
float blue = (rgb >> 0 & 0xff) / 255f;
@@ -291,7 +288,7 @@
* @throws IllegalArgumentException if the given value is {@code null} or
* empty or there is a problem decoding the value.
*/
- public static Paint decodePaint(String value) {
+ public static Paint decodePaint(final String value) {
Utils.checkNullOrEmpty(value, "paint");
Paint paint;
@@ -333,7 +330,7 @@
* @return The fully decoded paint value.
* @throws IllegalArgumentException if there is no paint type key found.
*/
- public static Paint decodePaint(Dictionary<String, ?> dictionary) {
+ public static Paint decodePaint(final Dictionary<String, ?> dictionary) {
Utils.checkNull(dictionary, "paint dictionary");
String paintType = JSON.get(dictionary, PAINT_TYPE_KEY);
@@ -342,33 +339,32 @@
}
Paint paint;
- switch (PaintType.valueOf(paintType.toUpperCase(Locale.ENGLISH))) {
- case SOLID_COLOR: {
- String color = JSON.get(dictionary, COLOR_KEY);
- paint = decodeColor(color);
- break;
- }
+ float startX, startY;
+ float endX, endY;
- case GRADIENT: {
- float startX = JSON.getFloat(dictionary, START_X_KEY);
- float startY = JSON.getFloat(dictionary, START_Y_KEY);
- float endX = JSON.getFloat(dictionary, END_X_KEY);
- float endY = JSON.getFloat(dictionary, END_Y_KEY);
+ switch (PaintType.valueOf(paintType.toUpperCase(Locale.ENGLISH))) {
+ case SOLID_COLOR:
+ paint = decodeColor((String) JSON.get(dictionary, COLOR_KEY));
+ break;
+
+ case GRADIENT:
+ startX = JSON.getFloat(dictionary, START_X_KEY);
+ startY = JSON.getFloat(dictionary, START_Y_KEY);
+ endX = JSON.getFloat(dictionary, END_X_KEY);
+ endY = JSON.getFloat(dictionary, END_Y_KEY);
Color startColor = decodeColor((String) JSON.get(dictionary, START_COLOR_KEY));
Color endColor = decodeColor((String) JSON.get(dictionary, END_COLOR_KEY));
paint = new GradientPaint(startX, startY, startColor, endX, endY, endColor);
break;
- }
case LINEAR_GRADIENT: {
- float startX = JSON.getFloat(dictionary, START_X_KEY);
- float startY = JSON.getFloat(dictionary, START_Y_KEY);
- float endX = JSON.getFloat(dictionary, END_X_KEY);
- float endY = JSON.getFloat(dictionary, END_Y_KEY);
+ startX = JSON.getFloat(dictionary, START_X_KEY);
+ startY = JSON.getFloat(dictionary, START_Y_KEY);
+ endX = JSON.getFloat(dictionary, END_X_KEY);
+ endY = JSON.getFloat(dictionary, END_Y_KEY);
@SuppressWarnings("unchecked")
- List<Dictionary<String, ?>> stops = (List<Dictionary<String, ?>>) JSON.get(
- dictionary, STOPS_KEY);
+ List<Dictionary<String, ?>> stops = (List<Dictionary<String, ?>>) JSON.get(dictionary, STOPS_KEY);
int n = stops.getLength();
float[] fractions = new float[n];
@@ -393,8 +389,7 @@
float radius = JSON.getFloat(dictionary, RADIUS_KEY);
@SuppressWarnings("unchecked")
- List<Dictionary<String, ?>> stops = (List<Dictionary<String, ?>>) JSON.get(
- dictionary, STOPS_KEY);
+ List<Dictionary<String, ?>> stops = (List<Dictionary<String, ?>>) JSON.get(dictionary, STOPS_KEY);
int n = stops.getLength();
float[] fractions = new float[n];
@@ -413,9 +408,8 @@
break;
}
- default: {
+ default:
throw new UnsupportedOperationException();
- }
}
return paint;
@@ -427,7 +421,7 @@
* @param graphics The graphics object to initialize.
* @param fontRenderContext The source of the font rendering hints.
*/
- public static void setFontRenderingHints(Graphics2D graphics, FontRenderContext fontRenderContext) {
+ public static void setFontRenderingHints(final Graphics2D graphics, final FontRenderContext fontRenderContext) {
graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
fontRenderContext.getAntiAliasingHint());
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
@@ -442,8 +436,8 @@
* @param font The font to use.
* @param color The foreground color for the text.
*/
- public static void prepareForText(Graphics2D graphics, FontRenderContext fontRenderContext,
- Font font, Color color) {
+ public static void prepareForText(final Graphics2D graphics, final FontRenderContext fontRenderContext,
+ final Font font, final Color color) {
setFontRenderingHints(graphics, fontRenderContext);
graphics.setFont(font);
@@ -457,7 +451,7 @@
* @param graphics The graphics object to prepare.
* @return The {@link Platform#getFontRenderContext} value.
*/
- public static FontRenderContext prepareForText(Graphics2D graphics) {
+ public static FontRenderContext prepareForText(final Graphics2D graphics) {
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
setFontRenderingHints(graphics, fontRenderContext);
@@ -474,7 +468,7 @@
* @param color The foreground color for the text.
* @return The font render context for the platform.
*/
- public static FontRenderContext prepareForText(Graphics2D graphics, Font font, Color color) {
+ public static FontRenderContext prepareForText(final Graphics2D graphics, final Font font, final Color color) {
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
prepareForText(graphics, fontRenderContext, font, color);
return fontRenderContext;
@@ -489,7 +483,7 @@
* @return The bounding rectangle to use for the average character size.
* @see Platform#getFontRenderContext
*/
- public static Dimensions getAverageCharacterSize(Font font) {
+ public static Dimensions getAverageCharacterSize(final Font font) {
int missingGlyphCode = font.getMissingGlyphCode();
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
@@ -513,8 +507,8 @@
* @param topOffset Same for vertical offset.
* @return The resulting rectangle for the caret.
*/
- public static Rectangle getCaretRectangle(TextHitInfo caret, AttributedCharacterIterator text,
- int leftOffset, int topOffset) {
+ public static Rectangle getCaretRectangle(final TextHitInfo caret, final AttributedCharacterIterator text,
+ final int leftOffset, final int topOffset) {
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
TextLayout layout = new TextLayout(text, fontRenderContext);
Shape caretShape = layout.getCaretShape(caret);
@@ -533,8 +527,8 @@
* @param bottom The bottom interior coordinate (height - 1)
* @param right The right interior coordinate (width - 1)
*/
- public static void drawBorders(Graphics2D graphics, Borders borders, int top, int left,
- int bottom, int right) {
+ public static void drawBorders(final Graphics2D graphics, final Borders borders, final int top, final int left,
+ final int bottom, final int right) {
// The single line/object cases, or the first of the multiple line cases
switch (borders) {
default:
diff --git a/wtk/src/org/apache/pivot/wtk/ImageView.java b/wtk/src/org/apache/pivot/wtk/ImageView.java
index 1953d9a8..657522c 100644
--- a/wtk/src/org/apache/pivot/wtk/ImageView.java
+++ b/wtk/src/org/apache/pivot/wtk/ImageView.java
@@ -120,7 +120,7 @@
*
* @param image The initial image to set, or <tt>null</tt> for no image.
*/
- public ImageView(Image image) {
+ public ImageView(final Image image) {
setImage(image);
installSkin(ImageView.class);
@@ -131,7 +131,7 @@
*
* @return The current image, or <tt>null</tt> if no image is set.
*/
- public Image getImage() {
+ public final Image getImage() {
return image;
}
@@ -140,7 +140,7 @@
*
* @param image The image to set, or <tt>null</tt> for no image.
*/
- public void setImage(Image image) {
+ public final void setImage(final Image image) {
Image previousImage = this.image;
if (previousImage != image) {
@@ -179,7 +179,7 @@
} else {
Image.load(imageURL, new TaskAdapter<>(new TaskListener<Image>() {
@Override
- public void taskExecuted(Task<Image> task) {
+ public void taskExecuted(final Task<Image> task) {
Image imageLoadedLocal = task.getResult();
// Update the contents of all image views that requested this image
@@ -194,7 +194,7 @@
}
@Override
- public void executeFailed(Task<Image> task) {
+ public void executeFailed(final Task<Image> task) {
// No-op
}
}));
@@ -217,7 +217,7 @@
* @see #setImage(URL)
* @see ImageUtils#findByName(String,String)
*/
- public final void setImage(String imageName) {
+ public final void setImage(final String imageName) {
setImage(ImageUtils.findByName(imageName, "image"));
}
@@ -238,7 +238,7 @@
* loaded in the background; <tt>false</tt> if they will be loaded
* synchronously.
*/
- public void setAsynchronous(boolean asynchronous) {
+ public void setAsynchronous(final boolean asynchronous) {
if (this.asynchronous != asynchronous) {
this.asynchronous = asynchronous;
imageViewListeners.asynchronousChanged(this);
@@ -259,7 +259,7 @@
*
* @param imageKey The image key, or <tt>null</tt> to clear the binding.
*/
- public void setImageKey(String imageKey) {
+ public void setImageKey(final String imageKey) {
String previousImageKey = this.imageKey;
if (previousImageKey != imageKey) {
@@ -272,7 +272,7 @@
return imageBindType;
}
- public void setImageBindType(BindType imageBindType) {
+ public void setImageBindType(final BindType imageBindType) {
Utils.checkNull(imageBindType, "imageBindType");
BindType previousImageBindType = this.imageBindType;
@@ -287,7 +287,7 @@
return imageBindMapping;
}
- public void setImageBindMapping(ImageBindMapping imageBindMapping) {
+ public void setImageBindMapping(final ImageBindMapping imageBindMapping) {
ImageBindMapping previousImageBindMapping = this.imageBindMapping;
if (previousImageBindMapping != imageBindMapping) {
@@ -297,31 +297,27 @@
}
@Override
- public void load(Object context) {
+ public void load(final Object context) {
if (imageKey != null && JSON.containsKey(context, imageKey)
&& imageBindType != BindType.STORE) {
Object value = JSON.get(context, imageKey);
if (imageBindMapping != null) {
switch (imageBindMapping.getType()) {
- case IMAGE: {
+ case IMAGE:
value = imageBindMapping.toImage(value);
break;
- }
- case URL: {
+ case URL:
value = imageBindMapping.toImageURL(value);
break;
- }
- case NAME: {
+ case NAME:
value = imageBindMapping.toImageName(value);
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -332,14 +328,13 @@
} else if (value instanceof String) {
setImage((String) value);
} else {
- throw new IllegalArgumentException(getClass().getName() + " can't bind to " + value
- + ".");
+ throw new IllegalArgumentException(getClass().getName() + " can't bind to " + value + ".");
}
}
}
@Override
- public void store(Object context) {
+ public void store(final Object context) {
if (imageKey != null && imageBindType != BindType.LOAD) {
JSON.put(context, imageKey,
(imageBindMapping == null) ? image : imageBindMapping.valueOf(image));
diff --git a/wtk/src/org/apache/pivot/wtk/ListView.java b/wtk/src/org/apache/pivot/wtk/ListView.java
index b8904af..cdbc80b 100644
--- a/wtk/src/org/apache/pivot/wtk/ListView.java
+++ b/wtk/src/org/apache/pivot/wtk/ListView.java
@@ -1595,7 +1595,7 @@
}
switch (selectMode) {
- case SINGLE: {
+ case SINGLE:
// Bind using selected item key
if (selectedItemKey != null && selectedItemBindType != BindType.STORE
&& JSON.containsKey(context, selectedItemKey)) {
@@ -1612,9 +1612,8 @@
}
break;
- }
- case MULTI: {
+ case MULTI:
// Bind using selected items key
if (selectedItemsKey != null && selectedItemsBindType != BindType.STORE
&& JSON.containsKey(context, selectedItemsKey)) {
@@ -1639,15 +1638,12 @@
}
break;
- }
- case NONE: {
+ case NONE:
break;
- }
- default: {
+ default:
break;
- }
}
if (checkmarksEnabled) {
@@ -1719,7 +1715,7 @@
}
switch (selectMode) {
- case SINGLE: {
+ case SINGLE:
// Bind using selected item key
if (selectedItemKey != null && selectedItemBindType != BindType.LOAD) {
Object item;
@@ -1739,9 +1735,8 @@
}
break;
- }
- case MULTI: {
+ case MULTI:
// Bind using selected items key
if (selectedItemsKey != null && selectedItemsBindType != BindType.LOAD) {
ArrayList<Object> items = new ArrayList<>();
@@ -1766,15 +1761,12 @@
}
break;
- }
- case NONE: {
+ case NONE:
break;
- }
- default: {
+ default:
break;
- }
}
if (checkmarksEnabled) {
diff --git a/wtk/src/org/apache/pivot/wtk/TableView.java b/wtk/src/org/apache/pivot/wtk/TableView.java
index 27596b7..d31e7fd 100644
--- a/wtk/src/org/apache/pivot/wtk/TableView.java
+++ b/wtk/src/org/apache/pivot/wtk/TableView.java
@@ -84,7 +84,7 @@
*
* @param name The column name.
*/
- public Column(String name) {
+ public Column(final String name) {
this(null, name, null, DEFAULT_WIDTH, false);
}
@@ -94,7 +94,7 @@
* @param name The column name.
* @param headerData The column header data.
*/
- public Column(String name, Object headerData) {
+ public Column(final String name, final Object headerData) {
this(null, name, headerData, DEFAULT_WIDTH, false);
}
@@ -105,7 +105,7 @@
* @param headerData The column header data.
* @param width The width of the column.
*/
- public Column(String name, Object headerData, int width) {
+ public Column(final String name, final Object headerData, final int width) {
this(null, name, headerData, width, false);
}
@@ -118,27 +118,28 @@
* @param relative If <tt>true</tt>, specifies a relative column width;
* otherwise, specifies a fixed column width.
*/
- public Column(String name, Object headerData, int width, boolean relative) {
+ public Column(final String name, final Object headerData, final int width, final boolean relative) {
this(null, name, headerData, width, relative);
}
- public Column(TableView tableView) {
+ public Column(final TableView tableView) {
this(tableView, null, null, DEFAULT_WIDTH, false);
}
- public Column(TableView tableView, String name) {
+ public Column(final TableView tableView, final String name) {
this(tableView, name, null, DEFAULT_WIDTH, false);
}
- public Column(TableView tableView, String name, Object headerData) {
+ public Column(final TableView tableView, final String name, final Object headerData) {
this(tableView, name, headerData, DEFAULT_WIDTH, false);
}
- public Column(TableView tableView, String name, Object headerData, int width) {
+ public Column(final TableView tableView, final String name, final Object headerData, final int width) {
this(tableView, name, headerData, width, false);
}
- public Column(TableView tableView, String name, Object headerData, int width, boolean relative) {
+ public Column(final TableView tableView, final String name, final Object headerData, final int width,
+ final boolean relative) {
setName(name);
setHeaderData(headerData);
setWidth(width, relative);
@@ -171,7 +172,7 @@
*
* @param name The column name.
*/
- public void setName(String name) {
+ public void setName(final String name) {
String previousName = this.name;
if (previousName != name) {
@@ -199,7 +200,7 @@
* @param headerData The column header data, or <tt>null</tt> for no
* header data.
*/
- public void setHeaderData(Object headerData) {
+ public void setHeaderData(final Object headerData) {
Object previousHeaderData = this.headerData;
if (previousHeaderData != headerData) {
@@ -224,7 +225,7 @@
*
* @param headerDataRenderer The new renderer for the header data.
*/
- public void setHeaderDataRenderer(HeaderDataRenderer headerDataRenderer) {
+ public void setHeaderDataRenderer(final HeaderDataRenderer headerDataRenderer) {
Utils.checkNull(headerDataRenderer, "Header data renderer");
HeaderDataRenderer previousHeaderDataRenderer = this.headerDataRenderer;
@@ -262,7 +263,7 @@
*
* @param width The absolute width of the column.
*/
- public void setWidth(int width) {
+ public void setWidth(final int width) {
setWidth(width, false);
}
@@ -273,7 +274,7 @@
* the '*' character, it is treated as a relative value. Otherwise, it
* is considered an absolute value.
*/
- public void setWidth(String width) {
+ public void setWidth(final String width) {
boolean relativeLocal = false;
if (width.endsWith("*")) {
@@ -292,7 +293,7 @@
* @param relative <tt>true</tt> if the column width is relative,
* <tt>false</tt> if it is fixed.
*/
- public void setWidth(int width, boolean relative) {
+ public void setWidth(final int width, final boolean relative) {
if (width < (relative ? 0 : -1)) {
throw new IllegalArgumentException("illegal width " + width);
}
@@ -324,7 +325,7 @@
* @param minimumWidth Column width cannot be smaller than this size.
* @param maximumWidth Column width cannot be greater than this size.
*/
- public void setWidthLimits(int minimumWidth, int maximumWidth) {
+ public void setWidthLimits(final int minimumWidth, final int maximumWidth) {
if (minimumWidth < 0) {
throw new IllegalArgumentException("Minimum width is negative, " + minimumWidth);
}
@@ -353,7 +354,7 @@
*
* @param widthLimits The new width limits.
*/
- public void setWidthLimits(Limits widthLimits) {
+ public void setWidthLimits(final Limits widthLimits) {
setWidthLimits(widthLimits.minimum, widthLimits.maximum);
}
@@ -371,7 +372,7 @@
*
* @param minimumWidth Minimum column width.
*/
- public void setMinimumWidth(int minimumWidth) {
+ public void setMinimumWidth(final int minimumWidth) {
setWidthLimits(minimumWidth, maximumWidth);
}
@@ -389,7 +390,7 @@
*
* @param maximumWidth Maximum column width.
*/
- public void setMaximumWidth(int maximumWidth) {
+ public void setMaximumWidth(final int maximumWidth) {
setWidthLimits(minimumWidth, maximumWidth);
}
@@ -408,7 +409,7 @@
*
* @param filter The column's filter, or <tt>null</tt> for no filter.
*/
- public void setFilter(Object filter) {
+ public void setFilter(final Object filter) {
Object previousFilter = this.filter;
if (previousFilter != filter) {
@@ -436,7 +437,7 @@
* @param cellRenderer The cell renderer that is used to draw the
* contents of this column.
*/
- public void setCellRenderer(CellRenderer cellRenderer) {
+ public void setCellRenderer(final CellRenderer cellRenderer) {
Utils.checkNull(cellRenderer, "Cell renderer");
CellRenderer previousCellRenderer = this.cellRenderer;
@@ -631,7 +632,7 @@
*/
public final class ColumnSequence implements Sequence<Column>, Iterable<Column> {
@Override
- public int add(Column column) {
+ public int add(final Column column) {
int index = getLength();
insert(column, index);
@@ -639,7 +640,7 @@
}
@Override
- public void insert(Column column, int index) {
+ public void insert(final Column column, final int index) {
Utils.checkNull(column, "Column");
if (column.tableView != null) {
@@ -654,12 +655,12 @@
}
@Override
- public Column update(int index, Column column) {
+ public Column update(final int index, final Column column) {
throw new UnsupportedOperationException();
}
@Override
- public int remove(Column column) {
+ public int remove(final Column column) {
int index = indexOf(column);
if (index != -1) {
remove(index, 1);
@@ -669,7 +670,7 @@
}
@Override
- public Sequence<Column> remove(int index, int count) {
+ public Sequence<Column> remove(final int index, final int count) {
Sequence<Column> removed = columns.remove(index, count);
if (count > 0) {
@@ -684,12 +685,12 @@
}
@Override
- public Column get(int index) {
+ public Column get(final int index) {
return columns.get(index);
}
@Override
- public int indexOf(Column column) {
+ public int indexOf(final Column column) {
return columns.indexOf(column);
}
@@ -710,12 +711,12 @@
public final class SortDictionary implements Dictionary<String, SortDirection>,
Iterable<String> {
@Override
- public SortDirection get(String columnName) {
+ public SortDirection get(final String columnName) {
return sortMap.get(columnName);
}
@Override
- public SortDirection put(String columnName, SortDirection sortDirection) {
+ public SortDirection put(final String columnName, final SortDirection sortDirection) {
SortDirection previousSortDirection;
if (sortDirection == null) {
@@ -737,7 +738,7 @@
}
@Override
- public SortDirection remove(String columnName) {
+ public SortDirection remove(final String columnName) {
SortDirection sortDirection = null;
if (containsKey(columnName)) {
@@ -750,7 +751,7 @@
}
@Override
- public boolean containsKey(String columnName) {
+ public boolean containsKey(final String columnName) {
return sortMap.containsKey(columnName);
}
@@ -758,7 +759,7 @@
return sortMap.isEmpty();
}
- public Dictionary.Pair<String, SortDirection> get(int index) {
+ public Dictionary.Pair<String, SortDirection> get(final int index) {
String columnName = sortList.get(index);
SortDirection sortDirection = sortMap.get(columnName);
@@ -806,7 +807,7 @@
private ListListener<Object> tableDataListener = new ListListener<Object>() {
@Override
- public void itemInserted(List<Object> list, int index) {
+ public void itemInserted(final List<Object> list, final int index) {
// Increment selected ranges
int updated = rangeSelection.insertIndex(index);
@@ -820,7 +821,7 @@
}
@Override
- public void itemsRemoved(List<Object> list, int index, Sequence<Object> items) {
+ public void itemsRemoved(final List<Object> list, final int index, final Sequence<Object> items) {
int count = items.getLength();
int previousSelectedIndex;
@@ -847,12 +848,12 @@
}
@Override
- public void itemUpdated(List<Object> list, int index, Object previousItem) {
+ public void itemUpdated(final List<Object> list, final int index, final Object previousItem) {
tableViewRowListeners.rowUpdated(TableView.this, index);
}
@Override
- public void listCleared(List<Object> list) {
+ public void listCleared(final List<Object> list) {
int cleared = rangeSelection.getLength();
rangeSelection.clear();
@@ -869,7 +870,7 @@
}
@Override
- public void comparatorChanged(List<Object> list, Comparator<Object> previousComparator) {
+ public void comparatorChanged(final List<Object> list, final Comparator<Object> previousComparator) {
if (list.getComparator() != null) {
int cleared = rangeSelection.getLength();
rangeSelection.clear();
@@ -910,13 +911,13 @@
*
* @param tableData The initial data for this table view.
*/
- public TableView(List<?> tableData) {
+ public TableView(final List<?> tableData) {
setTableData(tableData);
installSkin(TableView.class);
}
@Override
- protected void setSkin(org.apache.pivot.wtk.Skin skin) {
+ protected void setSkin(final org.apache.pivot.wtk.Skin skin) {
checkSkin(skin, TableView.Skin.class);
super.setSkin(skin);
@@ -952,7 +953,7 @@
* @param tableData The data to be presented by the table view.
*/
@SuppressWarnings("unchecked")
- public void setTableData(List<?> tableData) {
+ public void setTableData(final List<?> tableData) {
Utils.checkNull(tableData, "Table data");
List<?> previousTableData = this.tableData;
@@ -989,9 +990,9 @@
* Sets the table data.
*
* @param tableData A JSON string (must begin with <tt>[</tt> and end with
- * <tt>]</tt>) denoting the data to be presented by the table view.
+ * <tt>]</tt>, denoting a list) which will be the data to be presented by the table view.
*/
- public final void setTableData(String tableData) {
+ public final void setTableData(final String tableData) {
Utils.checkNull(tableData, "Table data");
try {
@@ -1007,7 +1008,7 @@
* @param tableData A URL referring to a JSON file containing the data to be
* presented by the table view.
*/
- public void setTableData(URL tableData) {
+ public void setTableData(final URL tableData) {
Utils.checkNull(tableData, "URL for table data");
JSONSerializer jsonSerializer = new JSONSerializer();
@@ -1025,7 +1026,7 @@
return columnSource;
}
- public void setColumnSource(TableView columnSource) {
+ public void setColumnSource(final TableView columnSource) {
TableView previousColumnSource = this.columnSource;
if (previousColumnSource != columnSource) {
@@ -1048,7 +1049,7 @@
*
* @param rowEditor The row editor for the list.
*/
- public void setRowEditor(RowEditor rowEditor) {
+ public void setRowEditor(final RowEditor rowEditor) {
RowEditor previousRowEditor = this.rowEditor;
if (previousRowEditor != rowEditor) {
@@ -1071,7 +1072,7 @@
*
* @param index The index to select, or <tt>-1</tt> to clear the selection.
*/
- public void setSelectedIndex(int index) {
+ public void setSelectedIndex(final int index) {
if (index == -1) {
clearSelection();
} else {
@@ -1088,7 +1089,7 @@
* @param start The start of the selection range.
* @param end The end of the range.
*/
- public void setSelectedRange(int start, int end) {
+ public void setSelectedRange(final int start, final int end) {
ArrayList<Span> selectedRanges = new ArrayList<>();
selectedRanges.add(new Span(start, end));
@@ -1115,7 +1116,7 @@
* @param selectedRanges The new sequence of selected ranges.
* @return The ranges that were actually set.
*/
- public Sequence<Span> setSelectedRanges(Sequence<Span> selectedRanges) {
+ public Sequence<Span> setSelectedRanges(final Sequence<Span> selectedRanges) {
Utils.checkNull(selectedRanges, "Selected ranges");
// When we're in mode NONE, the only thing we can do is to clear the
@@ -1165,7 +1166,7 @@
* @return The ranges that were actually set.
* @see #setSelectedRanges(Sequence)
*/
- public final Sequence<Span> setSelectedRanges(String selectedRanges) {
+ public final Sequence<Span> setSelectedRanges(final String selectedRanges) {
Utils.checkNull(selectedRanges, "Selected ranges");
try {
@@ -1178,7 +1179,7 @@
}
@SuppressWarnings("unchecked")
- private static Sequence<Span> parseSelectedRanges(String json) throws SerializationException {
+ private static Sequence<Span> parseSelectedRanges(final String json) throws SerializationException {
ArrayList<Span> selectedRanges = new ArrayList<>();
List<?> list = JSONSerializer.parseList(json);
@@ -1216,7 +1217,7 @@
* @return <tt>true</tt> if the index was added to the selection;
* <tt>false</tt>, otherwise.
*/
- public boolean addSelectedIndex(int index) {
+ public boolean addSelectedIndex(final int index) {
Sequence<Span> addedRanges = addSelectedRange(index, index);
return (addedRanges.getLength() > 0);
}
@@ -1228,7 +1229,7 @@
* @param end The last index in the range.
* @return The ranges that were added to the selection.
*/
- public Sequence<Span> addSelectedRange(int start, int end) {
+ public Sequence<Span> addSelectedRange(final int start, final int end) {
if (selectMode != SelectMode.MULTI) {
throw new IllegalStateException("Table view is not in multi-select mode.");
}
@@ -1262,7 +1263,7 @@
* @param range The range to add.
* @return The ranges that were added to the selection.
*/
- public Sequence<Span> addSelectedRange(Span range) {
+ public Sequence<Span> addSelectedRange(final Span range) {
Utils.checkNull(range, "Range");
return addSelectedRange(range.start, range.end);
@@ -1275,7 +1276,7 @@
* @return <tt>true</tt> if the index was removed from the selection;
* <tt>false</tt>, otherwise.
*/
- public boolean removeSelectedIndex(int index) {
+ public boolean removeSelectedIndex(final int index) {
Sequence<Span> removedRanges = removeSelectedRange(index, index);
return (removedRanges.getLength() > 0);
}
@@ -1287,7 +1288,7 @@
* @param end The end of the range to remove.
* @return The ranges that were removed from the selection.
*/
- public Sequence<Span> removeSelectedRange(int start, int end) {
+ public Sequence<Span> removeSelectedRange(final int start, final int end) {
if (selectMode != SelectMode.MULTI) {
throw new IllegalStateException("Table view is not in multi-select mode.");
}
@@ -1322,7 +1323,7 @@
* @param range The range to remove.
* @return The ranges that were removed from the selection.
*/
- public Sequence<Span> removeSelectedRange(Span range) {
+ public Sequence<Span> removeSelectedRange(final Span range) {
Utils.checkNull(range, "Range");
return removeSelectedRange(range.start, range.end);
@@ -1350,7 +1351,7 @@
* @param index The index whose selection state is to be tested.
* @return <tt>true</tt> if the index is selected; <tt>false</tt>, otherwise.
*/
- public boolean isRowSelected(int index) {
+ public boolean isRowSelected(final int index) {
indexBoundsCheck("index", index, 0, tableData.getLength() - 1);
return rangeSelection.containsIndex(index);
@@ -1368,7 +1369,7 @@
}
@SuppressWarnings("unchecked")
- public void setSelectedRow(Object row) {
+ public void setSelectedRow(final Object row) {
setSelectedIndex((row == null) ? -1 : ((List<Object>) tableData).indexOf(row));
}
@@ -1388,7 +1389,7 @@
}
@SuppressWarnings("unchecked")
- public void setSelectedRows(Sequence<Object> rows) {
+ public void setSelectedRows(final Sequence<Object> rows) {
Utils.checkNull(rows, "Selected rows");
ArrayList<Span> selectedRanges = new ArrayList<>();
@@ -1420,7 +1421,7 @@
*
* @param selectMode The new selection mode.
*/
- public void setSelectMode(SelectMode selectMode) {
+ public void setSelectMode(final SelectMode selectMode) {
Utils.checkNull(selectMode, "Select mode");
SelectMode previousSelectMode = this.selectMode;
@@ -1452,9 +1453,8 @@
* @return The new sort criteria.
*/
@SuppressWarnings("unchecked")
- public Dictionary<String, SortDirection> setSort(String columnName, SortDirection sortDirection) {
- Dictionary.Pair<String, SortDirection> sort = new Dictionary.Pair<>(columnName,
- sortDirection);
+ public Dictionary<String, SortDirection> setSort(final String columnName, final SortDirection sortDirection) {
+ Dictionary.Pair<String, SortDirection> sort = new Dictionary.Pair<>(columnName, sortDirection);
setSort(new ArrayList<>(sort));
@@ -1470,7 +1470,7 @@
* @throws IllegalArgumentException if the sort parameter is {@code null}.
*/
public Dictionary<String, SortDirection> setSort(
- Sequence<Dictionary.Pair<String, SortDirection>> sort) {
+ final Sequence<Dictionary.Pair<String, SortDirection>> sort) {
Utils.checkNull(sort, "Sort");
sortMap.clear();
@@ -1499,7 +1499,7 @@
* @throws IllegalArgumentException if the sort parameter is {@code null}
* or can't be parsed from the JSON input.
*/
- public final Dictionary<String, SortDirection> setSort(String sort) {
+ public final Dictionary<String, SortDirection> setSort(final String sort) {
Utils.checkNull(sort, "Sort");
try {
@@ -1512,7 +1512,7 @@
}
@SuppressWarnings("unchecked")
- private static Sequence<Dictionary.Pair<String, SortDirection>> parseSort(String json)
+ private static Sequence<Dictionary.Pair<String, SortDirection>> parseSort(final String json)
throws SerializationException {
ArrayList<Dictionary.Pair<String, SortDirection>> sort = new ArrayList<>();
@@ -1547,7 +1547,7 @@
* @return <tt>true</tt> if the row is disabled; <tt>false</tt>, otherwise.
*/
@SuppressWarnings("unchecked")
- public boolean isRowDisabled(int index) {
+ public boolean isRowDisabled(final int index) {
boolean disabled = false;
if (disabledRowFilter != null) {
@@ -1574,7 +1574,7 @@
* @param disabledRowFilter The disabled row filter, or <tt>null</tt> for no
* disabled row filter.
*/
- public void setDisabledRowFilter(Filter<?> disabledRowFilter) {
+ public void setDisabledRowFilter(final Filter<?> disabledRowFilter) {
Filter<?> previousDisabledRowFilter = this.disabledRowFilter;
if (previousDisabledRowFilter != disabledRowFilter) {
@@ -1587,7 +1587,7 @@
return tableDataKey;
}
- public void setTableDataKey(String tableDataKey) {
+ public void setTableDataKey(final String tableDataKey) {
String previousTableDataKey = this.tableDataKey;
if (previousTableDataKey != tableDataKey) {
@@ -1600,7 +1600,7 @@
return tableDataBindType;
}
- public void setTableDataBindType(BindType tableDataBindType) {
+ public void setTableDataBindType(final BindType tableDataBindType) {
Utils.checkNull(tableDataBindType, "Table data bind type");
BindType previousTableDataBindType = this.tableDataBindType;
@@ -1615,7 +1615,7 @@
return tableDataBindMapping;
}
- public void setTableDataBindMapping(TableDataBindMapping tableDataBindMapping) {
+ public void setTableDataBindMapping(final TableDataBindMapping tableDataBindMapping) {
TableDataBindMapping previousTableDataBindMapping = this.tableDataBindMapping;
if (previousTableDataBindMapping != tableDataBindMapping) {
@@ -1629,7 +1629,7 @@
return selectedRowKey;
}
- public void setSelectedRowKey(String selectedRowKey) {
+ public void setSelectedRowKey(final String selectedRowKey) {
String previousSelectedRowKey = this.selectedRowKey;
if (previousSelectedRowKey != selectedRowKey) {
@@ -1642,7 +1642,7 @@
return selectedRowBindType;
}
- public void setSelectedRowBindType(BindType selectedRowBindType) {
+ public void setSelectedRowBindType(final BindType selectedRowBindType) {
Utils.checkNull(selectedRowBindType, "Selected row bind type");
BindType previousSelectedRowBindType = this.selectedRowBindType;
@@ -1656,7 +1656,7 @@
return selectedRowBindMapping;
}
- public void setSelectedRowBindMapping(SelectedRowBindMapping selectedRowBindMapping) {
+ public void setSelectedRowBindMapping(final SelectedRowBindMapping selectedRowBindMapping) {
SelectedRowBindMapping previousSelectedRowBindMapping = this.selectedRowBindMapping;
if (previousSelectedRowBindMapping != selectedRowBindMapping) {
@@ -1670,7 +1670,7 @@
return selectedRowsKey;
}
- public void setSelectedRowsKey(String selectedRowsKey) {
+ public void setSelectedRowsKey(final String selectedRowsKey) {
String previousSelectedRowsKey = this.selectedRowsKey;
if (previousSelectedRowsKey != selectedRowsKey) {
@@ -1683,7 +1683,7 @@
return selectedRowsBindType;
}
- public void setSelectedRowsBindType(BindType selectedRowsBindType) {
+ public void setSelectedRowsBindType(final BindType selectedRowsBindType) {
Utils.checkNull(selectedRowsBindType, "Selected rows bind type");
BindType previousSelectedRowsBindType = this.selectedRowsBindType;
@@ -1698,7 +1698,7 @@
return selectedRowsBindMapping;
}
- public void setSelectedRowsBindMapping(SelectedRowBindMapping selectedRowsBindMapping) {
+ public void setSelectedRowsBindMapping(final SelectedRowBindMapping selectedRowsBindMapping) {
SelectedRowBindMapping previousSelectedRowsBindMapping = this.selectedRowsBindMapping;
if (previousSelectedRowsBindMapping != selectedRowsBindMapping) {
@@ -1710,7 +1710,7 @@
@Override
@SuppressWarnings("unchecked")
- public void load(Object context) {
+ public void load(final Object context) {
// Bind to list data
if (tableDataKey != null && tableDataBindType != BindType.STORE
&& JSON.containsKey(context, tableDataKey)) {
@@ -1727,7 +1727,7 @@
}
switch (selectMode) {
- case SINGLE: {
+ case SINGLE:
// Bind using selected row key
if (selectedRowKey != null && selectedRowBindType != BindType.STORE
&& JSON.containsKey(context, selectedRowKey)) {
@@ -1744,9 +1744,8 @@
}
break;
- }
- case MULTI: {
+ case MULTI:
// Bind using selected rows key
if (selectedRowsKey != null && selectedRowsBindType != BindType.STORE
&& JSON.containsKey(context, selectedRowsKey)) {
@@ -1771,20 +1770,17 @@
}
break;
- }
- case NONE: {
+ case NONE:
break;
- }
- default: {
+ default:
break;
- }
}
}
@Override
- public void store(Object context) {
+ public void store(final Object context) {
// Bind to table data
if (tableDataKey != null && tableDataBindType != BindType.LOAD) {
Object value;
@@ -1798,7 +1794,7 @@
}
switch (selectMode) {
- case SINGLE: {
+ case SINGLE:
// Bind using selected row key
if (selectedRowKey != null && selectedRowBindType != BindType.LOAD) {
Object row;
@@ -1818,9 +1814,8 @@
}
break;
- }
- case MULTI: {
+ case MULTI:
// Bind using selected rows key
if (selectedRowsKey != null && selectedRowsBindType != BindType.LOAD) {
ArrayList<Object> rows = new ArrayList<>();
@@ -1845,15 +1840,12 @@
}
break;
- }
- case NONE: {
+ case NONE:
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -1875,7 +1867,7 @@
* @return The row index, or <tt>-1</tt> if there is no row at the given
* y-coordinate.
*/
- public int getRowAt(int y) {
+ public int getRowAt(final int y) {
TableView.Skin tableViewSkin = (TableView.Skin) getSkin();
return tableViewSkin.getRowAt(y);
}
@@ -1887,7 +1879,7 @@
* @return The column index, or <tt>-1</tt> if there is no column at the
* given x-coordinate.
*/
- public int getColumnAt(int x) {
+ public int getColumnAt(final int x) {
TableView.Skin tableViewSkin = (TableView.Skin) getSkin();
return tableViewSkin.getColumnAt(x);
}
@@ -1898,7 +1890,7 @@
* @param rowIndex The row index.
* @return The bounding area of the row.
*/
- public Bounds getRowBounds(int rowIndex) {
+ public Bounds getRowBounds(final int rowIndex) {
TableView.Skin tableViewSkin = (TableView.Skin) getSkin();
return tableViewSkin.getRowBounds(rowIndex);
}
@@ -1909,7 +1901,7 @@
* @param columnIndex The column index.
* @return The bounding area of the column.
*/
- public Bounds getColumnBounds(int columnIndex) {
+ public Bounds getColumnBounds(final int columnIndex) {
TableView.Skin tableViewSkin = (TableView.Skin) getSkin();
return tableViewSkin.getColumnBounds(columnIndex);
}
@@ -1921,7 +1913,7 @@
* @param columnIndex The column index of the cell.
* @return The bounding area of the cell.
*/
- public Bounds getCellBounds(int rowIndex, int columnIndex) {
+ public Bounds getCellBounds(final int rowIndex, final int columnIndex) {
TableView.Skin tableViewSkin = (TableView.Skin) getSkin();
return tableViewSkin.getCellBounds(rowIndex, columnIndex);
}
diff --git a/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java b/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
index 0675eaf..9342922 100644
--- a/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
+++ b/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
@@ -42,12 +42,12 @@
this(null);
}
- public TagDecorator(Visual tag) {
+ public TagDecorator(final Visual tag) {
this(tag, HorizontalAlignment.RIGHT, VerticalAlignment.TOP, 0, 0);
}
- public TagDecorator(Visual tag, HorizontalAlignment horizontalAlignment,
- VerticalAlignment verticalAlignment, int xOffset, int yOffset) {
+ public TagDecorator(final Visual tag, final HorizontalAlignment horizontalAlignment,
+ final VerticalAlignment verticalAlignment, final int xOffset, final int yOffset) {
Utils.checkNull(horizontalAlignment, "horizontalAlignment");
Utils.checkNull(verticalAlignment, "verticalAlignment");
@@ -62,7 +62,7 @@
return tag;
}
- public void setTag(Visual tag) {
+ public void setTag(final Visual tag) {
this.tag = tag;
}
@@ -70,7 +70,7 @@
return horizontalAlignment;
}
- public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
+ public void setHorizontalAlignment(final HorizontalAlignment horizontalAlignment) {
Utils.checkNull(horizontalAlignment, "horizontalAlignment");
this.horizontalAlignment = horizontalAlignment;
@@ -80,7 +80,7 @@
return verticalAlignment;
}
- public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
+ public void setVerticalAlignment(final VerticalAlignment verticalAlignment) {
Utils.checkNull(verticalAlignment, "verticalAlignment");
this.verticalAlignment = verticalAlignment;
@@ -90,7 +90,7 @@
return xOffset;
}
- public void setXOffset(int xOffset) {
+ public void setXOffset(final int xOffset) {
this.xOffset = xOffset;
}
@@ -98,12 +98,12 @@
return yOffset;
}
- public void setYOffset(int yOffset) {
+ public void setYOffset(final int yOffset) {
this.yOffset = yOffset;
}
@Override
- public Graphics2D prepare(Component component, Graphics2D graphicsArgument) {
+ public Graphics2D prepare(final Component component, final Graphics2D graphicsArgument) {
if (tag != null) {
bounds = getBounds(component);
this.graphics = graphicsArgument;
@@ -123,57 +123,49 @@
}
@Override
- public Bounds getBounds(Component component) {
- Bounds localBounds;
+ public Bounds getBounds(final Component component) {
+ Bounds localBounds = null;
- if (tag == null) {
- localBounds = null;
- } else {
- int x, y;
+ if (tag != null) {
+ int x = 0, y = 0;
+ int tagWidth = tag.getWidth();
+ int tagHeight = tag.getHeight();
switch (horizontalAlignment) {
- case LEFT: {
- x = xOffset;
+ case LEFT:
break;
- }
- case RIGHT: {
- x = component.getWidth() - tag.getWidth() + xOffset;
+ case RIGHT:
+ x = component.getWidth() - tagWidth;
break;
- }
- case CENTER: {
- x = (component.getWidth() - tag.getWidth()) / 2 + xOffset;
+ case CENTER:
+ x = (component.getWidth() - tagWidth) / 2;
break;
- }
- default: {
+ default:
throw new UnsupportedOperationException();
- }
}
+ x += xOffset;
switch (verticalAlignment) {
- case TOP: {
- y = yOffset;
+ case TOP:
break;
- }
- case BOTTOM: {
- y = component.getHeight() - tag.getHeight() + yOffset;
+ case BOTTOM:
+ y = component.getHeight() - tagHeight;
break;
- }
- case CENTER: {
- y = (component.getHeight() - tag.getHeight()) / 2 + yOffset;
+ case CENTER:
+ y = (component.getHeight() - tagHeight) / 2;
break;
- }
- default: {
+ default:
throw new UnsupportedOperationException();
- }
}
+ y += yOffset;
- localBounds = new Bounds(x, y, tag.getWidth(), tag.getHeight());
+ localBounds = new Bounds(x, y, tagWidth, tagHeight);
}
return localBounds;
diff --git a/wtk/src/org/apache/pivot/wtk/media/Picture.java b/wtk/src/org/apache/pivot/wtk/media/Picture.java
index 1171d20..7ec5d94 100644
--- a/wtk/src/org/apache/pivot/wtk/media/Picture.java
+++ b/wtk/src/org/apache/pivot/wtk/media/Picture.java
@@ -41,7 +41,7 @@
private int baseline = -1;
- public Picture(BufferedImage bufferedImage) {
+ public Picture(final BufferedImage bufferedImage) {
Utils.checkNull(bufferedImage, "bufferedImage");
this.bufferedImage = bufferedImage;
@@ -61,11 +61,11 @@
return bufferedImage.getHeight();
}
- public void resample(int size) {
+ public void resample(final int size) {
resample(size, Interpolation.NEAREST_NEIGHBOR);
}
- public void resample(int size, Interpolation interpolation) {
+ public void resample(final int size, final Interpolation interpolation) {
int width = getWidth();
int height = getHeight();
@@ -81,11 +81,11 @@
resample(width, height, interpolation);
}
- public void resample(int width, int height) {
+ public void resample(final int width, final int height) {
resample(width, height, Interpolation.NEAREST_NEIGHBOR);
}
- public void resample(int width, int height, Interpolation interpolation) {
+ public void resample(final int width, final int height, final Interpolation interpolation) {
Utils.checkNull(interpolation, "interpolation");
int previousWidth = getWidth();
@@ -111,21 +111,17 @@
// Set the interpolation
Object interpolationHint = 0;
switch (interpolation) {
- case NEAREST_NEIGHBOR: {
+ case NEAREST_NEIGHBOR:
interpolationHint = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
break;
- }
- case BILINEAR: {
+ case BILINEAR:
interpolationHint = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
break;
- }
- case BICUBIC: {
+ case BICUBIC:
interpolationHint = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
break;
- }
- default: {
+ default:
break;
- }
}
bufferedImageGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
@@ -149,7 +145,7 @@
return baseline;
}
- public void setBaseline(int baseline) {
+ public void setBaseline(final int baseline) {
int previousBaseline = this.baseline;
if (baseline != previousBaseline) {
@@ -159,7 +155,7 @@
}
@Override
- public void paint(Graphics2D graphics) {
+ public void paint(final Graphics2D graphics) {
graphics.drawImage(bufferedImage, 0, 0, null);
}
}
diff --git a/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java b/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
index bdcef0d..e5dbd53 100644
--- a/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
+++ b/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
@@ -39,7 +39,7 @@
private boolean fill = false;
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
BoxPane boxPane = (BoxPane) component;
@@ -47,7 +47,7 @@
}
@Override
- public int getPreferredWidth(int height) {
+ public int getPreferredWidth(final int height) {
BoxPane boxPane = (BoxPane) getComponent();
int preferredWidth = 0;
@@ -93,7 +93,7 @@
}
@Override
- public int getPreferredHeight(int width) {
+ public int getPreferredHeight(final int width) {
BoxPane boxPane = (BoxPane) getComponent();
int preferredHeight = 0;
@@ -145,12 +145,11 @@
int preferredWidth = 0;
int preferredHeight = 0;
+ int j = 0;
switch (boxPane.getOrientation()) {
- case HORIZONTAL: {
- // Preferred width is the sum of the preferred widths of all
- // components
- int j = 0;
+ case HORIZONTAL:
+ // Preferred width is the sum of the preferred widths of all components
for (int i = 0, n = boxPane.getLength(); i < n; i++) {
Component component = boxPane.get(i);
@@ -168,11 +167,9 @@
}
break;
- }
- case VERTICAL: {
+ case VERTICAL:
// Preferred height is the sum of the preferred heights of all components
- int j = 0;
for (int i = 0, n = boxPane.getLength(); i < n; i++) {
Component component = boxPane.get(i);
@@ -190,11 +187,9 @@
}
break;
- }
- default: {
+ default:
break;
- }
}
// Include padding
@@ -205,14 +200,14 @@
}
@Override
- public int getBaseline(int width, int height) {
+ public int getBaseline(final int width, final int height) {
BoxPane boxPane = (BoxPane) getComponent();
int baseline = -1;
int contentHeight = 0;
switch (boxPane.getOrientation()) {
- case HORIZONTAL: {
+ case HORIZONTAL:
if (fill) {
int clientHeight = Math.max(height - padding.getHeight(), 0);
@@ -239,20 +234,16 @@
if (componentBaseline != -1) {
switch (verticalAlignment) {
- case CENTER: {
+ case CENTER:
componentBaseline += (contentHeight - size.height) / 2;
break;
- }
- case BOTTOM: {
+ case BOTTOM:
componentBaseline += contentHeight - size.height;
break;
- }
- case TOP: {
+ case TOP:
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -262,9 +253,8 @@
}
break;
- }
- case VERTICAL: {
+ case VERTICAL:
int clientWidth = Math.max(width - padding.getWidth(), 0);
for (Component component : boxPane) {
@@ -291,11 +281,9 @@
contentHeight -= spacing;
break;
- }
- default: {
+ default:
break;
- }
}
if (baseline != -1) {
@@ -303,24 +291,20 @@
baseline += padding.top;
} else {
switch (verticalAlignment) {
- case TOP: {
+ case TOP:
baseline += padding.top;
break;
- }
- case CENTER: {
+ case CENTER:
baseline += (height - contentHeight) / 2;
break;
- }
- case BOTTOM: {
+ case BOTTOM:
baseline += height - (contentHeight + padding.bottom);
break;
- }
- default: {
+ default:
break;
- }
}
}
}
@@ -344,20 +328,16 @@
int x = 0;
switch (horizontalAlignment) {
- case CENTER: {
+ case CENTER:
x = (width - preferredWidth) / 2;
break;
- }
- case RIGHT: {
+ case RIGHT:
x = width - preferredWidth;
break;
- }
- case LEFT: {
+ case LEFT:
break;
- }
- default: {
+ default:
break;
- }
}
x += padding.left;
@@ -373,7 +353,6 @@
if (fill) {
componentHeight = Math.max(height - padding.getHeight(), 0);
-
componentWidth = component.getPreferredWidth(componentHeight);
} else {
Dimensions preferredComponentSize = component.getPreferredSize();
@@ -382,24 +361,20 @@
}
switch (verticalAlignment) {
- case TOP: {
+ case TOP:
y = padding.top;
break;
- }
- case CENTER: {
+ case CENTER:
y = (height - componentHeight) / 2;
break;
- }
- case BOTTOM: {
+ case BOTTOM:
y = height - padding.bottom - componentHeight;
break;
- }
- default: {
+ default:
break;
- }
}
// Set the component's size and position
@@ -417,21 +392,19 @@
int y = 0;
switch (verticalAlignment) {
- case CENTER: {
+ case CENTER:
y = (height - preferredHeight) / 2;
break;
- }
- case BOTTOM: {
+ case BOTTOM:
y = height - preferredHeight;
break;
- }
+
case TOP:
break;
- default: {
+ default:
break;
- }
}
y += padding.top;
@@ -447,7 +420,6 @@
if (fill) {
componentWidth = Math.max(width - padding.getWidth(), 0);
-
componentHeight = component.getPreferredHeight(componentWidth);
} else {
Dimensions preferredComponentSize = component.getPreferredSize();
@@ -456,21 +428,17 @@
}
switch (horizontalAlignment) {
- case LEFT: {
+ case LEFT:
x = padding.left;
break;
- }
- case CENTER: {
+ case CENTER:
x = (width - componentWidth) / 2;
break;
- }
- case RIGHT: {
+ case RIGHT:
x = width - padding.right - componentWidth;
break;
- }
- default: {
+ default:
break;
- }
}
// Set the component's size and position
@@ -485,8 +453,7 @@
}
/**
- * @return The horizontal alignment of the BoxPane's components within the
- * pane.
+ * @return The horizontal alignment of the BoxPane's components within the pane.
*/
public HorizontalAlignment getHorizontalAlignment() {
return horizontalAlignment;
@@ -503,7 +470,7 @@
*
* @param horizontalAlignment The new horizontal alignment for our children.
*/
- public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
+ public void setHorizontalAlignment(final HorizontalAlignment horizontalAlignment) {
Utils.checkNull(horizontalAlignment, "horizontalAlignment");
this.horizontalAlignment = horizontalAlignment;
@@ -511,8 +478,7 @@
}
/**
- * @return The vertical alignment of the BoxPane's components within the
- * pane.
+ * @return The vertical alignment of the BoxPane's components within the pane.
*/
public VerticalAlignment getVerticalAlignment() {
return verticalAlignment;
@@ -529,7 +495,7 @@
*
* @param verticalAlignment The new horizontal alignment for our children.
*/
- public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
+ public void setVerticalAlignment(final VerticalAlignment verticalAlignment) {
Utils.checkNull(verticalAlignment, "verticalAlignment");
this.verticalAlignment = verticalAlignment;
@@ -550,7 +516,7 @@
*
* @param padding The new padding values for all edges.
*/
- public void setPadding(Insets padding) {
+ public void setPadding(final Insets padding) {
Utils.checkNull(padding, "padding");
this.padding = padding;
@@ -563,7 +529,7 @@
*
* @param padding A dictionary with keys in the set {top, left, bottom, right}.
*/
- public final void setPadding(Dictionary<String, ?> padding) {
+ public final void setPadding(final Dictionary<String, ?> padding) {
setPadding(new Insets(padding));
}
@@ -573,7 +539,7 @@
*
* @param padding A sequence with values in the order [top, left, bottom, right].
*/
- public final void setPadding(Sequence<?> padding) {
+ public final void setPadding(final Sequence<?> padding) {
setPadding(new Insets(padding));
}
@@ -583,7 +549,7 @@
*
* @param padding The new padding value for all edges.
*/
- public final void setPadding(int padding) {
+ public final void setPadding(final int padding) {
setPadding(new Insets(padding));
}
@@ -593,7 +559,7 @@
*
* @param padding The integer value to use for padding on all edges.
*/
- public final void setPadding(Number padding) {
+ public final void setPadding(final Number padding) {
setPadding(new Insets(padding));
}
@@ -604,7 +570,7 @@
* @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) {
+ public final void setPadding(final String padding) {
setPadding(Insets.decode(padding));
}
@@ -620,7 +586,7 @@
*
* @param spacing The new amount of spacing between components.
*/
- public void setSpacing(int spacing) {
+ public void setSpacing(final int spacing) {
Utils.checkNonNegative(spacing, "spacing");
this.spacing = spacing;
@@ -632,7 +598,7 @@
*
* @param spacing The new amount of spacing to use between components.
*/
- public final void setSpacing(Number spacing) {
+ public final void setSpacing(final Number spacing) {
Utils.checkNull(spacing, "spacing");
setSpacing(spacing.intValue());
@@ -664,14 +630,14 @@
* preferredHeight/preferredWidth just set, depending on the pane's
* orientation.
*/
- public void setFill(boolean fill) {
+ public void setFill(final boolean fill) {
this.fill = fill;
invalidateComponent();
}
// Box pane events
@Override
- public void orientationChanged(BoxPane boxPane) {
+ public void orientationChanged(final BoxPane boxPane) {
invalidateComponent();
}
}
diff --git a/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java b/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java
index c8a1122..76a7837 100644
--- a/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java
+++ b/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java
@@ -53,7 +53,8 @@
private ComponentMouseButtonListener calendarPopupMouseButtonListener = new ComponentMouseButtonListener() {
@Override
- public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
+ public boolean mouseClick(final Component component, final Mouse.Button button,
+ final int x, final int y, final int count) {
CalendarButton calendarButton = (CalendarButton) getComponent();
calendarPopup.close();
@@ -69,23 +70,21 @@
/**
* {@link KeyCode#ESCAPE ESCAPE} Close the popup.<br>
* {@link KeyCode#ENTER ENTER} Choose the selected date.<br>
- * {@link KeyCode#TAB TAB} Choose the selected date and transfer focus
- * forwards.<br> {@link KeyCode#TAB TAB} +
- * {@link Modifier#SHIFT SHIFT} Choose the selected date and
+ * {@link KeyCode#TAB TAB} Choose the selected date and transfer focus forwards.<br>
+ * {@link KeyCode#TAB TAB} + {@link Modifier#SHIFT SHIFT} Choose the selected date and
* transfer focus backwards.
*/
@Override
- public boolean keyPressed(Component component, int keyCode, KeyLocation keyLocation) {
+ public boolean keyPressed(final Component component, final int keyCode, final KeyLocation keyLocation) {
CalendarButton calendarButton = (CalendarButton) getComponent();
switch (keyCode) {
- case KeyCode.ESCAPE: {
+ case KeyCode.ESCAPE:
calendarPopup.close();
break;
- }
case KeyCode.TAB:
- case KeyCode.ENTER: {
+ case KeyCode.ENTER:
calendarPopup.close();
if (keyCode == KeyCode.TAB) {
@@ -98,11 +97,9 @@
calendarButton.setSelectedDate(date);
break;
- }
- default: {
+ default:
break;
- }
}
return false;
@@ -111,7 +108,7 @@
private WindowStateListener calendarPopupWindowStateListener = new WindowStateListener() {
@Override
- public void windowOpened(Window window) {
+ public void windowOpened(final Window window) {
Display display = window.getDisplay();
display.getContainerMouseListeners().add(displayMouseListener);
@@ -119,7 +116,7 @@
}
@Override
- public Vote previewWindowClose(Window window) {
+ public Vote previewWindowClose(final Window window) {
if (window.containsFocus()) {
getComponent().requestFocus();
}
@@ -128,14 +125,14 @@
}
@Override
- public void windowCloseVetoed(Window window, Vote reason) {
+ public void windowCloseVetoed(final Window window, final Vote reason) {
if (reason == Vote.DENY) {
window.requestFocus();
}
}
@Override
- public void windowClosed(Window window, Display display, Window owner) {
+ public void windowClosed(final Window window, final Display display, final Window owner) {
display.getContainerMouseListeners().remove(displayMouseListener);
Window componentWindow = getComponent().getWindow();
@@ -147,7 +144,7 @@
private ContainerMouseListener displayMouseListener = new ContainerMouseListener() {
@Override
- public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
+ public boolean mouseDown(final Container container, final Mouse.Button button, final int x, final int y) {
Display display = (Display) container;
Component descendant = display.getDescendantAt(x, y);
@@ -160,8 +157,8 @@
}
@Override
- public boolean mouseWheel(Container container, Mouse.ScrollType scrollType,
- int scrollAmount, int wheelRotation, int x, int y) {
+ public boolean mouseWheel(final Container container, final Mouse.ScrollType scrollType,
+ final int scrollAmount, final int wheelRotation, final int x, final int y) {
boolean consumed = false;
Display display = (Display) container;
@@ -179,13 +176,13 @@
calendar = new Calendar();
calendar.getCalendarListeners().add(new CalendarListener() {
@Override
- public void yearChanged(Calendar calendarArgument, int previousYear) {
+ public void yearChanged(final Calendar calendarArgument, final int previousYear) {
CalendarButton calendarButton = (CalendarButton) getComponent();
calendarButton.setYear(calendarArgument.getYear());
}
@Override
- public void monthChanged(Calendar calendarArgument, int previousMonth) {
+ public void monthChanged(final Calendar calendarArgument, final int previousMonth) {
CalendarButton calendarButton = (CalendarButton) getComponent();
calendarButton.setMonth(calendarArgument.getMonth());
}
@@ -198,7 +195,7 @@
}
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
CalendarButton calendarButton = (CalendarButton) component;
@@ -208,6 +205,7 @@
calendar.setLocale(calendarButton.getLocale());
}
+
// CalendarButton.Skin methods
@Override
public Window getCalendarPopup() {
@@ -216,7 +214,7 @@
// Component state events
@Override
- public void enabledChanged(Component component) {
+ public void enabledChanged(final Component component) {
super.enabledChanged(component);
if (!component.isEnabled()) {
@@ -229,7 +227,7 @@
}
@Override
- public void focusedChanged(Component component, Component obverseComponent) {
+ public void focusedChanged(final Component component, final Component obverseComponent) {
super.focusedChanged(component, obverseComponent);
repaintComponent();
@@ -247,7 +245,7 @@
// Component mouse events
@Override
- public void mouseOut(Component component) {
+ public void mouseOut(final Component component) {
super.mouseOut(component);
pressed = false;
@@ -255,7 +253,7 @@
}
@Override
- public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
+ public boolean mouseDown(final Component component, final Mouse.Button button, final int x, final int y) {
boolean consumed = super.mouseDown(component, button, x, y);
pressed = true;
@@ -271,7 +269,7 @@
}
@Override
- public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
+ public boolean mouseUp(final Component component, final Mouse.Button button, final int x, final int y) {
boolean consumed = super.mouseUp(component, button, x, y);
pressed = false;
@@ -287,7 +285,7 @@
* @see #keyReleased(Component, int, Keyboard.KeyLocation)
*/
@Override
- public boolean keyPressed(Component component, int keyCode, KeyLocation keyLocation) {
+ public boolean keyPressed(final Component component, final int keyCode, final KeyLocation keyLocation) {
boolean consumed = false;
if (keyCode == KeyCode.SPACE) {
@@ -312,7 +310,7 @@
* {@link KeyCode#SPACE SPACE} 'presses' the button.
*/
@Override
- public boolean keyReleased(Component component, int keyCode, KeyLocation keyLocation) {
+ public boolean keyReleased(final Component component, final int keyCode, final KeyLocation keyLocation) {
boolean consumed = false;
if (keyCode == KeyCode.SPACE) {
@@ -327,29 +325,29 @@
// Calendar button events
@Override
- public void yearChanged(CalendarButton calendarButton, int previousYear) {
+ public void yearChanged(final CalendarButton calendarButton, final int previousYear) {
calendar.setYear(calendarButton.getYear());
}
@Override
- public void monthChanged(CalendarButton calendarButton, int previousMonth) {
+ public void monthChanged(final CalendarButton calendarButton, final int previousMonth) {
calendar.setMonth(calendarButton.getMonth());
}
@Override
- public void localeChanged(CalendarButton calendarButton, Locale previousLocale) {
+ public void localeChanged(final CalendarButton calendarButton, final Locale previousLocale) {
calendar.setLocale(calendarButton.getLocale());
}
@Override
- public void disabledDateFilterChanged(CalendarButton calendarButton,
- Filter<CalendarDate> previousDisabledDateFilter) {
+ public void disabledDateFilterChanged(final CalendarButton calendarButton,
+ final Filter<CalendarDate> previousDisabledDateFilter) {
calendar.setDisabledDateFilter(calendarButton.getDisabledDateFilter());
}
// Calendar button selection events
@Override
- public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
+ public void selectedDateChanged(final CalendarButton calendarButton, final CalendarDate previousSelectedDate) {
// Set the selected date as the button data
CalendarDate date = calendarButton.getSelectedDate();
calendarButton.setButtonData(date);
diff --git a/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java b/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
index dc9ef4a..2c0dc4a 100644
--- a/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
+++ b/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
@@ -60,7 +60,7 @@
public final Component toCard;
public final int direction;
- public SelectionChangeTransition(int from, int to) {
+ public SelectionChangeTransition(final int from, final int to) {
super(selectionChangeDuration, selectionChangeRate, false);
this.from = from;
@@ -92,12 +92,12 @@
private FadeDecorator fadeOutDecorator = new FadeDecorator();
private FadeDecorator fadeInDecorator = new FadeDecorator();
- public CrossfadeTransition(int from, int to) {
+ public CrossfadeTransition(final int from, final int to) {
super(from, to);
}
@Override
- public void start(TransitionListener transitionListener) {
+ public void start(final TransitionListener transitionListener) {
if (fromCard != null) {
fromCard.getDecorators().add(fadeOutDecorator);
}
@@ -145,12 +145,12 @@
public class SlideTransition extends SelectionChangeTransition {
private Easing slideEasing = new Quartic();
- public SlideTransition(int from, int to) {
+ public SlideTransition(final int from, final int to) {
super(from, to);
}
@Override
- public void start(TransitionListener transitionListener) {
+ public void start(final TransitionListener transitionListener) {
toCard.setVisible(true);
super.start(transitionListener);
@@ -191,13 +191,13 @@
private double theta;
private ScaleDecorator scaleDecorator = new ScaleDecorator();
- public FlipTransition(Orientation orientation, int from, int to) {
+ public FlipTransition(final Orientation orientation, final int from, final int to) {
super(from, to);
this.orientation = orientation;
}
@Override
- public void start(TransitionListener transitionListener) {
+ public void start(final TransitionListener transitionListener) {
theta = 0;
getComponent().getDecorators().add(scaleDecorator);
@@ -215,7 +215,7 @@
protected void update() {
float percentComplete = getPercentComplete();
- if (percentComplete < 1f) {
+ if (percentComplete < 1.0f) {
theta = Math.PI * percentComplete;
float scale = (float) Math.abs(Math.cos(theta));
@@ -241,12 +241,12 @@
private ScaleDecorator fromScaleDecorator = new ScaleDecorator();
private ScaleDecorator toScaleDecorator = new ScaleDecorator();
- public ZoomTransition(int from, int to) {
+ public ZoomTransition(final int from, final int to) {
super(from, to);
}
@Override
- public void start(TransitionListener transitionListener) {
+ public void start(final TransitionListener transitionListener) {
if (fromCard != null) {
fromCard.getDecorators().add(fromScaleDecorator);
}
@@ -302,7 +302,7 @@
private static final int DEFAULT_SELECTION_CHANGE_RATE = 30;
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
CardPane cardPane = (CardPane) component;
@@ -310,7 +310,7 @@
}
@Override
- public int getPreferredWidth(int height) {
+ public int getPreferredWidth(final int height) {
int preferredWidth = 0;
CardPane cardPane = (CardPane) getComponent();
@@ -353,7 +353,7 @@
}
@Override
- public int getPreferredHeight(int width) {
+ public int getPreferredHeight(final int width) {
int preferredHeight = 0;
CardPane cardPane = (CardPane) getComponent();
@@ -457,7 +457,7 @@
}
@Override
- public int getBaseline(int width, int height) {
+ public int getBaseline(final int width, final int height) {
int baseline = -1;
if (sizeToSelection) {
@@ -497,7 +497,7 @@
* @return The amount of space between the edge of the CardPane and its
* content.
*/
- public Insets getPadding() {
+ public final Insets getPadding() {
return padding;
}
@@ -507,7 +507,7 @@
*
* @param padding The new padding values for all edges.
*/
- public void setPadding(Insets padding) {
+ public final void setPadding(final Insets padding) {
Utils.checkNull(padding, "padding");
this.padding = padding;
@@ -520,7 +520,7 @@
*
* @param padding A dictionary with keys in the set {top, left, bottom, right}.
*/
- public final void setPadding(Dictionary<String, ?> padding) {
+ public final void setPadding(final Dictionary<String, ?> padding) {
setPadding(new Insets(padding));
}
@@ -530,7 +530,7 @@
*
* @param padding A sequence with values in the order [top, left, bottom, right].
*/
- public final void setPadding(Sequence<?> padding) {
+ public final void setPadding(final Sequence<?> padding) {
setPadding(new Insets(padding));
}
@@ -540,7 +540,7 @@
*
* @param padding The new single padding value to use for all edges.
*/
- public final void setPadding(int padding) {
+ public final void setPadding(final int padding) {
setPadding(new Insets(padding));
}
@@ -550,7 +550,7 @@
*
* @param padding The new integer value to use for the padding on all edges.
*/
- public void setPadding(Number padding) {
+ public final void setPadding(final Number padding) {
setPadding(new Insets(padding));
}
@@ -561,7 +561,7 @@
* @param padding A string containing an integer or a JSON dictionary with
* keys top, left, bottom, and/or right.
*/
- public final void setPadding(String padding) {
+ public final void setPadding(final String padding) {
setPadding(Insets.decode(padding));
}
@@ -569,7 +569,7 @@
return sizeToSelection;
}
- public void setSizeToSelection(boolean sizeToSelection) {
+ public void setSizeToSelection(final boolean sizeToSelection) {
if (selectionChangeTransition != null) {
selectionChangeTransition.end();
}
@@ -582,7 +582,7 @@
return selectionChangeEffect;
}
- public void setSelectionChangeEffect(SelectionChangeEffect selectionChangeEffect) {
+ public void setSelectionChangeEffect(final SelectionChangeEffect selectionChangeEffect) {
if (selectionChangeTransition != null) {
selectionChangeTransition.end();
}
@@ -594,7 +594,7 @@
return selectionChangeDuration;
}
- public void setSelectionChangeDuration(int selectionChangeDuration) {
+ public void setSelectionChangeDuration(final int selectionChangeDuration) {
this.selectionChangeDuration = selectionChangeDuration;
}
@@ -602,7 +602,7 @@
return selectionChangeRate;
}
- public void setSelectionChangeRate(int selectionChangeRate) {
+ public void setSelectionChangeRate(final int selectionChangeRate) {
this.selectionChangeRate = selectionChangeRate;
}
@@ -640,12 +640,12 @@
* @param circular <tt>true</tt> if directional transitions should be
* circular; <tt>false</tt> otherwise
*/
- public void setCircular(boolean circular) {
+ public void setCircular(final boolean circular) {
this.circular = circular;
}
@Override
- public void componentInserted(Container container, int index) {
+ public void componentInserted(final Container container, final int index) {
if (selectionChangeTransition != null) {
selectionChangeTransition.end();
}
@@ -664,7 +664,7 @@
}
@Override
- public void componentsRemoved(Container container, int index, Sequence<Component> removed) {
+ public void componentsRemoved(final Container container, final int index, final Sequence<Component> removed) {
if (selectionChangeTransition != null) {
selectionChangeTransition.end();
}
@@ -680,7 +680,7 @@
}
@Override
- public Vote previewSelectedIndexChange(CardPane cardPane, int selectedIndex) {
+ public Vote previewSelectedIndexChange(final CardPane cardPane, final int selectedIndex) {
Vote vote;
if (cardPane.isShowing() && selectionChangeEffect != null
@@ -688,48 +688,42 @@
int previousSelectedIndex = cardPane.getSelectedIndex();
switch (selectionChangeEffect) {
- case CROSSFADE: {
+ case CROSSFADE:
selectionChangeTransition = new CrossfadeTransition(previousSelectedIndex,
selectedIndex);
break;
- }
case HORIZONTAL_SLIDE:
- case VERTICAL_SLIDE: {
+ case VERTICAL_SLIDE:
if (previousSelectedIndex != -1 && selectedIndex != -1) {
selectionChangeTransition = new SlideTransition(previousSelectedIndex,
selectedIndex);
}
break;
- }
- case HORIZONTAL_FLIP: {
+ case HORIZONTAL_FLIP:
if (previousSelectedIndex != -1 && selectedIndex != -1) {
selectionChangeTransition = new FlipTransition(Orientation.HORIZONTAL,
previousSelectedIndex, selectedIndex);
}
break;
- }
- case VERTICAL_FLIP: {
+ case VERTICAL_FLIP:
if (previousSelectedIndex != -1 && selectedIndex != -1) {
selectionChangeTransition = new FlipTransition(Orientation.VERTICAL,
previousSelectedIndex, selectedIndex);
}
break;
- }
- case ZOOM: {
+ case ZOOM:
if (previousSelectedIndex != -1 && selectedIndex != -1) {
selectionChangeTransition = new ZoomTransition(previousSelectedIndex,
selectedIndex);
}
break;
- }
- default: {
+ default:
break;
- }
}
if (selectionChangeTransition != null) {
@@ -758,7 +752,7 @@
}
@Override
- public void selectedIndexChangeVetoed(CardPane cardPane, Vote reason) {
+ public void selectedIndexChangeVetoed(final CardPane cardPane, final Vote reason) {
if (reason == Vote.DENY && selectionChangeTransition != null) {
// NOTE We stop, rather than end, the transition so the completion
// event isn't fired; if the event fires, the listener will set
@@ -773,7 +767,7 @@
}
@Override
- public void selectedIndexChanged(CardPane cardPane, int previousSelectedIndex) {
+ public void selectedIndexChanged(final CardPane cardPane, final int previousSelectedIndex) {
int selectedIndex = cardPane.getSelectedIndex();
if (selectedIndex != previousSelectedIndex) {
diff --git a/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java b/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
index ce63af8..41dbe21 100644
--- a/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
+++ b/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
@@ -50,13 +50,13 @@
this(false);
}
- public IndexFocusTraversalPolicy(boolean wrap) {
+ public IndexFocusTraversalPolicy(final boolean wrap) {
this.wrap = wrap;
}
@Override
- public Component getNextComponent(Container container, Component component,
- FocusTraversalDirection direction) {
+ public Component getNextComponent(final Container container, final Component component,
+ final FocusTraversalDirection direction) {
Utils.checkNull(container, "container");
Utils.checkNull(direction, "direction");
@@ -65,7 +65,7 @@
int n = container.getLength();
if (n > 0) {
switch (direction) {
- case FORWARD: {
+ case FORWARD:
if (component == null) {
// Return the first component in the sequence
nextComponent = container.get(0);
@@ -86,9 +86,8 @@
}
break;
- }
- case BACKWARD: {
+ case BACKWARD:
if (component == null) {
// Return the last component in the sequence
nextComponent = container.get(n - 1);
@@ -109,11 +108,9 @@
}
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -126,7 +123,7 @@
private static final FocusTraversalPolicy DEFAULT_FOCUS_TRAVERSAL_POLICY = new IndexFocusTraversalPolicy();
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
Container container = (Container) component;
@@ -140,17 +137,17 @@
}
@Override
- public int getPreferredWidth(int height) {
+ public int getPreferredWidth(final int height) {
return 0;
}
@Override
- public int getPreferredHeight(int width) {
+ public int getPreferredHeight(final int width) {
return 0;
}
@Override
- public void paint(Graphics2D graphics) {
+ public void paint(final Graphics2D graphics) {
if (backgroundPaint != null) {
graphics.setPaint(backgroundPaint);
graphics.fillRect(0, 0, getWidth(), getHeight());
@@ -183,7 +180,7 @@
*
* @param backgroundPaint The new {@link Paint} object to paint the background.
*/
- public void setBackgroundPaint(Paint backgroundPaint) {
+ public void setBackgroundPaint(final Paint backgroundPaint) {
this.backgroundPaint = backgroundPaint;
repaintComponent();
}
@@ -194,7 +191,7 @@
* @param backgroundPaint A string recognized by Pivot as a
* {@linkplain GraphicsUtilities#decodePaint(String) Color or Paint value}.
*/
- public final void setBackgroundPaint(String backgroundPaint) {
+ public final void setBackgroundPaint(final String backgroundPaint) {
setBackgroundPaint(GraphicsUtilities.decodePaint(backgroundPaint));
}
@@ -204,7 +201,7 @@
* @param backgroundPaint A dictionary containing a
* {@linkplain GraphicsUtilities#decodePaint(Dictionary) Paint description}.
*/
- public final void setBackgroundPaint(Dictionary<String, ?> backgroundPaint) {
+ public final void setBackgroundPaint(final Dictionary<String, ?> backgroundPaint) {
setBackgroundPaint(GraphicsUtilities.decodePaint(backgroundPaint));
}
@@ -221,7 +218,7 @@
*
* @param backgroundColor The new background color for the container.
*/
- public void setBackgroundColor(Color backgroundColor) {
+ public void setBackgroundColor(final Color backgroundColor) {
setBackgroundPaint(backgroundColor);
}
@@ -232,7 +229,7 @@
* {@linkplain GraphicsUtilities#decodeColor color values recognized by
* Pivot}.
*/
- public final void setBackgroundColor(String backgroundColor) {
+ public final void setBackgroundColor(final String backgroundColor) {
setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor, "backgroundColor"));
}
@@ -241,51 +238,51 @@
*
* @param backgroundColor An index into the theme's color palette.
*/
- public final void setBackgroundColor(int backgroundColor) {
+ public final void setBackgroundColor(final int backgroundColor) {
Theme theme = currentTheme();
setBackgroundColor(theme.getColor(backgroundColor));
}
// Container events
@Override
- public void componentInserted(Container container, int index) {
+ public void componentInserted(final Container container, final int index) {
// No-op
}
@Override
- public void componentsRemoved(Container container, int index, Sequence<Component> removed) {
+ public void componentsRemoved(final Container container, final int index, final Sequence<Component> removed) {
// No-op
}
@Override
- public void componentMoved(Container container, int from, int to) {
+ public void componentMoved(final Container container, final int from, final int to) {
// No-op
}
@Override
- public void focusTraversalPolicyChanged(Container container,
- FocusTraversalPolicy previousFocusTraversalPolicy) {
+ public void focusTraversalPolicyChanged(final Container container,
+ final FocusTraversalPolicy previousFocusTraversalPolicy) {
// No-op
}
@Override
- public boolean mouseMove(Container container, int x, int y) {
+ public boolean mouseMove(final Container container, final int x, final int y) {
return false;
}
@Override
- public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
+ public boolean mouseDown(final Container container, final Mouse.Button button, final int x, final int y) {
return false;
}
@Override
- public boolean mouseUp(Container container, Mouse.Button button, int x, int y) {
+ public boolean mouseUp(final Container container, final Mouse.Button button, final int x, final int y) {
return false;
}
@Override
- public boolean mouseWheel(Container container, Mouse.ScrollType scrollType, int scrollAmount,
- int wheelRotation, int x, int y) {
+ public boolean mouseWheel(final Container container, final Mouse.ScrollType scrollType, final int scrollAmount,
+ final int wheelRotation, final int x, final int y) {
return false;
}
}
diff --git a/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java b/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
index 650cf38..3d09142 100644
--- a/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
+++ b/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
@@ -45,7 +45,7 @@
}
@Override
- public int getPreferredWidth(int height) {
+ public int getPreferredWidth(final int height) {
FlowPane flowPane = (FlowPane) getComponent();
int preferredWidth = 0;
@@ -74,7 +74,7 @@
}
@Override
- public int getPreferredHeight(int width) {
+ public int getPreferredHeight(final int width) {
FlowPane flowPane = (FlowPane) getComponent();
int preferredHeight;
@@ -199,7 +199,7 @@
}
@Override
- public int getBaseline(int width, int height) {
+ public int getBaseline(final int width, final int height) {
FlowPane flowPane = (FlowPane) getComponent();
int baseline = -1;
@@ -293,21 +293,17 @@
int x = 0;
switch (alignment) {
- case LEFT: {
+ case LEFT:
x = padding.left;
break;
- }
- case CENTER: {
+ case CENTER:
x = (width - rowWidth) / 2;
break;
- }
- case RIGHT: {
+ case RIGHT:
x = width - rowWidth - padding.right;
break;
- }
- default: {
+ default:
break;
- }
}
for (Component component : row) {
@@ -334,7 +330,7 @@
return alignment;
}
- public void setAlignment(HorizontalAlignment alignment) {
+ public void setAlignment(final HorizontalAlignment alignment) {
Utils.checkNull(alignment, "alignment");
this.alignment = alignment;
@@ -355,7 +351,7 @@
*
* @param padding The individual padding values for each edge.
*/
- public void setPadding(Insets padding) {
+ public void setPadding(final Insets padding) {
Utils.checkNull(padding, "padding");
this.padding = padding;
@@ -368,7 +364,7 @@
*
* @param padding A dictionary with keys in the set {top, left, bottom, right}.
*/
- public final void setPadding(Dictionary<String, ?> padding) {
+ public final void setPadding(final Dictionary<String, ?> padding) {
setPadding(new Insets(padding));
}
@@ -378,7 +374,7 @@
*
* @param padding A sequence with values in the order [top, left, bottom, right].
*/
- public final void setPadding(Sequence<?> padding) {
+ public final void setPadding(final Sequence<?> padding) {
setPadding(new Insets(padding));
}
@@ -388,7 +384,7 @@
*
* @param padding The single padding value for all four sides.
*/
- public final void setPadding(int padding) {
+ public final void setPadding(final int padding) {
setPadding(new Insets(padding));
}
@@ -398,7 +394,7 @@
*
* @param padding The single padding value for all four sides.
*/
- public final void setPadding(Number padding) {
+ public final void setPadding(final Number padding) {
setPadding(new Insets(padding));
}
@@ -409,7 +405,7 @@
* @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) {
+ public final void setPadding(final String padding) {
setPadding(Insets.decode(padding));
}
@@ -417,14 +413,14 @@
return horizontalSpacing;
}
- public void setHorizontalSpacing(int horizontalSpacing) {
+ public void setHorizontalSpacing(final int horizontalSpacing) {
Utils.checkNonNegative(horizontalSpacing, "horizontalSpacing");
this.horizontalSpacing = horizontalSpacing;
invalidateComponent();
}
- public final void setHorizontalSpacing(Number horizontalSpacing) {
+ public final void setHorizontalSpacing(final Number horizontalSpacing) {
Utils.checkNull(horizontalSpacing, "horizontalSpacing");
setHorizontalSpacing(horizontalSpacing.intValue());
@@ -434,14 +430,14 @@
return verticalSpacing;
}
- public void setVerticalSpacing(int verticalSpacing) {
+ public void setVerticalSpacing(final int verticalSpacing) {
Utils.checkNonNegative(verticalSpacing, "verticalSpacing");
this.verticalSpacing = verticalSpacing;
invalidateComponent();
}
- public final void setVerticalSpacing(Number verticalSpacing) {
+ public final void setVerticalSpacing(final Number verticalSpacing) {
Utils.checkNull(verticalSpacing, "verticalSpacing");
setVerticalSpacing(verticalSpacing.intValue());
@@ -451,7 +447,7 @@
return alignToBaseline;
}
- public void setAlignToBaseline(boolean alignToBaseline) {
+ public void setAlignToBaseline(final boolean alignToBaseline) {
this.alignToBaseline = alignToBaseline;
invalidateComponent();
}