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 [13/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/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java Fri Oct 4 23:45:40 2013
@@ -34,12 +34,14 @@ import org.apache.pivot.wtk.MenuBar;
import org.apache.pivot.wtk.MenuHandler;
import org.apache.pivot.wtk.TabPane;
import org.apache.pivot.wtk.TextInput;
-import org.apache.pivot.wtk.TextInputSelectionListener;
import org.apache.pivot.wtk.TextInputContentListener;
+import org.apache.pivot.wtk.TextInputSelectionListener;
public class MenuBars extends Frame implements Bindable {
- @BXML private FileBrowserSheet fileBrowserSheet;
- @BXML private TabPane tabPane = null;
+ @BXML
+ private FileBrowserSheet fileBrowserSheet;
+ @BXML
+ private TabPane tabPane = null;
private MenuHandler menuHandler = new MenuHandler.Adapter() {
TextInputContentListener textInputTextListener = new TextInputContentListener.Adapter() {
@@ -60,7 +62,7 @@ public class MenuBars extends Frame impl
@Override
public void configureMenuBar(Component component, MenuBar menuBar) {
if (component instanceof TextInput) {
- TextInput textInput = (TextInput)component;
+ TextInput textInput = (TextInput) component;
updateActionState(textInput);
Action.getNamedActions().get("paste").setEnabled(true);
@@ -77,7 +79,7 @@ public class MenuBars extends Frame impl
@Override
public void cleanupMenuBar(Component component, MenuBar menuBar) {
if (component instanceof TextInput) {
- TextInput textInput = (TextInput)component;
+ TextInput textInput = (TextInput) component;
textInput.getTextInputContentListeners().remove(textInputTextListener);
textInput.getTextInputSelectionListeners().remove(textInputSelectionListener);
}
@@ -98,7 +100,8 @@ public class MenuBars extends Frame impl
Component tab;
try {
- tab = new Border((Component)bxmlSerializer.readObject(MenuBars.class, "document.bxml"));
+ tab = new Border((Component) bxmlSerializer.readObject(MenuBars.class,
+ "document.bxml"));
} catch (IOException exception) {
throw new RuntimeException(exception);
} catch (SerializationException exception) {
@@ -121,7 +124,7 @@ public class MenuBars extends Frame impl
Action.getNamedActions().put("cut", new Action(false) {
@Override
public void perform(Component source) {
- TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
+ TextInput textInput = (TextInput) MenuBars.this.getFocusDescendant();
textInput.cut();
}
});
@@ -129,7 +132,7 @@ public class MenuBars extends Frame impl
Action.getNamedActions().put("copy", new Action(false) {
@Override
public void perform(Component source) {
- TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
+ TextInput textInput = (TextInput) MenuBars.this.getFocusDescendant();
textInput.copy();
}
});
@@ -137,7 +140,7 @@ public class MenuBars extends Frame impl
Action.getNamedActions().put("paste", new Action(false) {
@Override
public void perform(Component source) {
- TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
+ TextInput textInput = (TextInput) MenuBars.this.getFocusDescendant();
textInput.paste();
}
});
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuButtons.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuButtons.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuButtons.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuButtons.java Fri Oct 4 23:45:40 2013
@@ -58,6 +58,6 @@ public class MenuButtons extends Window
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- componentBoxPane = (BoxPane)namespace.get("componentBoxPane");
+ componentBoxPane = (BoxPane) namespace.get("componentBoxPane");
}
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Accordions.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Accordions.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Accordions.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Accordions.java Fri Oct 4 23:45:40 2013
@@ -33,12 +33,13 @@ public class Accordions extends Window i
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- accordion = (Accordion)namespace.get("accordion");
+ accordion = (Accordion) namespace.get("accordion");
accordion.getAccordionSelectionListeners().add(new AccordionSelectionListener() {
private int selectedIndex = -1;
@Override
- public Vote previewSelectedIndexChange(Accordion accordionArgument, int selectedIndexArgument) {
+ public Vote previewSelectedIndexChange(Accordion accordionArgument,
+ int selectedIndexArgument) {
this.selectedIndex = selectedIndexArgument;
// Enable the next panel or disable the previous panel so the
@@ -58,8 +59,7 @@ public class Accordions extends Window i
@Override
public void selectedIndexChangeVetoed(Accordion accordionArgument, Vote reason) {
- if (reason == Vote.DENY
- && selectedIndex != -1) {
+ if (reason == Vote.DENY && selectedIndex != -1) {
Component panel = accordionArgument.getPanels().get(selectedIndex);
panel.setEnabled(!panel.isEnabled());
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/CardPanes.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/CardPanes.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/CardPanes.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/CardPanes.java Fri Oct 4 23:45:40 2013
@@ -47,18 +47,18 @@ public class CardPanes extends Window im
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- cardPane = (CardPane)namespace.get("cardPane");
- previousButton = (LinkButton)namespace.get("previousButton");
- nextButton = (LinkButton)namespace.get("nextButton");
- sizeToSelectionCheckbox = (Checkbox)namespace.get("sizeToSelectionCheckbox");
-
- crossfadeRadioButton = (RadioButton)namespace.get("crossfadeRadioButton");
- horizontalSlideRadioButton = (RadioButton)namespace.get("horizontalSlideRadioButton");
- verticalSlideRadioButton = (RadioButton)namespace.get("verticalSlideRadioButton");
- horizontalFlipRadioButton = (RadioButton)namespace.get("horizontalFlipRadioButton");
- verticalFlipRadioButton = (RadioButton)namespace.get("verticalFlipRadioButton");
- zoomRadioButton = (RadioButton)namespace.get("zoomRadioButton");
- noneRadioButton = (RadioButton)namespace.get("noneRadioButton");
+ cardPane = (CardPane) namespace.get("cardPane");
+ previousButton = (LinkButton) namespace.get("previousButton");
+ nextButton = (LinkButton) namespace.get("nextButton");
+ sizeToSelectionCheckbox = (Checkbox) namespace.get("sizeToSelectionCheckbox");
+
+ crossfadeRadioButton = (RadioButton) namespace.get("crossfadeRadioButton");
+ horizontalSlideRadioButton = (RadioButton) namespace.get("horizontalSlideRadioButton");
+ verticalSlideRadioButton = (RadioButton) namespace.get("verticalSlideRadioButton");
+ horizontalFlipRadioButton = (RadioButton) namespace.get("horizontalFlipRadioButton");
+ verticalFlipRadioButton = (RadioButton) namespace.get("verticalFlipRadioButton");
+ zoomRadioButton = (RadioButton) namespace.get("zoomRadioButton");
+ noneRadioButton = (RadioButton) namespace.get("noneRadioButton");
cardPane.getCardPaneListeners().add(new CardPaneListener.Adapter() {
@Override
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Ruler.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Ruler.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Ruler.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/Ruler.java Fri Oct 4 23:45:40 2013
@@ -22,8 +22,8 @@ import org.apache.pivot.wtk.Orientation;
public class Ruler extends Component {
- private static class RulerListenerList extends ListenerList<RulerListener>
- implements RulerListener {
+ private static class RulerListenerList extends ListenerList<RulerListener> implements
+ RulerListener {
@Override
public void orientationChanged(Ruler ruler) {
for (RulerListener listener : this) {
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java Fri Oct 4 23:45:40 2013
@@ -28,7 +28,7 @@ class RulerSkin extends ComponentSkin im
public void install(Component component) {
super.install(component);
- Ruler ruler = (Ruler)component;
+ Ruler ruler = (Ruler) component;
ruler.getRulerListeners().add(this);
}
@@ -39,7 +39,7 @@ class RulerSkin extends ComponentSkin im
@Override
public int getPreferredHeight(int width) {
- Ruler ruler = (Ruler)getComponent();
+ Ruler ruler = (Ruler) getComponent();
Orientation orientation = ruler.getOrientation();
return (orientation == Orientation.HORIZONTAL) ? 20 : 0;
@@ -47,7 +47,7 @@ class RulerSkin extends ComponentSkin im
@Override
public int getPreferredWidth(int height) {
- Ruler ruler = (Ruler)getComponent();
+ Ruler ruler = (Ruler) getComponent();
Orientation orientation = ruler.getOrientation();
return (orientation == Orientation.VERTICAL) ? 20 : 0;
@@ -58,7 +58,7 @@ class RulerSkin extends ComponentSkin im
int width = getWidth();
int height = getHeight();
- Ruler ruler = (Ruler)getComponent();
+ Ruler ruler = (Ruler) getComponent();
graphics.setColor(new Color(0xFF, 0xFF, 0xE0));
graphics.fillRect(0, 0, width, height);
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/TabPanes.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/TabPanes.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/TabPanes.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/TabPanes.java Fri Oct 4 23:45:40 2013
@@ -22,10 +22,10 @@ import org.apache.pivot.beans.Bindable;
import org.apache.pivot.collections.Map;
import org.apache.pivot.util.Resources;
import org.apache.pivot.util.Vote;
+import org.apache.pivot.wtk.BoxPane;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonStateListener;
import org.apache.pivot.wtk.Checkbox;
-import org.apache.pivot.wtk.BoxPane;
import org.apache.pivot.wtk.Orientation;
import org.apache.pivot.wtk.Prompt;
import org.apache.pivot.wtk.RadioButton;
@@ -48,17 +48,18 @@ public class TabPanes extends Window imp
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- confirmCloseTabPrompt = (Prompt)namespace.get("confirmCloseTabPrompt");
- tabPane = (TabPane)namespace.get("tabPane");
- closeableCheckbox = (Checkbox)namespace.get("closeableCheckbox");
- collapsibleCheckbox = (Checkbox)namespace.get("collapsibleCheckbox");
- horizontalRadioButton = (RadioButton)namespace.get("horizontalRadioButton");
- verticalRadioButton = (RadioButton)namespace.get("verticalRadioButton");
- cornerBoxPane = (BoxPane)namespace.get("cornerBoxPane");
+ confirmCloseTabPrompt = (Prompt) namespace.get("confirmCloseTabPrompt");
+ tabPane = (TabPane) namespace.get("tabPane");
+ closeableCheckbox = (Checkbox) namespace.get("closeableCheckbox");
+ collapsibleCheckbox = (Checkbox) namespace.get("collapsibleCheckbox");
+ horizontalRadioButton = (RadioButton) namespace.get("horizontalRadioButton");
+ verticalRadioButton = (RadioButton) namespace.get("verticalRadioButton");
+ cornerBoxPane = (BoxPane) namespace.get("cornerBoxPane");
tabPane.getTabPaneListeners().add(new TabPaneListener.Adapter() {
@Override
- public Vote previewRemoveTabs(final TabPane tabPaneArgument, final int index, final int count) {
+ public Vote previewRemoveTabs(final TabPane tabPaneArgument, final int index,
+ final int count) {
Vote vote;
if (confirmCloseTab) {
confirmCloseTabPrompt.open(TabPanes.this, new SheetCloseListener() {
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/ActivityIndicators.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/ActivityIndicators.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/ActivityIndicators.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/ActivityIndicators.java Fri Oct 4 23:45:40 2013
@@ -35,10 +35,10 @@ public class ActivityIndicators extends
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- activityIndicator1 = (ActivityIndicator)namespace.get("activityIndicator1");
- activityIndicator2 = (ActivityIndicator)namespace.get("activityIndicator2");
- activityIndicator3 = (ActivityIndicator)namespace.get("activityIndicator3");
- activityButton = (PushButton)namespace.get("activityButton");
+ activityIndicator1 = (ActivityIndicator) namespace.get("activityIndicator1");
+ activityIndicator2 = (ActivityIndicator) namespace.get("activityIndicator2");
+ activityIndicator3 = (ActivityIndicator) namespace.get("activityIndicator3");
+ activityButton = (PushButton) namespace.get("activityButton");
activityButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/Meters.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/Meters.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/Meters.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/progress/Meters.java Fri Oct 4 23:45:40 2013
@@ -41,8 +41,7 @@ public class Meters extends Window imple
// Simulate a long-running operation
percentage = 0;
- while (percentage < 100
- && !abort) {
+ while (percentage < 100 && !abort) {
try {
Thread.sleep(100);
percentage++;
@@ -51,10 +50,10 @@ public class Meters extends Window imple
ApplicationContext.queueCallback(new Runnable() {
@Override
public void run() {
- meter.setPercentage((double)percentage / 100);
+ meter.setPercentage((double) percentage / 100);
}
});
- } catch(InterruptedException exception) {
+ } catch (InterruptedException exception) {
throw new TaskExecutionException(exception);
}
}
@@ -70,8 +69,8 @@ public class Meters extends Window imple
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- meter = (Meter)namespace.get("meter");
- progressButton = (PushButton)namespace.get("progressButton");
+ meter = (Meter) namespace.get("meter");
+ progressButton = (PushButton) namespace.get("progressButton");
progressButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/scripting/Scripting.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/scripting/Scripting.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/scripting/Scripting.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/scripting/Scripting.java Fri Oct 4 23:45:40 2013
@@ -40,14 +40,13 @@ public class Scripting extends Applicati
private List<?> listData;
@Override
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
+ public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
bxmlSerializer.getNamespace().put("bar", "12345");
- window = (Window)bxmlSerializer.readObject(Scripting.class, "scripting.bxml");
- foo = (String)bxmlSerializer.getNamespace().get("foo");
- listData = (List<?>)bxmlSerializer.getNamespace().get("listData");
+ window = (Window) bxmlSerializer.readObject(Scripting.class, "scripting.bxml");
+ foo = (String) bxmlSerializer.getNamespace().get("foo");
+ listData = (List<?>) bxmlSerializer.getNamespace().get("listData");
System.out.println("foo = " + foo);
System.out.println("listData.getLength() = " + listData.getLength());
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ChangeCellRenderer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ChangeCellRenderer.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ChangeCellRenderer.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ChangeCellRenderer.java Fri Oct 4 23:45:40 2013
@@ -29,15 +29,13 @@ public class ChangeCellRenderer extends
public static final Color DOWN_COLOR = new Color(0xff, 0x00, 0x00);
@Override
- public void render(Object row, int rowIndex, int columnIndex,
- TableView tableView, String columnName,
- boolean selected, boolean highlighted, boolean disabled) {
- super.render(row, rowIndex, columnIndex, tableView, columnName,
- selected, highlighted, disabled);
+ public void render(Object row, int rowIndex, int columnIndex, TableView tableView,
+ String columnName, boolean selected, boolean highlighted, boolean disabled) {
+ super.render(row, rowIndex, columnIndex, tableView, columnName, selected, highlighted,
+ disabled);
- if (row != null
- && !selected) {
- StockQuote stockQuote = (StockQuote)row;
+ if (row != null && !selected) {
+ StockQuote stockQuote = (StockQuote) row;
float change = stockQuote.getChange();
getStyles().put("color", change < 0 ? DOWN_COLOR : UP_COLOR);
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuote.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuote.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuote.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuote.java Fri Oct 4 23:45:40 2013
@@ -56,7 +56,7 @@ public class StockQuote {
public void setValue(String value) {
try {
setValue(Float.parseFloat(value));
- } catch(NumberFormatException exception) {
+ } catch (NumberFormatException exception) {
setValue(Float.NaN);
}
}
@@ -72,7 +72,7 @@ public class StockQuote {
public void setOpeningValue(String openingValue) {
try {
setOpeningValue(Float.parseFloat(openingValue));
- } catch(NumberFormatException exception) {
+ } catch (NumberFormatException exception) {
setOpeningValue(Float.NaN);
}
}
@@ -88,7 +88,7 @@ public class StockQuote {
public void setHighValue(String highValue) {
try {
setHighValue(Float.parseFloat(highValue));
- } catch(NumberFormatException exception) {
+ } catch (NumberFormatException exception) {
setHighValue(Float.NaN);
}
}
@@ -104,7 +104,7 @@ public class StockQuote {
public void setLowValue(String lowValue) {
try {
setLowValue(Float.parseFloat(lowValue));
- } catch(NumberFormatException exception) {
+ } catch (NumberFormatException exception) {
setLowValue(Float.NaN);
}
}
@@ -120,7 +120,7 @@ public class StockQuote {
public void setChange(String change) {
try {
setChange(Float.parseFloat(change));
- } catch(NumberFormatException exception) {
+ } catch (NumberFormatException exception) {
setChange(Float.NaN);
}
}
@@ -136,7 +136,7 @@ public class StockQuote {
public void setVolume(String volume) {
try {
setVolume(Float.parseFloat(volume));
- } catch(NumberFormatException exception) {
+ } catch (NumberFormatException exception) {
setVolume(Float.NaN);
}
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTracker.java Fri Oct 4 23:45:40 2013
@@ -40,8 +40,8 @@ public class StockTracker extends Applic
Resources resources = new Resources(StockTrackerWindow.class.getName(), locale);
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (StockTrackerWindow)bxmlSerializer.readObject(getClass().getResource("stock_tracker_window.bxml"),
- resources);
+ window = (StockTrackerWindow) bxmlSerializer.readObject(
+ getClass().getResource("stock_tracker_window.bxml"), resources);
window.open(display);
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java Fri Oct 4 23:45:40 2013
@@ -66,13 +66,20 @@ import org.apache.pivot.wtk.content.Tabl
* Main Stock Tracker window.
*/
public class StockTrackerWindow extends Window implements Bindable {
- @BXML private TableView stocksTableView = null;
- @BXML private TextInput symbolTextInput = null;
- @BXML private Button addSymbolButton = null;
- @BXML private Button removeSymbolsButton = null;
- @BXML private BoxPane detailPane = null;
- @BXML private Label lastUpdateLabel = null;
- @BXML private Button yahooFinanceButton = null;
+ @BXML
+ private TableView stocksTableView = null;
+ @BXML
+ private TextInput symbolTextInput = null;
+ @BXML
+ private Button addSymbolButton = null;
+ @BXML
+ private Button removeSymbolsButton = null;
+ @BXML
+ private BoxPane detailPane = null;
+ @BXML
+ private Label lastUpdateLabel = null;
+ @BXML
+ private Button yahooFinanceButton = null;
private ArrayList<String> symbols;
private GetQuery getQuery = null;
@@ -86,7 +93,7 @@ public class StockTrackerWindow extends
symbols.add(symbol);
@SuppressWarnings("unchecked")
- List<StockQuote> tableData = (List<StockQuote>)stocksTableView.getTableData();
+ List<StockQuote> tableData = (List<StockQuote>) stocksTableView.getTableData();
StockQuote stockQuote = new StockQuote();
stockQuote.setSymbol(symbol);
int index = tableData.add(stockQuote);
@@ -106,7 +113,8 @@ public class StockTrackerWindow extends
int selectedIndex = stocksTableView.getFirstSelectedIndex();
ArrayList<Span> spanList = new ArrayList<>(stocksTableView.getSelectedRanges());
- // remove spans in reverse order to prevent IndexOutOfBoundsException
+ // remove spans in reverse order to prevent
+ // IndexOutOfBoundsException
ItemIterator<Span> it = spanList.iterator();
it.toEnd();
while (it.hasPrevious()) {
@@ -182,30 +190,32 @@ public class StockTrackerWindow extends
}
});
- stocksTableView.getTableViewSelectionListeners().add(new TableViewSelectionListener.Adapter() {
- @Override
- public void selectedRangesChanged(TableView tableView, Sequence<Span> previousSelectedRanges) {
- int firstSelectedIndex = stocksTableView.getFirstSelectedIndex();
- removeSymbolsAction.setEnabled(firstSelectedIndex != -1);
+ stocksTableView.getTableViewSelectionListeners().add(
+ new TableViewSelectionListener.Adapter() {
+ @Override
+ public void selectedRangesChanged(TableView tableView,
+ Sequence<Span> previousSelectedRanges) {
+ int firstSelectedIndex = stocksTableView.getFirstSelectedIndex();
+ removeSymbolsAction.setEnabled(firstSelectedIndex != -1);
- refreshDetail();
- }
- });
+ refreshDetail();
+ }
+ });
stocksTableView.getTableViewSortListeners().add(new TableViewSortListener.Adapter() {
@Override
public void sortChanged(TableView tableView) {
@SuppressWarnings("unchecked")
- List<Object> tableData = (List<Object>)tableView.getTableData();
+ List<Object> tableData = (List<Object>) tableView.getTableData();
tableData.setComparator(new TableViewRowComparator(tableView));
}
});
stocksTableView.getComponentKeyListeners().add(new ComponentKeyListener.Adapter() {
@Override
- public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
- if (keyCode == Keyboard.KeyCode.DELETE
- || keyCode == Keyboard.KeyCode.BACKSPACE) {
+ public boolean keyPressed(Component component, int keyCode,
+ Keyboard.KeyLocation keyLocation) {
+ if (keyCode == Keyboard.KeyCode.DELETE || keyCode == Keyboard.KeyCode.BACKSPACE) {
removeSymbolsAction.perform(component);
} else if (keyCode == Keyboard.KeyCode.A
&& Keyboard.isPressed(Platform.getCommandModifier())) {
@@ -226,7 +236,8 @@ public class StockTrackerWindow extends
symbolTextInput.getComponentKeyListeners().add(new ComponentKeyListener.Adapter() {
@Override
- public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
+ public boolean keyPressed(Component component, int keyCode,
+ Keyboard.KeyLocation keyLocation) {
if (keyCode == Keyboard.KeyCode.ENTER) {
if (addSymbolAction.isEnabled()) {
addSymbolAction.perform(component);
@@ -250,13 +261,13 @@ public class StockTrackerWindow extends
try {
desktop.browse(new URL(YAHOO_FINANCE_HOME).toURI());
- } catch(MalformedURLException exception) {
+ } catch (MalformedURLException exception) {
throw new RuntimeException(exception);
- } catch(URISyntaxException exception) {
+ } catch (URISyntaxException exception) {
throw new RuntimeException(exception);
- } catch(IOException exception) {
- System.out.println("Unable to open "
- + YAHOO_FINANCE_HOME + " in default browser.");
+ } catch (IOException exception) {
+ System.out.println("Unable to open " + YAHOO_FINANCE_HOME
+ + " in default browser.");
}
}
});
@@ -315,14 +326,8 @@ public class StockTrackerWindow extends
getQuery.getParameters().put("f", "snl1ohgc1v");
CSVSerializer quoteSerializer = new CSVSerializer(StockQuote.class);
- quoteSerializer.setKeys("symbol",
- "companyName",
- "value",
- "openingValue",
- "highValue",
- "lowValue",
- "change",
- "volume");
+ quoteSerializer.setKeys("symbol", "companyName", "value", "openingValue", "highValue",
+ "lowValue", "change", "volume");
getQuery.setSerializer(quoteSerializer);
@@ -331,13 +336,13 @@ public class StockTrackerWindow extends
public void taskExecuted(Task<Object> task) {
if (task == getQuery) {
@SuppressWarnings("unchecked")
- List<Object> quotes = (List<Object>)task.getResult();
+ List<Object> quotes = (List<Object>) task.getResult();
// Preserve any existing sort and selection
Sequence<?> selectedStocks = stocksTableView.getSelectedRows();
@SuppressWarnings("unchecked")
- List<Object> tableData = (List<Object>)stocksTableView.getTableData();
+ List<Object> tableData = (List<Object>) stocksTableView.getTableData();
Comparator<Object> comparator = tableData.getComparator();
quotes.setComparator(comparator);
@@ -397,7 +402,7 @@ public class StockTrackerWindow extends
if (firstSelectedIndex == lastSelectedIndex) {
@SuppressWarnings("unchecked")
- List<StockQuote> tableData = (List<StockQuote>)stocksTableView.getTableData();
+ List<StockQuote> tableData = (List<StockQuote>) stocksTableView.getTableData();
stockQuote = tableData.get(firstSelectedIndex);
} else {
stockQuote = new StockQuote();
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ValueMapping.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ValueMapping.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ValueMapping.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/ValueMapping.java Fri Oct 4 23:45:40 2013
@@ -28,7 +28,7 @@ public class ValueMapping implements Lab
@Override
public String toString(Object value) {
- return Float.isNaN((Float)value) ? null : FORMAT.format(value);
+ return Float.isNaN((Float) value) ? null : FORMAT.format(value);
}
@Override
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/SuggestionPopups.java Fri Oct 4 23:45:40 2013
@@ -94,7 +94,7 @@ public class SuggestionPopups extends Wi
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- stateTextInput = (TextInput)namespace.get("stateTextInput");
+ stateTextInput = (TextInput) namespace.get("stateTextInput");
stateTextInput.getTextInputContentListeners().add(new TextInputContentListener.Adapter() {
@Override
public void textInserted(TextInput textInput, int index, int count) {
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/text/TextInputs.java Fri Oct 4 23:45:40 2013
@@ -92,14 +92,13 @@ public class TextInputs extends Window i
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- stateTextInput = (TextInput)namespace.get("stateTextInput");
+ stateTextInput = (TextInput) namespace.get("stateTextInput");
stateTextInput.getTextInputContentListeners().add(new TextInputContentListener.Adapter() {
@Override
public void textInserted(final TextInput textInput, int index, int count) {
String text = textInput.getText();
- int i = ArrayList.binarySearch(states, text,
- states.getComparator());
+ int i = ArrayList.binarySearch(states, text, states.getComparator());
if (i < 0) {
i = -(i + 1);
@@ -110,11 +109,9 @@ public class TextInputs extends Window i
final String state = states.get(i);
if (state.toLowerCase().startsWith(text)) {
- String nextState = (i == n - 1) ?
- null : states.get(i + 1);
+ String nextState = (i == n - 1) ? null : states.get(i + 1);
- if (nextState == null
- || !nextState.toLowerCase().startsWith(text)) {
+ if (nextState == null || !nextState.toLowerCase().startsWith(text)) {
textInput.setText(state);
int selectionStart = text.length();
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/DateBindMapping.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/DateBindMapping.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/DateBindMapping.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/DateBindMapping.java Fri Oct 4 23:45:40 2013
@@ -27,8 +27,8 @@ import org.apache.pivot.wtk.content.Cale
public class DateBindMapping implements Spinner.ItemBindMapping {
@Override
public int indexOf(List<?> spinnerData, Object value) {
- CalendarDateSpinnerData calendarDateSpinnerData = (CalendarDateSpinnerData)spinnerData;
- return calendarDateSpinnerData.indexOf(CalendarDate.decode((String)value));
+ CalendarDateSpinnerData calendarDateSpinnerData = (CalendarDateSpinnerData) spinnerData;
+ return calendarDateSpinnerData.indexOf(CalendarDate.decode((String) value));
}
@Override
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpenseSheet.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpenseSheet.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpenseSheet.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpenseSheet.java Fri Oct 4 23:45:40 2013
@@ -49,12 +49,12 @@ public class ExpenseSheet extends Sheet
public void initialize(Map<String, Object> namespace, URL location, Resources resource) {
this.resources = resource;
- dateSpinner = (Spinner)namespace.get("dateSpinner");
- typeListButton = (ListButton)namespace.get("typeListButton");
- amountTextInput = (TextInput)namespace.get("amountTextInput");
+ dateSpinner = (Spinner) namespace.get("dateSpinner");
+ typeListButton = (ListButton) namespace.get("typeListButton");
+ amountTextInput = (TextInput) namespace.get("amountTextInput");
- cancelButton = (PushButton)namespace.get("cancelButton");
- okButton = (PushButton)namespace.get("okButton");
+ cancelButton = (PushButton) namespace.get("cancelButton");
+ okButton = (PushButton) namespace.get("okButton");
cancelButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
@@ -78,19 +78,19 @@ public class ExpenseSheet extends Sheet
if (result) {
// Validate the form contents
if (typeListButton.getSelectedIndex() == -1) {
- Form.setFlag(typeListButton, new Form.Flag(MessageType.ERROR,
- (String)resources.get("typeRequired")));
+ Form.setFlag(typeListButton,
+ new Form.Flag(MessageType.ERROR, (String) resources.get("typeRequired")));
errorCount++;
} else {
- Form.setFlag(typeListButton, (Form.Flag)null);
+ Form.setFlag(typeListButton, (Form.Flag) null);
}
if (amountTextInput.getCharacterCount() == 0) {
- Form.setFlag(amountTextInput, new Form.Flag(MessageType.ERROR,
- (String)resources.get("amountRequired")));
+ Form.setFlag(amountTextInput,
+ new Form.Flag(MessageType.ERROR, (String) resources.get("amountRequired")));
errorCount++;
} else {
- Form.setFlag(amountTextInput, (Form.Flag)null);
+ Form.setFlag(amountTextInput, (Form.Flag) null);
}
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/Expenses.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/Expenses.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/Expenses.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/Expenses.java Fri Oct 4 23:45:40 2013
@@ -48,8 +48,7 @@ public class Expenses extends Applicatio
URL origin = ApplicationContext.getOrigin();
if (origin == null) {
System.out.println("Warning: Origin null, so for this application to run you have to set the following properties: \n"
- + SECURE_KEY + ", " + HOSTNAME_KEY + ", " + PORT_KEY + "\n"
- );
+ + SECURE_KEY + ", " + HOSTNAME_KEY + ", " + PORT_KEY + "\n");
System.exit(1);
return; // make Eclipse's null checker happy
}
@@ -73,7 +72,7 @@ public class Expenses extends Applicatio
}
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- expensesWindow = (ExpensesWindow)bxmlSerializer.readObject(ExpensesWindow.class,
+ expensesWindow = (ExpensesWindow) bxmlSerializer.readObject(ExpensesWindow.class,
"expenses_window.bxml", true);
expensesWindow.setExpensesApplication(this);
expensesWindow.open(display);
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpensesWindow.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpensesWindow.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpensesWindow.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpensesWindow.java Fri Oct 4 23:45:40 2013
@@ -89,7 +89,6 @@ public class ExpensesWindow extends Wind
}
}
-
private Expenses expensesApplication = null;
private RefreshExpenseListAction refreshExpenseListAction = new RefreshExpenseListAction();
@@ -119,14 +118,14 @@ public class ExpensesWindow extends Wind
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- expenseTableView = (TableView)namespace.get("expenseTableView");
- activityIndicator = (ActivityIndicator)namespace.get("activityIndicator");
- activityIndicatorBoxPane = (BoxPane)namespace.get("activityIndicatorBoxPane");
+ expenseTableView = (TableView) namespace.get("expenseTableView");
+ activityIndicator = (ActivityIndicator) namespace.get("activityIndicator");
+ activityIndicatorBoxPane = (BoxPane) namespace.get("activityIndicatorBoxPane");
// Load the add/edit sheet
try {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- expenseSheet = (ExpenseSheet)bxmlSerializer.readObject(ExpenseSheet.class,
+ expenseSheet = (ExpenseSheet) bxmlSerializer.readObject(ExpenseSheet.class,
"expense_sheet.bxml", true);
} catch (IOException exception) {
throw new RuntimeException(exception);
@@ -135,22 +134,23 @@ public class ExpensesWindow extends Wind
}
// Create the delete confirmation prompt
- ArrayList<String> options = new ArrayList<>((String) resources.get("ok"), (String) resources.get("cancel"));
- deleteConfirmationPrompt = new Prompt(MessageType.QUESTION, (String)resources.get("confirmDelete"),
- options);
+ ArrayList<String> options = new ArrayList<>((String) resources.get("ok"),
+ (String) resources.get("cancel"));
+ deleteConfirmationPrompt = new Prompt(MessageType.QUESTION,
+ (String) resources.get("confirmDelete"), options);
// Attach event listeners
- expenseTableView.getTableViewSelectionListeners().add(new TableViewSelectionListener.Adapter() {
- @Override
- public void selectedRowChanged(TableView tableView, Object previousSelectedRow) {
- int selectedIndex = expenseTableView.getSelectedIndex();
- editSelectedExpenseAction.setEnabled(selectedIndex != -1);
- deleteSelectedExpenseAction.setEnabled(selectedIndex != -1);
- }
- });
+ expenseTableView.getTableViewSelectionListeners().add(
+ new TableViewSelectionListener.Adapter() {
+ @Override
+ public void selectedRowChanged(TableView tableView, Object previousSelectedRow) {
+ int selectedIndex = expenseTableView.getSelectedIndex();
+ editSelectedExpenseAction.setEnabled(selectedIndex != -1);
+ deleteSelectedExpenseAction.setEnabled(selectedIndex != -1);
+ }
+ });
}
-
public Expenses getExpensesApplication() {
return expensesApplication;
}
@@ -159,7 +159,6 @@ public class ExpensesWindow extends Wind
this.expensesApplication = expensesApplication;
}
-
@Override
public void open(Display display, Window owner) {
super.open(display, owner);
@@ -172,8 +171,7 @@ public class ExpensesWindow extends Wind
Expenses expensesApplicationLocal = getExpensesApplication();
GetQuery expenseListQuery = new GetQuery(expensesApplicationLocal.getHostname(),
expensesApplicationLocal.getPort(), "/pivot-tutorials/expenses",
- expensesApplicationLocal.isSecure()
- );
+ expensesApplicationLocal.isSecure());
activityIndicatorBoxPane.setVisible(true);
activityIndicator.setActive(true);
@@ -184,7 +182,7 @@ public class ExpensesWindow extends Wind
activityIndicatorBoxPane.setVisible(false);
activityIndicator.setActive(false);
- List<?> expenseData = (List<?>)task.getResult();
+ List<?> expenseData = (List<?>) task.getResult();
expenseTableView.setTableData(expenseData);
}
@@ -210,10 +208,9 @@ public class ExpensesWindow extends Wind
// POST expense to server and then add to table
Expenses expensesApplicationLocal = getExpensesApplication();
- PostQuery addExpenseQuery = new PostQuery(expensesApplicationLocal.getHostname(),
- expensesApplicationLocal.getPort(), "/pivot-tutorials/expenses",
- expensesApplicationLocal.isSecure()
- );
+ PostQuery addExpenseQuery = new PostQuery(
+ expensesApplicationLocal.getHostname(), expensesApplicationLocal.getPort(),
+ "/pivot-tutorials/expenses", expensesApplicationLocal.isSecure());
addExpenseQuery.setValue(expense);
activityIndicatorBoxPane.setVisible(true);
@@ -231,7 +228,7 @@ public class ExpensesWindow extends Wind
expense.put("id", id);
@SuppressWarnings("unchecked")
- List<Object> expenses = (List<Object>)expenseTableView.getTableData();
+ List<Object> expenses = (List<Object>) expenseTableView.getTableData();
expenses.add(expense);
}
@@ -240,7 +237,8 @@ public class ExpensesWindow extends Wind
activityIndicatorBoxPane.setVisible(false);
activityIndicator.setActive(false);
- Prompt.prompt(MessageType.ERROR, task.getFault().getMessage(), ExpensesWindow.this);
+ Prompt.prompt(MessageType.ERROR, task.getFault().getMessage(),
+ ExpensesWindow.this);
}
}));
}
@@ -263,10 +261,10 @@ public class ExpensesWindow extends Wind
// PUT expense to server and then update table
Expenses expensesApplicationLocal = getExpensesApplication();
- PutQuery updateExpenseQuery = new PutQuery(expensesApplicationLocal.getHostname(),
- expensesApplicationLocal.getPort(), "/pivot-tutorials/expenses/" + JSON.get(expenseLocal, "id"),
- expensesApplicationLocal.isSecure()
- );
+ PutQuery updateExpenseQuery = new PutQuery(
+ expensesApplicationLocal.getHostname(), expensesApplicationLocal.getPort(),
+ "/pivot-tutorials/expenses/" + JSON.get(expenseLocal, "id"),
+ expensesApplicationLocal.isSecure());
updateExpenseQuery.setValue(expenseLocal);
activityIndicatorBoxPane.setVisible(true);
@@ -280,7 +278,7 @@ public class ExpensesWindow extends Wind
// Find matching row and update
@SuppressWarnings("unchecked")
- List<Object> expenses = (List<Object>)expenseTableView.getTableData();
+ List<Object> expenses = (List<Object>) expenseTableView.getTableData();
for (int i = 0, n = expenses.getLength(); i < n; i++) {
if (JSON.get(expenses.get(i), "id").equals(id)) {
expenses.update(i, expenseLocal);
@@ -294,7 +292,8 @@ public class ExpensesWindow extends Wind
activityIndicatorBoxPane.setVisible(false);
activityIndicator.setActive(false);
- Prompt.prompt(MessageType.ERROR, task.getFault().getMessage(), ExpensesWindow.this);
+ Prompt.prompt(MessageType.ERROR, task.getFault().getMessage(),
+ ExpensesWindow.this);
}
}));
}
@@ -309,14 +308,12 @@ public class ExpensesWindow extends Wind
deleteConfirmationPrompt.open(this, new SheetCloseListener() {
@Override
public void sheetClosed(Sheet sheet) {
- if (sheet.getResult()
- && ((Prompt)sheet).getSelectedOptionIndex() == 1) {
+ if (sheet.getResult() && ((Prompt) sheet).getSelectedOptionIndex() == 1) {
// DELETE expense from server and then remove from table
Expenses expensesApplicationLocal = getExpensesApplication();
- DeleteQuery deleteExpenseQuery = new DeleteQuery(expensesApplicationLocal.getHostname(),
- expensesApplicationLocal.getPort(), "/pivot-tutorials/expenses/" + id,
- expensesApplicationLocal.isSecure()
- );
+ DeleteQuery deleteExpenseQuery = new DeleteQuery(
+ expensesApplicationLocal.getHostname(), expensesApplicationLocal.getPort(),
+ "/pivot-tutorials/expenses/" + id, expensesApplicationLocal.isSecure());
activityIndicatorBoxPane.setVisible(true);
activityIndicator.setActive(true);
@@ -329,7 +326,7 @@ public class ExpensesWindow extends Wind
// Find matching row and remove
@SuppressWarnings("unchecked")
- List<Object> expenses = (List<Object>)expenseTableView.getTableData();
+ List<Object> expenses = (List<Object>) expenseTableView.getTableData();
for (int i = 0, n = expenses.getLength(); i < n; i++) {
if (JSON.get(expenses.get(i), "id").equals(id)) {
expenses.remove(i, 1);
@@ -343,7 +340,8 @@ public class ExpensesWindow extends Wind
activityIndicatorBoxPane.setVisible(false);
activityIndicator.setActive(false);
- Prompt.prompt(MessageType.ERROR, task.getFault().getMessage(), ExpensesWindow.this);
+ Prompt.prompt(MessageType.ERROR, task.getFault().getMessage(),
+ ExpensesWindow.this);
}
}));
}
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java Fri Oct 4 23:45:40 2013
@@ -61,8 +61,8 @@ public class ResultItemRenderer extends
public void render(Object item, int index, ListView listView, boolean selected,
boolean checked, boolean highlighted, boolean disabled) {
if (item != null) {
- titleLabel.setText((String)JSON.get(item, "title"));
- phoneLabel.setText((String)JSON.get(item, "Phone"));
+ titleLabel.setText((String) JSON.get(item, "title"));
+ phoneLabel.setText((String) JSON.get(item, "Phone"));
Map<String, ?> location = JSON.get(item, "['y:location']");
if (location == null) {
@@ -75,7 +75,7 @@ public class ResultItemRenderer extends
}
}
- Font font = (Font)listView.getStyles().get("font");
+ Font font = (Font) listView.getStyles().get("font");
titleLabel.getStyles().put("font", font.deriveFont(font.getStyle() | Font.BOLD));
phoneLabel.getStyles().put("font", font);
addressLabel.getStyles().put("font", font);
@@ -84,15 +84,15 @@ public class ResultItemRenderer extends
if (listView.isEnabled() && !disabled) {
if (selected) {
if (listView.isFocused()) {
- color = (Color)listView.getStyles().get("selectionColor");
+ color = (Color) listView.getStyles().get("selectionColor");
} else {
- color = (Color)listView.getStyles().get("inactiveSelectionColor");
+ color = (Color) listView.getStyles().get("inactiveSelectionColor");
}
} else {
- color = (Color)listView.getStyles().get("color");
+ color = (Color) listView.getStyles().get("color");
}
} else {
- color = (Color)listView.getStyles().get("disabledColor");
+ color = (Color) listView.getStyles().get("disabledColor");
}
titleLabel.getStyles().put("color", color);
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/WebQueries.java Fri Oct 4 23:45:40 2013
@@ -43,10 +43,10 @@ public class WebQueries extends Applicat
@Override
public void startup(Display display, Map<String, String> properties) throws Exception {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (Window)bxmlSerializer.readObject(WebQueries.class, "web_queries.bxml");
+ window = (Window) bxmlSerializer.readObject(WebQueries.class, "web_queries.bxml");
- listView = (ListView)bxmlSerializer.getNamespace().get("listView");
- loadingLabel = (Label)bxmlSerializer.getNamespace().get("loadingLabel");
+ listView = (ListView) bxmlSerializer.getNamespace().get("listView");
+ loadingLabel = (Label) bxmlSerializer.getNamespace().get("loadingLabel");
// Execute the query:
// http://pipes.yahoo.com/pipes/pipe.run?_id=43115761f2da5af5341ae2e56a93d646&_render=json
@@ -57,7 +57,7 @@ public class WebQueries extends Applicat
getQuery.execute(new TaskAdapter<>(new TaskListener<Object>() {
@Override
public void taskExecuted(Task<Object> task) {
- List<?> items = (List<?>)JSON.get(task.getResult(), "value.items");
+ List<?> items = (List<?>) JSON.get(task.getResult(), "value.items");
if (items.getLength() > 0) {
listView.setListData(items);
loadingLabel.setVisible(false);
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/Windows.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/Windows.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/Windows.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/windows/Windows.java Fri Oct 4 23:45:40 2013
@@ -43,7 +43,7 @@ public class Windows extends Application
Frame frame;
try {
- frame = (Frame)bxmlSerializer.readObject(Windows.class, "frame.bxml");
+ frame = (Frame) bxmlSerializer.readObject(Windows.class, "frame.bxml");
} catch (SerializationException exception) {
throw new RuntimeException(exception);
} catch (IOException exception) {
@@ -62,17 +62,16 @@ public class Windows extends Application
@Override
public boolean shutdown(boolean optional) {
for (int i = display.getLength() - 1; i >= 0; i--) {
- Window window = (Window)display.get(i);
+ Window window = (Window) display.get(i);
window.close();
}
return false;
}
- public Window load(String fileName)
- throws SerializationException, IOException {
+ public Window load(String fileName) throws SerializationException, IOException {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
- return (Window)bxmlSerializer.readObject(Windows.class, fileName);
+ return (Window) bxmlSerializer.readObject(Windows.class, fileName);
}
public static void main(String[] args) {
Modified: pivot/trunk/web-server/src/org/apache/pivot/web/server/ProxyServlet.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web-server/src/org/apache/pivot/web/server/ProxyServlet.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web-server/src/org/apache/pivot/web/server/ProxyServlet.java (original)
+++ pivot/trunk/web-server/src/org/apache/pivot/web/server/ProxyServlet.java Fri Oct 4 23:45:40 2013
@@ -34,7 +34,6 @@ import javax.servlet.http.HttpServletRes
import org.apache.pivot.collections.HashSet;
-
/**
* HTTP proxy that allows an unsigned applet to issue web queries to services
* outside of its origin server.
@@ -86,8 +85,7 @@ public class ProxyServlet extends HttpSe
}
@Override
- public void init(ServletConfig config)
- throws ServletException {
+ public void init(ServletConfig config) throws ServletException {
super.init();
hostname = config.getInitParameter(HOSTNAME_PARAM);
@@ -129,14 +127,14 @@ public class ProxyServlet extends HttpSe
URL url = null;
try {
url = new URL(request.getScheme(), hostname, port, pathLocal);
- } catch(MalformedURLException exception) {
+ } catch (MalformedURLException exception) {
throw new ServletException("Unable to construct URL.", exception);
}
String method = request.getMethod();
// Open a connection to the URL
- HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(method);
connection.setAllowUserInteraction(false);
connection.setInstanceFollowRedirects(false);
@@ -182,7 +180,7 @@ public class ProxyServlet extends HttpSe
outputStream = connection.getOutputStream();
outputStream = new BufferedOutputStream(outputStream, BUFFER_SIZE);
for (int data = inputStream.read(); data != -1; data = inputStream.read()) {
- outputStream.write((byte)data);
+ outputStream.write((byte) data);
}
} finally {
if (outputStream != null) {
@@ -195,8 +193,7 @@ public class ProxyServlet extends HttpSe
int status = connection.getResponseCode();
int statusPrefix = status / 100;
- if (statusPrefix == 1
- || statusPrefix == 3) {
+ if (statusPrefix == 1 || statusPrefix == 3) {
throw new ServletException("Unexpected server response: " + status);
}
@@ -205,9 +202,7 @@ public class ProxyServlet extends HttpSe
// Write response headers
// NOTE Header indexes start at 1, not 0
int i = 1;
- for (String key = connection.getHeaderFieldKey(i);
- key != null;
- key = connection.getHeaderFieldKey(++i)) {
+ for (String key = connection.getHeaderFieldKey(i); key != null; key = connection.getHeaderFieldKey(++i)) {
if (!ignoreResponseHeaders.contains(key)) {
String value = connection.getHeaderField(i);
@@ -227,7 +222,7 @@ public class ProxyServlet extends HttpSe
try {
// Response returned on input stream
inputStream = connection.getInputStream();
- } catch(Exception exception) {
+ } catch (Exception exception) {
// Response returned on error stream
inputStream = connection.getErrorStream();
}
@@ -237,7 +232,7 @@ public class ProxyServlet extends HttpSe
OutputStream outputStream = response.getOutputStream();
for (int data = inputStream.read(); data != -1; data = inputStream.read()) {
- outputStream.write((byte)data);
+ outputStream.write((byte) data);
}
}
Modified: pivot/trunk/web-server/src/org/apache/pivot/web/server/QueryServlet.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web-server/src/org/apache/pivot/web/server/QueryServlet.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web-server/src/org/apache/pivot/web/server/QueryServlet.java (original)
+++ pivot/trunk/web-server/src/org/apache/pivot/web/server/QueryServlet.java Fri Oct 4 23:45:40 2013
@@ -46,9 +46,9 @@ import org.apache.pivot.web.QueryExcepti
*/
public abstract class QueryServlet extends HttpServlet {
/**
- * Immutable string sequence representing a query path. The path is constructed
- * by splitting the path info provided by the base servlet on the path separator
- * character ("/").
+ * Immutable string sequence representing a query path. The path is
+ * constructed by splitting the path info provided by the base servlet on
+ * the path separator character ("/").
*/
public static class Path implements Sequence<String>, Iterable<String> {
private ArrayList<String> elements;
@@ -190,8 +190,8 @@ public abstract class QueryServlet exten
public URL getLocation() {
URL location;
try {
- location = new URL(isSecure() ? HTTPS_PROTOCOL : HTTP_PROTOCOL, getHostname(), getPort(),
- getContextPath() + getServletPath() + "/");
+ location = new URL(isSecure() ? HTTPS_PROTOCOL : HTTP_PROTOCOL, getHostname(),
+ getPort(), getContextPath() + getServletPath() + "/");
} catch (MalformedURLException exception) {
throw new RuntimeException(exception);
}
@@ -200,8 +200,8 @@ public abstract class QueryServlet exten
}
/**
- * Returns the servlet's parameter dictionary, which holds the values
- * passed in the HTTP request query string.
+ * Returns the servlet's parameter dictionary, which holds the values passed
+ * in the HTTP request query string.
*/
public QueryDictionary getParameters() {
return parameters.get();
@@ -224,11 +224,10 @@ public abstract class QueryServlet exten
}
/**
- * Prepares a servlet for request execution. This method is called immediately
- * prior to the {@link #validate(Query.Method, Path)} method.
- * <p>
- * The default implementation is a no-op.
- *
+ * Prepares a servlet for request execution. This method is called
+ * immediately prior to the {@link #validate(Query.Method, Path)} method.
+ * <p> The default implementation is a no-op.
+ *
* @throws ServletException
*/
protected void prepare() throws ServletException {
@@ -237,10 +236,9 @@ public abstract class QueryServlet exten
/**
* Disposes any resources allocated in {@link #prepare()}. This method is
- * guaranteed to be called even if the HTTP handler method throws.
- * <p>
- * The default implementation is a no-op.
- *
+ * guaranteed to be called even if the HTTP handler method throws. <p> The
+ * default implementation is a no-op.
+ *
* @throws ServletException
*/
protected void dispose() throws ServletException {
@@ -248,14 +246,12 @@ public abstract class QueryServlet exten
}
/**
- * Validates a servlet for request execution. This method is called immediately
- * prior to the HTTP handler method.
- * <p>
- * The default implementation is a no-op.
- *
+ * Validates a servlet for request execution. This method is called
+ * immediately prior to the HTTP handler method. <p> The default
+ * implementation is a no-op.
+ *
* @param method
* @param path
- *
* @throws QueryException
*/
protected void validate(Query.Method method, Path path) throws QueryException {
@@ -265,12 +261,9 @@ public abstract class QueryServlet exten
/**
* Handles an HTTP GET request. The default implementation throws an HTTP
* 405 query exception.
- *
+ *
* @param path
- *
- * @return
- * The result of the GET.
- *
+ * @return The result of the GET.
* @throws QueryException
*/
protected Object doGet(Path path) throws QueryException {
@@ -280,14 +273,11 @@ public abstract class QueryServlet exten
/**
* Handles an HTTP POST request. The default implementation throws an HTTP
* 405 query exception.
- *
+ *
* @param path
* @param value
- *
- * @return
- * A URL containing the location of the created resource, or <tt>null</tt> if
- * operation did not result in the creation of a resource.
- *
+ * @return A URL containing the location of the created resource, or
+ * <tt>null</tt> if operation did not result in the creation of a resource.
* @throws QueryException
*/
protected URL doPost(Path path, Object value) throws QueryException {
@@ -297,14 +287,11 @@ public abstract class QueryServlet exten
/**
* Handles an HTTP GET request. The default implementation throws an HTTP
* 405 query exception.
- *
+ *
* @param path
* @param value
- *
- * @return
- * <tt>true</tt> if the operation resulted in the creation of a resource;
- * <tt>false</tt>, otherwise.
- *
+ * @return <tt>true</tt> if the operation resulted in the creation of a
+ * resource; <tt>false</tt>, otherwise.
* @throws QueryException
*/
protected boolean doPut(Path path, Object value) throws QueryException {
@@ -314,9 +301,8 @@ public abstract class QueryServlet exten
/**
* Handles an HTTP GET request. The default implementation throws an HTTP
* 405 query exception.
- *
+ *
* @param path
- *
* @throws QueryException
*/
protected void doDelete(Path path) throws QueryException {
@@ -324,11 +310,11 @@ public abstract class QueryServlet exten
}
/**
- * Creates a serializer that will be used to serialize the current request data.
- *
+ * Creates a serializer that will be used to serialize the current request
+ * data.
+ *
* @param method
* @param path
- *
* @throws QueryException
*/
protected abstract Serializer<?> createSerializer(Query.Method method, Path path)
@@ -419,14 +405,13 @@ public abstract class QueryServlet exten
try {
validate(Query.Method.GET, path);
result = doGet(path);
- serializer = (Serializer<Object>)createSerializer(Query.Method.GET, path);
+ serializer = (Serializer<Object>) createSerializer(Query.Method.GET, path);
} catch (QueryException exception) {
response.setStatus(exception.getStatus());
response.flushBuffer();
}
- if (!response.isCommitted()
- && serializer != null) {
+ if (!response.isCommitted() && serializer != null) {
response.setStatus(Query.Status.OK);
setResponseHeaders(response);
@@ -587,11 +572,10 @@ public abstract class QueryServlet exten
private static Path getPath(HttpServletRequest request) {
String pathInfo = request.getPathInfo();
Path path;
- if (pathInfo == null
- || pathInfo.length() == 0) {
+ if (pathInfo == null || pathInfo.length() == 0) {
path = new Path();
} else {
- path = new Path(pathInfo.substring(1).split("/"));
+ path = new Path(pathInfo.substring(1).split("/"));
}
return path;
Modified: pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/BasicAuthentication.java Fri Oct 4 23:45:40 2013
@@ -19,9 +19,8 @@ package org.apache.pivot.web;
import org.apache.pivot.util.Base64;
/**
- * Implementation of the {@link Authentication} interface supporting the
- * HTTP <a href="http://tools.ietf.org/rfc/rfc2617.txt">Basic
- * Authentication</a> scheme.
+ * Implementation of the {@link Authentication} interface supporting the HTTP <a
+ * href="http://tools.ietf.org/rfc/rfc2617.txt">Basic Authentication</a> scheme.
*/
public class BasicAuthentication implements Authentication {
private String username;
Modified: pivot/trunk/web/src/org/apache/pivot/web/GetQuery.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/GetQuery.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/GetQuery.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/GetQuery.java Fri Oct 4 23:45:40 2013
@@ -44,9 +44,9 @@ public class GetQuery extends Query<Obje
/**
* Synchronously executes the GET operation.
- *
- * @return
- * The result of the operation, deserialized using the query's serializer.
+ *
+ * @return The result of the operation, deserialized using the query's
+ * serializer.
*/
@Override
public Object execute() throws QueryException {
Modified: pivot/trunk/web/src/org/apache/pivot/web/PostQuery.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/PostQuery.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/PostQuery.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/PostQuery.java Fri Oct 4 23:45:40 2013
@@ -57,9 +57,8 @@ public class PostQuery extends Query<URL
/**
* Sets the value that will be POSTed to the server when the query is
* executed.
- *
- * @param value
- * The value to POST to the server.
+ *
+ * @param value The value to POST to the server.
*/
public void setValue(Object value) {
this.value = value;
@@ -67,11 +66,10 @@ public class PostQuery extends Query<URL
/**
* Synchronously executes the POST operation.
- *
- * @return
- * A URL that uniquely identifies the location of the resource created
- * on the server by the operation, or <tt>null</tt> if the server did
- * not return a location.
+ *
+ * @return A URL that uniquely identifies the location of the resource
+ * created on the server by the operation, or <tt>null</tt> if the server
+ * did not return a location.
*/
@Override
public URL execute() throws QueryException {
@@ -84,7 +82,7 @@ public class PostQuery extends Query<URL
if (location != null) {
try {
valueLocation = new URL(getLocation(), location);
- } catch(MalformedURLException exception) {
+ } catch (MalformedURLException exception) {
throw new RuntimeException(exception);
}
}
Modified: pivot/trunk/web/src/org/apache/pivot/web/PutQuery.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/PutQuery.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/PutQuery.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/PutQuery.java Fri Oct 4 23:45:40 2013
@@ -53,11 +53,9 @@ public class PutQuery extends Query<Bool
}
/**
- * Sets the value that will be PUT to the server when the query is
- * executed.
- *
- * @param value
- * The value to PUT to the server.
+ * Sets the value that will be PUT to the server when the query is executed.
+ *
+ * @param value The value to PUT to the server.
*/
public void setValue(Object value) {
this.value = value;
@@ -65,10 +63,9 @@ public class PutQuery extends Query<Bool
/**
* Synchronously executes the PUT operation.
- *
- * @return
- * <tt>true</tt> if the operation resulted in the creation of a server
- * resource; <tt>false</tt>, otherwise.
+ *
+ * @return <tt>true</tt> if the operation resulted in the creation of a
+ * server resource; <tt>false</tt>, otherwise.
*/
@Override
public Boolean execute() throws QueryException {
Modified: pivot/trunk/web/src/org/apache/pivot/web/Query.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/Query.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/Query.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/Query.java Fri Oct 4 23:45:40 2013
@@ -38,29 +38,19 @@ import org.apache.pivot.util.ListenerLis
/**
* Abstract base class for web queries. A web query is an asynchronous operation
- * that executes one of the following HTTP methods:
- *
- * <ul>
- * <li>GET</li>
- * <li>POST</li>
- * <li>PUT</li>
- * <li>DELETE</li>
- * </ul>
- *
- * @param <V>
- * The type of the value retrieved or sent via the query. For GET operations,
- * it is {@link Object}; for POST operations, the type is {@link URL}. For PUT
- * and DELETE, it is {@link Void}.
+ * that executes one of the following HTTP methods: <ul> <li>GET</li>
+ * <li>POST</li> <li>PUT</li> <li>DELETE</li> </ul>
+ *
+ * @param <V> The type of the value retrieved or sent via the query. For GET
+ * operations, it is {@link Object}; for POST operations, the type is
+ * {@link URL}. For PUT and DELETE, it is {@link Void}.
*/
public abstract class Query<V> extends IOTask<V> {
/**
* Supported HTTP methods.
*/
public enum Method {
- GET,
- POST,
- PUT,
- DELETE;
+ GET, POST, PUT, DELETE;
}
/**
@@ -93,8 +83,8 @@ public abstract class Query<V> extends I
/**
* Query listener list.
*/
- private static class QueryListenerList<V> extends ListenerList<QueryListener<V>>
- implements QueryListener<V> {
+ private static class QueryListenerList<V> extends ListenerList<QueryListener<V>> implements
+ QueryListener<V> {
@Override
public synchronized void add(QueryListener<V> listener) {
super.add(listener);
@@ -157,7 +147,8 @@ public abstract class Query<V> extends I
static {
try {
- // See http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html
+ // See
+ // http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html
// For more info on this system property
System.setProperty("java.net.useSystemProxies", "true");
} catch (SecurityException exception) {
@@ -167,7 +158,7 @@ public abstract class Query<V> extends I
/**
* Creates a new web query.
- *
+ *
* @param hostname
* @param port
* @param path
@@ -178,8 +169,7 @@ public abstract class Query<V> extends I
super(executorService);
try {
- locationContext = new URL(secure ? HTTPS_PROTOCOL : HTTP_PROTOCOL,
- hostname, port, path);
+ locationContext = new URL(secure ? HTTPS_PROTOCOL : HTTP_PROTOCOL, hostname, port, path);
} catch (MalformedURLException exception) {
throw new IllegalArgumentException("Unable to construct context URL.", exception);
}
@@ -214,10 +204,9 @@ public abstract class Query<V> extends I
/**
* Gets the proxy associated with this query.
- *
- * @return
- * This query's proxy, or <tt>null</tt> if the query is using the default
- * JVM proxy settings
+ *
+ * @return This query's proxy, or <tt>null</tt> if the query is using the
+ * default JVM proxy settings
*/
public Proxy getProxy() {
return proxy;
@@ -225,10 +214,9 @@ public abstract class Query<V> extends I
/**
* Sets the proxy associated with this query.
- *
- * @param proxy
- * This query's proxy, or <tt>null</tt> to use the default JVM proxy
- * settings
+ *
+ * @param proxy This query's proxy, or <tt>null</tt> to use the default JVM
+ * proxy settings
*/
public void setProxy(Proxy proxy) {
this.proxy = proxy;
@@ -244,12 +232,10 @@ public abstract class Query<V> extends I
queryStringBuilder.append("&");
}
- queryStringBuilder.append(URLEncoder.encode(key, URL_ENCODING)
- + "=" + URLEncoder.encode(parameters.get(key, index),
- URL_ENCODING));
+ queryStringBuilder.append(URLEncoder.encode(key, URL_ENCODING) + "="
+ + URLEncoder.encode(parameters.get(key, index), URL_ENCODING));
} catch (UnsupportedEncodingException exception) {
- throw new IllegalStateException("Unable to construct query string.",
- exception);
+ throw new IllegalStateException("Unable to construct query string.", exception);
}
}
}
@@ -277,16 +263,16 @@ public abstract class Query<V> extends I
}
/**
- * Returns the web query's request header dictionary. Request headers
- * are passed via HTTP headers when the query is executed.
+ * Returns the web query's request header dictionary. Request headers are
+ * passed via HTTP headers when the query is executed.
*/
public QueryDictionary getRequestHeaders() {
return requestHeaders;
}
/**
- * Returns the web query's response header dictionary. Response headers
- * are returned via HTTP headers when the query is executed.
+ * Returns the web query's response header dictionary. Response headers are
+ * returned via HTTP headers when the query is executed.
*/
public QueryDictionary getResponseHeaders() {
return responseHeaders;
@@ -294,7 +280,7 @@ public abstract class Query<V> extends I
/**
* Returns the status of the most recent execution.
- *
+ *
* @return An HTTP code representing the most recent execution status.
*/
public int getStatus() {
@@ -312,9 +298,8 @@ public abstract class Query<V> extends I
/**
* Sets the serializer used to stream the value passed to or from the web
* query.
- *
- * @param serializer
- * The serializer (must be non-null).
+ *
+ * @param serializer The serializer (must be non-null).
*/
public void setSerializer(Serializer<?> serializer) {
if (serializer == null) {
@@ -327,9 +312,8 @@ public abstract class Query<V> extends I
/**
* Gets the number of bytes that have been sent in the body of this query's
* HTTP request. This will only be non-zero for POST and PUT requests, as
- * GET and DELETE requests send no content to the server.
- * <p>
- * For POST and PUT requests, this number will increment in between the
+ * GET and DELETE requests send no content to the server. <p> For POST and
+ * PUT requests, this number will increment in between the
* {@link QueryListener#connected(Query) connected} and
* {@link QueryListener#requestSent(Query) requestSent} phases of the
* <tt>QueryListener</tt> lifecycle methods. Interested listeners can poll
@@ -343,10 +327,8 @@ public abstract class Query<V> extends I
* Gets the number of bytes that have been received from the server in the
* body of the server's HTTP response. This will generally only be non-zero
* for GET requests, as POST, PUT, and DELETE requests generally don't
- * solicit response content from the server.
- * <p>
- * This number will increment in between the
- * {@link QueryListener#requestSent(Query) requestSent} and
+ * solicit response content from the server. <p> This number will increment
+ * in between the {@link QueryListener#requestSent(Query) requestSent} and
* {@link QueryListener#responseReceived(Query) responseReceived} phases of
* the <tt>QueryListener</tt> lifecycle methods. Interested listeners can
* poll for this value during that phase.
@@ -360,9 +342,8 @@ public abstract class Query<V> extends I
* in the body of the server's HTTP response. This value reflects the
* <tt>Content-Length</tt> HTTP response header and is thus merely an
* expectation. The actual total number of bytes that will be received is
- * not known for certain until the full response has been received.
- * <p>
- * If the server did not specify a <tt>Content-Length</tt> HTTP response
+ * not known for certain until the full response has been received. <p> If
+ * the server did not specify a <tt>Content-Length</tt> HTTP response
* header, a value of <tt>-1</tt> will be returned to indicate that this
* value is unknown.
*/
@@ -376,7 +357,7 @@ public abstract class Query<V> extends I
URL location = getLocation();
HttpURLConnection connection = null;
- Serializer<Object> serializerLocal = (Serializer<Object>)this.serializer;
+ Serializer<Object> serializerLocal = (Serializer<Object>) this.serializer;
bytesSent = 0;
bytesReceived = 0;
@@ -401,8 +382,7 @@ public abstract class Query<V> extends I
connection.setInstanceFollowRedirects(false);
connection.setUseCaches(false);
- if (connection instanceof HttpsURLConnection
- && hostnameVerifier != null) {
+ if (connection instanceof HttpsURLConnection && hostnameVerifier != null) {
HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;
httpsConnection.setHostnameVerifier(hostnameVerifier);
}
@@ -455,8 +435,7 @@ public abstract class Query<V> extends I
// NOTE Header indexes start at 1, not 0
int i = 1;
- for (String key = connection.getHeaderFieldKey(i); key != null;
- key = connection.getHeaderFieldKey(++i)) {
+ for (String key = connection.getHeaderFieldKey(i); key != null; key = connection.getHeaderFieldKey(++i)) {
responseHeaders.add(key, connection.getHeaderField(i));
}
@@ -467,8 +446,7 @@ public abstract class Query<V> extends I
}
// Read the response body
- if (method == Method.GET
- && status == Query.Status.OK) {
+ if (method == Method.GET && status == Query.Status.OK) {
InputStream inputStream = null;
try {
inputStream = connection.getInputStream();
Modified: pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java Fri Oct 4 23:45:40 2013
@@ -22,7 +22,6 @@ import org.apache.pivot.collections.Arra
import org.apache.pivot.collections.Dictionary;
import org.apache.pivot.collections.HashMap;
-
/**
* Represents a collection of keyed data associated with a query. Allows
* multiple values to be set against a given key.
@@ -157,7 +156,6 @@ public final class QueryDictionary imple
return map.containsKey(searchKey);
}
-
public int getLength(final String key) {
String searchKey = key;
if (!caseSensitiveKeys) {
Modified: pivot/trunk/web/src/org/apache/pivot/web/QueryException.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/QueryException.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/QueryException.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/QueryException.java Fri Oct 4 23:45:40 2013
@@ -42,9 +42,8 @@ public class QueryException extends Task
/**
* Returns the HTTP status code corresponding to the exception.
- *
- * @return
- * An HTTP status code reflecting the nature of the exception, or
+ *
+ * @return An HTTP status code reflecting the nature of the exception, or
* <tt>0</tt> if the HTTP status is not known.
*/
public int getStatus() {