Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix some eclipse warnings

git-svn-id: https://svn.apache.org/repos/asf/pivot/trunk@1338284 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 8ab7db3b43182a172ba5df2073f26a2bd0017f88 1 parent f9c312d
Sandro Martini authored
Showing with 608 additions and 547 deletions.
  1. +42 −31 core/src/org/apache/pivot/beans/BXMLSerializer.java
  2. +3 −2 core/src/org/apache/pivot/beans/BeanAdapter.java
  3. +3 −2 core/src/org/apache/pivot/beans/BeanMonitor.java
  4. +14 −14 core/src/org/apache/pivot/collections/ArrayList.java
  5. +2 −2 core/src/org/apache/pivot/collections/EnumSet.java
  6. +9 −9 core/src/org/apache/pivot/collections/HashMap.java
  7. +7 −7 core/src/org/apache/pivot/collections/LinkedList.java
  8. +5 −0 core/src/org/apache/pivot/collections/ListListener.java
  9. +5 −0 core/src/org/apache/pivot/collections/MapListener.java
  10. +1 −0  core/src/org/apache/pivot/collections/Queue.java
  11. +4 −0 core/src/org/apache/pivot/collections/QueueListener.java
  12. +4 −0 core/src/org/apache/pivot/collections/SetListener.java
  13. +1 −0  core/src/org/apache/pivot/collections/Stack.java
  14. +4 −0 core/src/org/apache/pivot/collections/StackListener.java
  15. +3 −3 core/src/org/apache/pivot/collections/adapter/MapAdapter.java
  16. +3 −3 core/src/org/apache/pivot/collections/adapter/SetAdapter.java
  17. +1 −0  core/src/org/apache/pivot/collections/concurrent/SynchronizedQueue.java
  18. +1 −0  core/src/org/apache/pivot/collections/concurrent/SynchronizedStack.java
  19. +2 −2 core/src/org/apache/pivot/io/IOTask.java
  20. +41 −41 core/src/org/apache/pivot/json/JSONSerializer.java
  21. +9 −0 core/src/org/apache/pivot/json/JSONSerializerListener.java
  22. +4 −4 core/src/org/apache/pivot/serialization/CSVSerializer.java
  23. +3 −0  core/src/org/apache/pivot/serialization/CSVSerializerListener.java
  24. +21 −21 core/src/org/apache/pivot/util/concurrent/Task.java
  25. +7 −7 core/src/org/apache/pivot/xml/Element.java
  26. +7 −0 core/src/org/apache/pivot/xml/ElementListener.java
  27. +1 −0  core/src/org/apache/pivot/xml/Node.java
  28. +6 −2 core/src/org/apache/pivot/xml/XMLSerializer.java
  29. +3 −0  core/src/org/apache/pivot/xml/XMLSerializerListener.java
  30. +7 −3 core/test/org/apache/pivot/json/test/BindTest.java
  31. +9 −9 core/test/org/apache/pivot/json/test/JSONSerializerTest.java
  32. +3 −0  core/test/org/apache/pivot/serialization/test/CSVSerializerTest.java
  33. +6 −4 core/test/org/apache/pivot/util/concurrent/test/TaskTest.java
  34. +3 −3 core/test/org/apache/pivot/xml/test/XMLSerializerTest.java
  35. +3 −0  demos/src/org/apache/pivot/demos/decorator/DecoratorDemo.java
  36. +5 −2 demos/src/org/apache/pivot/demos/dnd/DragAndDropDemo.java
  37. +3 −2 demos/src/org/apache/pivot/demos/dnd/FileDropTargetDemo.java
  38. +1 −9 demos/src/org/apache/pivot/demos/dom/DOMInteractionDemo.java
  39. +1 −0  demos/src/org/apache/pivot/demos/itunes/SearchDemo.java
  40. +2 −9 demos/src/org/apache/pivot/demos/json/JSONViewer.java
  41. +1 −9 demos/src/org/apache/pivot/demos/memorygame/MemGame.java
  42. +30 −20 demos/src/org/apache/pivot/demos/million/LargeData.java
  43. +1 −9 demos/src/org/apache/pivot/demos/roweditor/RowEditorDemo.java
  44. +1 −8 demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilder.java
  45. +6 −6 demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java
  46. +7 −7 demos/src/org/apache/pivot/demos/suggest/SuggestionDemo.java
  47. +2 −9 demos/src/org/apache/pivot/demos/text/TextPaneDemo.java
  48. +1 −0  demos/src/org/apache/pivot/demos/xml/NodeRenderer.java
  49. +2 −9 demos/src/org/apache/pivot/demos/xml/XMLViewer.java
  50. +1 −9 examples/src/org/apache/pivot/examples/builder/BuilderExample.java
  51. +3 −0  examples/src/org/apache/pivot/examples/deployment/DeploymentExample.java
  52. +3 −2 examples/src/org/apache/pivot/examples/sheets/EditGreetingSheet.java
  53. +4 −3 examples/src/org/apache/pivot/examples/sheets/SheetExampleWindow.java
  54. +2 −10 tests/src/org/apache/pivot/tests/ApplicationHandlerTest.java
  55. +8 −6 tests/src/org/apache/pivot/tests/ColorPaletteTest.java
  56. +1 −9 tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.java
  57. +10 −10 tutorials/www/hello-bxml.xml
  58. +1 −1  tutorials/www/hello-world.xml
  59. +5 −4 web-server/src/org/apache/pivot/web/server/ProxyServlet.java
  60. +4 −4 web/src/org/apache/pivot/web/Query.java
  61. +4 −0 web/src/org/apache/pivot/web/QueryListener.java
  62. +8 −7 wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
  63. +21 −16 wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
  64. +10 −10 wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
  65. +31 −29 wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
  66. +2 −2 wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme.java
  67. +20 −16 wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
  68. +6 −0 wtk/src/org/apache/pivot/wtk/Application.java
  69. +36 −34 wtk/src/org/apache/pivot/wtk/ApplicationContext.java
  70. +115 −107 wtk/src/org/apache/pivot/wtk/Component.java
  71. +3 −0  wtk/src/org/apache/pivot/wtk/ComponentDataListener.java
