You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/09/09 21:53:00 UTC
svn commit: r995558 - in /pivot/trunk: core/src/org/apache/pivot/json/
core/test/org/apache/pivot/json/test/
demos/src/org/apache/pivot/demos/styles/ tests/src/org/apache/pivot/tests/
tutorials/src/org/apache/pivot/tutorials/ tutorials/src/org/apache/p...
Author: gbrown
Date: Thu Sep 9 19:53:00 2010
New Revision: 995558
URL: http://svn.apache.org/viewvc?rev=995558&view=rev
Log:
Add a source argument to Action#perform().
Modified:
pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
pivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java
pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java
pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml
pivot/trunk/tests/src/org/apache/pivot/tests/ActionMappingTest.java
pivot/trunk/tests/src/org/apache/pivot/tests/SpinnerFocusTest.java
pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/ContextMenus.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuBars.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/MenuButtons.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockTrackerWindow.java
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ExpensesWindow.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Thu Sep 9 19:53:00 2010
@@ -1104,110 +1104,46 @@ public class JSONSerializer implements S
}
/**
- * Converts a object to a JSON string representation.
+ * Converts a object to a JSON string representation. The map keys will always
+ * be quote-delimited.
*
* @param value
* The object to convert.
*
* @return
* The resulting JSON string.
+ *
+ * @see #toString(Object, boolean)
*/
public static String toString(Object value) throws SerializationException {
- JSONSerializer jsonSerializer = new JSONSerializer();
- StringWriter writer = new StringWriter();
-
- try {
- jsonSerializer.writeObject(value, writer);
- } catch(IOException exception) {
- throw new RuntimeException(exception);
- }
-
- return writer.toString();
+ return toString(value, false);
}
/**
- * Converts a string to a JSON string representation.
+ * Converts a object to a JSON string representation.
*
* @param value
* The object to convert.
*
- * @return
- * The resulting JSON string.
- */
- public static String toString(String value) {
- try {
- return toString((Object)value);
- } catch(SerializationException exception) {
- throw new RuntimeException(exception);
- }
- }
-
- /**
- * Converts a number to a JSON string representation.
- *
- * @param value
- * The object to convert.
+ * @param alwaysDelimitMapKeys
+ * A flag indicating whether or not map keys will always be quote-delimited.
*
* @return
* The resulting JSON string.
*/
- public static String toString(Number value) {
- try {
- return toString((Object)value);
- } catch(SerializationException exception) {
- throw new RuntimeException(exception);
- }
- }
+ public static String toString(Object value, boolean alwaysDelimitMapKeys) throws SerializationException {
+ JSONSerializer jsonSerializer = new JSONSerializer();
+ jsonSerializer.setAlwaysDelimitMapKeys(alwaysDelimitMapKeys);
- /**
- * Converts a boolean to a JSON string representation.
- *
- * @param value
- * The object to convert.
- *
- * @return
- * The resulting JSON string.
- */
- public static String toString(Boolean value) {
- try {
- return toString((Object)value);
- } catch(SerializationException exception) {
- throw new RuntimeException(exception);
- }
- }
+ StringWriter writer = new StringWriter();
- /**
- * Converts a list to a JSON string representation.
- *
- * @param value
- * The object to convert.
- *
- * @return
- * The resulting JSON string.
- */
- public static String toString(List<?> value) {
try {
- return toString((Object)value);
- } catch(SerializationException exception) {
+ jsonSerializer.writeObject(value, writer);
+ } catch(IOException exception) {
throw new RuntimeException(exception);
}
- }
- /**
- * Converts a map to a JSON string representation.
- *
- * @param value
- * The object to convert.
- *
- * @return
- * The resulting JSON string.
- */
- public static String toString(Map<String, ?> value) {
- try {
- return toString((Object)value);
- } catch(SerializationException exception) {
- throw new RuntimeException(exception);
- }
+ return writer.toString();
}
public ListenerList<JSONSerializerListener> getJSONSerializerListeners() {
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=995558&r1=995557&r2=995558&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 Thu Sep 9 19:53:00 2010
@@ -46,12 +46,16 @@ public class JSONSerializerTest {
@Test(expected=RuntimeException.class)
public void testInvalidNumbers() {
- JSONSerializer.toString(Float.NaN);
- JSONSerializer.toString(Float.NEGATIVE_INFINITY);
- JSONSerializer.toString(Float.POSITIVE_INFINITY);
- JSONSerializer.toString(Double.NaN);
- JSONSerializer.toString(Double.NEGATIVE_INFINITY);
- JSONSerializer.toString(Double.POSITIVE_INFINITY);
+ try {
+ JSONSerializer.toString(Float.NaN);
+ JSONSerializer.toString(Float.NEGATIVE_INFINITY);
+ JSONSerializer.toString(Float.POSITIVE_INFINITY);
+ JSONSerializer.toString(Double.NaN);
+ JSONSerializer.toString(Double.NEGATIVE_INFINITY);
+ JSONSerializer.toString(Double.POSITIVE_INFINITY);
+ } catch (SerializationException exception) {
+ // No-op
+ }
}
@Test
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/styles/ColorSchemeBuilderWindow.java Thu Sep 9 19:53:00 2010
@@ -39,6 +39,7 @@ import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.HorizontalAlignment;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.LocalManifest;
+import org.apache.pivot.wtk.Prompt;
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.Spinner;
import org.apache.pivot.wtk.SpinnerSelectionListener;
@@ -229,7 +230,12 @@ public class ColorSchemeBuilderWindow ex
}
LocalManifest clipboardContent = new LocalManifest();
- clipboardContent.putText(JSONSerializer.toString(colors));
+
+ try {
+ clipboardContent.putText(JSONSerializer.toString(colors));
+ } catch (SerializationException exception) {
+ Prompt.prompt(exception.getMessage(), this);
+ }
Clipboard.setContent(clipboardContent);
}
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml Thu Sep 9 19:53:00 2010
@@ -151,6 +151,11 @@ limitations under the License.
ButtonPressListener.buttonPressed="org.apache.pivot.wtk.Prompt.prompt('This is a prompt.',
arguments[0].window);"/>
</BoxPane>
+
+ <Border>
+ <TextArea preferredWidth="200"
+ text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."/>
+ </Border>
</BoxPane>
</TablePane.Row>
</TablePane>
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/ActionMappingTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/ActionMappingTest.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/ActionMappingTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/ActionMappingTest.java Thu Sep 9 19:53:00 2010
@@ -21,6 +21,7 @@ import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Action;
import org.apache.pivot.wtk.Alert;
import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Keyboard;
@@ -34,14 +35,14 @@ public class ActionMappingTest implement
public void startup(Display display, Map<String, String> properties) throws Exception {
Action.getNamedActions().put("action1", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
Alert.alert(MessageType.INFO, "Action 1 performed.", window);
}
});
Action.getNamedActions().put("action2", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
Alert.alert(MessageType.INFO, "Action 2 performed.", window);
}
});
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/SpinnerFocusTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/SpinnerFocusTest.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/SpinnerFocusTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/SpinnerFocusTest.java Thu Sep 9 19:53:00 2010
@@ -40,7 +40,7 @@ public class SpinnerFocusTest implements
}
@Override
- public void perform() {
+ public void perform(Component source) {
Alert.alert("Foo", frame);
}
};
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/text_area_test.bxml Thu Sep 9 19:53:00 2010
@@ -28,7 +28,7 @@ limitations under the License.
<BoxPane orientation="vertical" styles="{padding:8}">
<Border>
- <TextArea2 bxml:id="textArea" text="abc
def
g" preferredWidth="320"
+ <TextArea2 bxml:id="textArea" text="abcdef
ghij
klmno
p" preferredWidth="320"
styles="{margin:8, backgroundColor:'#eeeeee', wrapText:true, horizontalAlignment:'left'}">
<textAreaContentListeners>
function textChanged(textArea) {
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/KitchenSink.java Thu Sep 9 19:53:00 2010
@@ -302,7 +302,7 @@ public class KitchenSink implements Appl
}
@Override
- public void perform() {
+ public void perform(Component source) {
Button selectedItem = imageMenuGroup.getSelection();
String imageName = (String)selectedItem.getUserData().get("image");
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java Thu Sep 9 19:53:00 2010
@@ -92,7 +92,7 @@ public class TablePanes extends Window i
namedActions.put("configureCell", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
Sheet sheet;
@@ -117,7 +117,7 @@ public class TablePanes extends Window i
namedActions.put("configureRow", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
Sheet sheet;
@@ -141,7 +141,7 @@ public class TablePanes extends Window i
namedActions.put("insertRow", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
Sheet sheet;
@@ -176,7 +176,7 @@ public class TablePanes extends Window i
namedActions.put("removeRow", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
ArrayList<String> options = new ArrayList<String>("OK", "Cancel");
String message = "Remove Row?";
Label body = new Label("Are you sure you want to remove the row?");
@@ -199,7 +199,7 @@ public class TablePanes extends Window i
namedActions.put("configureColumn", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
Sheet sheet;
@@ -223,7 +223,7 @@ public class TablePanes extends Window i
namedActions.put("insertColumn", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
Sheet sheet;
@@ -259,7 +259,7 @@ public class TablePanes extends Window i
namedActions.put("removeColumn", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
ArrayList<String> options = new ArrayList<String>("OK", "Cancel");
String message = "Remove Column?";
Label body = new Label("Are you sure you want to remove the column?");
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/ContextMenus.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/ContextMenus.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/ContextMenus.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/menus/ContextMenus.java Thu Sep 9 19:53:00 2010
@@ -40,7 +40,7 @@ public class ContextMenus extends Window
Menu.Item whatIsThisMenuItem = new Menu.Item("What is this?");
whatIsThisMenuItem.setAction(new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
String description = (String)descendant.getUserData().get("description");
String message = "This is a " + description + ".";
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=995558&r1=995557&r2=995558&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 Thu Sep 9 19:53:00 2010
@@ -92,7 +92,7 @@ public class MenuBars extends Frame impl
public MenuBars() {
Action.getNamedActions().put("fileNew", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
BXMLSerializer bxmlSerializer = new BXMLSerializer();
bxmlSerializer.getNamespace().put("menuHandler", menuHandler);
@@ -113,14 +113,14 @@ public class MenuBars extends Frame impl
Action.getNamedActions().put("fileOpen", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
fileBrowserSheet.open(MenuBars.this);
}
});
Action.getNamedActions().put("cut", new Action(false) {
@Override
- public void perform() {
+ public void perform(Component source) {
TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
textInput.cut();
}
@@ -128,7 +128,7 @@ public class MenuBars extends Frame impl
Action.getNamedActions().put("copy", new Action(false) {
@Override
- public void perform() {
+ public void perform(Component source) {
TextInput textInput = (TextInput)MenuBars.this.getFocusDescendant();
textInput.copy();
}
@@ -136,7 +136,7 @@ public class MenuBars extends Frame impl
Action.getNamedActions().put("paste", new Action(false) {
@Override
- public void perform() {
+ public void perform(Component source) {
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=995558&r1=995557&r2=995558&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 Thu Sep 9 19:53:00 2010
@@ -25,6 +25,7 @@ import org.apache.pivot.collections.Map;
import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.Action;
import org.apache.pivot.wtk.Bounds;
+import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.ListButton;
import org.apache.pivot.wtk.Point;
import org.apache.pivot.wtk.Window;
@@ -43,7 +44,7 @@ public class MenuButtons extends Window
public MenuButtons() {
Action.getNamedActions().put("newCircle", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
Ellipse ellipse = new Ellipse();
ellipse.setSize(50, 50);
@@ -57,7 +58,7 @@ public class MenuButtons extends Window
Action.getNamedActions().put("newSquare", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
Rectangle rectangle = new Rectangle();
rectangle.setSize(50, 50);
@@ -71,7 +72,7 @@ public class MenuButtons extends Window
Action.getNamedActions().put("newText", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
Text text = new Text();
text.setText("ABC");
text.setFont("Arial BOLD 24");
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=995558&r1=995557&r2=995558&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 Thu Sep 9 19:53:00 2010
@@ -80,7 +80,7 @@ public class StockTrackerWindow extends
private Action addSymbolAction = new Action(false) {
@Override
@SuppressWarnings("unchecked")
- public void perform() {
+ public void perform(Component source) {
String symbol = symbolTextInput.getText().toUpperCase();
if (symbols.indexOf(symbol) == -1) {
symbols.add(symbol);
@@ -101,7 +101,7 @@ public class StockTrackerWindow extends
// Action invoke to remove selected symbols
private Action removeSymbolsAction = new Action(false) {
@Override
- public void perform() {
+ public void perform(Component source) {
int selectedIndex = stocksTableView.getFirstSelectedIndex();
int selectionLength = stocksTableView.getLastSelectedIndex() - selectedIndex + 1;
stocksTableView.getTableData().remove(selectedIndex, selectionLength);
@@ -123,7 +123,7 @@ public class StockTrackerWindow extends
// Action invoked to refresh the symbol table view
private Action refreshTableAction = new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
refreshTable();
}
};
@@ -198,7 +198,7 @@ public class StockTrackerWindow extends
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
if (keyCode == Keyboard.KeyCode.DELETE
|| keyCode == Keyboard.KeyCode.BACKSPACE) {
- removeSymbolsAction.perform();
+ removeSymbolsAction.perform(component);
} else if (keyCode == Keyboard.KeyCode.A
&& Keyboard.isPressed(Platform.getCommandModifier())) {
stocksTableView.selectAll();
@@ -221,7 +221,7 @@ public class StockTrackerWindow extends
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
if (keyCode == Keyboard.KeyCode.ENTER) {
if (addSymbolAction.isEnabled()) {
- addSymbolAction.perform();
+ addSymbolAction.perform(component);
}
}
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=995558&r1=995557&r2=995558&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 Thu Sep 9 19:53:00 2010
@@ -37,6 +37,7 @@ import org.apache.pivot.web.PutQuery;
import org.apache.pivot.wtk.Action;
import org.apache.pivot.wtk.ActivityIndicator;
import org.apache.pivot.wtk.BoxPane;
+import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.MessageType;
import org.apache.pivot.wtk.Prompt;
@@ -53,14 +54,14 @@ import org.apache.pivot.wtk.Window;
public class ExpensesWindow extends Window implements Bindable {
private class RefreshExpenseListAction extends Action {
@Override
- public void perform() {
+ public void perform(Component source) {
refreshExpenseList();
}
}
private class AddExpenseAction extends Action {
@Override
- public void perform() {
+ public void perform(Component source) {
addExpense();
}
}
@@ -71,7 +72,7 @@ public class ExpensesWindow extends Wind
}
@Override
- public void perform() {
+ public void perform(Component source) {
updateSelectedExpense();
}
}
@@ -82,7 +83,7 @@ public class ExpensesWindow extends Wind
}
@Override
- public void perform() {
+ public void perform(Component source) {
deleteSelectedExpense();
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Action.java Thu Sep 9 19:53:00 2010
@@ -147,7 +147,7 @@ public abstract class Action {
/**
* Performs the action.
*/
- public abstract void perform();
+ public abstract void perform(Component source);
public boolean isEnabled() {
return enabled;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java Thu Sep 9 19:53:00 2010
@@ -412,7 +412,7 @@ public abstract class Button extends Com
buttonPressListeners.buttonPressed(this);
if (action != null) {
- action.perform();
+ action.perform(this);
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java?rev=995558&r1=995557&r2=995558&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java Thu Sep 9 19:53:00 2010
@@ -1132,7 +1132,7 @@ public class Window extends Container {
Action action = actionMap.get(keyStroke);
if (action != null
&& action.isEnabled()) {
- action.perform();
+ action.perform(this);
}
return consumed;