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 2011/08/04 03:27:40 UTC
svn commit: r1153719 - in
/pivot/trunk/tests/src/org/apache/pivot/tests/issues: Pivot694.java
pivot_694.bxml
Author: smartini
Date: Thu Aug 4 01:27:39 2011
New Revision: 1153719
URL: http://svn.apache.org/viewvc?rev=1153719&view=rev
Log:
PIVOT-694 , Fix from Greg is Ok. But other problems are visible now (see some TODO inside Pivot694.java)
Modified:
pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot694.java
pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_694.bxml
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot694.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot694.java?rev=1153719&r1=1153718&r2=1153719&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot694.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot694.java Thu Aug 4 01:27:39 2011
@@ -22,12 +22,13 @@ import org.apache.pivot.beans.BXMLSerial
import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Button;
-import org.apache.pivot.wtk.ButtonGroup;
import org.apache.pivot.wtk.ButtonPressListener;
import org.apache.pivot.wtk.CalendarButton;
+import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.ListButton;
+import org.apache.pivot.wtk.ListView;
import org.apache.pivot.wtk.PushButton;
import org.apache.pivot.wtk.Spinner;
import org.apache.pivot.wtk.TableView;
@@ -36,17 +37,25 @@ import org.apache.pivot.wtk.Window;
public class Pivot694 implements Application {
private Window window = null;
- private ButtonGroup pushButtons = null;
- private ButtonGroup toggleButtons = null;
- private ButtonGroup radioButtons = null;
- private ButtonGroup checkButtons = null;
- private ButtonGroup checkTriButtons = null;
- private CalendarButton calendarButton = null;
- private Spinner spinner = null;
-
- private TableView tableView = null;
- private TreeView treeView = null;
+// TODO: for release 2.1 ... maybe generalizing some test here
+// private ButtonGroup pushButtons = null;
+// private ButtonGroup toggleButtons = null;
+// private ButtonGroup radioButtons = null;
+// private ButtonGroup checkButtons = null;
+// private ButtonGroup checkTriButtons = null;
+
+ private CalendarButton calendarButton1 = null;
+ private CalendarButton calendarButton2 = null;
+ private Spinner spinner1 = null;
+ private Spinner spinner2 = null;
+
+ private ListView listView1 = null;
+ private ListView listView2 = null;
+ private TableView tableView1 = null;
+ private TableView tableView2 = null;
+ private TreeView treeView1 = null;
+ private TreeView treeView2 = null;
private ListButton listButton1 = null;
private ListButton listButton2 = null;
@@ -66,6 +75,14 @@ public class Pivot694 implements Applica
initializeFields(bxmlSerializer);
window.open(display);
+ System.out.println("Note that elements to clear selection, "
+ + " are to improve Pivot on this feature in a next release, so now only some components will support it"
+ );
+ System.out.println("Note that elements to clear (data) inside, will be emptied"
+ + " only if they have a buttonDataKey/listDataKey/tableDataKey/treeDataKey/spinnerDataKey/xxxDataKey"
+ + " property set at creation time"
+ );
+
System.out.println("startup: end");
}
@@ -89,17 +106,24 @@ public class Pivot694 implements Applica
private void initializeFields(BXMLSerializer serializer) {
System.out.println("initializeFields: start");
- pushButtons = (ButtonGroup)serializer.getNamespace().get("pushButtons");
- toggleButtons = (ButtonGroup)serializer.getNamespace().get("toggleButtons");
- radioButtons = (ButtonGroup)serializer.getNamespace().get("radioButtons");
- checkButtons = (ButtonGroup)serializer.getNamespace().get("checkButtons");
- checkTriButtons = (ButtonGroup)serializer.getNamespace().get("checkTriButtons");
-
- calendarButton = (CalendarButton)serializer.getNamespace().get("calendarButton");
- spinner = (Spinner)serializer.getNamespace().get("spinner");
-
- tableView = (TableView)serializer.getNamespace().get("tableView");
- treeView = (TreeView)serializer.getNamespace().get("treeView");
+// TODO: for release 2.1 ... maybe generalizing some test here
+// pushButtons = (ButtonGroup)serializer.getNamespace().get("pushButtons");
+// toggleButtons = (ButtonGroup)serializer.getNamespace().get("toggleButtons");
+// radioButtons = (ButtonGroup)serializer.getNamespace().get("radioButtons");
+// checkButtons = (ButtonGroup)serializer.getNamespace().get("checkButtons");
+// checkTriButtons = (ButtonGroup)serializer.getNamespace().get("checkTriButtons");
+
+ calendarButton1 = (CalendarButton)serializer.getNamespace().get("calendarButton1");
+ calendarButton2 = (CalendarButton)serializer.getNamespace().get("calendarButton2");
+ spinner1 = (Spinner)serializer.getNamespace().get("spinner1");
+ spinner2 = (Spinner)serializer.getNamespace().get("spinner2");
+
+ listView1 = (ListView)serializer.getNamespace().get("listView1");
+ listView2 = (ListView)serializer.getNamespace().get("listView2");
+ tableView1 = (TableView)serializer.getNamespace().get("tableView1");
+ tableView2 = (TableView)serializer.getNamespace().get("tableView2");
+ treeView1 = (TreeView)serializer.getNamespace().get("treeView1");
+ treeView2 = (TreeView)serializer.getNamespace().get("treeView2");
listButton1 = (ListButton)serializer.getNamespace().get("listButton1");
listButton2 = (ListButton)serializer.getNamespace().get("listButton2");
@@ -110,22 +134,26 @@ public class Pivot694 implements Applica
public void buttonPressed(Button button) {
System.out.println("Clearing selection from " + button.getName() + " at " + new Date());
- //TODO: verify what to do on these ...
+// TODO: for release 2.1 ... maybe generalizing some test here
// pushButtons.clearSelection();
// toggleButtons.clearSelection();
// radioButtons.clearSelection();
// checkButtons.clearSelection();
// checkTriButtons.clearSelection();
-
+//
// calendarButton.clearSelection();
// spinner.clearSelection();
-
- tableView.clearSelection();
- treeView.clearSelection();
-
+//
// listButton1.clearSelection();
// listButton2.clearSelection();
+ listView1.clearSelection();
+ listView2.clearSelection();
+ tableView1.clearSelection();
+ tableView2.clearSelection();
+ treeView1.clearSelection();
+ treeView2.clearSelection();
+
}
});
@@ -135,27 +163,50 @@ public class Pivot694 implements Applica
public void buttonPressed(Button button) {
System.out.println("Clearing data from " + button.getName() + " at " + new Date());
-// TODO: verify what to do on these ...
+// TODO: verify for release 2.1 if implement a method to empty components inside ...
// pushButtons.remove(button);
// toggleButtons.remove(button);
// radioButtons.remove(button);
// checkButtons.remove(button);
// checkTriButtons.remove(button);
- calendarButton.clear();
- spinner.clear();
+ // force clear of elements data ...
+ clearComponent(calendarButton1); // TODO: doesn't seem to work on this component ...
+ clearComponent(calendarButton2);
+ clearComponent(spinner1);
+ clearComponent(spinner2);
+ clearComponent(listButton1);
+ clearComponent(listButton2);
+
+ clearComponent(listView1);
+ clearComponent(listView2);
+ clearComponent(tableView1);
+ clearComponent(tableView2);
+ clearComponent(treeView1); // TODO: doesn't seem to work on this component ...
+ clearComponent(treeView2);
- tableView.clear();
- treeView.clear();
+// TODO: put (in bxml) the two tableView in a SplitPane, and see some strange moving mouse over ...
+
+// TODO: add clear even to some type of buttons (all types in the first row displayed) ...
- listButton1.clear();
- listButton2.clear();
}
});
System.out.println("initializeFields: end");
}
+ protected static final void clearComponent(Component component) {
+ if (component == null)
+ throw new IllegalArgumentException();
+
+ component.clear();
+ component.repaint();
+
+ System.out.println("Component " + component + " with name \""
+ + component.getName() + "\""
+ + " cleared, and forced a repaint on it"
+ );
+ }
public static void main(String[] args) {
DesktopApplicationContext.main(Pivot694.class, args);
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_694.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_694.bxml?rev=1153719&r1=1153718&r2=1153719&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_694.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_694.bxml Thu Aug 4 01:27:39 2011
@@ -21,8 +21,10 @@ limitations under the License.
xmlns:content="org.apache.pivot.wtk.content"
xmlns:collections="org.apache.pivot.collections"
xmlns="org.apache.pivot.wtk"
+ preferredWidth="800" preferredHeight="600"
>
+<ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
<BoxPane orientation="vertical" styles="{padding:6, spacing:8, fill:true}">
<BoxPane styles="{padding:4, verticalAlignment:'top'}">
@@ -92,8 +94,10 @@ limitations under the License.
<BoxPane styles="{padding:4, verticalAlignment:'top'}">
<FlowPane>
- <Label text="Select one element:"/>
- <ListButton bxml:id="listButton1" buttonData="Color">
+ <Label text="Select one element (listDataKey set):"/>
+ <ListButton bxml:id="listButton1" buttonData="Color"
+ listDataKey="colorKey"
+ >
<content:ListItem text="Red"/>
<content:ListItem text="Orange"/>
<content:ListItem text="Yellow"/>
@@ -104,7 +108,7 @@ limitations under the License.
</FlowPane>
<Separator/>
<FlowPane>
- <Label text="Select one element:"/>
+ <Label text="Select one element (listDataKey not set):"/>
<ListButton bxml:id="listButton2" buttonData="Number"
listData="['One', 'Two', 'Three']"
/>
@@ -114,62 +118,150 @@ limitations under the License.
<BoxPane styles="{padding:4, verticalAlignment:'top'}">
<FlowPane>
- <Label text="Select a date:"/>
- <CalendarButton bxml:id="calendarButton"/>
+ <Label text="Select a date (buttonDataKey set):"/>
+ <CalendarButton bxml:id="calendarButton1" buttonDataKey = "buttonDataKey" />
</FlowPane>
<Separator/>
<FlowPane>
- <Label text="Select a value:"/>
- <Spinner bxml:id="spinner" preferredWidth="60"
- spinnerData="['One', 'Two', 'Three', 'Four', 'Five']"
- circular="true"
- selectedIndex="0"
- />
+ <Label text="Select a date (buttonDataKey not set):"/>
+ <CalendarButton bxml:id="calendarButton2" />
+ </FlowPane>
+ </BoxPane>
+ <Separator/>
+
+ <BoxPane styles="{padding:4, verticalAlignment:'top'}">
+ <Label text="Select a value (spinnerDataKey set):"/>
+ <Spinner bxml:id="spinner1" preferredWidth="60"
+ spinnerData="['One', 'Two', 'Three', 'Four', 'Five']"
+ circular="true"
+ selectedIndex="0"
+ spinnerDataKey="spinnerDataKey"
+ />
+ <Separator/>
+ <Label text="Select a value (spinnerDataKey not set):"/>
+ <Spinner bxml:id="spinner2" preferredWidth="60"
+ spinnerData="['One', 'Two', 'Three', 'Four', 'Five']"
+ circular="true"
+ selectedIndex="0"
+ />
+ </BoxPane>
+ <Separator/>
+
+ <BoxPane styles="{padding:4, verticalAlignment:'top'}">
+ <FlowPane>
+ <Label text="ListView (listDataKey set):"/>
+ <ListView bxml:id="listView1" selectMode="multi" listDataKey= "listDataKey">
+ <listData>
+ <content:NumericSpinnerData lowerBound="0" upperBound="3" increment="1"/>
+ </listData>
+ </ListView>
+ </FlowPane>
+ <Separator/>
+ <FlowPane>
+ <Label text="ListView (listDataKey not set):"/>
+ <ListView bxml:id="listView2" selectMode="multi">
+ <listData>
+ <content:NumericSpinnerData lowerBound="0" upperBound="3" increment="1"/>
+ </listData>
+ </ListView>
</FlowPane>
</BoxPane>
<Separator/>
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <TableView bxml:id="tableView" styles="{variableRowHeight:true, backgroundColor:'#ffeeee'}" selectMode="multi">
- <columns>
- <TableView.Column name="value" width="1*"/>
- <TableView.Column width="1*"/>
- </columns>
-
- <collections:HashMap value="Single Line"/>
- <collections:HashMap value="Double
Line Line Line Line!"/>
- <collections:HashMap value="Single Line"/>
- <collections:HashMap value="Double
Line"/>
- </TableView>
- </ScrollPane>
- <Separator/>
-
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <TreeView bxml:id="treeView" selectMode="multi">
- <nodeRenderer>
- <content:TreeViewNodeRenderer showIcon="true"/>
- </nodeRenderer>
- <treeData>
- <content:TreeBranch>
- <content:TreeBranch text="Activity">
- <content:TreeBranch text="Games">
- <content:TreeNode text="Foosball"/>
- <content:TreeNode text="A very long game name that just serves to show how a wide tree node behaves"/>
- <content:TreeNode text="Ping Pong"/>
- <content:TreeNode text="Air Hockey"/>
+ <!--
+ <SplitPane orientation="horizontal" splitRatio="0.5" resizeMode="primary_region"
+ preferredWidth="700" preferredHeight="100"
+ >
+ <top>
+ -->
+ <BoxPane orientation="vertical" styles="{fill:true}">
+ <Label text="TableView (tableDataKey set):"/>
+ <TableView bxml:id="tableView1" styles="{variableRowHeight:true, backgroundColor:'#ffeeee'}" selectMode="multi" tableDataKey="tableDataKey">
+ <columns>
+ <TableView.Column name="value" width="1*"/>
+ <TableView.Column width="1*"/>
+ </columns>
+ <collections:HashMap value="Single Line"/>
+ <collections:HashMap value="Double
Line Line Line Line!"/>
+ <collections:HashMap value="Single Line"/>
+ <collections:HashMap value="Double
Line"/>
+ </TableView>
+ <!--
+ </top>
+ <bottom>
+ -->
+ <Label text="TableView (tableDataKey not set):"/>
+ <TableView bxml:id="tableView2" styles="{variableRowHeight:true, backgroundColor:'#ffeeee'}" selectMode="multi">
+ <columns>
+ <TableView.Column name="value" width="1*"/>
+ <TableView.Column width="1*"/>
+ </columns>
+ <collections:HashMap value="Single Line"/>
+ <collections:HashMap value="Double
Line Line Line Line!"/>
+ <collections:HashMap value="Single Line"/>
+ <collections:HashMap value="Double
Line"/>
+ </TableView>
+ <!--
+ </bottom>
+ </SplitPane>
+ -->
+ </BoxPane>
+ <Separator/>
+
+ <BoxPane styles="{padding:4, verticalAlignment:'top'}">
+ <FlowPane>
+ <Label text="TreeView (treeDataKey set): - future"/>
+ <TreeView bxml:id="treeView1" selectMode="multi"
+ ComponentListener.parentChanged="treeView1.expandAll();"
+ >
+ <nodeRenderer>
+ <content:TreeViewNodeRenderer showIcon="true"/>
+ </nodeRenderer>
+ <treeData>
+ <content:TreeBranch>
+ <content:TreeBranch text="Activity">
+ <content:TreeBranch text="Games">
+ <content:TreeNode text="Foosball"/>
+ <content:TreeNode text="Ping Pong"/>
+ <content:TreeNode text="Air Hockey"/>
+ </content:TreeBranch>
+ </content:TreeBranch>
+ </content:TreeBranch>
+ </treeData>
+ </TreeView>
+ </FlowPane>
+ <Separator/>
+ <FlowPane>
+ <Label text="TreeView (treeDataKey not set):"/>
+ <TreeView bxml:id="treeView2" selectMode="multi"
+ ComponentListener.parentChanged="treeView2.expandAll();"
+ >
+ <nodeRenderer>
+ <content:TreeViewNodeRenderer showIcon="true"/>
+ </nodeRenderer>
+ <treeData>
+ <content:TreeBranch>
+ <content:TreeBranch text="Activity">
+ <content:TreeBranch text="Games">
+ <content:TreeNode text="Foosball"/>
+ <content:TreeNode text="Ping Pong"/>
+ <content:TreeNode text="Air Hockey"/>
+ </content:TreeBranch>
</content:TreeBranch>
</content:TreeBranch>
- </content:TreeBranch>
- </treeData>
- </TreeView>
- </ScrollPane>
+ </treeData>
+ </TreeView>
+ </FlowPane>
+ </BoxPane>
<Separator/>
+
<BoxPane styles="{padding:4, verticalAlignment:'top', horizontalAlignment:'center'}">
<PushButton bxml:id="clearSelectionButton" buttonData="Click to Clear Selection in supported Components" enabled="true"/>
<PushButton bxml:id="clearButton" buttonData="Click to Clear data in supported Components"/>
</BoxPane>
</BoxPane>
+</ScrollPane>
</Window>