You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/04/28 00:22:57 UTC
svn commit: r769188 - in
/incubator/pivot/trunk/demos/src/pivot/demos/roweditor: Demo.java
TableViewRowEditor.java demo.wtkx tableViewRowEditor.wtkx
Author: tvolkert
Date: Mon Apr 27 22:22:57 2009
New Revision: 769188
URL: http://svn.apache.org/viewvc?rev=769188&view=rev
Log:
Changed the row editor demo to use the new default table view row editor
Removed:
incubator/pivot/trunk/demos/src/pivot/demos/roweditor/TableViewRowEditor.java
incubator/pivot/trunk/demos/src/pivot/demos/roweditor/tableViewRowEditor.wtkx
Modified:
incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java
incubator/pivot/trunk/demos/src/pivot/demos/roweditor/demo.wtkx
Modified: incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java?rev=769188&r1=769187&r2=769188&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/roweditor/Demo.java Mon Apr 27 22:22:57 2009
@@ -17,9 +17,16 @@
package pivot.demos.roweditor;
import pivot.collections.Dictionary;
+import pivot.collections.EnumList;
import pivot.wtk.Application;
import pivot.wtk.Display;
+import pivot.wtk.ListButton;
+import pivot.wtk.Spinner;
+import pivot.wtk.TableView;
+import pivot.wtk.TextInput;
import pivot.wtk.Window;
+import pivot.wtk.content.CalendarDateSpinnerData;
+import pivot.wtk.content.TableViewRowEditor;
import pivot.wtkx.WTKXSerializer;
/**
@@ -34,6 +41,27 @@
WTKXSerializer wtkxSerializer = new WTKXSerializer();
window = (Window)wtkxSerializer.readObject(getClass().getResource("demo.wtkx"));
window.open(display);
+
+ TableView tableView = (TableView)wtkxSerializer.getObjectByName("tableView");
+ TableViewRowEditor tableViewRowEditor = new TableViewRowEditor();
+ tableView.setRowEditor(tableViewRowEditor);
+
+ // Date uses a Spinner with a CalendarDateSpinnerData model
+ Spinner dateSpinner = new Spinner(new CalendarDateSpinnerData());
+ dateSpinner.setSelectedItemKey("date");
+ tableViewRowEditor.getCellEditors().put("date", dateSpinner);
+
+ // Expense type uses a ListButton that presents the expense types
+ ListButton typeListButton = new ListButton(new EnumList<ExpenseType>(ExpenseType.class));
+ typeListButton.setSelectedItemKey("type");
+ tableViewRowEditor.getCellEditors().put("type", typeListButton);
+
+ // Amount uses a TextInput with strict currency validation
+ TextInput amountTextInput = new TextInput();
+ amountTextInput.setValidator(new CurrencyValidator());
+ amountTextInput.getStyles().put("strictValidation", true);
+ amountTextInput.setTextKey("amount");
+ tableViewRowEditor.getCellEditors().put("amount", amountTextInput);
}
public boolean shutdown(boolean optional) throws Exception {
Modified: incubator/pivot/trunk/demos/src/pivot/demos/roweditor/demo.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/pivot/demos/roweditor/demo.wtkx?rev=769188&r1=769187&r2=769188&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/pivot/demos/roweditor/demo.wtkx (original)
+++ incubator/pivot/trunk/demos/src/pivot/demos/roweditor/demo.wtkx Mon Apr 27 22:22:57 2009
@@ -37,7 +37,7 @@
<TablePane.Row height="1*">
<Border styles="{padding:0}">
<content>
- <ScrollPane wtkx:id="scrollPane" horizontalScrollBarPolicy="fillToCapacity" styles="{backgroundColor:4}">
+ <ScrollPane horizontalScrollBarPolicy="fillToCapacity" styles="{backgroundColor:4}">
<view>
<TableView wtkx:id="tableView" selectMode="single">
<columns>
@@ -50,9 +50,6 @@
</TableView.Column>
<TableView.Column name="description" width="1*" headerData="Description"/>
</columns>
- <rowEditor>
- <demo:TableViewRowEditor tableViewScrollPane="$scrollPane"/>
- </rowEditor>
<tableData>
<collections:ArrayList>
<demo:CustomTableRow date="2009-03-28" type="Travel" amount="1286.90" description="Ticket #145-XX-71903-09"/>
@@ -68,7 +65,7 @@
</TableView>
</view>
<columnHeader>
- <TableViewHeader wtkx:id="tableViewHeader" tableView="$tableView" styles="{headersPressable:false}"/>
+ <TableViewHeader tableView="$tableView" styles="{headersPressable:false}"/>
</columnHeader>
</ScrollPane>
</content>