You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2009/11/13 16:28:24 UTC
svn commit: r835878 - in /incubator/pivot/trunk:
core/src/org/apache/pivot/collections/ wtk/src/org/apache/pivot/wtk/skin/
wtk/src/org/apache/pivot/wtk/skin/terra/ wtk/test/org/apache/pivot/wtk/test/
Author: smartini
Date: Fri Nov 13 15:28:24 2009
New Revision: 835878
URL: http://svn.apache.org/viewvc?rev=835878&view=rev
Log:
trim-whitespace
Modified:
incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ListViewTest2.java
incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/listview_test2.wtkx
Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java?rev=835878&r1=835877&r2=835878&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java Fri Nov 13 15:28:24 2009
@@ -112,7 +112,7 @@
ArrayList.this.remove(index, 1);
modificationCount++;
}
-
+
private void indexBoundsCheck() {
if (index < 0 || index >+ ArrayList.this.length) {
throw new IllegalStateException("index " + index + " out of bounds");
@@ -141,7 +141,7 @@
}
public ArrayList(int capacity) {
- CollectionArgChecks.zeroOrGreater("capacity", capacity);
+ CollectionArgChecks.zeroOrGreater("capacity", capacity);
items = new Object[capacity];
}
@@ -220,7 +220,7 @@
}
private void insert(T item, int index, boolean validate) {
- CollectionArgChecks.indexBounds(index, 0, length);
+ CollectionArgChecks.indexBounds(index, 0, length);
if (comparator != null
&& validate) {
@@ -250,7 +250,7 @@
@SuppressWarnings("unchecked")
@Override
public T update(int index, T item) {
- CollectionArgChecks.indexBounds(index, 0, length - 1);
+ CollectionArgChecks.indexBounds(index, 0, length - 1);
T previousItem = (T)items[index];
@@ -295,7 +295,7 @@
@SuppressWarnings("unchecked")
@Override
public Sequence<T> remove(int index, int count) {
- CollectionArgChecks.indexBounds(index, count, 0, length);
+ CollectionArgChecks.indexBounds(index, count, 0, length);
ArrayList<T> removed = new ArrayList<T>((T[])items, index, count);
@@ -336,7 +336,7 @@
@SuppressWarnings("unchecked")
@Override
public T get(int index) {
- CollectionArgChecks.indexBounds(index, 0, length);
+ CollectionArgChecks.indexBounds(index, 0, length);
return (T)items[index];
}
@@ -504,8 +504,8 @@
@SuppressWarnings("unchecked")
public static <T> void sort(ArrayList<T> arrayList, int from, int to, Comparator<T> comparator) {
- CollectionArgChecks.notNull("arrayList", arrayList);
- CollectionArgChecks.notNull("comparator", comparator);
+ CollectionArgChecks.notNull("arrayList", arrayList);
+ CollectionArgChecks.notNull("comparator", comparator);
Arrays.sort((T[])arrayList.items, from, to, comparator);
@@ -523,9 +523,9 @@
@SuppressWarnings("unchecked")
public static <T> int binarySearch(ArrayList<T> arrayList, T item, Comparator<T> comparator) {
- CollectionArgChecks.notNull("arrayList", arrayList);
- CollectionArgChecks.notNull("comparator", comparator);
- CollectionArgChecks.notNull("item", item);
+ CollectionArgChecks.notNull("arrayList", arrayList);
+ CollectionArgChecks.notNull("comparator", comparator);
+ CollectionArgChecks.notNull("item", item);
int index = Arrays.binarySearch((T[])arrayList.items, 0, arrayList.length, item, comparator);
Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java?rev=835878&r1=835877&r2=835878&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/CollectionArgChecks.java Fri Nov 13 15:28:24 2009
@@ -19,7 +19,7 @@
/**
* Implements various assert-style checking for the Pivot collections classes.
* Throws nice descriptive exceptions if something goes wrong.
- *
+ *
* @author Noel Grandin
*/
public class CollectionArgChecks {
@@ -29,19 +29,19 @@
throw new IllegalArgumentException(fieldName + " cannot be null");
}
}
-
+
public static void zeroOrGreater(String fieldName, int field) {
if (field < 0) {
throw new IllegalArgumentException(fieldName + " " + field + " cannot be < 0");
}
}
-
+
public static void indexBounds(int index, int boundStart, int boundEnd) {
if (index < boundStart || index > boundEnd) {
throw new IndexOutOfBoundsException("index " + index + " out of bounds");
}
}
-
+
public static void indexBounds(int index, int count, int boundStart, int boundEnd) {
if (count < 0) {
throw new IllegalArgumentException();
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java?rev=835878&r1=835877&r2=835878&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/GridPaneSkin.java Fri Nov 13 15:28:24 2009
@@ -81,7 +81,7 @@
}
}
}
-
+
int visibleRowCount = 0;
int clientHeight = height - padding.top - padding.bottom;
for (int i = 0; i < rowCount; i++) {
@@ -97,7 +97,7 @@
if (visibleRowCount > 0) {
cellHeight = clientHeight / visibleRowCount;
}
-
+
int cellPreferredWidth = 0;
for (int i = 0; i < rowCount; i++) {
GridPane.Row row = rows.get(i);
@@ -111,7 +111,7 @@
}
}
}
-
+
// The preferred width of the grid pane is the sum of the column
// widths, plus padding and spacing
@@ -156,7 +156,7 @@
}
}
}
-
+
int visibleColumnCount = 0;
int clientWidth = width - padding.left - padding.right;
for (int i = 0; i < columnCount; i++) {
@@ -224,7 +224,7 @@
}
}
}
-
+
// The preferred width of the grid pane is the sum of the column
// widths, plus padding and spacing
@@ -244,7 +244,7 @@
// The preferred height of the grid pane is the sum of the row
// heights, plus padding and spacing
-
+
int visibleRowCount = 0;
int preferredHeight = padding.top + padding.bottom;
for (int i = 0; i < rowCount; i++) {
@@ -256,7 +256,7 @@
if (visibleRowCount > 1) {
preferredHeight += (visibleRowCount - 1) * verticalSpacing;
}
-
+
return new Dimensions(preferredWidth, preferredHeight);
}
@@ -310,10 +310,10 @@
}
}
}
-
-
+
+
// Calculate cell width
-
+
int visibleColumnCount = 0;
int clientWidth = width - padding.left - padding.right;
for (int i = 0; i < columnCount; i++) {
@@ -329,10 +329,10 @@
if (visibleColumnCount > 0) {
cellWidth = clientWidth / visibleColumnCount;
}
-
-
+
+
// Calculate cell height
-
+
int visibleRowCount = 0;
int clientHeight = height - padding.top - padding.bottom;
for (int i = 0; i < rowCount; i++) {
@@ -348,7 +348,7 @@
if (visibleRowCount > 0) {
cellHeight = clientHeight / visibleRowCount;
}
-
+
int componentY = padding.top;
for (int i = 0; i < rowCount; i++) {
GridPane.Row row = rows.get(i);
@@ -692,7 +692,7 @@
GridPane.RowSequence rows = gridPane.getRows();
int rowCount = rows.getLength();
-
+
int rowIndex = -1;
int rowY = padding.top;
@@ -715,7 +715,7 @@
GridPane.RowSequence rows = gridPane.getRows();
int rowCount = rows.getLength();
-
+
if (row < 0
|| row >= rowCount) {
throw new IndexOutOfBoundsException(String.valueOf(row));
@@ -736,7 +736,7 @@
GridPane.ColumnSequence columns = gridPane.getColumns();
int columnCount = columns.getLength();
-
+
int columnIndex = -1;
for (int j = 0, columnX = padding.left; columnX <= x && j < columnCount; j++) {
@@ -758,7 +758,7 @@
GridPane.ColumnSequence columns = gridPane.getColumns();
int columnCount = columns.getLength();
-
+
if (column < 0
|| column >= columnCount) {
throw new IndexOutOfBoundsException(String.valueOf(column));
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java?rev=835878&r1=835877&r2=835878&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java Fri Nov 13 15:28:24 2009
@@ -136,14 +136,14 @@
ListView listView = (ListView)getComponent();
List<Object> listData = (List<Object>)listView.getListData();
ListView.ItemRenderer itemRenderer = listView.getItemRenderer();
-
+
if (variableItemHeight) {
int clientWidth = width;
if (listView.getCheckmarksEnabled()) {
clientWidth = Math.max(clientWidth - (CHECKBOX.getWidth() + (checkboxPadding.left
+ checkboxPadding.right)), 0);
}
-
+
int index = 0;
for (Object item : listData) {
itemRenderer.render(item, index++, listView, false, false, false, false);
@@ -196,7 +196,7 @@
ListView.ItemRenderer itemRenderer = listView.getItemRenderer();
if (variableItemHeight) {
-
+
int width = getWidth();
// Paint the list contents
@@ -220,7 +220,7 @@
int itemWidth = width;
int itemX = 0;
-
+
boolean checked = false;
if (listView.getCheckmarksEnabled()) {
checked = listView.isItemChecked(itemIndex);
@@ -228,13 +228,13 @@
+ checkboxPadding.right);
itemWidth -= itemX;
}
-
+
itemRenderer.render(item, itemIndex, listView, selected, checked, highlighted, disabled);
int itemHeight = itemRenderer.getPreferredHeight(itemWidth);
if (listView.getCheckmarksEnabled()) {
itemHeight = Math.max(itemHeight, checkboxHeight);
}
-
+
variableItemHeightYCache[itemIndex] = itemY;
itemY += itemHeight;
}
@@ -265,7 +265,7 @@
graphics.setPaint(backgroundColor);
graphics.fillRect(0, 0, width, height);
}
-
+
// Paint the list contents
int itemStart = 0;
int itemEnd = listData.getLength() - 1;
@@ -290,7 +290,7 @@
} else {
itemY = itemStart * fixedItemHeight;
}
-
+
for (int itemIndex = itemStart; itemIndex <= itemEnd; itemIndex++) {
Object item = listData.get(itemIndex);
boolean highlighted = (itemIndex == highlightedIndex
@@ -350,7 +350,7 @@
itemRenderer.setSize(itemWidth, itemHeight);
itemRenderer.paint(rendererGraphics);
rendererGraphics.dispose();
-
+
itemY += itemHeight;
}
}
@@ -417,7 +417,7 @@
}
return itemY;
}
-
+
private int getItemHeight(int index) {
int itemHeight;
if (variableItemHeight) {
@@ -427,7 +427,7 @@
}
return itemHeight;
}
-
+
@Override
public boolean isFocusable() {
ListView listView = (ListView)getComponent();
@@ -706,7 +706,7 @@
repaintComponent();
}
-
+
@Override
public boolean mouseMove(Component component, int x, int y) {
boolean consumed = super.mouseMove(component, x, y);
@@ -758,7 +758,7 @@
int itemIndex = getItemAt(y);
- if (itemIndex != -1
+ if (itemIndex != -1
&& itemIndex < listData.getLength()
&& !listView.isItemDisabled(itemIndex)) {
int itemY = getItemBounds(itemIndex).y;
@@ -1100,10 +1100,10 @@
@SuppressWarnings("unchecked")
public void selectedRangesChanged(ListView listView, Sequence<Span> previousSelectedRanges) {
List<Object> listData = (List<Object>)listView.getListData();
-
+
// Repaint only the area that changed (intersection of previous
// and new selection)
-
+
int rangeStart = 0;
int rangeEnd = listData.getLength() - 1;
for (int i = 0; i < previousSelectedRanges.getLength(); i++) {
@@ -1118,7 +1118,7 @@
rangeStart = Math.min(rangeStart, span.start);
rangeEnd = Math.max(rangeEnd, span.end);
}
-
+
repaintComponent(0, getItemY(rangeStart),
getWidth(), getItemY(rangeEnd) + getItemHeight(rangeEnd));
}
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ListViewTest2.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ListViewTest2.java?rev=835878&r1=835877&r2=835878&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ListViewTest2.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/ListViewTest2.java Fri Nov 13 15:28:24 2009
@@ -32,7 +32,7 @@
throws Exception {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
window = new Window((Component)wtkxSerializer.readObject(getClass().getResource("listview_test2.wtkx")));
-
+
window.setTitle("ListView Test");
window.setMaximized(true);
window.open(display);
Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/listview_test2.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/listview_test2.wtkx?rev=835878&r1=835877&r2=835878&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/listview_test2.wtkx (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/listview_test2.wtkx Fri Nov 13 15:28:24 2009
@@ -16,7 +16,7 @@
limitations under the License.
-->
-<BoxPane
+<BoxPane
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns:collections="org.apache.pivot.collections"
xmlns:content="org.apache.pivot.wtk.content"
@@ -132,7 +132,7 @@
</content>
</Border>
</BoxPane>
-
+
<BoxPane orientation="vertical" styles="{spacing:6}">
<Label text="Checked" styles="{font:{bold:true}}"/>
<Border styles="{color:10}">