You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/10/05 01:45:53 UTC
svn commit: r1529349 [6/44] - in /pivot/trunk:
charts/src/org/apache/pivot/charts/
charts/src/org/apache/pivot/charts/skin/ core/src/org/apache/pivot/beans/
core/src/org/apache/pivot/collections/
core/src/org/apache/pivot/collections/adapter/ core/src/...
Modified: pivot/trunk/core/src/org/apache/pivot/xml/Element.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/Element.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/Element.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/Element.java Fri Oct 4 23:45:40 2013
@@ -57,10 +57,9 @@ public class Element extends Node implem
/**
* Returns the element to which this attribute belongs.
- *
- * @return
- * This attribute's element, or <tt>null</tt> if the attribute does not
- * belong to an element.
+ *
+ * @return This attribute's element, or <tt>null</tt> if the attribute
+ * does not belong to an element.
*/
public Element getElement() {
return element;
@@ -68,10 +67,9 @@ public class Element extends Node implem
/**
* Returns the attribute's namespace prefix.
- *
- * @return
- * The attribute's namespace prefix, or <tt>null</tt> if the attribute belongs to the
- * default namespace.
+ *
+ * @return The attribute's namespace prefix, or <tt>null</tt> if the
+ * attribute belongs to the default namespace.
*/
public String getNamespacePrefix() {
return namespacePrefix;
@@ -107,7 +105,7 @@ public class Element extends Node implem
/**
* Sets the attribute's value.
- *
+ *
* @param value
*/
public void setValue(String value) {
@@ -132,15 +130,14 @@ public class Element extends Node implem
if (this == o) {
equals = true;
} else if (o instanceof Attribute) {
- Attribute attribute = (Attribute)o;
+ Attribute attribute = (Attribute) o;
if (namespacePrefix == null) {
equals = (attribute.namespacePrefix == null);
} else {
equals = (namespacePrefix.equals(attribute.namespacePrefix));
}
- equals &= (localName.equals(attribute.localName)
- && value.equals(attribute.value));
+ equals &= (localName.equals(attribute.localName) && value.equals(attribute.value));
}
return equals;
@@ -179,7 +176,7 @@ public class Element extends Node implem
/**
* Adds an attribute to the sequence.
- *
+ *
* @param attribute
*/
@Override
@@ -192,7 +189,7 @@ public class Element extends Node implem
/**
* Inserts an attribute into the sequence at a specific location.
- *
+ *
* @param attribute
* @param index
*/
@@ -208,7 +205,8 @@ public class Element extends Node implem
String attributeName = attribute.getName();
if (attributeMap.containsKey(attributeName)) {
- throw new IllegalArgumentException("Attribute \"" + attributeName + "\" already exists.");
+ throw new IllegalArgumentException("Attribute \"" + attributeName
+ + "\" already exists.");
}
attributes.insert(attribute, index);
@@ -219,9 +217,8 @@ public class Element extends Node implem
}
/**
- * @throws UnsupportedOperationException
- * This method is not supported. Use {@link Attribute#setValue(String)}
- * instead.
+ * @throws UnsupportedOperationException This method is not supported.
+ * Use {@link Attribute#setValue(String)} instead.
*/
@Override
public Attribute update(int index, Attribute item) {
@@ -230,7 +227,7 @@ public class Element extends Node implem
/**
* Removes an attribute from the sequence.
- *
+ *
* @param attribute
*/
@Override
@@ -245,7 +242,7 @@ public class Element extends Node implem
/**
* Removes a range of attributes from the sequence.
- *
+ *
* @param index
* @param count
*/
@@ -253,7 +250,7 @@ public class Element extends Node implem
public Sequence<Attribute> remove(int index, int count) {
Sequence<Attribute> removed = attributes.remove(index, count);
if (count > 0) {
- for (int i = 0, n = removed.getLength(); i < n; i++ ) {
+ for (int i = 0, n = removed.getLength(); i < n; i++) {
Attribute attribute = removed.get(i);
String attributeName = attribute.getName();
attributeMap.remove(attributeName);
@@ -268,7 +265,7 @@ public class Element extends Node implem
/**
* Returns the attribute at a given index.
- *
+ *
* @param index
*/
@Override
@@ -278,11 +275,9 @@ public class Element extends Node implem
/**
* Determines the index of an attribute.
- *
+ *
* @param attribute
- *
- * @return
- * The index of the attribute, if found; otherwise, <tt>-1</tt>.
+ * @return The index of the attribute, if found; otherwise, <tt>-1</tt>.
*/
@Override
public int indexOf(Attribute attribute) {
@@ -315,12 +310,10 @@ public class Element extends Node implem
/**
* Returns the URI of a namespace declared by this element.
- *
- * @param prefix
- * The namespace prefix.
- *
- * @return
- * The declared namespace, or <tt>null</tt> if no such namespace exists.
+ *
+ * @param prefix The namespace prefix.
+ * @return The declared namespace, or <tt>null</tt> if no such namespace
+ * exists.
*/
@Override
public String get(String prefix) {
@@ -329,15 +322,10 @@ public class Element extends Node implem
/**
* Sets the URI of a namespace declared by this element.
- *
- * @param prefix
- * The namespace prefix.
- *
- * @param uri
- * The namespace URI.
- *
- * @return
- * The URI previously associated with the given prefix.
+ *
+ * @param prefix The namespace prefix.
+ * @param uri The namespace URI.
+ * @return The URI previously associated with the given prefix.
*/
@Override
public String put(String prefix, String uri) {
@@ -359,12 +347,9 @@ public class Element extends Node implem
/**
* Removes a namespace from this element's declared namespaces.
- *
- * @param prefix
- * The namespace prefix.
- *
- * @return
- * The URI previously associated with the given prefix.
+ *
+ * @param prefix The namespace prefix.
+ * @return The URI previously associated with the given prefix.
*/
@Override
public String remove(String prefix) {
@@ -380,12 +365,10 @@ public class Element extends Node implem
/**
* Tests for the existence of a namespace declared by this element.
- *
+ *
* @param prefix
- *
- * @return
- * <tt>true</tt> if this element declares a namespace with the given prefix;
- * <tt>false</tt>, otherwise.
+ * @return <tt>true</tt> if this element declares a namespace with the
+ * given prefix; <tt>false</tt>, otherwise.
*/
@Override
public boolean containsKey(String prefix) {
@@ -401,8 +384,8 @@ public class Element extends Node implem
}
}
- private static class ElementListenerList extends ListenerList<ElementListener>
- implements ElementListener {
+ private static class ElementListenerList extends ListenerList<ElementListener> implements
+ ElementListener {
@Override
public void defaultNamespaceURIChanged(Element element, String previousDefaultNamespaceURI) {
for (ElementListener listener : this) {
@@ -454,7 +437,6 @@ public class Element extends Node implem
}
/**
-
* Dictionary representing the attributes declared by this element.
*/
public class ElementDictionary implements Dictionary<String, String> {
@@ -463,11 +445,10 @@ public class Element extends Node implem
/**
* Returns an attribute value.
- *
+ *
* @param attributeName
- *
- * @return
- * The value associated with the given attribute, or <tt>null</tt>
+ * @return The value associated with the given attribute, or
+ * <tt>null</tt>
*/
@Override
public String get(String attributeName) {
@@ -477,13 +458,11 @@ public class Element extends Node implem
/**
* Sets an attribute value.
- *
+ *
* @param attributeName
* @param value
- *
- * @return
- * The value previously associated with the given attribute, or <tt>null</tt>
- * if the attribute did not previously exist.
+ * @return The value previously associated with the given attribute, or
+ * <tt>null</tt> if the attribute did not previously exist.
*/
@Override
public String put(String attributeName, String value) {
@@ -504,7 +483,8 @@ public class Element extends Node implem
localNameElementDictionary = attributeName.substring(i + 1);
}
- attributeSequence.add(new Attribute(namespacePrefixElementDictionary, localNameElementDictionary, value));
+ attributeSequence.add(new Attribute(namespacePrefixElementDictionary,
+ localNameElementDictionary, value));
} else {
previousValue = attribute.getValue();
attribute.setValue(value);
@@ -515,11 +495,9 @@ public class Element extends Node implem
/**
* Removes an attribute.
- *
+ *
* @param attributeName
- *
- * @return
- * The value previously associated with the given attribute.
+ * @return The value previously associated with the given attribute.
*/
@Override
public String remove(String attributeName) {
@@ -533,12 +511,10 @@ public class Element extends Node implem
/**
* Tests for the existence of an attribute.
- *
+ *
* @param attributeName
- *
- * @return
- * <tt>true</tt> if this element defines the given attribute; <tt>false<tt>,
- * otherwise.
+ * @return <tt>true</tt> if this element defines the given attribute;
+ * <tt>false<tt>, otherwise.
*/
@Override
public boolean containsKey(String attributeName) {
@@ -547,7 +523,6 @@ public class Element extends Node implem
}
-
private String namespacePrefix;
private String localName;
@@ -578,10 +553,9 @@ public class Element extends Node implem
/**
* Returns the element's namespace prefix.
- *
- * @return
- * The element's namespace prefix, or <tt>null</tt> if the element belongs to the
- * default namespace.
+ *
+ * @return The element's namespace prefix, or <tt>null</tt> if the element
+ * belongs to the default namespace.
*/
public String getNamespacePrefix() {
return namespacePrefix;
@@ -610,10 +584,9 @@ public class Element extends Node implem
/**
* Returns the element's default namespace URI.
- *
- * @return
- * The default namespace URI declared by this element, or <tt>null</tt> if
- * this element does not declare a default namespace.
+ *
+ * @return The default namespace URI declared by this element, or
+ * <tt>null</tt> if this element does not declare a default namespace.
*/
public String getDefaultNamespaceURI() {
return defaultNamespaceURI;
@@ -621,10 +594,10 @@ public class Element extends Node implem
/**
* Sets the element's default namespace URI.
- *
- * @param defaultNamespaceURI
- * The default namespace URI declared by this element, or <tt>null</tt> if
- * this element does not declare a default namespace.
+ *
+ * @param defaultNamespaceURI The default namespace URI declared by this
+ * element, or <tt>null</tt> if this element does not declare a default
+ * namespace.
*/
public void setDefaultNamespaceURI(String defaultNamespaceURI) {
String previousDefaultNamespaceURI = this.defaultNamespaceURI;
@@ -643,16 +616,13 @@ public class Element extends Node implem
}
/**
- * Determines the namespace URI corresponding to the given prefix by traversing
- * the element's ancestry.
- *
- * @param prefix
- * The namespace prefix to look up, or <tt>null</tt> to determine the default
- * namespace for this element.
- *
- * @return
- * The namespace URI corresponding to the given prefix, or <tt>null</tt> if a
- * URI could not be found.
+ * Determines the namespace URI corresponding to the given prefix by
+ * traversing the element's ancestry.
+ *
+ * @param prefix The namespace prefix to look up, or <tt>null</tt> to
+ * determine the default namespace for this element.
+ * @return The namespace URI corresponding to the given prefix, or
+ * <tt>null</tt> if a URI could not be found.
*/
public String getNamespaceURI(String prefix) {
String namespaceURI;
@@ -691,11 +661,9 @@ public class Element extends Node implem
/**
* Adds a node to this element.
- *
+ *
* @param node
- *
- * @return
- * The index at which the node was added.
+ * @return The index at which the node was added.
*/
@Override
public int add(Node node) {
@@ -711,7 +679,7 @@ public class Element extends Node implem
/**
* Inserts a node at a specific location within this element.
- *
+ *
* @param node
* @param index
*/
@@ -727,8 +695,7 @@ public class Element extends Node implem
}
/**
- * @throws UnsupportedOperationException
- * This method is not supported.
+ * @throws UnsupportedOperationException This method is not supported.
*/
@Override
public Node update(int index, Node node) {
@@ -737,7 +704,7 @@ public class Element extends Node implem
/**
* Removes a node from this element.
- *
+ *
* @param node
*/
@Override
@@ -752,18 +719,16 @@ public class Element extends Node implem
/**
* Removes a range of nodes from this element.
- *
+ *
* @param index
* @param count
- *
- * @return
- * The removed nodes.
+ * @return The removed nodes.
*/
@Override
public Sequence<Node> remove(int index, int count) {
Sequence<Node> removed = nodes.remove(index, count);
if (count > 0) {
- for (int i = 0, n = removed.getLength(); i < n; i++ ) {
+ for (int i = 0, n = removed.getLength(); i < n; i++) {
Node node = removed.get(i);
node.setParent(null);
}
@@ -792,7 +757,7 @@ public class Element extends Node implem
/**
* Returns the node at the given index.
- *
+ *
* @param index
*/
@Override
@@ -802,10 +767,9 @@ public class Element extends Node implem
/**
* Determines the index of the given node within this element.
- *
- * @return
- * The index of the node, or <tt>-1</tt> if the node does not exist in
- * this element.
+ *
+ * @return The index of the node, or <tt>-1</tt> if the node does not exist
+ * in this element.
*/
@Override
public int indexOf(Node node) {
@@ -821,8 +785,7 @@ public class Element extends Node implem
}
/**
- * @return
- * <tt>null</tt>; elements cannot be sorted.
+ * @return <tt>null</tt>; elements cannot be sorted.
*/
@Override
public Comparator<Node> getComparator() {
@@ -830,8 +793,7 @@ public class Element extends Node implem
}
/**
- * @throws UnsupportedOperationException
- * Elements cannot be sorted.
+ * @throws UnsupportedOperationException Elements cannot be sorted.
*/
@Override
public void setComparator(Comparator<Node> comparator) {
@@ -848,9 +810,8 @@ public class Element extends Node implem
/**
* Determines if this element defines any attributes.
- *
- * @return
- * <tt>true</tt> if this element does not define any attributes;
+ *
+ * @return <tt>true</tt> if this element does not define any attributes;
* <tt>false</tt>, otherwise.
*/
@Override
@@ -861,13 +822,10 @@ public class Element extends Node implem
/**
* Returns the sub-elements of of this element whose tag names match the
* given name.
- *
- * @param name
- * The tag name to match.
- *
- * @return
- * A list containing the matching elements. The list will be empty if no
- * elements matched the given tag name.
+ *
+ * @param name The tag name to match.
+ * @return A list containing the matching elements. The list will be empty if
+ * no elements matched the given tag name.
*/
public List<Element> getElements(String name) {
ArrayList<Element> elements = new ArrayList<>();
@@ -876,7 +834,7 @@ public class Element extends Node implem
Node node = get(i);
if (node instanceof Element) {
- Element element = (Element)node;
+ Element element = (Element) node;
if (element.getName().equals(name)) {
elements.add(element);
@@ -891,10 +849,9 @@ public class Element extends Node implem
* Returns the text content of this element. An element is defined to
* contain text when it contains a single child that is an instance of
* {@link TextNode}.
- *
- * @return
- * The text content of the element, or {@code null} if this element does
- * not contain text.
+ *
+ * @return The text content of the element, or {@code null} if this element
+ * does not contain text.
*/
public String getText() {
String text = null;
@@ -903,7 +860,7 @@ public class Element extends Node implem
Node node = get(0);
if (node instanceof TextNode) {
- TextNode textNode = (TextNode)node;
+ TextNode textNode = (TextNode) node;
text = textNode.getText();
}
}
@@ -942,10 +899,7 @@ public class Element extends Node implem
for (int i = 1, n = namespacePrefix.length(); i < n; i++) {
c = namespacePrefix.charAt(i);
- if (!Character.isLetterOrDigit(c)
- && c != '-'
- && c != '_'
- && c != '.') {
+ if (!Character.isLetterOrDigit(c) && c != '-' && c != '_' && c != '.') {
throw new IllegalArgumentException("'" + c + "' is not a valid character"
+ " for a namespace prefix.");
}
@@ -962,8 +916,7 @@ public class Element extends Node implem
}
char c = localName.charAt(0);
- if (!Character.isLetter(c)
- && c != '_') {
+ if (!Character.isLetter(c) && c != '_') {
throw new IllegalArgumentException("'" + c + "' is not a valid start"
+ " character for a local name.");
}
@@ -971,10 +924,7 @@ public class Element extends Node implem
for (int i = 1, n = localName.length(); i < n; i++) {
c = localName.charAt(i);
- if (!Character.isLetterOrDigit(c)
- && c != '-'
- && c != '_'
- && c != '.') {
+ if (!Character.isLetterOrDigit(c) && c != '-' && c != '_' && c != '.') {
throw new IllegalArgumentException("'" + c + "' is not a valid character"
+ " for a local name.");
}
Modified: pivot/trunk/core/src/org/apache/pivot/xml/ElementListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/ElementListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/ElementListener.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/ElementListener.java Fri Oct 4 23:45:40 2013
@@ -52,7 +52,8 @@ public interface ElementListener {
}
@Override
- public void attributesRemoved(Element element, int index, Sequence<Element.Attribute> attributes) {
+ public void attributesRemoved(Element element, int index,
+ Sequence<Element.Attribute> attributes) {
// empty block
}
@@ -64,7 +65,7 @@ public interface ElementListener {
/**
* Called when an element's default namespace URI has changed.
- *
+ *
* @param element
* @param previousDefaultNamespaceURI
*/
@@ -72,7 +73,7 @@ public interface ElementListener {
/**
* Called when a namespace has been added to an element.
- *
+ *
* @param element
* @param prefix
*/
@@ -80,7 +81,7 @@ public interface ElementListener {
/**
* Called when an element attribute has been updated.
- *
+ *
* @param element
* @param prefix
* @param previousURI
@@ -89,7 +90,7 @@ public interface ElementListener {
/**
* Called when a namespace has been removed from an element.
- *
+ *
* @param element
* @param prefix
* @param uri
@@ -98,7 +99,7 @@ public interface ElementListener {
/**
* Called when an attribute has been added to an element.
- *
+ *
* @param element
* @param index
*/
@@ -106,7 +107,7 @@ public interface ElementListener {
/**
* Called when attributes have been removed from an element.
- *
+ *
* @param element
* @param index
* @param attributes
@@ -115,7 +116,7 @@ public interface ElementListener {
/**
* Called when an attribute's value has changed.
- *
+ *
* @param attribute
* @param previousValue
*/
Modified: pivot/trunk/core/src/org/apache/pivot/xml/Node.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/Node.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/Node.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/Node.java Fri Oct 4 23:45:40 2013
@@ -22,8 +22,8 @@ import org.apache.pivot.util.ListenerLis
* Abstract base class for XML nodes.
*/
public abstract class Node {
- private static class NodeListenerList extends ListenerList<NodeListener>
- implements NodeListener {
+ private static class NodeListenerList extends ListenerList<NodeListener> implements
+ NodeListener {
@Override
public void parentChanged(Node node, Element previousParent) {
for (NodeListener listener : this) {
@@ -45,7 +45,7 @@ public abstract class Node {
/**
* Sets the parent element of the node.
- *
+ *
* @param parent
*/
protected void setParent(Element parent) {
Modified: pivot/trunk/core/src/org/apache/pivot/xml/NodeListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/NodeListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/NodeListener.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/NodeListener.java Fri Oct 4 23:45:40 2013
@@ -22,7 +22,7 @@ package org.apache.pivot.xml;
public interface NodeListener {
/**
* Called when a node's parent has changed.
- *
+ *
* @param node
* @param previousParent
*/
Modified: pivot/trunk/core/src/org/apache/pivot/xml/TextNode.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/TextNode.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/TextNode.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/TextNode.java Fri Oct 4 23:45:40 2013
@@ -41,7 +41,7 @@ public class TextNode extends Node {
if (this == o) {
equals = true;
} else if (o instanceof TextNode) {
- TextNode textNode = (TextNode)o;
+ TextNode textNode = (TextNode) o;
equals = (text.equals(textNode.text));
}
Modified: pivot/trunk/core/src/org/apache/pivot/xml/XML.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/XML.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/XML.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/XML.java Fri Oct 4 23:45:40 2013
@@ -25,22 +25,14 @@ import org.apache.pivot.collections.List
public class XML {
/**
* Returns the element matching a given path.
- *
- * @param root
- * The element from which to begin the search.
- *
- * @param path
- * A path of the form:
- * <pre>
- * tag[n]/tag[n]/...
- * </pre>
- * The bracketed index values are optional and refer to the <i>n</i>th
- * occurrence of the given tag name within its parent element. If
- * omitted, the path refers to the first occurrence of the named
- * element (i.e. the element at index 0).
- *
- * @return
- * The matching element, or {@code null} if no such element exists.
+ *
+ * @param root The element from which to begin the search.
+ * @param path A path of the form: <pre> tag[n]/tag[n]/... </pre> The
+ * bracketed index values are optional and refer to the <i>n</i>th
+ * occurrence of the given tag name within its parent element. If omitted,
+ * the path refers to the first occurrence of the named element (i.e. the
+ * element at index 0).
+ * @return The matching element, or {@code null} if no such element exists.
*/
public static Element getElement(Element root, String path) {
if (root == null) {
@@ -79,12 +71,11 @@ public class XML {
trailingBracketIndex));
}
-
int j = 0;
int k = 0;
for (Node node : current) {
if (node instanceof Element) {
- Element element = (Element)node;
+ Element element = (Element) node;
if (element.getName().equals(tagName)) {
if (k == index) {
@@ -99,7 +90,7 @@ public class XML {
}
if (j < current.getLength()) {
- current = (Element)current.get(j);
+ current = (Element) current.get(j);
} else {
current = null;
break;
@@ -112,19 +103,12 @@ public class XML {
/**
* Returns the sub-elements of a descendant of {@code root} whose tag names
* match the given name.
- *
- * @param root
- * The element from which to begin the search.
- *
- * @param path
- * The path to the descendant, relative to {@code root}.
- *
- * @param name
- * The tag name to match.
- *
- * @return
- * The matching elements, or {@code null} if no such descendant exists.
- *
+ *
+ * @param root The element from which to begin the search.
+ * @param path The path to the descendant, relative to {@code root}.
+ * @param name The tag name to match.
+ * @return The matching elements, or {@code null} if no such descendant
+ * exists.
* @see #getElement(Element, String)
* @see Element#getElements(String)
*/
@@ -135,17 +119,11 @@ public class XML {
/**
* Returns the text content of a descendant of {@code root}.
- *
- * @param root
- * The element from which to begin the search.
- *
- * @param path
- * The path to the descendant, relative to {@code root}.
- *
- * @return
- * The text of the descedant, or {@code null} if no such descendant
+ *
+ * @param root The element from which to begin the search.
+ * @param path The path to the descendant, relative to {@code root}.
+ * @return The text of the descedant, or {@code null} if no such descendant
* exists.
- *
* @see #getElement(Element, String)
* @see Element#getText()
*/
Modified: pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java Fri Oct 4 23:45:40 2013
@@ -94,8 +94,7 @@ public class XMLSerializer implements Se
}
@Override
- public Element readObject(InputStream inputStream)
- throws IOException, SerializationException {
+ public Element readObject(InputStream inputStream) throws IOException, SerializationException {
if (inputStream == null) {
throw new IllegalArgumentException("inputStream is null.");
}
@@ -146,8 +145,7 @@ public class XMLSerializer implements Se
case XMLStreamConstants.START_ELEMENT: {
// Create the element
String prefix = xmlStreamReader.getPrefix();
- if (prefix != null
- && prefix.length() == 0) {
+ if (prefix != null && prefix.length() == 0) {
prefix = null;
}
@@ -170,16 +168,16 @@ public class XMLSerializer implements Se
// Get the element's attributes
for (int i = 0, n = xmlStreamReader.getAttributeCount(); i < n; i++) {
String attributePrefix = xmlStreamReader.getAttributePrefix(i);
- if (attributePrefix != null
- && attributePrefix.length() == 0) {
+ if (attributePrefix != null && attributePrefix.length() == 0) {
attributePrefix = null;
}
String attributeLocalName = xmlStreamReader.getAttributeLocalName(i);
String attributeValue = xmlStreamReader.getAttributeValue(i);
- element.getAttributes().add(new Element.Attribute(attributePrefix,
- attributeLocalName, attributeValue));
+ element.getAttributes().add(
+ new Element.Attribute(attributePrefix, attributeLocalName,
+ attributeValue));
}
if (current == null) {
@@ -225,8 +223,8 @@ public class XMLSerializer implements Se
}
@Override
- public void writeObject(Element element, OutputStream outputStream)
- throws IOException, SerializationException {
+ public void writeObject(Element element, OutputStream outputStream) throws IOException,
+ SerializationException {
if (outputStream == null) {
throw new IllegalArgumentException("outputStream is null.");
}
@@ -310,9 +308,9 @@ public class XMLSerializer implements Se
// Write out the child nodes
for (Node node : element) {
if (node instanceof Element) {
- writeElement((Element)node, xmlStreamWriter);
+ writeElement((Element) node, xmlStreamWriter);
} else if (node instanceof TextNode) {
- writeTextNode((TextNode)node, xmlStreamWriter);
+ writeTextNode((TextNode) node, xmlStreamWriter);
} else {
throw new SerializationException("Unsupported node type: "
+ node.getClass().getName());
Modified: pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializerListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializerListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializerListener.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializerListener.java Fri Oct 4 23:45:40 2013
@@ -42,7 +42,7 @@ public interface XMLSerializerListener {
/**
* Called when the serializer has begun reading an element.
- *
+ *
* @param xmlSerializer
* @param element
*/
@@ -50,14 +50,14 @@ public interface XMLSerializerListener {
/**
* Called when the serializer has finished reading an element.
- *
+ *
* @param xmlSerializer
*/
public void endElement(XMLSerializer xmlSerializer);
/**
* Called when the serializer has read a text node.
- *
+ *
* @param xmlSerializer
* @param textNode
*/
Modified: pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/beans/test/BeanAdapterTest.java Fri Oct 4 23:45:40 2013
@@ -73,12 +73,12 @@ public class BeanAdapterTest {
}
@Test
- public void testSerializeBigDecimal()
- {
+ public void testSerializeBigDecimal() {
System.out.println("testSerializeBigDecimal");
double random_double = rnd.nextDouble();
- System.out.println("random_double = " + random_double + " (value will be truncated to 4 digits in this test)");
+ System.out.println("random_double = " + random_double
+ + " (value will be truncated to 4 digits in this test)");
src_test.setBd(new BigDecimal(random_double, new MathContext(4)));
@@ -108,8 +108,7 @@ public class BeanAdapterTest {
}
@Test
- public void testSerializeBigInteger()
- {
+ public void testSerializeBigInteger() {
System.out.println("testSerializeBigInteger");
int random_int = rnd.nextInt();
@@ -143,8 +142,7 @@ public class BeanAdapterTest {
}
@Test
- public void testSerializeString()
- {
+ public void testSerializeString() {
System.out.println("testSerializeString");
String value = "A test String";
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/ArrayListTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/ArrayListTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/ArrayListTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/ArrayListTest.java Fri Oct 4 23:45:40 2013
@@ -16,7 +16,10 @@
*/
package org.apache.pivot.collections.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.apache.pivot.collections.ArrayList;
import org.apache.pivot.collections.List;
@@ -107,7 +110,7 @@ public class ArrayListTest {
ArrayList<Object> list = new ArrayList<Object>("a", "b", "c");
Sequence<?> sequence = list;
- list = new ArrayList<>((Sequence<Object>)sequence);
+ list = new ArrayList<>((Sequence<Object>) sequence);
assertEquals(list.getLength(), 3);
assertEquals(list.get(0), "a");
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/EnumListTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/EnumListTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/EnumListTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/EnumListTest.java Fri Oct 4 23:45:40 2013
@@ -21,12 +21,9 @@ import static org.junit.Assert.assertEqu
import org.apache.pivot.collections.EnumList;
import org.junit.Test;
-
public class EnumListTest {
public enum TestEnum {
- A,
- B,
- C
+ A, B, C
}
@Test
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/EnumMapTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/EnumMapTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/EnumMapTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/EnumMapTest.java Fri Oct 4 23:45:40 2013
@@ -22,12 +22,9 @@ import static org.junit.Assert.assertTru
import org.apache.pivot.collections.EnumMap;
import org.junit.Test;
-
public class EnumMapTest {
public enum TestEnum {
- A,
- B,
- C
+ A, B, C
}
@Test
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/HashMapTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/HashMapTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/HashMapTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/HashMapTest.java Fri Oct 4 23:45:40 2013
@@ -24,12 +24,10 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
// import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
-
// import org.apache.pivot.collections.ArrayList;
import org.apache.pivot.collections.HashMap;
import org.apache.pivot.collections.Map;
@@ -105,9 +103,9 @@ public class HashMapTest {
@Test
public void constructorTests() {
- @SuppressWarnings("unchecked") // or it will generate a warning during build with Java 7
- HashMap<String, Integer> map = new HashMap<>(new Map.Pair<>(
- "a", 1), new Map.Pair<>("b", 2));
+ @SuppressWarnings("unchecked")
+ // or it will generate a warning during build with Java 7
+ HashMap<String, Integer> map = new HashMap<>(new Map.Pair<>("a", 1), new Map.Pair<>("b", 2));
assertEquals(2, map.getCount());
map = new HashMap<>(map);
@@ -118,35 +116,27 @@ public class HashMapTest {
}
-/*
-// TODO: re-enable this, to make it work even inside latest eclipse ...
- @Test
- public void comparatorTest() {
- Comparator<Character> comparator = new Comparator<Character>() {
- @Override
- public int compare(Character c1, Character c2) {
- return c1.compareTo(c2);
- }
- };
-
- HashMap<Character, Integer> map = new HashMap<Character, Integer>(comparator);
- ArrayList<Character> keys = new ArrayList<Character>('c', 'a', 'x', 'r', 'd', 'n', 'f');
-
- int n = keys.getLength();
-
- int i = 0;
- while (i < n) {
- map.put(keys.get(i), i++);
- }
-
- keys.setComparator(comparator);
-
- int j = 0;
- for (Character c : keys) {
- assertEquals(keys.get(j++), c);
- }
- }
- */
+ /*
+ * // TODO: re-enable this, to make it work even inside latest eclipse ...
+ *
+ * @Test public void comparatorTest() { Comparator<Character> comparator =
+ * new Comparator<Character>() {
+ *
+ * @Override public int compare(Character c1, Character c2) { return
+ * c1.compareTo(c2); } };
+ *
+ * HashMap<Character, Integer> map = new HashMap<Character,
+ * Integer>(comparator); ArrayList<Character> keys = new
+ * ArrayList<Character>('c', 'a', 'x', 'r', 'd', 'n', 'f');
+ *
+ * int n = keys.getLength();
+ *
+ * int i = 0; while (i < n) { map.put(keys.get(i), i++); }
+ *
+ * keys.setComparator(comparator);
+ *
+ * int j = 0; for (Character c : keys) { assertEquals(keys.get(j++), c); } }
+ */
@Test
public void iteratorConcurrentModificationTest() {
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/HashSetTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/HashSetTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/HashSetTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/HashSetTest.java Fri Oct 4 23:45:40 2013
@@ -16,7 +16,10 @@
*/
package org.apache.pivot.collections.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.Iterator;
@@ -39,8 +42,7 @@ public class HashSetTest {
int i = 0;
for (String element : set) {
- assertTrue(element.equals("A")
- || element.equals("B"));
+ assertTrue(element.equals("A") || element.equals("B"));
i++;
}
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/LinkedListTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/LinkedListTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/LinkedListTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/LinkedListTest.java Fri Oct 4 23:45:40 2013
@@ -16,7 +16,10 @@
*/
package org.apache.pivot.collections.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
@@ -143,7 +146,7 @@ public class LinkedListTest {
assertEquals(linkedList, new LinkedList<>("A", "d", "N", "P", "z"));
}
- @Test(expected=ConcurrentModificationException.class)
+ @Test(expected = ConcurrentModificationException.class)
public void simpleConcurrentModificationTest() {
LinkedList<String> linkedList = new LinkedList<>("a", "b", "c", "d", "e");
List.ItemIterator<String> iterator = linkedList.iterator();
@@ -151,7 +154,7 @@ public class LinkedListTest {
iterator.next();
}
- @Test(expected=ConcurrentModificationException.class)
+ @Test(expected = ConcurrentModificationException.class)
public void advancedConcurrentModificationTest() {
LinkedList<String> linkedList = new LinkedList<>("a", "b", "c", "d", "e");
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/QueueTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/QueueTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/QueueTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/QueueTest.java Fri Oct 4 23:45:40 2013
@@ -25,7 +25,6 @@ import org.apache.pivot.collections.Link
import org.apache.pivot.collections.Queue;
import org.junit.Test;
-
public class QueueTest {
@Test
public void queueTest() {
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/StackTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/StackTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/StackTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/StackTest.java Fri Oct 4 23:45:40 2013
@@ -23,7 +23,6 @@ import org.apache.pivot.collections.Link
import org.apache.pivot.collections.Stack;
import org.junit.Test;
-
public class StackTest {
@Test
public void stackTest() {
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedQueueTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedQueueTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedQueueTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedQueueTest.java Fri Oct 4 23:45:40 2013
@@ -26,7 +26,6 @@ import org.apache.pivot.util.concurrent.
import org.apache.pivot.util.concurrent.TaskListener;
import org.junit.Test;
-
public class SynchronizedQueueTest {
@Test
public void synchronizedQueueTest() {
@@ -35,8 +34,7 @@ public class SynchronizedQueueTest {
}
private static void testSynchronizedQueue(Queue<String> queue) {
- final SynchronizedQueue<String> synchronizedQueue =
- new SynchronizedQueue<>(queue);
+ final SynchronizedQueue<String> synchronizedQueue = new SynchronizedQueue<>(queue);
Task<Void> testTask = new Task<Void>() {
@Override
@@ -71,7 +69,7 @@ public class SynchronizedQueueTest {
try {
Thread.sleep(500);
- } catch(InterruptedException exception) {
+ } catch (InterruptedException exception) {
throw new RuntimeException(exception);
}
@@ -82,7 +80,7 @@ public class SynchronizedQueueTest {
if (testTask.isPending()) {
try {
testTask.wait(10000);
- } catch(InterruptedException exception) {
+ } catch (InterruptedException exception) {
throw new RuntimeException(exception);
}
}
Modified: pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedStackTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedStackTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedStackTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/collections/test/SynchronizedStackTest.java Fri Oct 4 23:45:40 2013
@@ -26,7 +26,6 @@ import org.apache.pivot.util.concurrent.
import org.apache.pivot.util.concurrent.TaskListener;
import org.junit.Test;
-
public class SynchronizedStackTest {
@Test
public void synchronizedStackTest() {
@@ -35,8 +34,7 @@ public class SynchronizedStackTest {
}
private static void testSynchronizedStack(Stack<String> stack) {
- final SynchronizedStack<String> synchronizedStack =
- new SynchronizedStack<>(stack);
+ final SynchronizedStack<String> synchronizedStack = new SynchronizedStack<>(stack);
Task<Void> testTask = new Task<Void>() {
@Override
@@ -71,7 +69,7 @@ public class SynchronizedStackTest {
try {
Thread.sleep(500);
- } catch(InterruptedException exception) {
+ } catch (InterruptedException exception) {
throw new RuntimeException(exception);
}
@@ -82,7 +80,7 @@ public class SynchronizedStackTest {
if (testTask.isPending()) {
try {
testTask.wait(10000);
- } catch(InterruptedException exception) {
+ } catch (InterruptedException exception) {
throw new RuntimeException(exception);
}
}
Modified: pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/BindTest.java Fri Oct 4 23:45:40 2013
@@ -16,7 +16,9 @@
*/
package org.apache.pivot.json.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.StringReader;
@@ -34,20 +36,21 @@ import org.junit.Test;
public class BindTest {
/**
* Tests returning an untyped list.
- *
+ *
* @throws IOException
* @throws SerializationException
*/
@Test
public void testUntypedList() throws IOException, SerializationException {
JSONSerializer listSerializer = new JSONSerializer(ArrayList.class);
- List<?> list = (List<?>)listSerializer.readObject(new StringReader("[1, 2, 3, 4, 5]"));
+ List<?> list = (List<?>) listSerializer.readObject(new StringReader("[1, 2, 3, 4, 5]"));
assertEquals(list.get(0), 1);
}
/**
- * Tests returning a typed list using {@code org.apache.pivot.util.TypeLiteral}.
- *
+ * Tests returning a typed list using
+ * {@code org.apache.pivot.util.TypeLiteral}.
+ *
* @throws IOException
* @throws SerializationException
*/
@@ -55,16 +58,16 @@ public class BindTest {
public void testTypedList() throws IOException, SerializationException {
JSONSerializer listSerializer = new JSONSerializer();
@SuppressWarnings("unchecked")
- List<Object> list =
- (List<Object>)listSerializer.readObject(getClass().getResourceAsStream("list.json"));
+ List<Object> list = (List<Object>) listSerializer.readObject(getClass().getResourceAsStream(
+ "list.json"));
- JSONSerializer typedListSerializer =
- new JSONSerializer((new TypeLiteral<ArrayList<SampleBean2>>() {
+ JSONSerializer typedListSerializer = new JSONSerializer(
+ (new TypeLiteral<ArrayList<SampleBean2>>() {
// empty block
}).getType());
@SuppressWarnings("unchecked")
- ArrayList<SampleBean2> typedList =
- (ArrayList<SampleBean2>)typedListSerializer.readObject(getClass().getResourceAsStream("list.json"));
+ ArrayList<SampleBean2> typedList = (ArrayList<SampleBean2>) typedListSerializer.readObject(getClass().getResourceAsStream(
+ "list.json"));
Object item0 = typedList.get(0);
assertTrue(item0 instanceof SampleBean2);
@@ -72,8 +75,9 @@ public class BindTest {
}
/**
- * Tests returning a subclass of a generic {@code org.apache.pivot.collections.List}.
- *
+ * Tests returning a subclass of a generic
+ * {@code org.apache.pivot.collections.List}.
+ *
* @throws IOException
* @throws SerializationException
*/
@@ -81,12 +85,12 @@ public class BindTest {
public void testListSubclass() throws IOException, SerializationException {
JSONSerializer listSerializer = new JSONSerializer();
@SuppressWarnings("unchecked")
- List<Object> list =
- (List<Object>)listSerializer.readObject(getClass().getResourceAsStream("list.json"));
+ List<Object> list = (List<Object>) listSerializer.readObject(getClass().getResourceAsStream(
+ "list.json"));
JSONSerializer typedListSerializer = new JSONSerializer(SampleBean2ListSubclass.class);
- SampleBean2List typedList =
- (SampleBean2List)typedListSerializer.readObject(getClass().getResourceAsStream("list.json"));
+ SampleBean2List typedList = (SampleBean2List) typedListSerializer.readObject(getClass().getResourceAsStream(
+ "list.json"));
Object item0 = typedList.get(0);
assertTrue(item0 instanceof SampleBean2);
@@ -94,8 +98,9 @@ public class BindTest {
}
/**
- * Tests returning a class that implements {@code org.apache.pivot.collections.Sequence}.
- *
+ * Tests returning a class that implements
+ * {@code org.apache.pivot.collections.Sequence}.
+ *
* @throws IOException
* @throws SerializationException
*/
@@ -103,22 +108,22 @@ public class BindTest {
public void testSequence() throws IOException, SerializationException {
JSONSerializer listSerializer = new JSONSerializer();
@SuppressWarnings("unchecked")
- List<Object> list =
- (List<Object>)listSerializer.readObject(getClass().getResourceAsStream("list.json"));
+ List<Object> list = (List<Object>) listSerializer.readObject(getClass().getResourceAsStream(
+ "list.json"));
JSONSerializer sequenceSerializer = new JSONSerializer(SampleBean2SequenceSubclass.class);
- SampleBean2Sequence sequence =
- (SampleBean2Sequence)sequenceSerializer.readObject(getClass().getResourceAsStream("list.json"));
+ SampleBean2Sequence sequence = (SampleBean2Sequence) sequenceSerializer.readObject(getClass().getResourceAsStream(
+ "list.json"));
Object item0 = sequence.get(0);
assertNotNull(item0);
- // assertTrue(item0 instanceof SampleBean2); // true but superfluous
+ // assertTrue(item0 instanceof SampleBean2); // true but superfluous
assertEquals(sequence.get(0).getA(), JSON.get(list, "[0].a"));
}
/**
* Tests returning an untyped map.
- *
+ *
* @throws IOException
* @throws SerializationException
*/
@@ -126,34 +131,37 @@ public class BindTest {
public void testUntypedMap() throws IOException, SerializationException {
JSONSerializer mapSerializer = new JSONSerializer(HashMap.class);
@SuppressWarnings("unchecked")
- HashMap<String, ?> map = (HashMap<String, ?>)mapSerializer.readObject(new StringReader("{a:1, b:2, c:'3'}"));
+ HashMap<String, ?> map = (HashMap<String, ?>) mapSerializer.readObject(new StringReader(
+ "{a:1, b:2, c:'3'}"));
assertEquals(map.get("a"), 1);
}
/**
- * Tests returning a typed map using {@code org.apache.pivot.util.TypeLiteral}.
- *
+ * Tests returning a typed map using
+ * {@code org.apache.pivot.util.TypeLiteral}.
+ *
* @throws IOException
* @throws SerializationException
*/
@Test
public void testTypedMap() throws IOException, SerializationException {
- JSONSerializer typedMapSerializer =
- new JSONSerializer((new TypeLiteral<HashMap<String, SampleBean2>>() {
+ JSONSerializer typedMapSerializer = new JSONSerializer(
+ (new TypeLiteral<HashMap<String, SampleBean2>>() {
// empty block
}).getType());
@SuppressWarnings("unchecked")
- HashMap<String, SampleBean2> map =
- (HashMap<String, SampleBean2>)typedMapSerializer.readObject(new StringReader("{foo: {a:1, b:2, c:'3'}}"));
+ HashMap<String, SampleBean2> map = (HashMap<String, SampleBean2>) typedMapSerializer.readObject(new StringReader(
+ "{foo: {a:1, b:2, c:'3'}}"));
assertTrue(JSON.get(map, "foo") instanceof SampleBean2);
assertEquals(JSON.get(map, "foo.c"), "3");
}
/**
- * Tests returning a subclass of a generic {@code org.apache.pivot.collections.Map}.
- *
+ * Tests returning a subclass of a generic
+ * {@code org.apache.pivot.collections.Map}.
+ *
* @throws IOException
* @throws SerializationException
*/
@@ -161,25 +169,27 @@ public class BindTest {
public void testMapSubclass() throws IOException, SerializationException {
JSONSerializer typedMapSerializer = new JSONSerializer(SampleBean2MapSubclass.class);
- SampleBean2Map map =
- (SampleBean2Map)typedMapSerializer.readObject(new StringReader("{foo: {a:1, b:2, c:'3'}}"));
+ SampleBean2Map map = (SampleBean2Map) typedMapSerializer.readObject(new StringReader(
+ "{foo: {a:1, b:2, c:'3'}}"));
assertTrue(JSON.get(map, "foo") instanceof SampleBean2);
assertEquals(JSON.get(map, "foo.c"), "3");
}
/**
- * Tests returning a class that implements {@code org.apache.pivot.collections.Dictionary}.
- *
+ * Tests returning a class that implements
+ * {@code org.apache.pivot.collections.Dictionary}.
+ *
* @throws IOException
* @throws SerializationException
*/
@Test
public void testDictionary() throws IOException, SerializationException {
- JSONSerializer dictionarySerializer = new JSONSerializer(SampleBean2DictionarySubclass.class);
+ JSONSerializer dictionarySerializer = new JSONSerializer(
+ SampleBean2DictionarySubclass.class);
- SampleBean2Dictionary dictionary =
- (SampleBean2Dictionary)dictionarySerializer.readObject(new StringReader("{foo: {a:1, b:2, c:'3'}}"));
+ SampleBean2Dictionary dictionary = (SampleBean2Dictionary) dictionarySerializer.readObject(new StringReader(
+ "{foo: {a:1, b:2, c:'3'}}"));
assertTrue(JSON.get(dictionary, "foo") instanceof SampleBean2);
assertEquals(JSON.get(dictionary, "foo.c"), "3");
@@ -187,7 +197,7 @@ public class BindTest {
/**
* Tests returning a Java bean value.
- *
+ *
* @throws IOException
* @throws SerializationException
*/
@@ -195,12 +205,12 @@ public class BindTest {
public void testBean() throws IOException, SerializationException {
JSONSerializer mapSerializer = new JSONSerializer();
@SuppressWarnings("unchecked")
- Map<String, Object> map =
- (Map<String, Object>)mapSerializer.readObject(getClass().getResourceAsStream("map.json"));
+ Map<String, Object> map = (Map<String, Object>) mapSerializer.readObject(getClass().getResourceAsStream(
+ "map.json"));
JSONSerializer beanSerializer = new JSONSerializer(SampleBean1.class);
- SampleBean1 typedMap =
- (SampleBean1)beanSerializer.readObject(getClass().getResourceAsStream("map.json"));
+ SampleBean1 typedMap = (SampleBean1) beanSerializer.readObject(getClass().getResourceAsStream(
+ "map.json"));
assertEquals(typedMap.getA(), JSON.get(map, "a"));
assertEquals(typedMap.getB(), JSON.get(map, "b"));
Modified: pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java Fri Oct 4 23:45:40 2013
@@ -37,7 +37,7 @@ public class JSONSerializerTest {
List<?> emptyList;
try {
emptyList = JSONSerializer.parseList("[\n]");
- } catch(SerializationException exception) {
+ } catch (SerializationException exception) {
throw new RuntimeException(exception);
}
@@ -50,32 +50,32 @@ public class JSONSerializerTest {
assertEquals(0.000005, JSONSerializer.parseDouble("5.0E-6"), 0);
}
- @Test(expected=SerializationException.class)
+ @Test(expected = SerializationException.class)
public void testFloatNaN() throws SerializationException {
JSONSerializer.toString(Float.NaN);
}
- @Test(expected=SerializationException.class)
+ @Test(expected = SerializationException.class)
public void testFloatNegativeInfinity() throws SerializationException {
JSONSerializer.toString(Float.NEGATIVE_INFINITY);
}
- @Test(expected=SerializationException.class)
+ @Test(expected = SerializationException.class)
public void testFloatPositiveInfinity() throws SerializationException {
JSONSerializer.toString(Float.POSITIVE_INFINITY);
}
- @Test(expected=SerializationException.class)
+ @Test(expected = SerializationException.class)
public void testDoubleNaN() throws SerializationException {
JSONSerializer.toString(Double.NaN);
}
- @Test(expected=SerializationException.class)
+ @Test(expected = SerializationException.class)
public void testDoubleNegativeInfinity() throws SerializationException {
JSONSerializer.toString(Double.NEGATIVE_INFINITY);
}
- @Test(expected=SerializationException.class)
+ @Test(expected = SerializationException.class)
public void testDoublePositiveInfinityN() throws SerializationException {
JSONSerializer.toString(Double.POSITIVE_INFINITY);
}
@@ -85,7 +85,8 @@ public class JSONSerializerTest {
JSONSerializer jsonSerializer = new JSONSerializer();
JSONSerializerListener jsonSerializerListener = new JSONSerializerListener() {
@Override
- public void beginDictionary(JSONSerializer jsonSerializerArgument, Dictionary<String, ?> value) {
+ public void beginDictionary(JSONSerializer jsonSerializerArgument,
+ Dictionary<String, ?> value) {
System.out.println("Begin dictionary: " + value);
}
@@ -146,11 +147,10 @@ public class JSONSerializerTest {
}
@Test
- public void testJavaMap()
- {
+ public void testJavaMap() {
System.out.println("Test interaction with Standard java.util.Map");
- java.util.HashMap<String, java.util.Map<String, String>> root = new java.util.HashMap<>();
+ java.util.HashMap<String, java.util.Map<String, String>> root = new java.util.HashMap<>();
java.util.HashMap<String, String> child = new java.util.HashMap<>();
child.put("name", "John Doe");
Modified: pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/serialization/test/BinarySerializerTest.java Fri Oct 4 23:45:40 2013
@@ -16,6 +16,9 @@
*/
package org.apache.pivot.serialization.test;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -23,19 +26,12 @@ import org.apache.pivot.serialization.Bi
import org.apache.pivot.serialization.Serializer;
import org.junit.Test;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.fail;
-
public class BinarySerializerTest {
@Test
public void testBinarySerializer() {
Serializer<Object> serializer = new BinarySerializer();
- Object[] outputData = {
- "Hello World",
- 123.456,
- true
- };
+ Object[] outputData = { "Hello World", 123.456, true };
Object[] inputData;
try {
@@ -48,13 +44,13 @@ public class BinarySerializerTest {
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
try {
- inputData = (Object[])serializer.readObject(inputStream);
+ inputData = (Object[]) serializer.readObject(inputStream);
} finally {
inputStream.close();
}
assertArrayEquals(outputData, inputData);
- } catch(Exception exception) {
+ } catch (Exception exception) {
fail(exception.getMessage());
}
}
Modified: pivot/trunk/core/test/org/apache/pivot/serialization/test/ByteArraySerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/serialization/test/ByteArraySerializerTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/serialization/test/ByteArraySerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/serialization/test/ByteArraySerializerTest.java Fri Oct 4 23:45:40 2013
@@ -28,10 +28,9 @@ import org.apache.pivot.serialization.Se
import org.apache.pivot.serialization.Serializer;
import org.junit.Test;
-
public class ByteArraySerializerTest {
public static final String testString = "// \n" + "// Hello from "
- + ByteArraySerializerTest.class.getName() + "\n" + "// \n";
+ + ByteArraySerializerTest.class.getName() + "\n" + "// \n";
public static final byte[] testBytes = testString.getBytes();
public void log(String msg) {
Modified: pivot/trunk/core/test/org/apache/pivot/serialization/test/CSVSerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/serialization/test/CSVSerializerTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/serialization/test/CSVSerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/serialization/test/CSVSerializerTest.java Fri Oct 4 23:45:40 2013
@@ -16,6 +16,8 @@
*/
package org.apache.pivot.serialization.test;
+import static org.junit.Assert.assertEquals;
+
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -24,13 +26,11 @@ import org.apache.pivot.collections.Arra
import org.apache.pivot.collections.Dictionary;
import org.apache.pivot.collections.HashMap;
import org.apache.pivot.collections.List;
-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.junit.Test;
-import static org.junit.Assert.assertEquals;
-
public class CSVSerializerTest {
@SuppressWarnings("unchecked")
@Test
@@ -68,25 +68,25 @@ public class CSVSerializerTest {
Dictionary<String, Object> row;
// Test the first row
- row = (Dictionary<String, Object>)result.get(0);
+ row = (Dictionary<String, Object>) result.get(0);
assertEquals(row.get("A"), "a1");
assertEquals(row.get("B"), "b1");
assertEquals(row.get("C"), "c1");
// Test the second row
- row = (Dictionary<String, Object>)result.get(1);
+ row = (Dictionary<String, Object>) result.get(1);
assertEquals(row.get("A"), "a2");
assertEquals(row.get("B"), "b2");
assertEquals(row.get("C"), "c2");
// Test the third row
- row = (Dictionary<String, Object>)result.get(2);
+ row = (Dictionary<String, Object>) result.get(2);
assertEquals(row.get("A"), "a3");
assertEquals(row.get("B"), "b3");
assertEquals(row.get("C"), "c3");
// Test the fourth row
- row = (Dictionary<String, Object>)result.get(3);
+ row = (Dictionary<String, Object>) result.get(3);
assertEquals(row.get("A"), "a4");
assertEquals(row.get("B"), "b4");
assertEquals(row.get("C"), "c4");
@@ -105,7 +105,7 @@ public class CSVSerializerTest {
List<?> result = serializer.readObject(reader);
@SuppressWarnings("unchecked")
- Dictionary<String, Object> row = (Dictionary<String, Object>)result.get(0);
+ Dictionary<String, Object> row = (Dictionary<String, Object>) result.get(0);
assertEquals("a", row.get("A"));
assertEquals(",b,", row.get("B"));
assertEquals("c", row.get("C"));
@@ -124,7 +124,7 @@ public class CSVSerializerTest {
List<?> result = serializer.readObject(reader);
@SuppressWarnings("unchecked")
- Dictionary<String, Object> row = (Dictionary<String, Object>)result.get(0);
+ Dictionary<String, Object> row = (Dictionary<String, Object>) result.get(0);
assertEquals("a", row.get("A"));
assertEquals("\"b\"", row.get("B"));
assertEquals("c", row.get("C"));
@@ -143,26 +143,23 @@ public class CSVSerializerTest {
List<?> result = serializer.readObject(reader);
@SuppressWarnings("unchecked")
- Dictionary<String, Object> row = (Dictionary<String, Object>)result.get(0);
+ Dictionary<String, Object> row = (Dictionary<String, Object>) result.get(0);
assertEquals("a", row.get("A"));
assertEquals("b\nb", row.get("B"));
assertEquals("c", row.get("C"));
}
- @SuppressWarnings("unchecked") // or it will generate a warning during build with Java 7
+ @SuppressWarnings("unchecked")
+ // or it will generate a warning during build with Java 7
@Test
public void testBasicWriteObject() throws IOException {
List<Object> items = new ArrayList<>();
- items.add(new HashMap<>(
- new Dictionary.Pair<String, Object>("A", "a1"),
- new Dictionary.Pair<String, Object>("B", "b1"),
- new Dictionary.Pair<String, Object>("C", "c1")
- ));
- items.add(new HashMap<>(
- new Dictionary.Pair<String, Object>("A", "a2"),
- new Dictionary.Pair<String, Object>("B", "b2"),
- new Dictionary.Pair<String, Object>("C", "c2")
- ));
+ items.add(new HashMap<>(new Dictionary.Pair<String, Object>("A", "a1"),
+ new Dictionary.Pair<String, Object>("B", "b1"), new Dictionary.Pair<String, Object>(
+ "C", "c1")));
+ items.add(new HashMap<>(new Dictionary.Pair<String, Object>("A", "a2"),
+ new Dictionary.Pair<String, Object>("B", "b2"), new Dictionary.Pair<String, Object>(
+ "C", "c2")));
StringWriter writer = new StringWriter();
@@ -174,15 +171,14 @@ public class CSVSerializerTest {
assertEquals("a1,b1,c1\r\na2,b2,c2\r\n", writer.toString());
}
- @SuppressWarnings("unchecked") // or it will generate a warning during build with Java 7
+ @SuppressWarnings("unchecked")
+ // or it will generate a warning during build with Java 7
@Test
public void testQuotedCommaWriteObject() throws IOException {
List<Object> items = new ArrayList<>();
- items.add(new HashMap<>(
- new Dictionary.Pair<String, Object>("A", "a"),
- new Dictionary.Pair<String, Object>("B", ",b,"),
- new Dictionary.Pair<String, Object>("C", "c")
- ));
+ items.add(new HashMap<>(new Dictionary.Pair<String, Object>("A", "a"),
+ new Dictionary.Pair<String, Object>("B", ",b,"), new Dictionary.Pair<String, Object>(
+ "C", "c")));
StringWriter writer = new StringWriter();
@@ -194,15 +190,14 @@ public class CSVSerializerTest {
assertEquals("a,\",b,\",c\r\n", writer.toString());
}
- @SuppressWarnings("unchecked") // or it will generate a warning during build with Java 7
+ @SuppressWarnings("unchecked")
+ // or it will generate a warning during build with Java 7
@Test
public void testQuotedQuoteWriteObject() throws IOException {
List<Object> items = new ArrayList<>();
- items.add(new HashMap<>(
- new Dictionary.Pair<String, Object>("A", "a"),
- new Dictionary.Pair<String, Object>("B", "\"b\""),
- new Dictionary.Pair<String, Object>("C", "c")
- ));
+ items.add(new HashMap<>(new Dictionary.Pair<String, Object>("A", "a"),
+ new Dictionary.Pair<String, Object>("B", "\"b\""), new Dictionary.Pair<String, Object>(
+ "C", "c")));
StringWriter writer = new StringWriter();
@@ -214,15 +209,14 @@ public class CSVSerializerTest {
assertEquals("a,\"\"\"b\"\"\",c\r\n", writer.toString());
}
- @SuppressWarnings("unchecked") // or it will generate a warning during build with Java 7
+ @SuppressWarnings("unchecked")
+ // or it will generate a warning during build with Java 7
@Test
public void testQuotedNewlineWriteObject() throws IOException {
List<Object> items = new ArrayList<>();
- items.add(new HashMap<>(
- new Dictionary.Pair<String, Object>("A", "a"),
- new Dictionary.Pair<String, Object>("B", "\nb\n"),
- new Dictionary.Pair<String, Object>("C", "c")
- ));
+ items.add(new HashMap<>(new Dictionary.Pair<String, Object>("A", "a"),
+ new Dictionary.Pair<String, Object>("B", "\nb\n"), new Dictionary.Pair<String, Object>(
+ "C", "c")));
StringWriter writer = new StringWriter();
@@ -250,7 +244,7 @@ public class CSVSerializerTest {
CSVSerializer serializer = new CSVSerializer();
List<?> result = serializer.readObject(reader);
@SuppressWarnings("unchecked")
- Dictionary<String, Object> row = (Dictionary<String, Object>)result.get(0);
+ Dictionary<String, Object> row = (Dictionary<String, Object>) result.get(0);
assertEquals(row.get("A"), "a1");
assertEquals(row.get("B"), "b1");
assertEquals(row.get("C"), "c1");
Modified: pivot/trunk/core/test/org/apache/pivot/serialization/test/PropertiesSerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/serialization/test/PropertiesSerializerTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/serialization/test/PropertiesSerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/serialization/test/PropertiesSerializerTest.java Fri Oct 4 23:45:40 2013
@@ -30,17 +30,16 @@ import org.apache.pivot.serialization.Se
import org.apache.pivot.serialization.Serializer;
import org.junit.Test;
-public class PropertiesSerializerTest
-{
+public class PropertiesSerializerTest {
public static Map<String, Object> testMap = null;
static {
testMap = new HashMap<>();
- testMap.put("hello", "Hello World");
- testMap.put("number", 123.456);
+ testMap.put("hello", "Hello World");
+ testMap.put("number", 123.456);
testMap.put("boolean", true);
- testMap.put("date", new java.util.Date());
- testMap.put("object", new Object());
+ testMap.put("date", new java.util.Date());
+ testMap.put("object", new Object());
}
public void log(String msg) {
@@ -49,8 +48,8 @@ public class PropertiesSerializerTest
// utility method to transform the given Map to Properties,
// and then to byte array
- protected byte[] mapToPropertiesToBytes(Map<String, Object> testMap2)
- throws IOException, SerializationException {
+ protected byte[] mapToPropertiesToBytes(Map<String, Object> testMap2) throws IOException,
+ SerializationException {
Serializer<Map<?, ?>> serializer = new PropertiesSerializer();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -77,7 +76,9 @@ public class PropertiesSerializerTest
// dump content, but useful only for text resources ...
int dumpLength = testBytes.length;
- log("Result: " + dumpLength + " bytes"
+ log("Result: "
+ + dumpLength
+ + " bytes"
+ ", dump written content now (could have different ordering of rows, and without comment lines):\n"
+ new String(testBytes));
@@ -95,7 +96,6 @@ public class PropertiesSerializerTest
byte[] testBytes = mapToPropertiesToBytes(testMap);
assertNotNull(testBytes);
-
Serializer<Map<?, ?>> serializer = new PropertiesSerializer();
log("serializer instance created: " + serializer);
Modified: pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/serialization/test/StringSerializerTest.java Fri Oct 4 23:45:40 2013
@@ -29,10 +29,9 @@ import org.apache.pivot.serialization.Se
import org.apache.pivot.serialization.StringSerializer;
import org.junit.Test;
-
public class StringSerializerTest {
public static final String testString = "// \n" + "// Hello from "
- + StringSerializerTest.class.getName() + "\n" + "// \n";
+ + StringSerializerTest.class.getName() + "\n" + "// \n";
public static final byte[] testBytes = testString.getBytes();
public void log(String msg) {
Modified: pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java (original)
+++ pivot/trunk/core/test/org/apache/pivot/util/test/ParentResourcesTest.java Fri Oct 4 23:45:40 2013
@@ -76,7 +76,7 @@ public class ParentResourcesTest {
@Test
public void testList() {
- List<?> list = (List<?>)main.get("aList");
+ List<?> list = (List<?>) main.get("aList");
assertNotNull("aList not null", list);
assertEquals("6 items", 6, list.getLength());
@@ -106,8 +106,7 @@ public class ParentResourcesTest {
main = new Resources(parent, getClass().getName(), Locale.ENGLISH, Charset.defaultCharset());
testString();
- main = new Resources(parent, getClass().getName(), Locale.ENGLISH,
- Charset.defaultCharset());
+ main = new Resources(parent, getClass().getName(), Locale.ENGLISH, Charset.defaultCharset());
testString();
}
Modified: pivot/trunk/demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java (original)
+++ pivot/trunk/demos-server/src/org/apache/pivot/demos/rest/server/RESTDemoServlet.java Fri Oct 4 23:45:40 2013
@@ -27,8 +27,8 @@ import org.apache.pivot.json.JSONSeriali
import org.apache.pivot.serialization.SerializationException;
import org.apache.pivot.serialization.Serializer;
import org.apache.pivot.web.Query;
-import org.apache.pivot.web.QueryException;
import org.apache.pivot.web.Query.Method;
+import org.apache.pivot.web.QueryException;
import org.apache.pivot.web.server.QueryServlet;
public class RESTDemoServlet extends QueryServlet {
@@ -64,8 +64,7 @@ public class RESTDemoServlet extends Que
@SuppressWarnings("resource")
@Override
protected URL doPost(Path path, Object value) throws QueryException {
- if (path.getLength() > 0
- || value == null) {
+ if (path.getLength() > 0 || value == null) {
throw new QueryException(Query.Status.BAD_REQUEST);
}
@@ -97,8 +96,7 @@ public class RESTDemoServlet extends Que
@SuppressWarnings("resource")
@Override
protected boolean doPut(Path path, Object value) throws QueryException {
- if (path.getLength() != 1
- || value == null) {
+ if (path.getLength() != 1 || value == null) {
throw new QueryException(Query.Status.BAD_REQUEST);
}
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/decorator/DecoratorDemo.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/decorator/DecoratorDemo.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/decorator/DecoratorDemo.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/decorator/DecoratorDemo.java Fri Oct 4 23:45:40 2013
@@ -34,9 +34,9 @@ public class DecoratorDemo implements Ap
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- reflectionWindow = (Window)bxmlSerializer.readObject(DecoratorDemo.class,
+ reflectionWindow = (Window) bxmlSerializer.readObject(DecoratorDemo.class,
"reflection_window.bxml");
- translucentFrame = (Frame)bxmlSerializer.readObject(DecoratorDemo.class,
+ translucentFrame = (Frame) bxmlSerializer.readObject(DecoratorDemo.class,
"translucent_frame.bxml");
final FadeDecorator fadeDecorator = new FadeDecorator();
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/dnd/DragAndDropDemo.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/dnd/DragAndDropDemo.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/dnd/DragAndDropDemo.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/dnd/DragAndDropDemo.java Fri Oct 4 23:45:40 2013
@@ -43,15 +43,24 @@ import org.apache.pivot.wtk.Window;
import org.apache.pivot.wtk.media.Image;
public class DragAndDropDemo extends Window implements Bindable {
- @BXML private Label label;
- @BXML private PushButton copyTextButton;
- @BXML private PushButton pasteTextButton;
- @BXML private ImageView imageView;
- @BXML private PushButton copyImageButton;
- @BXML private PushButton pasteImageButton;
- @BXML private ListView listView;
- @BXML private PushButton copyFilesButton;
- @BXML private PushButton pasteFilesButton;
+ @BXML
+ private Label label;
+ @BXML
+ private PushButton copyTextButton;
+ @BXML
+ private PushButton pasteTextButton;
+ @BXML
+ private ImageView imageView;
+ @BXML
+ private PushButton copyImageButton;
+ @BXML
+ private PushButton pasteImageButton;
+ @BXML
+ private ListView listView;
+ @BXML
+ private PushButton copyFilesButton;
+ @BXML
+ private PushButton pasteFilesButton;
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
@@ -107,8 +116,7 @@ public class DragAndDropDemo extends Win
int supportedDropActions, DropAction userDropAction) {
DropAction dropAction = null;
- if (dragContent.containsText()
- && DropAction.COPY.isSelected(supportedDropActions)) {
+ if (dragContent.containsText() && DropAction.COPY.isSelected(supportedDropActions)) {
dropAction = DropAction.COPY;
}
@@ -141,7 +149,7 @@ public class DragAndDropDemo extends Win
try {
label.setText(dragContent.getText());
dropAction = DropAction.COPY;
- } catch(IOException exception) {
+ } catch (IOException exception) {
System.err.println(exception);
}
}
@@ -167,11 +175,10 @@ public class DragAndDropDemo extends Win
public void buttonPressed(Button button) {
Manifest clipboardContent = Clipboard.getContent();
- if (clipboardContent != null
- && clipboardContent.containsText()) {
+ if (clipboardContent != null && clipboardContent.containsText()) {
try {
label.setText(clipboardContent.getText());
- } catch(IOException exception) {
+ } catch (IOException exception) {
System.err.println(exception);
}
}
@@ -231,8 +238,7 @@ public class DragAndDropDemo extends Win
int supportedDropActions, DropAction userDropAction) {
DropAction dropAction = null;
- if (dragContent.containsImage()
- && DropAction.COPY.isSelected(supportedDropActions)) {
+ if (dragContent.containsImage() && DropAction.COPY.isSelected(supportedDropActions)) {
dropAction = DropAction.COPY;
}
@@ -265,7 +271,7 @@ public class DragAndDropDemo extends Win
try {
imageView.setImage(dragContent.getImage());
dropAction = DropAction.COPY;
- } catch(IOException exception) {
+ } catch (IOException exception) {
System.err.println(exception);
}
}
@@ -293,11 +299,10 @@ public class DragAndDropDemo extends Win
public void buttonPressed(Button button) {
Manifest clipboardContent = Clipboard.getContent();
- if (clipboardContent != null
- && clipboardContent.containsImage()) {
+ if (clipboardContent != null && clipboardContent.containsImage()) {
try {
imageView.setImage(clipboardContent.getImage());
- } catch(IOException exception) {
+ } catch (IOException exception) {
System.err.println(exception);
}
}
@@ -312,8 +317,8 @@ public class DragAndDropDemo extends Win
@Override
public boolean beginDrag(Component component, int x, int y) {
- ListView listViewLocal = (ListView)component;
- FileList fileList = (FileList)listViewLocal.getListData();
+ ListView listViewLocal = (ListView) component;
+ FileList fileList = (FileList) listViewLocal.getListData();
if (fileList.getLength() > 0) {
content = new LocalManifest();
@@ -394,7 +399,7 @@ public class DragAndDropDemo extends Win
try {
listView.setListData(dragContent.getFileList());
dropAction = DropAction.COPY;
- } catch(IOException exception) {
+ } catch (IOException exception) {
System.err.println(exception);
}
}