View
73 core/src/org/apache/pivot/beans/BXMLSerializer.java
@@ -203,6 +203,7 @@ public ScriptBindMapping(ScriptEngine scriptEngine, String functionName) {
this.functionName = functionName;
}
+ @Override
public Object evaluate(Object value) {
Bindings bindings = scriptEngine.getBindings(ScriptContext.GLOBAL_SCOPE);
if (bindings.containsKey(functionName)) {
@@ -391,6 +392,7 @@ public int size() {
}
/** DO NOT USE. see https://issues.apache.org/jira/browse/PIVOT-742 */
+ @SuppressWarnings("unused")
@Deprecated
public BXMLSerializer(final ClassLoader classLoader) {
throw new UnsupportedOperationException("https://issues.apache.org/jira/browse/PIVOT-742");
@@ -466,7 +468,7 @@ public Object readObject(InputStream inputStream)
// Apply the namespace bindings
for (Attribute attribute : namespaceBindingAttributes) {
- Element element = attribute.element;
+ Element elementLocal = attribute.element;
String sourcePath = (String)attribute.value;
NamespaceBinding.BindMapping bindMapping;
@@ -479,16 +481,16 @@ public Object readObject(InputStream inputStream)
bindMapping = new ScriptBindMapping(scriptEngineManager.getEngineByName(language), bindFunction);
}
- switch (element.type) {
+ switch (elementLocal.type) {
case INSTANCE:
case INCLUDE: {
// Bind to <element ID>.<attribute name>
- if (element.id == null) {
- element.id = INTERNAL_ID_PREFIX + Integer.toString(nextID++);
- namespace.put(element.id, element.value);
+ if (elementLocal.id == null) {
+ elementLocal.id = INTERNAL_ID_PREFIX + Integer.toString(nextID++);
+ namespace.put(elementLocal.id, elementLocal.value);
}
- String targetPath = element.id + "." + attribute.name;
+ String targetPath = elementLocal.id + "." + attribute.name;
NamespaceBinding namespaceBinding = new NamespaceBinding(namespace, sourcePath, targetPath,
bindMapping);
namespaceBinding.bind();
@@ -498,18 +500,22 @@ public Object readObject(InputStream inputStream)
case READ_ONLY_PROPERTY: {
// Bind to <parent element ID>.<element name>.<attribute name>
- if (element.parent.id == null) {
- element.parent.id = INTERNAL_ID_PREFIX + Integer.toString(nextID++);
- namespace.put(element.parent.id, element.parent.value);
+ if (elementLocal.parent.id == null) {
+ elementLocal.parent.id = INTERNAL_ID_PREFIX + Integer.toString(nextID++);
+ namespace.put(elementLocal.parent.id, elementLocal.parent.value);
}
- String targetPath = element.parent.id + "." + element.name + "." + attribute.name;
+ String targetPath = elementLocal.parent.id + "." + elementLocal.name + "." + attribute.name;
NamespaceBinding namespaceBinding = new NamespaceBinding(namespace, sourcePath, targetPath,
bindMapping);
namespaceBinding.bind();
break;
}
+
+ default: {
+ break;
+ }
}
}
@@ -572,11 +578,11 @@ public final Object readObject(Class<?> baseType, String resourceName, boolean l
}
// throw a nice error so the user knows which resource did not load
- URL location = baseType.getResource(resourceName);
- if (location == null) {
+ URL locationLocal = baseType.getResource(resourceName);
+ if (locationLocal == null) {
throw new IllegalArgumentException("could not find resource " + resourceName);
}
- return readObject(location, localize ? new Resources(baseType.getName()) : null);
+ return readObject(locationLocal, localize ? new Resources(baseType.getName()) : null);
}
/**
@@ -587,37 +593,37 @@ public final Object readObject(Class<?> baseType, String resourceName, boolean l
* resolution must manually set this property via a call to
* {@link #setResources(Resources)} before calling this method.
*
- * @param location
+ * @param locationArgument
* The location of the BXML resource.
*
* @see #readObject(URL, Resources)
*/
- public final Object readObject(URL location)
+ public final Object readObject(URL locationArgument)
throws IOException, SerializationException {
- return readObject(location, null);
+ return readObject(locationArgument, null);
}
/**
* Deserializes an object hierarchy from a BXML resource.
*
- * @param location
+ * @param locationArgument
* The location of the BXML resource.
*
- * @param resources
+ * @param resourcesArgument
* The resources that will be used to localize the deserialized resource.
*
* #see readObject(InputStream)
*/
- public final Object readObject(URL location, Resources resources)
+ public final Object readObject(URL locationArgument, Resources resourcesArgument)
throws IOException, SerializationException {
- if (location == null) {
+ if (locationArgument == null) {
throw new IllegalArgumentException("location is null.");
}
- this.location = location;
- this.resources = resources;
+ this.location = locationArgument;
+ this.resources = resourcesArgument;
- InputStream inputStream = new BufferedInputStream(location.openStream());
+ InputStream inputStream = new BufferedInputStream(locationArgument.openStream());
Object object;
try {
@@ -818,9 +824,9 @@ private void processStartElement() throws IOException, SerializationException {
String src = element.properties.get(INCLUDE_SRC_ATTRIBUTE);
- Resources resources = this.resources;
+ Resources resourcesLocal = this.resources;
if (element.properties.containsKey(INCLUDE_RESOURCES_ATTRIBUTE)) {
- resources = new Resources(resources,
+ resourcesLocal = new Resources(resourcesLocal,
element.properties.get(INCLUDE_RESOURCES_ATTRIBUTE));
}
@@ -866,11 +872,11 @@ private void processStartElement() throws IOException, SerializationException {
}
// Determine location from src attribute
- URL location;
+ URL locationLocal;
if (src.charAt(0) == '/') {
- location = classLoader.getResource(src.substring(1));
+ locationLocal = classLoader.getResource(src.substring(1));
} else {
- location = new URL(this.location, src);
+ locationLocal = new URL(this.location, src);
}
// Set optional resolution properties
@@ -880,12 +886,12 @@ private void processStartElement() throws IOException, SerializationException {
resolvable.setNamespace(namespace);
}
- resolvable.setLocation(location);
- resolvable.setResources(resources);
+ resolvable.setLocation(locationLocal);
+ resolvable.setResources(resourcesLocal);
}
// Read the object
- InputStream inputStream = new BufferedInputStream(location.openStream());
+ InputStream inputStream = new BufferedInputStream(locationLocal.openStream());
try {
element.value = serializer.readObject(inputStream);
} finally {
@@ -973,6 +979,11 @@ private void processAttributes() throws SerializationException {
case REFERENCE: {
property = (localName.equals(REFERENCE_ID_ATTRIBUTE));
+ break;
+ }
+
+ default: {
+ break;
}
}
View
5 core/src/org/apache/pivot/beans/BeanAdapter.java
@@ -74,10 +74,10 @@ public String next() {
throw new NoSuchElementException();
}
- String nextProperty = this.nextProperty;
+ String nextPropertyLocal = this.nextProperty;
nextProperty();
- return nextProperty;
+ return nextPropertyLocal;
}
private void nextProperty() {
@@ -138,6 +138,7 @@ private void nextProperty() {
}
}
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
View
5 core/src/org/apache/pivot/beans/BeanMonitor.java
@@ -78,9 +78,10 @@ public void remove(PropertyChangeListener listener) {
}
}
- public void propertyChanged(Object bean, String propertyName) {
+ @Override
+ public void propertyChanged(Object beanArgument, String propertyName) {
for (PropertyChangeListener listener : this) {
- listener.propertyChanged(bean, propertyName);
+ listener.propertyChanged(beanArgument, propertyName);
}
}
}
View
28 core/src/org/apache/pivot/collections/ArrayList.java
@@ -37,16 +37,16 @@
private class ArrayListItemIterator implements ItemIterator<T> {
private int index = 0;
- private int modificationCount;
+ private int modificationCountLocal;
private boolean forward = true;
public ArrayListItemIterator() {
- modificationCount = ArrayList.this.modificationCount;
+ modificationCountLocal = ArrayList.this.modificationCount;
}
@Override
public boolean hasNext() {
- if (modificationCount != ArrayList.this.modificationCount) {
+ if (modificationCountLocal != ArrayList.this.modificationCount) {
throw new ConcurrentModificationException();
}
@@ -65,7 +65,7 @@ public T next() {
@Override
public boolean hasPrevious() {
- if (modificationCount != ArrayList.this.modificationCount) {
+ if (modificationCountLocal != ArrayList.this.modificationCount) {
throw new ConcurrentModificationException();
}
@@ -97,7 +97,7 @@ public void insert(T item) {
indexBoundsCheck();
ArrayList.this.insert(item, index);
- modificationCount++;
+ modificationCountLocal++;
}
@Override
@@ -105,7 +105,7 @@ public void update(T item) {
indexBoundsCheck();
ArrayList.this.update(forward ? index - 1 : index, item);
- modificationCount++;
+ modificationCountLocal++;
}
@Override
@@ -117,7 +117,7 @@ public void remove() {
}
ArrayList.this.remove(index, 1);
- modificationCount++;
+ modificationCountLocal++;
}
private void indexBoundsCheck() {
@@ -394,20 +394,20 @@ public int getLength() {
}
public void trimToSize() {
- Object[] items = new Object[length];
- System.arraycopy(this.items, 0, items, 0, length);
+ Object[] itemsLocal = new Object[length];
+ System.arraycopy(this.items, 0, itemsLocal, 0, length);
- this.items = items;
- length = items.length;
+ this.items = itemsLocal;
+ length = itemsLocal.length;
}
public void ensureCapacity(int capacity) {
if (capacity > items.length) {
capacity = Math.max(this.items.length * 3 / 2, capacity);
- Object[] items = new Object[capacity];
- System.arraycopy(this.items, 0, items, 0, length);
+ Object[] itemsLocal = new Object[capacity];
+ System.arraycopy(this.items, 0, itemsLocal, 0, length);
- this.items = items;
+ this.items = itemsLocal;
}
}
View
4 core/src/org/apache/pivot/collections/EnumSet.java
@@ -59,11 +59,11 @@ public E next() {
throw new NoSuchElementException();
}
- E next = this.next;
+ E nextLocal = this.next;
this.next = null;
i++;
- return next;
+ return nextLocal;
}
@Override
View
18 core/src/org/apache/pivot/collections/HashMap.java
@@ -36,7 +36,7 @@
private class KeyIterator implements Iterator<K> {
private int bucketIndex;
private Iterator<Pair<K, V>> entryIterator;
- private int count;
+ private int countLocal;
private Pair<K, V> entry = null;
@@ -44,12 +44,12 @@ public KeyIterator() {
bucketIndex = 0;
entryIterator = getBucketIterator(bucketIndex);
- count = HashMap.this.count;
+ countLocal = HashMap.this.count;
}
@Override
public boolean hasNext() {
- if (count != HashMap.this.count) {
+ if (countLocal != HashMap.this.count) {
throw new ConcurrentModificationException();
}
@@ -81,7 +81,7 @@ public void remove() {
}
entryIterator.remove();
- count--;
+ countLocal--;
HashMap.this.count--;
if (mapListeners != null) {
@@ -91,8 +91,8 @@ public void remove() {
entry = null;
}
- private Iterator<Pair<K, V>> getBucketIterator(int bucketIndex) {
- LinkedList<Pair<K, V>> bucket = buckets.get(bucketIndex);
+ private Iterator<Pair<K, V>> getBucketIterator(int bucketIndexArgument) {
+ LinkedList<Pair<K, V>> bucket = buckets.get(bucketIndexArgument);
return (bucket == null) ? new EmptyIterator<Pair<K,V>>() : bucket.iterator();
}
@@ -406,12 +406,12 @@ public void setComparator(Comparator<K> comparator) {
} else {
if (keys == null) {
// Populate key list
- ArrayList<K> keys = new ArrayList<K>((int)(getCapacity() * loadFactor));
+ ArrayList<K> keysLocal = new ArrayList<K>((int)(getCapacity() * loadFactor));
for (K key : this) {
- keys.add(key);
+ keysLocal.add(key);
}
- this.keys = keys;
+ this.keys = keysLocal;
}
keys.setComparator(comparator);
View
14 core/src/org/apache/pivot/collections/LinkedList.java
@@ -54,15 +54,15 @@ public Node(Node<T> previous, Node<T> next, T item) {
private Node<T> current = null;
private boolean forward = false;
- private int modificationCount;
+ private int modificationCountLocal;
public LinkedListItemIterator() {
- modificationCount = LinkedList.this.modificationCount;
+ modificationCountLocal = LinkedList.this.modificationCount;
}
@Override
public boolean hasNext() {
- if (modificationCount != LinkedList.this.modificationCount) {
+ if (modificationCountLocal != LinkedList.this.modificationCount) {
throw new ConcurrentModificationException();
}
@@ -91,7 +91,7 @@ public T next() {
@Override
public boolean hasPrevious() {
- if (modificationCount != LinkedList.this.modificationCount) {
+ if (modificationCountLocal != LinkedList.this.modificationCount) {
throw new ConcurrentModificationException();
}
@@ -164,7 +164,7 @@ public void insert(T item) {
LinkedList.this.insert(item, previous, next);
length++;
- modificationCount++;
+ modificationCountLocal++;
LinkedList.this.modificationCount++;
if (listListeners != null) {
@@ -184,7 +184,7 @@ public void update(T item) {
verifyLocation(item, current.previous, current.next);
current.item = item;
- modificationCount++;
+ modificationCountLocal++;
LinkedList.this.modificationCount++;
if (listListeners != null) {
@@ -221,7 +221,7 @@ public void remove() {
}
length--;
- modificationCount++;
+ modificationCountLocal++;
LinkedList.this.modificationCount++;
if (listListeners != null) {
View
5 core/src/org/apache/pivot/collections/ListListener.java
@@ -28,22 +28,27 @@
public static class Adapter<T> implements ListListener<T> {
@Override
public void itemInserted(List<T> list, int index) {
+ // empty block
}
@Override
public void itemsRemoved(List<T> list, int index, Sequence<T> items) {
+ // empty block
}
@Override
public void itemUpdated(List<T> list, int index, T previousItem) {
+ // empty block
}
@Override
public void listCleared(List<T> list) {
+ // empty block
}
@Override
public void comparatorChanged(List<T> list, Comparator<T> previousComparator) {
+ // empty block
}
}
View
5 core/src/org/apache/pivot/collections/MapListener.java
@@ -28,22 +28,27 @@
public static class Adapter<K, V> implements MapListener<K, V> {
@Override
public void valueAdded(Map<K, V> map, K key) {
+ // empty block
}
@Override
public void valueUpdated(Map<K, V> map, K key, V previousValue) {
+ // empty block
}
@Override
public void valueRemoved(Map<K, V> map, K key, V value) {
+ // empty block
}
@Override
public void mapCleared(Map<K, V> map) {
+ // empty block
}
@Override
public void comparatorChanged(Map<K, V> map, Comparator<K> previousComparator) {
+ // empty block
}
}
View
1  core/src/org/apache/pivot/collections/Queue.java
@@ -92,6 +92,7 @@ public void comparatorChanged(Queue<T> queue, Comparator<T> previousComparator)
* <tt>true</tt> if the queue contains no items; <tt>false</tt>,
* otherwise.
*/
+ @Override
public boolean isEmpty();
/**
View
4 core/src/org/apache/pivot/collections/QueueListener.java
@@ -28,18 +28,22 @@
public static class Adapter<T> implements QueueListener<T> {
@Override
public void itemEnqueued(Queue<T> queue, T item) {
+ // empty block
}
@Override
public void itemDequeued(Queue<T> queue, T item) {
+ // empty block
}
@Override
public void queueCleared(Queue<T> queue) {
+ // empty block
}
@Override
public void comparatorChanged(Queue<T> queue, Comparator<T> previousComparator) {
+ // empty block
}
}
View
4 core/src/org/apache/pivot/collections/SetListener.java
@@ -28,18 +28,22 @@
public static class Adapter<E> implements SetListener<E> {
@Override
public void elementAdded(Set<E> set, E element) {
+ // empty block
}
@Override
public void elementRemoved(Set<E> set, E element) {
+ // empty block
}
@Override
public void setCleared(Set<E> set) {
+ // empty block
}
@Override
public void comparatorChanged(Set<E> set, Comparator<E> previousComparator) {
+ // empty block
}
}
View
1  core/src/org/apache/pivot/collections/Stack.java
@@ -92,6 +92,7 @@ public void comparatorChanged(Stack<T> stack, Comparator<T> previousComparator)
* <tt>true</tt> if the stack contains no items; <tt>false</tt>,
* otherwise.
*/
+ @Override
public boolean isEmpty();
/**
View
4 core/src/org/apache/pivot/collections/StackListener.java
@@ -28,18 +28,22 @@
public static class Adapter<T> implements StackListener<T> {
@Override
public void itemPushed(Stack<T> stack, T item) {
+ // empty block
}
@Override
public void itemPopped(Stack<T> stack, T item) {
+ // empty block
}
@Override
public void stackCleared(Stack<T> stack) {
+ // empty block
}
@Override
public void comparatorChanged(Stack<T> stack, Comparator<T> previousComparator) {
+ // empty block
}
}
View
6 core/src/org/apache/pivot/collections/adapter/MapAdapter.java
@@ -123,9 +123,9 @@ public void setComparator(Comparator<K> comparator) {
try {
Constructor<?> constructor = this.map.getClass().getConstructor(Comparator.class);
if (constructor != null) {
- java.util.Map<K, V> map = (java.util.Map<K, V>)constructor.newInstance(comparator);
- map.putAll(this.map);
- this.map = map;
+ java.util.Map<K, V> mapLocal = (java.util.Map<K, V>)constructor.newInstance(comparator);
+ mapLocal.putAll(this.map);
+ this.map = mapLocal;
}
} catch (SecurityException exception) {
throw new RuntimeException(exception);
View
6 core/src/org/apache/pivot/collections/adapter/SetAdapter.java
@@ -119,9 +119,9 @@ public void setComparator(Comparator<E> comparator) {
try {
Constructor<?> constructor = this.set.getClass().getConstructor(Comparator.class);
if (constructor != null) {
- java.util.SortedSet<E> set = (java.util.SortedSet<E>)constructor.newInstance(comparator);
- set.addAll(this.set);
- this.set = set;
+ java.util.SortedSet<E> setLocal = (java.util.SortedSet<E>)constructor.newInstance(comparator);
+ setLocal.addAll(this.set);
+ this.set = setLocal;
}
} catch (SecurityException exception) {
throw new RuntimeException(exception);
View
1  core/src/org/apache/pivot/collections/concurrent/SynchronizedQueue.java
@@ -81,6 +81,7 @@ public synchronized T dequeue() {
item = queue.dequeue();
queueListeners.itemDequeued(this, item);
} catch(InterruptedException exception) {
+ // empty block
}
return item;
View
1  core/src/org/apache/pivot/collections/concurrent/SynchronizedStack.java
@@ -82,6 +82,7 @@ public synchronized T pop() {
stackListeners.itemPopped(this, item);
}
catch(InterruptedException exception) {
+ // empty block
}
return item;
View
4 core/src/org/apache/pivot/io/IOTask.java
@@ -112,7 +112,7 @@ public void close() throws IOException {
}
@Override
- public void mark(int readLimit) {
+ public synchronized void mark(int readLimit) {
if (abort) {
throw new AbortException();
}
@@ -122,7 +122,7 @@ public void mark(int readLimit) {
}
@Override
- public void reset() throws IOException {
+ public synchronized void reset() throws IOException {
if (abort) {
throw new AbortException();
}
View
82 core/src/org/apache/pivot/json/JSONSerializer.java
@@ -281,7 +281,7 @@ public Object readObject(Reader reader)
return object;
}
- private Object readValue(Reader reader, Type type)
+ private Object readValue(Reader reader, Type typeArgument)
throws IOException, SerializationException {
Object object = null;
@@ -294,15 +294,15 @@ private Object readValue(Reader reader, Type type)
if (c == 'n') {
object = readNullValue(reader);
} else if (c == '"' || c == '\'') {
- object = readStringValue(reader, type);
+ object = readStringValue(reader, typeArgument);
} else if (c == '+' || c == '-' || Character.isDigit(c)) {
- object = readNumberValue(reader, type);
+ object = readNumberValue(reader, typeArgument);
} else if (c == 't' || c == 'f') {
- object = readBooleanValue(reader, type);
+ object = readBooleanValue(reader, typeArgument);
} else if (c == '[') {
- object = readListValue(reader, type);
+ object = readListValue(reader, typeArgument);
} else if (c == '{') {
- object = readMapValue(reader, type);
+ object = readMapValue(reader, typeArgument);
} else {
throw new SerializationException("Unexpected character in input stream.");
}
@@ -445,10 +445,10 @@ private String readString(Reader reader)
return stringBuilder.toString();
}
- private Object readStringValue(Reader reader, Type type)
+ private Object readStringValue(Reader reader, Type typeArgument)
throws IOException, SerializationException {
- if (!(type instanceof Class<?>)) {
- throw new SerializationException("Cannot convert string to " + type + ".");
+ if (!(typeArgument instanceof Class<?>)) {
+ throw new SerializationException("Cannot convert string to " + typeArgument + ".");
}
String string = readString(reader);
@@ -458,13 +458,13 @@ private Object readStringValue(Reader reader, Type type)
jsonSerializerListeners.readString(this, string);
}
- return BeanAdapter.coerce(string, (Class<?>)type);
+ return BeanAdapter.coerce(string, (Class<?>)typeArgument);
}
- private Object readNumberValue(Reader reader, Type type)
+ private Object readNumberValue(Reader reader, Type typeArgument)
throws IOException, SerializationException {
- if (!(type instanceof Class<?>)) {
- throw new SerializationException("Cannot convert number to " + type + ".");
+ if (!(typeArgument instanceof Class<?>)) {
+ throw new SerializationException("Cannot convert number to " + typeArgument + ".");
}
Number number = null;
@@ -503,13 +503,13 @@ private Object readNumberValue(Reader reader, Type type)
jsonSerializerListeners.readNumber(this, number);
}
- return BeanAdapter.coerce(number, (Class<?>)type);
+ return BeanAdapter.coerce(number, (Class<?>)typeArgument);
}
- private Object readBooleanValue(Reader reader, Type type)
+ private Object readBooleanValue(Reader reader, Type typeArgument)
throws IOException, SerializationException {
- if (!(type instanceof Class<?>)) {
- throw new SerializationException("Cannot convert boolean to " + type + ".");
+ if (!(typeArgument instanceof Class<?>)) {
+ throw new SerializationException("Cannot convert boolean to " + typeArgument + ".");
}
String text = (c == 't') ? "true" : "false";
@@ -537,22 +537,22 @@ private Object readBooleanValue(Reader reader, Type type)
jsonSerializerListeners.readBoolean(this, value);
}
- return BeanAdapter.coerce(value, (Class<?>)type);
+ return BeanAdapter.coerce(value, (Class<?>)typeArgument);
}
@SuppressWarnings("unchecked")
- private Object readListValue(Reader reader, Type type)
+ private Object readListValue(Reader reader, Type typeArgument)
throws IOException, SerializationException {
Sequence<Object> sequence = null;
Type itemType = null;
- if (type == Object.class) {
+ if (typeArgument == Object.class) {
// Return the default sequence and item types
sequence = new ArrayList<Object>();
itemType = Object.class;
} else {
// Determine the item type from generic parameters
- Type parentType = type;
+ Type parentType = typeArgument;
while (parentType != null) {
if (parentType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType)parentType;
@@ -600,11 +600,11 @@ private Object readListValue(Reader reader, Type type)
// Instantiate the sequence type
Class<?> sequenceType;
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType)type;
+ if (typeArgument instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType)typeArgument;
sequenceType = (Class<?>)parameterizedType.getRawType();
} else {
- sequenceType = (Class<?>)type;
+ sequenceType = (Class<?>)typeArgument;
}
try {
@@ -653,18 +653,18 @@ private Object readListValue(Reader reader, Type type)
}
@SuppressWarnings("unchecked")
- private Object readMapValue(Reader reader, Type type)
+ private Object readMapValue(Reader reader, Type typeArgument)
throws IOException, SerializationException {
Dictionary<String, Object> dictionary = null;
Type valueType = null;
- if (type == Object.class) {
+ if (typeArgument == Object.class) {
// Return the default dictionary and value types
dictionary = new HashMap<String, Object>();
valueType = Object.class;
} else {
// Determine the value type from generic parameters
- Type parentType = type;
+ Type parentType = typeArgument;
while (parentType != null) {
if (parentType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType)parentType;
@@ -708,7 +708,7 @@ private Object readMapValue(Reader reader, Type type)
// Instantiate the dictionary or bean type
if (valueType == null) {
- Class<?> beanType = (Class<?>)type;
+ Class<?> beanType = (Class<?>)typeArgument;
try {
dictionary = new BeanAdapter(beanType.newInstance());
@@ -719,11 +719,11 @@ private Object readMapValue(Reader reader, Type type)
}
} else {
Class<?> dictionaryType;
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType)type;
+ if (typeArgument instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType)typeArgument;
dictionaryType = (Class<?>)parameterizedType.getRawType();
} else {
- dictionaryType = (Class<?>)type;
+ dictionaryType = (Class<?>)typeArgument;
}
try {
@@ -893,9 +893,9 @@ public void writeObject(Object object, Writer writer)
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0, n = string.length(); i < n; i++) {
- char c = string.charAt(i);
+ char ci = string.charAt(i);
- switch(c) {
+ switch(ci) {
case '\t': {
stringBuilder.append("\\t");
break;
@@ -909,17 +909,17 @@ public void writeObject(Object object, Writer writer)
case '\\':
case '\"':
case '\'': {
- stringBuilder.append("\\" + c);
+ stringBuilder.append("\\" + ci);
break;
}
default: {
if (charset.name().startsWith("UTF")
- || c <= 0xFF) {
- stringBuilder.append(c);
+ || ci <= 0xFF) {
+ stringBuilder.append(ci);
} else {
stringBuilder.append("\\u");
- stringBuilder.append(String.format("%04x", (short)c));
+ stringBuilder.append(String.format("%04x", (short)ci));
}
}
}
@@ -980,14 +980,14 @@ public void writeObject(Object object, Writer writer)
StringBuilder keyStringBuilder = new StringBuilder();
for (int j = 0, n = key.length(); j < n; j++) {
- char c = key.charAt(j);
- identifier &= Character.isJavaIdentifierPart(c);
+ char cj = key.charAt(j);
+ identifier &= Character.isJavaIdentifierPart(cj);
- if (c == '"') {
+ if (cj == '"') {
keyStringBuilder.append('\\');
}
- keyStringBuilder.append(c);
+ keyStringBuilder.append(cj);
}
key = keyStringBuilder.toString();
View
9 core/src/org/apache/pivot/json/JSONSerializerListener.java
@@ -29,38 +29,47 @@
public static class Adapter implements JSONSerializerListener {
@Override
public void beginDictionary(JSONSerializer jsonSerializer, Dictionary<String, ?> value) {
+ // empty block
}
@Override
public void endDictionary(JSONSerializer jsonSerializer) {
+ // empty block
}
@Override
public void readKey(JSONSerializer jsonSerializer, String key) {
+ // empty block
}
@Override
public void beginSequence(JSONSerializer jsonSerializer, Sequence<?> value) {
+ // empty block
}
@Override
public void endSequence(JSONSerializer jsonSerializer) {
+ // empty block
}
@Override
public void readString(JSONSerializer jsonSerializer, String value) {
+ // empty block
}
@Override
public void readNumber(JSONSerializer jsonSerializer, Number value) {
+ // empty block
}
@Override
public void readBoolean(JSONSerializer jsonSerializer, Boolean value) {
+ // empty block
}
@Override
public void readNull(JSONSerializer jsonSerializer) {
+ // empty block
}
}
View
8 core/src/org/apache/pivot/serialization/CSVSerializer.java
@@ -249,11 +249,11 @@ public void setVerbose(boolean verbose) {
throw new SerializationException("Could not read keys from input.");
}
- String[] keys = line.split(",");
- this.keys = new ArrayList<String>(keys.length);
+ String[] keysLocal = line.split(",");
+ this.keys = new ArrayList<String>(keysLocal.length);
- for (int i = 0; i < keys.length; i++) {
- String key = keys[i];
+ for (int i = 0; i < keysLocal.length; i++) {
+ String key = keysLocal[i];
this.keys.add(key.trim());
}
}
View
3  core/src/org/apache/pivot/serialization/CSVSerializerListener.java
@@ -28,14 +28,17 @@
public static class Adapter implements CSVSerializerListener {
@Override
public void beginList(CSVSerializer csvSerializer, List<?> list) {
+ // empty block
}
@Override
public void endList(CSVSerializer csvSerializer) {
+ // empty block
}
@Override
public void readItem(CSVSerializer csvSerializer, Object item) {
+ // empty block
}
}
View
42 core/src/org/apache/pivot/util/concurrent/Task.java
@@ -35,32 +35,32 @@
private class ExecuteCallback implements Runnable {
@Override
public void run() {
- V result = null;
- Throwable fault = null;
+ V resultLocal = null;
+ Throwable faultLocal = null;
try {
- result = execute();
+ resultLocal = execute();
}
catch(Throwable throwable) {
- fault = throwable;
+ faultLocal = throwable;
}
- TaskListener<V> taskListener;
+ TaskListener<V> taskListenerLocal;
synchronized (Task.this) {
- Task.this.result = result;
- Task.this.fault = fault;
+ Task.this.result = resultLocal;
+ Task.this.fault = faultLocal;
abort = false;
- taskListener = Task.this.taskListener;
+ taskListenerLocal = Task.this.taskListener;
Task.this.taskListener = null;
}
- if (fault == null) {
- taskListener.taskExecuted(Task.this);
+ if (faultLocal == null) {
+ taskListenerLocal.taskExecuted(Task.this);
}
else {
- taskListener.executeFailed(Task.this);
+ taskListenerLocal.executeFailed(Task.this);
}
}
}
@@ -143,11 +143,11 @@ public Task(ExecutorService executorService) {
* notified on the task's worker thread, not on the thread that executed
* the task.
*
- * @param taskListener
+ * @param taskListenerArgument
* The listener to be notified when the task completes.
*/
- public synchronized void execute(TaskListener<V> taskListener) {
- execute(taskListener, executorService);
+ public synchronized void execute(TaskListener<V> taskListenerArgument) {
+ execute(taskListenerArgument, executorService);
}
/**
@@ -156,16 +156,16 @@ public synchronized void execute(TaskListener<V> taskListener) {
* notified on the task's worker thread, not on the thread that executed
* the task.
*
- * @param taskListener The listener to be notified when the task completes.
- * @param executorService The service to submit the task to, overriding the
+ * @param taskListenerArgument The listener to be notified when the task completes.
+ * @param executorServiceArgument The service to submit the task to, overriding the
* Task's own ExecutorService.
*/
- public synchronized void execute(TaskListener<V> taskListener, ExecutorService executorService) {
- if (taskListener == null) {
+ public synchronized void execute(TaskListener<V> taskListenerArgument, ExecutorService executorServiceArgument) {
+ if (taskListenerArgument == null) {
throw new IllegalArgumentException("taskListener is null.");
}
- if (executorService == null) {
+ if (executorServiceArgument == null) {
throw new IllegalThreadStateException("executorService is null.");
}
@@ -173,7 +173,7 @@ public synchronized void execute(TaskListener<V> taskListener, ExecutorService e
throw new IllegalThreadStateException("Task is already pending.");
}
- this.taskListener = taskListener;
+ this.taskListener = taskListenerArgument;
result = null;
fault = null;
@@ -181,7 +181,7 @@ public synchronized void execute(TaskListener<V> taskListener, ExecutorService e
// Create a new execute callback and post it to the executor service
ExecuteCallback executeCallback = new ExecuteCallback();
- executorService.submit(executeCallback);
+ executorServiceArgument.submit(executeCallback);
}
/**
View
14 core/src/org/apache/pivot/xml/Element.java
@@ -493,18 +493,18 @@ public String put(String attributeName, String value) {
if (attribute == null) {
previousValue = null;
- String namespacePrefix;
- String localName;
+ String namespacePrefixElementDictionary;
+ String localNameElementDictionary;
int i = attributeName.indexOf(':');
if (i == -1) {
- namespacePrefix = null;
- localName = attributeName;
+ namespacePrefixElementDictionary = null;
+ localNameElementDictionary = attributeName;
} else {
- namespacePrefix = attributeName.substring(0, i);
- localName = attributeName.substring(i + 1);
+ namespacePrefixElementDictionary = attributeName.substring(0, i);
+ localNameElementDictionary = attributeName.substring(i + 1);
}
- attributeSequence.add(new Attribute(namespacePrefix, localName, value));
+ attributeSequence.add(new Attribute(namespacePrefixElementDictionary, localNameElementDictionary, value));
} else {
previousValue = attribute.getValue();
attribute.setValue(value);
View
7 core/src/org/apache/pivot/xml/ElementListener.java
@@ -28,30 +28,37 @@
public static class Adapter implements ElementListener {
@Override
public void defaultNamespaceURIChanged(Element element, String previousDefaultNamespaceURI) {
+ // empty block
}
@Override
public void namespaceAdded(Element element, String prefix) {
+ // empty block
}
@Override
public void namespaceUpdated(Element element, String prefix, String previousURI) {
+ // empty block
}
@Override
public void namespaceRemoved(Element element, String prefix, String uri) {
+ // empty block
}
@Override
public void attributeInserted(Element element, int index) {
+ // empty block
}
@Override
public void attributesRemoved(Element element, int index, Sequence<Element.Attribute> attributes) {
+ // empty block
}
@Override
public void attributeValueChanged(Element.Attribute attribute, String previousValue) {
+ // empty block
}
}
View
1  core/src/org/apache/pivot/xml/Node.java
@@ -24,6 +24,7 @@
public abstract class Node {
private static class NodeListenerList extends ListenerList<NodeListener>
implements NodeListener {
+ @Override
public void parentChanged(Node node, Element previousParent) {
for (NodeListener listener : this) {
listener.parentChanged(node, previousParent);
View
8 core/src/org/apache/pivot/xml/XMLSerializer.java
@@ -135,7 +135,9 @@ public Element readObject(Reader reader) throws SerializationException {
xmlSerializerListeners.readTextNode(this, textNode);
}
- current.add(textNode);
+ if (current != null) {
+ current.add(textNode);
+ }
}
break;
@@ -203,7 +205,9 @@ public Element readObject(Reader reader) throws SerializationException {
}
// Move up the stack
- current = current.getParent();
+ if (current != null) {
+ current = current.getParent();
+ }
break;
}
View
3  core/src/org/apache/pivot/xml/XMLSerializerListener.java
@@ -26,14 +26,17 @@
public static class Adapter implements XMLSerializerListener {
@Override
public void beginElement(XMLSerializer xmlSerializer, Element element) {
+ // empty block
}
@Override
public void endElement(XMLSerializer xmlSerializer) {
+ // empty block
}
@Override
public void readTextNode(XMLSerializer xmlSerializer, TextNode textNode) {
+ // empty block
}
}
View
10 core/test/org/apache/pivot/json/test/BindTest.java
@@ -59,7 +59,9 @@ public void testTypedList() throws IOException, SerializationException {
(List<Object>)listSerializer.readObject(getClass().getResourceAsStream("list.json"));
JSONSerializer typedListSerializer =
- new JSONSerializer((new TypeLiteral<ArrayList<SampleBean2>>() {}).getType());
+ new JSONSerializer((new TypeLiteral<ArrayList<SampleBean2>>() {
+ // empty block
+ }).getType());
ArrayList<SampleBean2> typedList =
(ArrayList<SampleBean2>)typedListSerializer.readObject(getClass().getResourceAsStream("list.json"));
@@ -109,7 +111,7 @@ public void testSequence() throws IOException, SerializationException {
Object item0 = sequence.get(0);
assertNotNull(item0);
- // assertTrue(item0 instanceof SampleBean2); // true but superflous
+ // assertTrue(item0 instanceof SampleBean2); // true but superfluous
assertEquals(sequence.get(0).getA(), JSON.get(list, "[0].a"));
}
@@ -137,7 +139,9 @@ public void testUntypedMap() throws IOException, SerializationException {
@SuppressWarnings("unchecked")
public void testTypedMap() throws IOException, SerializationException {
JSONSerializer typedMapSerializer =
- new JSONSerializer((new TypeLiteral<HashMap<String, SampleBean2>>() {}).getType());
+ new JSONSerializer((new TypeLiteral<HashMap<String, SampleBean2>>() {
+ // empty block
+ }).getType());
HashMap<String, SampleBean2> map =
(HashMap<String, SampleBean2>)typedMapSerializer.readObject(new StringReader("{foo: {a:1, b:2, c:'3'}}"));
View
18 core/test/org/apache/pivot/json/test/JSONSerializerTest.java
@@ -85,47 +85,47 @@ public void testEquals() throws IOException, SerializationException {
JSONSerializer jsonSerializer = new JSONSerializer();
JSONSerializerListener jsonSerializerListener = new JSONSerializerListener() {
@Override
- public void beginDictionary(JSONSerializer jsonSerializer, Dictionary<String, ?> value) {
+ public void beginDictionary(JSONSerializer jsonSerializerArgument, Dictionary<String, ?> value) {
System.out.println("Begin dictionary: " + value);
}
@Override
- public void endDictionary(JSONSerializer jsonSerializer) {
+ public void endDictionary(JSONSerializer jsonSerializerArgument) {
System.out.println("End dictionary");
}
@Override
- public void readKey(JSONSerializer jsonSerializer, String key) {
+ public void readKey(JSONSerializer jsonSerializerArgument, String key) {
System.out.println("Read key: " + key);
}
@Override
- public void beginSequence(JSONSerializer jsonSerializer, Sequence<?> value) {
+ public void beginSequence(JSONSerializer jsonSerializerArgument, Sequence<?> value) {
System.out.println("Begin sequence: " + value);
}
@Override
- public void endSequence(JSONSerializer jsonSerializer) {
+ public void endSequence(JSONSerializer jsonSerializerArgument) {
System.out.println("End sequence");
}
@Override
- public void readString(JSONSerializer jsonSerializer, String value) {
+ public void readString(JSONSerializer jsonSerializerArgument, String value) {
System.out.println("Read string: " + value);
}
@Override
- public void readNumber(JSONSerializer jsonSerializer, Number value) {
+ public void readNumber(JSONSerializer jsonSerializerArgument, Number value) {
System.out.println("Read number: " + value);
}
@Override
- public void readBoolean(JSONSerializer jsonSerializer, Boolean value) {
+ public void readBoolean(JSONSerializer jsonSerializerArgument, Boolean value) {
System.out.println("Read boolean: " + value);
}
@Override
- public void readNull(JSONSerializer jsonSerializer) {
+ public void readNull(JSONSerializer jsonSerializerArgument) {
System.out.println("Read null");
}
};
View
3  core/test/org/apache/pivot/serialization/test/CSVSerializerTest.java
@@ -48,14 +48,17 @@ public void testBasicReadObject() throws IOException, SerializationException {
CSVSerializer serializer = new CSVSerializer();
serializer.setKeys("A", "B", "C");
serializer.getCSVSerializerListeners().add(new CSVSerializerListener() {
+ @Override
public void beginList(CSVSerializer csvSerializer, List<?> list) {
System.out.println("Begin list: " + list);
}
+ @Override
public void endList(CSVSerializer csvSerializer) {
System.out.println("End list");
}
+ @Override
public void readItem(CSVSerializer csvSerializer, Object item) {
System.out.println("Read item: " + item);
}
View
10 core/test/org/apache/pivot/util/concurrent/test/TaskTest.java
@@ -24,10 +24,10 @@
public class TaskTest {
public static class SleepTask extends Task<Void> {
- private long timeout = 0;
+ private long timeoutSleepTask = 0;
public SleepTask(long timeout) {
- this.timeout = timeout;
+ this.timeoutSleepTask = timeout;
}
@Override
@@ -35,7 +35,7 @@ public Void execute() {
System.out.println("Starting task " + this + "...");
try {
- Thread.sleep(timeout);
+ Thread.sleep(timeoutSleepTask);
} catch (InterruptedException exception) {
System.out.println(exception);
}
@@ -47,7 +47,7 @@ public Void execute() {
@Override
public String toString() {
- return Long.toString(timeout);
+ return Long.toString(timeoutSleepTask);
}
}
@@ -84,6 +84,7 @@ public synchronized void executeFailed(Task<Void> task) {
try {
taskListener.wait();
} catch (InterruptedException exception) {
+ // empty block
}
}
}
@@ -121,6 +122,7 @@ public synchronized void executeFailed(Task<Void> task) {
try {
taskListener.wait();
} catch (InterruptedException exception) {
+ // empty block
}
}
}
View
6 core/test/org/apache/pivot/xml/test/XMLSerializerTest.java
@@ -90,17 +90,17 @@ public void equalsTest() throws IOException, SerializationException {
XMLSerializer xmlSerializer = new XMLSerializer();
XMLSerializerListener xmlSerializerListener = new XMLSerializerListener() {
@Override
- public void beginElement(XMLSerializer xmlSerializer, Element element) {
+ public void beginElement(XMLSerializer xmlSerializerArgument, Element element) {
System.out.println("Begin element: " + element);
}
@Override
- public void endElement(XMLSerializer xmlSerializer) {
+ public void endElement(XMLSerializer xmlSerializerArgument) {
System.out.println("End element");
}
@Override
- public void readTextNode(XMLSerializer xmlSerializer, TextNode textNode) {
+ public void readTextNode(XMLSerializer xmlSerializerArgument, TextNode textNode) {
System.out.println("Read text node: " + textNode);
}
};
View
3  demos/src/org/apache/pivot/demos/decorator/DecoratorDemo.java
@@ -75,13 +75,16 @@ public boolean shutdown(boolean optional) {
@Override
public void suspend() {
+ // empty block
}
@Override
public void resume() {
+ // empty block
}
public static void main(String[] args) {
DesktopApplicationContext.main(DecoratorDemo.class, args);
}
+
}
View
7 demos/src/org/apache/pivot/demos/dnd/DragAndDropDemo.java
@@ -117,6 +117,7 @@ public DropAction dragEnter(Component component, Manifest dragContent,
@Override
public void dragExit(Component component) {
+ // empty block
}
@Override
@@ -240,6 +241,7 @@ public DropAction dragEnter(Component component, Manifest dragContent,
@Override
public void dragExit(Component component) {
+ // empty block
}
@Override
@@ -310,8 +312,8 @@ public void buttonPressed(Button button) {
@Override
public boolean beginDrag(Component component, int x, int y) {
- ListView listView = (ListView)component;
- FileList fileList = (FileList)listView.getListData();
+ ListView listViewLocal = (ListView)component;
+ FileList fileList = (FileList)listViewLocal.getListData();
if (fileList.getLength() > 0) {
content = new LocalManifest();
@@ -368,6 +370,7 @@ public DropAction dragEnter(Component component, Manifest dragContent,
@Override
public void dragExit(Component component) {
+ // empty block
}
@Override
View
5 demos/src/org/apache/pivot/demos/dnd/FileDropTargetDemo.java
@@ -106,6 +106,7 @@ public DropAction dragEnter(Component component, Manifest dragContent,
@Override
public void dragExit(Component component) {
+ // empty block
}
@Override
@@ -128,8 +129,8 @@ public DropAction drop(Component component, Manifest dragContent,
if (dragContent.containsFileList()) {
try {
FileList tableData = (FileList)fileTableView.getTableData();
- FileList fileList = dragContent.getFileList();
- for (File file : fileList) {
+ FileList fileListLocal = dragContent.getFileList();
+ for (File file : fileListLocal) {
if (file.isDirectory()) {
// TODO Expand recursively
}
View
10 demos/src/org/apache/pivot/demos/dom/DOMInteractionDemo.java
@@ -30,7 +30,7 @@
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.Window;
-public class DOMInteractionDemo implements Application {
+public class DOMInteractionDemo extends Application.Adapter {
private class CallFromBrowserCallback implements Runnable {
String text;
@@ -85,14 +85,6 @@ public boolean shutdown(boolean optional) {
return false;
}
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
public void sayHello(String helloText) {
ApplicationContext.queueCallback(new CallFromBrowserCallback(helloText));
}
View
1  demos/src/org/apache/pivot/demos/itunes/SearchDemo.java
@@ -232,6 +232,7 @@ public void updateArtwork() {
try {
artworkURL = new URL((String)result.get("artworkUrl100"));
} catch (MalformedURLException exception) {
+ // ignore exception
}
}
View
11 demos/src/org/apache/pivot/demos/json/JSONViewer.java
@@ -49,7 +49,7 @@
* Utility application that allows the user to browse a JSON structure
* using a tree view component.
*/
-public class JSONViewer implements Application {
+public class JSONViewer extends Application.Adapter {
private Window window = null;
@BXML private TreeView treeView = null;
@@ -97,14 +97,6 @@ public boolean shutdown(boolean optional) {
return false;
}
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
public void paste() {
Manifest clipboardContent = Clipboard.getContent();
@@ -236,4 +228,5 @@ public int compare(TreeNode treeNode1, TreeNode treeNode2) {
public static void main(String[] args) {
DesktopApplicationContext.main(JSONViewer.class, args);
}
+
}
View
10 demos/src/org/apache/pivot/demos/memorygame/MemGame.java
@@ -30,7 +30,7 @@
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.Window;
-public class MemGame implements Application, ButtonPressListener {
+public class MemGame extends Application.Adapter implements ButtonPressListener {
private static final String IMG_BASE_FOLDER = "/org/apache/pivot/demos/memorygame/img/";
private static Random random = new Random();
@@ -78,14 +78,6 @@ public boolean shutdown(boolean optional) {
return false;
}
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
public static void main(String[] args) {
DesktopApplicationContext.main(MemGame.class, args);
}
View
50 demos/src/org/apache/pivot/demos/million/LargeData.java
@@ -16,6 +16,7 @@
*/
package org.apache.pivot.demos.million;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -26,16 +27,17 @@
import org.apache.pivot.collections.List;
import org.apache.pivot.collections.Map;
import org.apache.pivot.io.IOTask;
-import org.apache.pivot.serialization.CSVSerializerListener;
import org.apache.pivot.serialization.CSVSerializer;
+import org.apache.pivot.serialization.CSVSerializerListener;
import org.apache.pivot.serialization.SerializationException;
import org.apache.pivot.util.concurrent.Task;
-import org.apache.pivot.util.concurrent.TaskListener;
import org.apache.pivot.util.concurrent.TaskExecutionException;
+import org.apache.pivot.util.concurrent.TaskListener;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.ApplicationContext;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonPressListener;
+import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.ListButton;
@@ -46,7 +48,11 @@
import org.apache.pivot.wtk.Window;
import org.apache.pivot.wtk.content.TableViewRowComparator;
-public class LargeData implements Application {
+public class LargeData extends Application.Adapter {
+ private static final String USER_HOME = System.getProperty("user.home");
+
+ URL origin = null;
+
private class LoadDataTask extends IOTask<Void> {
private URL fileURL;
@@ -68,14 +74,14 @@ public Void execute() throws TaskExecutionException {
private ArrayList<Object> page = new ArrayList<Object>(pageSize);
@Override
- public void endList(CSVSerializer csvSerializer) {
+ public void endList(CSVSerializer csvSerializerArgument) {
if (page.getLength() > 0) {
ApplicationContext.queueCallback(new AddRowsCallback(page));
}
}
@Override
- public void readItem(CSVSerializer csvSerializer, Object item) {
+ public void readItem(CSVSerializer csvSerializerArgument, Object item) {
page.add(item);
if (page.getLength() == pageSize) {
@@ -139,6 +145,12 @@ public void startup(Display display, Map<String, String> properties) throws Exce
throw new IllegalArgumentException(BASE_PATH_KEY + " is required.");
}
+ origin = ApplicationContext.getOrigin();
+ if (origin == null) {
+ System.out.println("Running as a Standalone Java Application, so set as origin the user home: \"" + USER_HOME + "\"");
+ origin = (new File(USER_HOME).toURI()).toURL();
+ }
+
BXMLSerializer bxmlSerializer = new BXMLSerializer();
window = (Window)bxmlSerializer.readObject(LargeData.class, "large_data.bxml");
fileListButton = (ListButton)bxmlSerializer.getNamespace().get("fileListButton");
@@ -172,11 +184,11 @@ public void buttonPressed(Button button) {
tableView.getTableViewSortListeners().add(new TableViewSortListener.Adapter() {
@Override
@SuppressWarnings("unchecked")
- public void sortChanged(TableView tableView) {
- List<Object> tableData = (List<Object>)tableView.getTableData();
+ public void sortChanged(TableView tableViewArgument) {
+ List<Object> tableData = (List<Object>)tableViewArgument.getTableData();
long startTime = System.currentTimeMillis();
- tableData.setComparator(new TableViewRowComparator(tableView));
+ tableData.setComparator(new TableViewRowComparator(tableViewArgument));
long endTime = System.currentTimeMillis();
statusLabel.setText("Data sorted in " + (endTime - startTime) + " ms.");
@@ -195,14 +207,6 @@ public boolean shutdown(boolean optional) {
return false;
}
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
private void loadData() {
int index = fileListButton.getSelectedIndex();
int capacity = (int)Math.pow(10, index + 1);
@@ -212,8 +216,6 @@ private void loadData() {
String fileName = (String)fileListButton.getSelectedItem();
- URL origin = ApplicationContext.getOrigin();
-
URL fileURL = null;
try {
fileURL = new URL(origin, basePath + "/" + fileName);
@@ -225,15 +227,18 @@ private void loadData() {
statusLabel.setText("Loading " + fileURL);
final long t0 = System.currentTimeMillis();
+ System.out.println("Loading \"" + fileURL + "\" ...");
loadDataTask = new LoadDataTask(fileURL);
loadDataTask.execute(new TaskAdapter<Void>(new TaskListener<Void>() {
@Override
public void taskExecuted(Task<Void> task) {
long t1 = System.currentTimeMillis();
+ String msg = "Read " + tableView.getTableData().getLength() + " rows in "
+ + (t1 - t0) + "ms";
+ System.out.println(msg);
- statusLabel.setText("Read " + tableView.getTableData().getLength() + " rows in "
- + (t1 - t0) + "ms");
+ statusLabel.setText(msg);
loadDataButton.setEnabled(true);
cancelButton.setEnabled(false);
@@ -253,4 +258,9 @@ public void executeFailed(Task<Void> task) {
}));
}
}
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(LargeData.class, args);
+ }
+
}
View
10 demos/src/org/apache/pivot/demos/roweditor/RowEditorDemo.java
@@ -26,7 +26,7 @@
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Window;
-public class RowEditorDemo implements Application {
+public class RowEditorDemo extends Application.Adapter {
private Window window = null;
public static final String LANGUAGE_KEY = "language";
@@ -57,14 +57,6 @@ public boolean shutdown(boolean optional) {
return false;
}
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
public static void main(String[] args) {
DesktopApplicationContext.main(RowEditorDemo.class, args);
}
View
9 demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilder.java
@@ -21,7 +21,7 @@
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Display;
-public class ColorSchemeBuilder implements Application {
+public class ColorSchemeBuilder extends Application.Adapter {
private ColorSchemeBuilderWindow window = null;
@Override
@@ -41,11 +41,4 @@ public boolean shutdown(boolean optional) {
return false;
}
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
}
View
12 demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java
@@ -110,22 +110,22 @@ public void initialize(Map<String, Object> namespace, URL location, Resources re
ColorChooserButtonSelectionListener colorChooserButtonSelectionListener =
new ColorChooserButtonSelectionListener() {
@Override
- public void selectedColorChanged(ColorChooserButton colorChooserButton,
+ public void selectedColorChanged(ColorChooserButton colorChooserButtonArgument,