You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2018/08/23 16:12:56 UTC
svn commit: r1838738 [2/3] - in /pivot/trunk: core/src/org/apache/pivot/xml/
wtk-terra/src/org/apache/pivot/wtk/skin/terra/
wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/effects/
wtk/src/org/apache/pivot/wtk/media/ wtk/src/org/apache/pivot...
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java Thu Aug 23 16:12:55 2018
@@ -95,17 +95,14 @@ public final class GraphicsUtilities {
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 @@ public final class GraphicsUtilities {
* 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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
}
Paint paint;
+ float startX, startY;
+ float endX, endY;
+
switch (PaintType.valueOf(paintType.toUpperCase(Locale.ENGLISH))) {
- case SOLID_COLOR: {
- String color = JSON.get(dictionary, COLOR_KEY);
- paint = decodeColor(color);
+ case SOLID_COLOR:
+ paint = decodeColor((String) JSON.get(dictionary, COLOR_KEY));
break;
- }
- 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);
+ 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 @@ public final class GraphicsUtilities {
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 @@ public final class GraphicsUtilities {
break;
}
- default: {
+ default:
throw new UnsupportedOperationException();
- }
}
return paint;
@@ -427,7 +421,7 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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 @@ public final class GraphicsUtilities {
* @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:
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ImageView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ImageView.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ImageView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ImageView.java Thu Aug 23 16:12:55 2018
@@ -120,7 +120,7 @@ public class ImageView extends Component
*
* @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 @@ public class ImageView extends Component
*
* @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 @@ public class ImageView extends Component
*
* @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 @@ public class ImageView extends Component
} 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 @@ public class ImageView extends Component
}
@Override
- public void executeFailed(Task<Image> task) {
+ public void executeFailed(final Task<Image> task) {
// No-op
}
}));
@@ -217,7 +217,7 @@ public class ImageView extends Component
* @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 @@ public class ImageView extends Component
* 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 @@ public class ImageView extends Component
*
* @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 @@ public class ImageView extends Component
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 @@ public class ImageView extends Component
return imageBindMapping;
}
- public void setImageBindMapping(ImageBindMapping imageBindMapping) {
+ public void setImageBindMapping(final ImageBindMapping imageBindMapping) {
ImageBindMapping previousImageBindMapping = this.imageBindMapping;
if (previousImageBindMapping != imageBindMapping) {
@@ -297,31 +297,27 @@ public class ImageView extends Component
}
@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 @@ public class ImageView extends Component
} 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));
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java Thu Aug 23 16:12:55 2018
@@ -1595,7 +1595,7 @@ public class ListView extends Component
}
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 @@ public class ListView extends Component
}
break;
- }
- case MULTI: {
+ case MULTI:
// Bind using selected items key
if (selectedItemsKey != null && selectedItemsBindType != BindType.STORE
&& JSON.containsKey(context, selectedItemsKey)) {
@@ -1639,15 +1638,12 @@ public class ListView extends Component
}
break;
- }
- case NONE: {
+ case NONE:
break;
- }
- default: {
+ default:
break;
- }
}
if (checkmarksEnabled) {
@@ -1719,7 +1715,7 @@ public class ListView extends Component
}
switch (selectMode) {
- case SINGLE: {
+ case SINGLE:
// Bind using selected item key
if (selectedItemKey != null && selectedItemBindType != BindType.LOAD) {
Object item;
@@ -1739,9 +1735,8 @@ public class ListView extends Component
}
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 @@ public class ListView extends Component
}
break;
- }
- case NONE: {
+ case NONE:
break;
- }
- default: {
+ default:
break;
- }
}
if (checkmarksEnabled) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java Thu Aug 23 16:12:55 2018
@@ -84,7 +84,7 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
* 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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
*
* @param minimumWidth Minimum column width.
*/
- public void setMinimumWidth(int minimumWidth) {
+ public void setMinimumWidth(final int minimumWidth) {
setWidthLimits(minimumWidth, maximumWidth);
}
@@ -389,7 +390,7 @@ public class TableView extends Component
*
* @param maximumWidth Maximum column width.
*/
- public void setMaximumWidth(int maximumWidth) {
+ public void setMaximumWidth(final int maximumWidth) {
setWidthLimits(minimumWidth, maximumWidth);
}
@@ -408,7 +409,7 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
* @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 class TableView extends Component
*/
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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
}
@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 class TableView extends Component
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 @@ public class TableView extends Component
}
@Override
- public SortDirection remove(String columnName) {
+ public SortDirection remove(final String columnName) {
SortDirection sortDirection = null;
if (containsKey(columnName)) {
@@ -750,7 +751,7 @@ public class TableView extends Component
}
@Override
- public boolean containsKey(String columnName) {
+ public boolean containsKey(final String columnName) {
return sortMap.containsKey(columnName);
}
@@ -758,7 +759,7 @@ public class TableView extends Component
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 @@ public class TableView extends Component
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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* 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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
return columnSource;
}
- public void setColumnSource(TableView columnSource) {
+ public void setColumnSource(final TableView columnSource) {
TableView previousColumnSource = this.columnSource;
if (previousColumnSource != columnSource) {
@@ -1048,7 +1049,7 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
*
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
}
@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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
return tableDataKey;
}
- public void setTableDataKey(String tableDataKey) {
+ public void setTableDataKey(final String tableDataKey) {
String previousTableDataKey = this.tableDataKey;
if (previousTableDataKey != tableDataKey) {
@@ -1600,7 +1600,7 @@ public class TableView extends Component
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 @@ public class TableView extends Component
return tableDataBindMapping;
}
- public void setTableDataBindMapping(TableDataBindMapping tableDataBindMapping) {
+ public void setTableDataBindMapping(final TableDataBindMapping tableDataBindMapping) {
TableDataBindMapping previousTableDataBindMapping = this.tableDataBindMapping;
if (previousTableDataBindMapping != tableDataBindMapping) {
@@ -1629,7 +1629,7 @@ public class TableView extends Component
return selectedRowKey;
}
- public void setSelectedRowKey(String selectedRowKey) {
+ public void setSelectedRowKey(final String selectedRowKey) {
String previousSelectedRowKey = this.selectedRowKey;
if (previousSelectedRowKey != selectedRowKey) {
@@ -1642,7 +1642,7 @@ public class TableView extends Component
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 @@ public class TableView extends Component
return selectedRowBindMapping;
}
- public void setSelectedRowBindMapping(SelectedRowBindMapping selectedRowBindMapping) {
+ public void setSelectedRowBindMapping(final SelectedRowBindMapping selectedRowBindMapping) {
SelectedRowBindMapping previousSelectedRowBindMapping = this.selectedRowBindMapping;
if (previousSelectedRowBindMapping != selectedRowBindMapping) {
@@ -1670,7 +1670,7 @@ public class TableView extends Component
return selectedRowsKey;
}
- public void setSelectedRowsKey(String selectedRowsKey) {
+ public void setSelectedRowsKey(final String selectedRowsKey) {
String previousSelectedRowsKey = this.selectedRowsKey;
if (previousSelectedRowsKey != selectedRowsKey) {
@@ -1683,7 +1683,7 @@ public class TableView extends Component
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 @@ public class TableView extends Component
return selectedRowsBindMapping;
}
- public void setSelectedRowsBindMapping(SelectedRowBindMapping selectedRowsBindMapping) {
+ public void setSelectedRowsBindMapping(final SelectedRowBindMapping selectedRowsBindMapping) {
SelectedRowBindMapping previousSelectedRowsBindMapping = this.selectedRowsBindMapping;
if (previousSelectedRowsBindMapping != selectedRowsBindMapping) {
@@ -1710,7 +1710,7 @@ public class TableView extends Component
@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 @@ public class TableView extends Component
}
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 @@ public class TableView extends Component
}
break;
- }
- case MULTI: {
+ case MULTI:
// Bind using selected rows key
if (selectedRowsKey != null && selectedRowsBindType != BindType.STORE
&& JSON.containsKey(context, selectedRowsKey)) {
@@ -1771,20 +1770,17 @@ public class TableView extends Component
}
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 @@ public class TableView extends Component
}
switch (selectMode) {
- case SINGLE: {
+ case SINGLE:
// Bind using selected row key
if (selectedRowKey != null && selectedRowBindType != BindType.LOAD) {
Object row;
@@ -1818,9 +1814,8 @@ public class TableView extends Component
}
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 @@ public class TableView extends Component
}
break;
- }
- case NONE: {
+ case NONE:
break;
- }
- default: {
+ default:
break;
- }
}
}
@@ -1875,7 +1867,7 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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 @@ public class TableView extends Component
* @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);
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java Thu Aug 23 16:12:55 2018
@@ -42,12 +42,12 @@ public class TagDecorator implements Dec
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 @@ public class TagDecorator implements Dec
return tag;
}
- public void setTag(Visual tag) {
+ public void setTag(final Visual tag) {
this.tag = tag;
}
@@ -70,7 +70,7 @@ public class TagDecorator implements Dec
return horizontalAlignment;
}
- public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
+ public void setHorizontalAlignment(final HorizontalAlignment horizontalAlignment) {
Utils.checkNull(horizontalAlignment, "horizontalAlignment");
this.horizontalAlignment = horizontalAlignment;
@@ -80,7 +80,7 @@ public class TagDecorator implements Dec
return verticalAlignment;
}
- public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
+ public void setVerticalAlignment(final VerticalAlignment verticalAlignment) {
Utils.checkNull(verticalAlignment, "verticalAlignment");
this.verticalAlignment = verticalAlignment;
@@ -90,7 +90,7 @@ public class TagDecorator implements Dec
return xOffset;
}
- public void setXOffset(int xOffset) {
+ public void setXOffset(final int xOffset) {
this.xOffset = xOffset;
}
@@ -98,12 +98,12 @@ public class TagDecorator implements Dec
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 @@ public class TagDecorator implements Dec
}
@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;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java Thu Aug 23 16:12:55 2018
@@ -41,7 +41,7 @@ public class Picture extends Image {
private int baseline = -1;
- public Picture(BufferedImage bufferedImage) {
+ public Picture(final BufferedImage bufferedImage) {
Utils.checkNull(bufferedImage, "bufferedImage");
this.bufferedImage = bufferedImage;
@@ -61,11 +61,11 @@ public class Picture extends Image {
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 @@ public class Picture extends Image {
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 @@ public class Picture extends Image {
// 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 @@ public class Picture extends Image {
return baseline;
}
- public void setBaseline(int baseline) {
+ public void setBaseline(final int baseline) {
int previousBaseline = this.baseline;
if (baseline != previousBaseline) {
@@ -159,7 +155,7 @@ public class Picture extends Image {
}
@Override
- public void paint(Graphics2D graphics) {
+ public void paint(final Graphics2D graphics) {
graphics.drawImage(bufferedImage, 0, 0, null);
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java Thu Aug 23 16:12:55 2018
@@ -39,7 +39,7 @@ public class BoxPaneSkin extends Contain
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 @@ public class BoxPaneSkin extends Contain
}
@Override
- public int getPreferredWidth(int height) {
+ public int getPreferredWidth(final int height) {
BoxPane boxPane = (BoxPane) getComponent();
int preferredWidth = 0;
@@ -93,7 +93,7 @@ public class BoxPaneSkin extends Contain
}
@Override
- public int getPreferredHeight(int width) {
+ public int getPreferredHeight(final int width) {
BoxPane boxPane = (BoxPane) getComponent();
int preferredHeight = 0;
@@ -145,12 +145,11 @@ public class BoxPaneSkin extends Contain
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 @@ public class BoxPaneSkin extends Contain
}
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 @@ public class BoxPaneSkin extends Contain
}
break;
- }
- default: {
+ default:
break;
- }
}
// Include padding
@@ -205,14 +200,14 @@ public class BoxPaneSkin extends Contain
}
@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 @@ public class BoxPaneSkin extends Contain
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 @@ public class BoxPaneSkin extends Contain
}
break;
- }
- case VERTICAL: {
+ case VERTICAL:
int clientWidth = Math.max(width - padding.getWidth(), 0);
for (Component component : boxPane) {
@@ -291,11 +281,9 @@ public class BoxPaneSkin extends Contain
contentHeight -= spacing;
break;
- }
- default: {
+ default:
break;
- }
}
if (baseline != -1) {
@@ -303,24 +291,20 @@ public class BoxPaneSkin extends Contain
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 @@ public class BoxPaneSkin extends Contain
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 @@ public class BoxPaneSkin extends Contain
if (fill) {
componentHeight = Math.max(height - padding.getHeight(), 0);
-
componentWidth = component.getPreferredWidth(componentHeight);
} else {
Dimensions preferredComponentSize = component.getPreferredSize();
@@ -382,24 +361,20 @@ public class BoxPaneSkin extends Contain
}
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 @@ public class BoxPaneSkin extends Contain
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 @@ public class BoxPaneSkin extends Contain
if (fill) {
componentWidth = Math.max(width - padding.getWidth(), 0);
-
componentHeight = component.getPreferredHeight(componentWidth);
} else {
Dimensions preferredComponentSize = component.getPreferredSize();
@@ -456,21 +428,17 @@ public class BoxPaneSkin extends Contain
}
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 @@ public class BoxPaneSkin extends Contain
}
/**
- * @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
}
/**
- * @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
* @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
*
* @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 @@ public class BoxPaneSkin extends Contain
* 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();
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java?rev=1838738&r1=1838737&r2=1838738&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java Thu Aug 23 16:12:55 2018
@@ -53,7 +53,8 @@ public abstract class CalendarButtonSkin
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 @@ public abstract class CalendarButtonSkin
/**
* {@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 @@ public abstract class CalendarButtonSkin
calendarButton.setSelectedDate(date);
break;
- }
- default: {
+ default:
break;
- }
}
return false;
@@ -111,7 +108,7 @@ public abstract class CalendarButtonSkin
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 @@ public abstract class CalendarButtonSkin
}
@Override
- public Vote previewWindowClose(Window window) {
+ public Vote previewWindowClose(final Window window) {
if (window.containsFocus()) {
getComponent().requestFocus();
}
@@ -128,14 +125,14 @@ public abstract class CalendarButtonSkin
}
@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 @@ public abstract class CalendarButtonSkin
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 @@ public abstract class CalendarButtonSkin
}
@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 @@ public abstract class CalendarButtonSkin
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 @@ public abstract class CalendarButtonSkin
}
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
CalendarButton calendarButton = (CalendarButton) component;
@@ -208,6 +205,7 @@ public abstract class CalendarButtonSkin
calendar.setLocale(calendarButton.getLocale());
}
+
// CalendarButton.Skin methods
@Override
public Window getCalendarPopup() {
@@ -216,7 +214,7 @@ public abstract class CalendarButtonSkin
// 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 @@ public abstract class CalendarButtonSkin
}
@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 @@ public abstract class CalendarButtonSkin
// Component mouse events
@Override
- public void mouseOut(Component component) {
+ public void mouseOut(final Component component) {
super.mouseOut(component);
pressed = false;
@@ -255,7 +253,7 @@ public abstract class CalendarButtonSkin
}
@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 @@ public abstract class CalendarButtonSkin
}
@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 @@ public abstract class CalendarButtonSkin
* @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 @@ public abstract class CalendarButtonSkin
* {@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 @@ public abstract class CalendarButtonSkin
// 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);