Permalink
Browse files

Resolve PIVOT-632.

git-svn-id: https://svn.apache.org/repos/asf/pivot/branches/1.5.x@996004 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 8d3ed0c commit 28dbff9207463ffad15025e25f3ebd5d63b8ca01 Gregory K. Brown committed Sep 10, 2010
@@ -20,6 +20,7 @@
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 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);
}
});
@@ -40,7 +40,7 @@ public String getDescription() {
}
@Override
- public void perform() {
+ public void perform(Component source) {
Alert.alert("Foo", frame);
}
};
@@ -302,7 +302,7 @@ public String getDescription() {
}
@Override
- public void perform() {
+ public void perform(Component source) {
Button selectedItem = imageMenuGroup.getSelection();
String imageName = (String)selectedItem.getUserData().get("image");
@@ -93,7 +93,7 @@ public TablePanes() {
namedActions.put("configureCell", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Sheet sheet;
@@ -117,7 +117,7 @@ public void perform() {
namedActions.put("configureRow", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Sheet sheet;
@@ -140,7 +140,7 @@ public void perform() {
namedActions.put("insertRow", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Sheet sheet;
@@ -174,7 +174,7 @@ public void perform() {
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?");
@@ -197,7 +197,7 @@ public void sheetClosed(Sheet sheet) {
namedActions.put("configureColumn", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Sheet sheet;
@@ -220,7 +220,7 @@ public void perform() {
namedActions.put("insertColumn", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Sheet sheet;
@@ -255,7 +255,7 @@ public void perform() {
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?");
@@ -41,7 +41,7 @@ public boolean configureContextMenu(Component component, Menu menu, int x, int y
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 + ".";
@@ -93,7 +93,7 @@ private void updateActionState(TextInput textInput) {
public MenuBars() {
Action.getNamedActions().put("fileNew", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Component tab;
try {
@@ -121,30 +121,30 @@ public void perform() {
Action.getNamedActions().put("fileOpen", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
fileBrowserSheet.open(window);
}
});
Action.getNamedActions().put("cut", new Action(false) {
@Override
- public void perform() {
+ public void perform(Component source) {
TextInput textInput = (TextInput)window.getFocusDescendant();
textInput.cut();
}
});
Action.getNamedActions().put("copy", new Action(false) {
@Override
- public void perform() {
+ public void perform(Component source) {
TextInput textInput = (TextInput)window.getFocusDescendant();
textInput.copy();
}
});
Action.getNamedActions().put("paste", new Action(false) {
@Override
- public void perform() {
+ public void perform(Component source) {
TextInput textInput = (TextInput)window.getFocusDescendant();
textInput.paste();
}
@@ -23,6 +23,7 @@
import org.apache.pivot.wtk.Action;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Bounds;
+import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.ImageView;
@@ -50,7 +51,7 @@
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);
@@ -64,7 +65,7 @@ public void perform() {
Action.getNamedActions().put("newSquare", new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
Rectangle rectangle = new Rectangle();
rectangle.setSize(50, 50);
@@ -78,7 +79,7 @@ public void perform() {
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");
@@ -79,7 +79,7 @@
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);
@@ -100,7 +100,7 @@ public void perform() {
// 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);
@@ -122,7 +122,7 @@ public void perform() {
// Action invoked to refresh the symbol table view
private Action refreshTableAction = new Action() {
@Override
- public void perform() {
+ public void perform(Component source) {
refreshTable();
}
};
@@ -197,7 +197,7 @@ public void sortChanged(TableView tableView) {
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();
@@ -220,7 +220,7 @@ public void textChanged(TextInput textInput) {
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
if (keyCode == Keyboard.KeyCode.ENTER) {
if (addSymbolAction.isEnabled()) {
- addSymbolAction.perform();
+ addSymbolAction.perform(component);
}
}
@@ -35,6 +35,7 @@
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;
@@ -55,14 +56,14 @@
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();
}
}
@@ -73,7 +74,7 @@ public EditSelectedExpenseAction() {
}
@Override
- public void perform() {
+ public void perform(Component source) {
updateSelectedExpense();
}
}
@@ -84,7 +85,7 @@ public DeleteSelectedExpenseAction() {
}
@Override
- public void perform() {
+ public void perform(Component source) {
deleteSelectedExpense();
}
}
@@ -146,8 +146,9 @@ public String getDescription() {
/**
* Performs the action.
+ * @param source TODO
*/
- public abstract void perform();
+ public abstract void perform(Component source);
public boolean isEnabled() {
return enabled;
@@ -364,7 +364,7 @@ public void press() {
buttonPressListeners.buttonPressed(this);
if (action != null) {
- action.perform();
+ action.perform(this);
}
}
@@ -1097,7 +1097,7 @@ public boolean keyReleased(int keyCode, Keyboard.KeyLocation keyLocation) {
Action action = actionMap.get(keyStroke);
if (action != null
&& action.isEnabled()) {
- action.perform();
+ action.perform(this);
}
return consumed;

0 comments on commit 28dbff9

Please sign in to comment.