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/12/24 17:07:40 UTC
svn commit: r1222994 [5/11] - in /pivot/trunk:
core/test/org/apache/pivot/beans/test/
demos/src/org/apache/pivot/demos/memorygame/
demos/src/org/apache/pivot/demos/memorygame/img/
demos/src/org/apache/pivot/demos/roweditor/ demos/www/ etc/ examples/src...
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_list.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_list.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_list.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_list.bxml Sat Dec 24 16:07:37 2011
@@ -1,60 +1,60 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License,
-Version 2.0 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<Window title="Multiple Selection on Lists" maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns:collections="org.apache.pivot.collections"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns="org.apache.pivot.wtk">
- <windowStateListeners>
- function windowOpened(window) {
- dataListView.requestFocus();
- }
- </windowStateListeners>
-
- <TablePane styles="{horizontalSpacing:8}">
- <columns>
- <TablePane.Column width="1*"/>
- <TablePane.Column width="1*"/>
- </columns>
-
- <TablePane.Row height="1*">
- <Border styles="{color:10}">
- <ScrollPane horizontalScrollBarPolicy="fill">
- <ListView bxml:id="dataListView" selectMode="multi">
- <listData>
- <content:NumericSpinnerData lowerBound="0" upperBound="30" increment="1"/>
- </listData>
-
- <listViewSelectionListeners>
- importPackage(org.apache.pivot.collections);
- function selectedRangesChanged(viewComponent, previousSelectedElements) {
- selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
- }
- </listViewSelectionListeners>
- </ListView>
- </ScrollPane>
- </Border>
- <Border styles="{color:10}">
- <ScrollPane horizontalScrollBarPolicy="fill">
- <ListView bxml:id="selectionListView" selectMode="none"/>
- </ScrollPane>
- </Border>
- </TablePane.Row>
- </TablePane>
-</Window>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="Multiple Selection on Lists" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:collections="org.apache.pivot.collections"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk">
+ <windowStateListeners>
+ function windowOpened(window) {
+ dataListView.requestFocus();
+ }
+ </windowStateListeners>
+
+ <TablePane styles="{horizontalSpacing:8}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ <TablePane.Column width="1*"/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <Border styles="{color:10}">
+ <ScrollPane horizontalScrollBarPolicy="fill">
+ <ListView bxml:id="dataListView" selectMode="multi">
+ <listData>
+ <content:NumericSpinnerData lowerBound="0" upperBound="30" increment="1"/>
+ </listData>
+
+ <listViewSelectionListeners>
+ importPackage(org.apache.pivot.collections);
+ function selectedRangesChanged(viewComponent, previousSelectedElements) {
+ selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
+ }
+ </listViewSelectionListeners>
+ </ListView>
+ </ScrollPane>
+ </Border>
+ <Border styles="{color:10}">
+ <ScrollPane horizontalScrollBarPolicy="fill">
+ <ListView bxml:id="selectionListView" selectMode="none"/>
+ </ScrollPane>
+ </Border>
+ </TablePane.Row>
+ </TablePane>
+</Window>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_list.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_list.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_table.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_table.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_table.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_table.bxml Sat Dec 24 16:07:37 2011
@@ -1,92 +1,92 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License,
-Version 2.0 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<Window title="Multiple Selection on Tables" maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns:collections="org.apache.pivot.collections"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns="org.apache.pivot.wtk">
- <windowStateListeners
->
- function windowOpened(window) {
- dataTableView.requestFocus();
- }
- </windowStateListeners>
-
- <TablePane styles="{horizontalSpacing:8}">
- <columns>
- <TablePane.Column width="1*"/>
- <TablePane.Column width="1*"/>
- </columns>
-
- <TablePane.Row height="1*">
- <Border styles="{color:10}">
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <TableView bxml:id="dataTableView" selectMode="multi">
- <columns>
- <TableView.Column name="i" width="75"/>
- <TableView.Column name="a" width="75"/>
- <TableView.Column name="b" width="75"/>
- <TableView.Column name="c" width="75"/>
- <TableView.Column name="d" width="1*"/>
- </columns>
- <componentListeners>
- <![CDATA[
- importClass(org.apache.pivot.collections.ArrayList);
- importClass(org.apache.pivot.collections.HashMap);
-
- function parentChanged(component, previousParent) {
- if (component.getParent() != null) {
- var tableData = new ArrayList();
-
- for (var i = 0; i < 20; i++) {
- var row = new HashMap();
- row.put("i", new String(i));
- row.put("a", new String(Math.floor(Math.random() * 100)));
- row.put("b", new String(Math.floor(Math.random() * 1000)));
- row.put("c", new String(Math.floor(Math.random() * 10000)));
- tableData.add(row);
- }
-
- component.setTableData(tableData);
- }
- }
-
- function selectedRangesChanged(viewComponent, previousSelectedElements) {
- selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
- }
- ]]>
- </componentListeners>
-
- <tableViewSelectionListeners>
- importPackage(org.apache.pivot.collections);
- function selectedRangesChanged(viewComponent, previousSelectedElements) {
- selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
- }
- </tableViewSelectionListeners>
- </TableView>
- </ScrollPane>
- </Border>
- <Border styles="{color:10}">
- <ScrollPane horizontalScrollBarPolicy="fill">
- <ListView bxml:id="selectionListView" selectMode="none"/>
- </ScrollPane>
- </Border>
- </TablePane.Row>
- </TablePane>
-</Window>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="Multiple Selection on Tables" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:collections="org.apache.pivot.collections"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk">
+ <windowStateListeners
+>
+ function windowOpened(window) {
+ dataTableView.requestFocus();
+ }
+ </windowStateListeners>
+
+ <TablePane styles="{horizontalSpacing:8}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ <TablePane.Column width="1*"/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <Border styles="{color:10}">
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <TableView bxml:id="dataTableView" selectMode="multi">
+ <columns>
+ <TableView.Column name="i" width="75"/>
+ <TableView.Column name="a" width="75"/>
+ <TableView.Column name="b" width="75"/>
+ <TableView.Column name="c" width="75"/>
+ <TableView.Column name="d" width="1*"/>
+ </columns>
+ <componentListeners>
+ <![CDATA[
+ importClass(org.apache.pivot.collections.ArrayList);
+ importClass(org.apache.pivot.collections.HashMap);
+
+ function parentChanged(component, previousParent) {
+ if (component.getParent() != null) {
+ var tableData = new ArrayList();
+
+ for (var i = 0; i < 20; i++) {
+ var row = new HashMap();
+ row.put("i", new String(i));
+ row.put("a", new String(Math.floor(Math.random() * 100)));
+ row.put("b", new String(Math.floor(Math.random() * 1000)));
+ row.put("c", new String(Math.floor(Math.random() * 10000)));
+ tableData.add(row);
+ }
+
+ component.setTableData(tableData);
+ }
+ }
+
+ function selectedRangesChanged(viewComponent, previousSelectedElements) {
+ selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
+ }
+ ]]>
+ </componentListeners>
+
+ <tableViewSelectionListeners>
+ importPackage(org.apache.pivot.collections);
+ function selectedRangesChanged(viewComponent, previousSelectedElements) {
+ selectionListView.listData = new ArrayList(viewComponent.selectedRanges);
+ }
+ </tableViewSelectionListeners>
+ </TableView>
+ </ScrollPane>
+ </Border>
+ <Border styles="{color:10}">
+ <ScrollPane horizontalScrollBarPolicy="fill">
+ <ListView bxml:id="selectionListView" selectMode="none"/>
+ </ScrollPane>
+ </Border>
+ </TablePane.Row>
+ </TablePane>
+</Window>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_table.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_table.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_tree.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_tree.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_tree.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_tree.bxml Sat Dec 24 16:07:37 2011
@@ -1,109 +1,109 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License,
-Version 2.0 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<Window title="Multiple Selection on Trees" maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns:collections="org.apache.pivot.collections"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns="org.apache.pivot.wtk"
->
- <windowStateListeners>
- function windowOpened(window) {
- dataTreeView.requestFocus();
- }
- </windowStateListeners>
-
- <TablePane styles="{horizontalSpacing:8}">
- <columns>
- <TablePane.Column width="1*"/>
- <TablePane.Column width="1*"/>
- </columns>
-
- <TablePane.Row height="1*">
- <Border styles="{color:10}">
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <TreeView bxml:id="dataTreeView" 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"/>
- </content:TreeBranch>
- <content:TreeBranch text="Sports">
- <content:TreeNode text="Baseball"/>
- <content:TreeNode text="Basketball"/>
- <content:TreeNode text="Football"/>
- <content:TreeNode text="Ice Hockey"/>
- <content:TreeNode text="Soccer"/>
- <content:TreeNode text="Softball"/>
- </content:TreeBranch>
- <content:TreeNode text="Camping"/>
- <content:TreeNode text="Skiing"/>
- </content:TreeBranch>
- <content:TreeBranch text="Occasion">
- <content:TreeBranch text="Holidays">
- <content:TreeNode text="Christmas"/>
- <content:TreeNode text="Independence Day"/>
- <content:TreeNode text="Labor Day"/>
- <content:TreeNode text="New Year's Day"/>
- <content:TreeNode text="President's Day"/>
- <content:TreeNode text="Thanksgiving"/>
- <content:TreeNode text="Valentine's Day"/>
- <content:TreeNode text="Veteran's Day"/>
- </content:TreeBranch>
- <content:TreeNode text="Anniversary"/>
- <content:TreeNode text="Birthday"/>
- <content:TreeNode text="Wedding"/>
- </content:TreeBranch>
- <content:TreeBranch text="Location">
- <content:TreeNode text="Africa"/>
- <content:TreeNode text="Antarctica"/>
- <content:TreeNode text="Asia"/>
- <content:TreeNode text="Australia"/>
- <content:TreeNode text="Europe"/>
- <content:TreeNode text="North America"/>
- <content:TreeBranch text="South America">
- <content:TreeNode text="Peru"/>
- </content:TreeBranch>
- </content:TreeBranch>
- </content:TreeBranch>
- </treeData>
-
- <treeViewSelectionListeners>
- importPackage(org.apache.pivot.collections);
- function selectedPathsChanged(viewComponent, previousSelectedElements) {
- selectionListView.listData = new ArrayList(viewComponent.selectedPaths);
- }
- </treeViewSelectionListeners>
- </TreeView>
- </ScrollPane>
- </Border>
- <Border styles="{color:10}">
- <ScrollPane horizontalScrollBarPolicy="fill">
- <ListView bxml:id="selectionListView" selectMode="none"/>
- </ScrollPane>
- </Border>
- </TablePane.Row>
- </TablePane>
-</Window>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="Multiple Selection on Trees" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:collections="org.apache.pivot.collections"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk"
+>
+ <windowStateListeners>
+ function windowOpened(window) {
+ dataTreeView.requestFocus();
+ }
+ </windowStateListeners>
+
+ <TablePane styles="{horizontalSpacing:8}">
+ <columns>
+ <TablePane.Column width="1*"/>
+ <TablePane.Column width="1*"/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <Border styles="{color:10}">
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <TreeView bxml:id="dataTreeView" 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"/>
+ </content:TreeBranch>
+ <content:TreeBranch text="Sports">
+ <content:TreeNode text="Baseball"/>
+ <content:TreeNode text="Basketball"/>
+ <content:TreeNode text="Football"/>
+ <content:TreeNode text="Ice Hockey"/>
+ <content:TreeNode text="Soccer"/>
+ <content:TreeNode text="Softball"/>
+ </content:TreeBranch>
+ <content:TreeNode text="Camping"/>
+ <content:TreeNode text="Skiing"/>
+ </content:TreeBranch>
+ <content:TreeBranch text="Occasion">
+ <content:TreeBranch text="Holidays">
+ <content:TreeNode text="Christmas"/>
+ <content:TreeNode text="Independence Day"/>
+ <content:TreeNode text="Labor Day"/>
+ <content:TreeNode text="New Year's Day"/>
+ <content:TreeNode text="President's Day"/>
+ <content:TreeNode text="Thanksgiving"/>
+ <content:TreeNode text="Valentine's Day"/>
+ <content:TreeNode text="Veteran's Day"/>
+ </content:TreeBranch>
+ <content:TreeNode text="Anniversary"/>
+ <content:TreeNode text="Birthday"/>
+ <content:TreeNode text="Wedding"/>
+ </content:TreeBranch>
+ <content:TreeBranch text="Location">
+ <content:TreeNode text="Africa"/>
+ <content:TreeNode text="Antarctica"/>
+ <content:TreeNode text="Asia"/>
+ <content:TreeNode text="Australia"/>
+ <content:TreeNode text="Europe"/>
+ <content:TreeNode text="North America"/>
+ <content:TreeBranch text="South America">
+ <content:TreeNode text="Peru"/>
+ </content:TreeBranch>
+ </content:TreeBranch>
+ </content:TreeBranch>
+ </treeData>
+
+ <treeViewSelectionListeners>
+ importPackage(org.apache.pivot.collections);
+ function selectedPathsChanged(viewComponent, previousSelectedElements) {
+ selectionListView.listData = new ArrayList(viewComponent.selectedPaths);
+ }
+ </treeViewSelectionListeners>
+ </TreeView>
+ </ScrollPane>
+ </Border>
+ <Border styles="{color:10}">
+ <ScrollPane horizontalScrollBarPolicy="fill">
+ <ListView bxml:id="selectionListView" selectMode="none"/>
+ </ScrollPane>
+ </Border>
+ </TablePane.Row>
+ </TablePane>
+</Window>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_tree.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/multiple_selection_tree.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/recursive_disable.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/recursive_disable.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/recursive_disable.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/recursive_disable.bxml Sat Dec 24 16:07:37 2011
@@ -1,59 +1,59 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License,
-Version 2.0 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<Window maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns="org.apache.pivot.wtk"
->
- <BoxPane orientation="vertical" styles="{padding:6, spacing:8, fill:true}">
- <Checkbox buttonData="Enable Magic">
- <buttonStateListeners>
- function stateChanged(button, previousState) {
- paneMagic.setEnabled(button.isSelected());
- }
- </buttonStateListeners>
- </Checkbox>
- <TablePane bxml:id="paneMagic" enabled="false"
- styles="{verticalSpacing:4, horizontalSpacing:4, padding:{left:20}}">
- <columns>
- <TablePane.Column width="-1" />
- <TablePane.Column width="1*" />
- </columns>
- <TablePane.Row>
- <Label text="Preferred spell:"/>
- <ListButton listData="['Accio', 'Expeliarmus', 'Riddikulus']" selectedIndex="0"/>
- </TablePane.Row>
- <TablePane.Row>
- <Label text="Wand supplier:"/>
- <TextInput bxml:id="textSupplier" />
- </TablePane.Row>
- </TablePane>
- <Checkbox buttonData="Enable Kindness">
- <buttonStateListeners>
- function stateChanged(button, previousState) {
- listActs.setEnabled(button.isSelected());
- }
- </buttonStateListeners>
- </Checkbox>
- <BoxPane styles="{padding:{left:20}}">
- <Label text="Acts:"/>
- <ListButton bxml:id="listActs" enabled="false"
- listData="['Wash dishes', 'Run errands', 'Carry groceries']" selectedIndex="0"/>
- </BoxPane>
- </BoxPane>
-</Window>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns="org.apache.pivot.wtk"
+>
+ <BoxPane orientation="vertical" styles="{padding:6, spacing:8, fill:true}">
+ <Checkbox buttonData="Enable Magic">
+ <buttonStateListeners>
+ function stateChanged(button, previousState) {
+ paneMagic.setEnabled(button.isSelected());
+ }
+ </buttonStateListeners>
+ </Checkbox>
+ <TablePane bxml:id="paneMagic" enabled="false"
+ styles="{verticalSpacing:4, horizontalSpacing:4, padding:{left:20}}">
+ <columns>
+ <TablePane.Column width="-1" />
+ <TablePane.Column width="1*" />
+ </columns>
+ <TablePane.Row>
+ <Label text="Preferred spell:"/>
+ <ListButton listData="['Accio', 'Expeliarmus', 'Riddikulus']" selectedIndex="0"/>
+ </TablePane.Row>
+ <TablePane.Row>
+ <Label text="Wand supplier:"/>
+ <TextInput bxml:id="textSupplier" />
+ </TablePane.Row>
+ </TablePane>
+ <Checkbox buttonData="Enable Kindness">
+ <buttonStateListeners>
+ function stateChanged(button, previousState) {
+ listActs.setEnabled(button.isSelected());
+ }
+ </buttonStateListeners>
+ </Checkbox>
+ <BoxPane styles="{padding:{left:20}}">
+ <Label text="Acts:"/>
+ <ListButton bxml:id="listActs" enabled="false"
+ listData="['Wash dishes', 'Run errands', 'Carry groceries']" selectedIndex="0"/>
+ </BoxPane>
+ </BoxPane>
+</Window>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/recursive_disable.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/recursive_disable.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/splash.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/splash.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/splash.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/splash.bxml Sat Dec 24 16:07:37 2011
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License,
-Version 2.0 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<Window title="Hello BXML!" maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns="org.apache.pivot.wtk">
- <Label text="Splash Screen Test"
- styles="{font:'Arial bold 24', color:'#ff0000',
- horizontalAlignment:'center', verticalAlignment:'center'}"
- />
-</Window>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="Hello BXML!" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns="org.apache.pivot.wtk">
+ <Label text="Splash Screen Test"
+ styles="{font:'Arial bold 24', color:'#ff0000',
+ horizontalAlignment:'center', verticalAlignment:'center'}"
+ />
+</Window>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/splash.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/splash.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/splash.png
------------------------------------------------------------------------------
origination-name = image/png
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/splash.png
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Sat Dec 24 16:07:37 2011
@@ -1 +1 @@
-application/octet-stream
+image/png
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test3.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test3.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test3.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test3.bxml Sat Dec 24 16:07:37 2011
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License,
-Version 2.0 (the "License"); you may not use this file except in
-compliance with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-<Window title="Table View Test3, using a custom TableViewCellRenderer" maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns:collections="org.apache.pivot.collections"
- xmlns:content="org.apache.pivot.wtk.content"
- xmlns:tests="org.apache.pivot.tests"
- xmlns="org.apache.pivot.wtk">
- <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
- <TableView bxml:id="tableView" styles="{variableRowHeight:true, backgroundColor:'#ffeeee'}">
- <columns>
- <TableView.Column name="value" width="100">
- <cellRenderer>
- <tests:TableViewCellRendererCustom styles="{wrapText:true}"/>
- </cellRenderer>
- </TableView.Column>
-
- <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>
-</Window>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="Table View Test3, using a custom TableViewCellRenderer" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:collections="org.apache.pivot.collections"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns:tests="org.apache.pivot.tests"
+ xmlns="org.apache.pivot.wtk">
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <TableView bxml:id="tableView" styles="{variableRowHeight:true, backgroundColor:'#ffeeee'}">
+ <columns>
+ <TableView.Column name="value" width="100">
+ <cellRenderer>
+ <tests:TableViewCellRendererCustom styles="{wrapText:true}"/>
+ </cellRenderer>
+ </TableView.Column>
+
+ <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>
+</Window>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test3.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test3.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.java Sat Dec 24 16:07:37 2011
@@ -1,83 +1,83 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pivot.tutorials.bxmlexplorer;
-
-import org.apache.pivot.beans.BXMLSerializer;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.Alert;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.MessageType;
-import org.apache.pivot.wtk.TextArea;
-import org.apache.pivot.wtk.Window;
-
-public class BXMLExplorer implements Application {
-
- /**
- * For the moment editing is experimental, so use a property to turn it on.
- */
- static final boolean ENABLE_EDITING = Boolean.getBoolean("edit");
-
- private BXMLExplorerWindow window = null;
-
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (BXMLExplorerWindow)bxmlSerializer.readObject(BXMLExplorer.class,
- "bxml_explorer_window.bxml", true);
- window.open(display);
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
- static void displayLoadException(Throwable exception, Window window) {
- String message = exception.getClass().getName();
-
- TextArea body = null;
- String bodyText = exception.getMessage();
- if (bodyText != null
- && bodyText.length() > 0) {
- body = new TextArea();
- body.setText(bodyText);
- body.setEditable(false);
- }
-
- Alert.alert(MessageType.ERROR, message, null, body, window, null);
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(BXMLExplorer.class, args);
- }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tutorials.bxmlexplorer;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Alert;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.MessageType;
+import org.apache.pivot.wtk.TextArea;
+import org.apache.pivot.wtk.Window;
+
+public class BXMLExplorer implements Application {
+
+ /**
+ * For the moment editing is experimental, so use a property to turn it on.
+ */
+ static final boolean ENABLE_EDITING = Boolean.getBoolean("edit");
+
+ private BXMLExplorerWindow window = null;
+
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ BXMLSerializer bxmlSerializer = new BXMLSerializer();
+ window = (BXMLExplorerWindow)bxmlSerializer.readObject(BXMLExplorer.class,
+ "bxml_explorer_window.bxml", true);
+ window.open(display);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ static void displayLoadException(Throwable exception, Window window) {
+ String message = exception.getClass().getName();
+
+ TextArea body = null;
+ String bodyText = exception.getMessage();
+ if (bodyText != null
+ && bodyText.length() > 0) {
+ body = new TextArea();
+ body.setText(bodyText);
+ body.setEditable(false);
+ }
+
+ Alert.alert(MessageType.ERROR, message, null, body, window, null);
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(BXMLExplorer.class, args);
+ }
+}
+
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.json
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.json?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.json (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.json Sat Dec 24 16:07:37 2011
@@ -1,67 +1,67 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-{ title: "Apache Pivot BXML Explorer",
-
- explorerPane: {
- label: "BXML Explorer",
- branches: {
- basic: "Labels & Image Views",
- buttons: "Buttons",
- lists: "Lists",
- text: "Text",
- separators: "Separators",
- layout: "Layout Containers",
- navigation: "Navigation Containers",
- viewports: "Viewports",
- progress: "Progress Indicators",
- boundedRange: "Bounded Range Components",
- calendars: "Calendars",
- colorChoosers: "Color Choosers",
- menus: "Menus",
- tables: "Tables",
- trees: "Trees",
- fileBrowsing: " File Browsing"
- }
- },
-
- contentPane: {
- visualizationLabel: "Visualization",
- bxmlSourceLabel: "BXML Source",
-
- scrollBarPolicy: {
- tooltip: "Show/Change Scroll Bar Policy",
- horizontal: "Horizontal Scroll Bar Policy",
- vertical: "Vertical Scroll Bar Policy",
- auto: "Auto",
- fill: "Fill",
- fillToCapacity: "Fill To Capacity",
- never: "Never",
- always: "Always"
- }
- },
-
- inspectorPane: {
- propertiesLabel: "Properties",
- stylesLabel: "Styles"
- },
-
- eventLoggerPane: {
- tooltip: "Show/Clear Event Log Commands",
- label: "Event Log",
- clear: "Clear Event Log"
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{ title: "Apache Pivot BXML Explorer",
+
+ explorerPane: {
+ label: "BXML Explorer",
+ branches: {
+ basic: "Labels & Image Views",
+ buttons: "Buttons",
+ lists: "Lists",
+ text: "Text",
+ separators: "Separators",
+ layout: "Layout Containers",
+ navigation: "Navigation Containers",
+ viewports: "Viewports",
+ progress: "Progress Indicators",
+ boundedRange: "Bounded Range Components",
+ calendars: "Calendars",
+ colorChoosers: "Color Choosers",
+ menus: "Menus",
+ tables: "Tables",
+ trees: "Trees",
+ fileBrowsing: " File Browsing"
+ }
+ },
+
+ contentPane: {
+ visualizationLabel: "Visualization",
+ bxmlSourceLabel: "BXML Source",
+
+ scrollBarPolicy: {
+ tooltip: "Show/Change Scroll Bar Policy",
+ horizontal: "Horizontal Scroll Bar Policy",
+ vertical: "Vertical Scroll Bar Policy",
+ auto: "Auto",
+ fill: "Fill",
+ fillToCapacity: "Fill To Capacity",
+ never: "Never",
+ always: "Always"
+ }
+ },
+
+ inspectorPane: {
+ propertiesLabel: "Properties",
+ stylesLabel: "Styles"
+ },
+
+ eventLoggerPane: {
+ tooltip: "Show/Clear Event Log Commands",
+ label: "Event Log",
+ clear: "Clear Event Log"
+ }
+}
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorer.json
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java Sat Dec 24 16:07:37 2011
@@ -1,364 +1,364 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.pivot.tutorials.bxmlexplorer;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.pivot.beans.BXML;
-import org.apache.pivot.beans.BXMLSerializer;
-import org.apache.pivot.beans.BeanAdapter;
-import org.apache.pivot.beans.Bindable;
-import org.apache.pivot.beans.DefaultProperty;
-import org.apache.pivot.collections.List;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.collections.Sequence;
-import org.apache.pivot.collections.Sequence.Tree.Path;
-import org.apache.pivot.serialization.SerializationException;
-import org.apache.pivot.tutorials.bxmlexplorer.tools.ComponentPropertyInspector;
-import org.apache.pivot.tutorials.bxmlexplorer.tools.ComponentStyleInspector;
-import org.apache.pivot.util.Resources;
-import org.apache.pivot.wtk.ButtonPressListener;
-import org.apache.pivot.wtk.CardPane;
-import org.apache.pivot.wtk.Checkbox;
-import org.apache.pivot.wtk.Component;
-import org.apache.pivot.wtk.ComponentMouseButtonListener;
-import org.apache.pivot.wtk.ImageView;
-import org.apache.pivot.wtk.Label;
-import org.apache.pivot.wtk.LinkButton;
-import org.apache.pivot.wtk.Mouse.Button;
-import org.apache.pivot.wtk.PushButton;
-import org.apache.pivot.wtk.RadioButton;
-import org.apache.pivot.wtk.TablePane;
-import org.apache.pivot.wtk.TextPane;
-import org.apache.pivot.wtk.TreeView;
-import org.apache.pivot.wtk.TreeView.SelectMode;
-import org.apache.pivot.wtk.TreeViewSelectionListener;
-import org.apache.pivot.wtk.Window;
-import org.apache.pivot.wtk.content.TreeBranch;
-import org.apache.pivot.wtk.content.TreeNode;
-import org.apache.pivot.wtk.content.TreeViewNodeRenderer;
-import org.apache.pivot.wtk.effects.Decorator;
-import org.apache.pivot.wtk.effects.ShadeDecorator;
-import org.xml.sax.SAXException;
-
-public class BXMLExplorerDocument extends CardPane implements Bindable {
- @BXML
- private TreeView treeView;
- @BXML
- private CardPane playgroundCardPane;
- @BXML
- private TextPane bxmlSourceTextPane;
- @BXML
- private ComponentPropertyInspector componentPropertyInspector;
- @BXML
- private ComponentStyleInspector componentStyleInspector;
- @BXML
- private PushButton reloadButton;
-
- private File file;
- private Component loadedComponent;
- /**
- * maps the WTK widgets -> bxml:id values
- */
- private HashMap<Object, String> widgetToID = null;
- private HashMap<Object, TreeNode> componentToTreeNode = null;
-
- public BXMLExplorerDocument() {
- }
-
- @Override
- public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
- treeView.setSelectMode(SelectMode.SINGLE);
- treeView.setNodeRenderer(new MyTreeViewNodeRenderer());
- treeView.getTreeViewSelectionListeners().add(new TreeViewSelectionListener.Adapter() {
- private final Decorator focusDecorator = new ShadeDecorator(0.2f, Color.RED);
- private Component previousSelectedComponent = null;
-
- @Override
- public void selectedNodeChanged(TreeView treeView, Object previousSelectedNode) {
- TreeNode node = (TreeNode) treeView.getSelectedNode();
- if (previousSelectedComponent != null
- && previousSelectedComponent.getDecorators().indexOf(focusDecorator) > -1) {
- previousSelectedComponent.getDecorators().remove(focusDecorator);
- previousSelectedComponent = null;
- }
- if (node == null || !(node.getUserData() instanceof Component)) {
- // TODO make the inspectors able to deal with things like
- // TablePane.Row
- componentPropertyInspector.setSource(null);
- componentStyleInspector.setSource(null);
- return;
- }
- Component selectedComp = (Component) node.getUserData();
- if (selectedComp != null
- && selectedComp.getDecorators().indexOf(focusDecorator) == -1) {
- selectedComp.getDecorators().add(focusDecorator);
- previousSelectedComponent = selectedComp;
- }
-
- if (selectedComp instanceof FakeWindow) {
- selectedComp = ((FakeWindow) selectedComp).window;
- }
- componentPropertyInspector.setSource(selectedComp);
- componentStyleInspector.setSource(selectedComp);
- }
-
- @Override
- public void selectedPathsChanged(TreeView treeView, Sequence<Path> previousSelectedPaths) {
- // if the selection becomes empty, remove the decorator
- if (treeView.getSelectedNode() == null && previousSelectedComponent != null
- && previousSelectedComponent.getDecorators().indexOf(focusDecorator) > -1) {
- previousSelectedComponent.getDecorators().remove(focusDecorator);
- }
- }
-
- });
-
- playgroundCardPane.getComponentMouseButtonListeners().add(
- new ComponentMouseButtonListener.Adapter() {
- @Override
- public boolean mouseClick(Component component, Button button, int x, int y,
- int count) {
- if (count == 1) {
- Component comp = playgroundCardPane.getDescendantAt(x, y);
- if (comp != null) {
- TreeNode treeNode = componentToTreeNode.get(comp);
- Path path = getPathForNode(treeView, treeNode);
- if (path != null) {
- treeView.setSelectedPath(path);
- return true;
- }
- }
- }
- return false;
- }
- });
-
- reloadButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(org.apache.pivot.wtk.Button button) {
- playgroundCardPane.remove(loadedComponent);
- widgetToID = null;
- componentToTreeNode = null;
- loadedComponent = null;
- try {
- load(file);
- } catch (RuntimeException exception) {
- exception.printStackTrace();
- BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
- } catch (IOException exception) {
- exception.printStackTrace();
- BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
- } catch (SerializationException exception) {
- exception.printStackTrace();
- BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
- } catch (ParserConfigurationException exception) {
- exception.printStackTrace();
- BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
- } catch (SAXException exception) {
- exception.printStackTrace();
- BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
- }
- }
- });
- }
-
- @SuppressWarnings("unchecked")
- private static Path getPathForNode(TreeView treeView, TreeNode treeNode) {
- List<Object> treeData = (List<Object>) treeView.getTreeData();
- Sequence.Tree.ItemIterator<Object> itemIterator = Sequence.Tree.depthFirstIterator(treeData);
- while (itemIterator.hasNext()) {
- Object node = itemIterator.next();
- if (node == treeNode) {
- return itemIterator.getPath();
- }
- }
- return null;
- }
-
- public File getLoadedFile() {
- return file;
- }
-
- public void load(File f) throws IOException, SerializationException, ParserConfigurationException, SAXException {
- BXMLSerializer serializer = new BXMLSerializer();
- serializer.setLocation(f.toURI().toURL());
- final FileInputStream in = new FileInputStream(f);
- try {
- Object obj = serializer.readObject(in);
- if (!(obj instanceof Component)) {
- throw new IllegalStateException("obj " + obj + " is of class " + obj.getClass()
- + " which is not a subtype of Component");
- }
- // create an inverse map so we can IDs for widgets
- widgetToID = new HashMap<Object, String>();
- for (String key : serializer.getNamespace()) {
- widgetToID.put(serializer.getNamespace().get(key), key);
- }
- // we can't add a Window into the component hierarchy, so fake it
- if (obj instanceof Window) {
- obj = new FakeWindow((Window) obj);
- }
- // create the explorer tree
- componentToTreeNode = new HashMap<Object, TreeNode>();
- // the root node is not visible
- final TreeBranch rootbranch = new TreeBranch("");
- rootbranch.add(analyseObjectTree(obj));
- treeView.setTreeData(rootbranch);
- treeView.expandAll();
- // add the loaded widget to the display
- this.loadedComponent = (Component) obj;
- playgroundCardPane.add((Component) obj);
- } finally {
- in.close();
- }
- final FileInputStream in2 = new FileInputStream(f);
- try {
- CreateHighlightedXML xml = new CreateHighlightedXML();
- bxmlSourceTextPane.setDocument(xml.prettyPrint(in2));
- } finally {
- in2.close();
- }
- this.file = f;
- }
-
- @SuppressWarnings("unchecked")
- private TreeNode analyseObjectTree(Object container) {
- // We don't want the RowSequence object to show up in the tree, it doesn't look neat
- if (container instanceof TablePane) {
- TreeBranch branch = new TreeBranch(nameForObject(container));
- TablePane table = (TablePane) container;
- for (TablePane.Row row : table.getRows()) {
- TreeNode childBranch = analyseObjectTree(row);
- branch.add(childBranch);
- }
- setComponentIconOnTreeNode(container, branch);
- return branch;
- }
-
- // We don't want to analyse the components that are added as part of the
- // skin, so use similar logic to BXMLSerializer
- DefaultProperty defaultProperty = container.getClass().getAnnotation(DefaultProperty.class);
- if (defaultProperty != null) {
- TreeBranch branch = new TreeBranch(nameForObject(container));
- String defaultPropertyName = defaultProperty.value();
- BeanAdapter beanAdapter = new BeanAdapter(container);
- if (!beanAdapter.containsKey(defaultPropertyName)) {
- throw new IllegalStateException("default property " + defaultPropertyName
- + " not found on " + container);
- }
- Object defaultPropertyValue = beanAdapter.get(defaultPropertyName);
- if (defaultPropertyValue != null) {
- if (defaultPropertyValue instanceof Component) {
- TreeNode childBranch = analyseObjectTree(defaultPropertyValue);
- branch.add(childBranch);
- }
- }
- // An empty branch looks untidy if it has an arrow next to it,
- // so make empty branches into nodes.
- if (branch.isEmpty()) {
- TreeNode node = new TreeNode(branch.getText());
- setComponentIconOnTreeNode(container, node);
- return node;
- } else {
- setComponentIconOnTreeNode(container, branch);
- return branch;
- }
- }
-
- if (container instanceof Sequence<?>) {
- TreeBranch branch = new TreeBranch(nameForObject(container));
- Iterable<Object> sequence = (Iterable<Object>) container;
- for (Object child : sequence) {
- TreeNode childBranch = analyseObjectTree(child);
- branch.add(childBranch);
- }
- setComponentIconOnTreeNode(container, branch);
- return branch;
- }
-
- TreeNode node = new TreeNode(nameForObject(container));
- setComponentIconOnTreeNode(container, node);
- return node;
- }
-
- private void setComponentIconOnTreeNode(Object container, TreeNode branch) {
- componentToTreeNode.put(container, branch);
- branch.setUserData(container);
- setComponentIconOnTreeNode(branch, container);
- }
-
- private static void setComponentIconOnTreeNode(TreeNode treeNode, Object comp) {
- String resource = null;
- if (comp instanceof Label) {
- resource = "label.png";
- }
- if (comp instanceof ImageView) {
- resource = "/org/apache/pivot/tutorials/IMG_0725_2.jpg";
- }
- if (comp instanceof PushButton) {
- resource = "pushbutton.png";
- }
- if (comp instanceof RadioButton) {
- resource = "radiobutton.png";
- }
- if (comp instanceof Checkbox) {
- resource = "checkbox.png";
- }
- if (comp instanceof LinkButton) {
- resource = "linkbutton.png";
- }
- if (comp instanceof TablePane) {
- resource = "tablepane.png";
- }
- if (resource != null) {
- URL url = BXMLExplorerDocument.class.getResource(resource);
- if (url == null) {
- throw new IllegalStateException("could not load resource " + resource);
- }
- treeNode.setIcon(url);
- }
- }
-
- private String nameForObject(Object obj) {
- if (obj instanceof FakeWindow) {
- obj = ((FakeWindow) obj).window;
- }
- String bxmlID = widgetToID.get(obj);
- if (bxmlID == null) {
- return obj.getClass().getSimpleName();
- } else {
- return obj.getClass().getSimpleName() + " " + bxmlID;
- }
- }
-
- private static class MyTreeViewNodeRenderer extends TreeViewNodeRenderer {
- public MyTreeViewNodeRenderer() {
- setFillIcon(true);
- setIconWidth(32);
- setIconHeight(32);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tutorials.bxmlexplorer;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.pivot.beans.BXML;
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.beans.BeanAdapter;
+import org.apache.pivot.beans.Bindable;
+import org.apache.pivot.beans.DefaultProperty;
+import org.apache.pivot.collections.List;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.collections.Sequence;
+import org.apache.pivot.collections.Sequence.Tree.Path;
+import org.apache.pivot.serialization.SerializationException;
+import org.apache.pivot.tutorials.bxmlexplorer.tools.ComponentPropertyInspector;
+import org.apache.pivot.tutorials.bxmlexplorer.tools.ComponentStyleInspector;
+import org.apache.pivot.util.Resources;
+import org.apache.pivot.wtk.ButtonPressListener;
+import org.apache.pivot.wtk.CardPane;
+import org.apache.pivot.wtk.Checkbox;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.ComponentMouseButtonListener;
+import org.apache.pivot.wtk.ImageView;
+import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.LinkButton;
+import org.apache.pivot.wtk.Mouse.Button;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.RadioButton;
+import org.apache.pivot.wtk.TablePane;
+import org.apache.pivot.wtk.TextPane;
+import org.apache.pivot.wtk.TreeView;
+import org.apache.pivot.wtk.TreeView.SelectMode;
+import org.apache.pivot.wtk.TreeViewSelectionListener;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtk.content.TreeBranch;
+import org.apache.pivot.wtk.content.TreeNode;
+import org.apache.pivot.wtk.content.TreeViewNodeRenderer;
+import org.apache.pivot.wtk.effects.Decorator;
+import org.apache.pivot.wtk.effects.ShadeDecorator;
+import org.xml.sax.SAXException;
+
+public class BXMLExplorerDocument extends CardPane implements Bindable {
+ @BXML
+ private TreeView treeView;
+ @BXML
+ private CardPane playgroundCardPane;
+ @BXML
+ private TextPane bxmlSourceTextPane;
+ @BXML
+ private ComponentPropertyInspector componentPropertyInspector;
+ @BXML
+ private ComponentStyleInspector componentStyleInspector;
+ @BXML
+ private PushButton reloadButton;
+
+ private File file;
+ private Component loadedComponent;
+ /**
+ * maps the WTK widgets -> bxml:id values
+ */
+ private HashMap<Object, String> widgetToID = null;
+ private HashMap<Object, TreeNode> componentToTreeNode = null;
+
+ public BXMLExplorerDocument() {
+ }
+
+ @Override
+ public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
+ treeView.setSelectMode(SelectMode.SINGLE);
+ treeView.setNodeRenderer(new MyTreeViewNodeRenderer());
+ treeView.getTreeViewSelectionListeners().add(new TreeViewSelectionListener.Adapter() {
+ private final Decorator focusDecorator = new ShadeDecorator(0.2f, Color.RED);
+ private Component previousSelectedComponent = null;
+
+ @Override
+ public void selectedNodeChanged(TreeView treeView, Object previousSelectedNode) {
+ TreeNode node = (TreeNode) treeView.getSelectedNode();
+ if (previousSelectedComponent != null
+ && previousSelectedComponent.getDecorators().indexOf(focusDecorator) > -1) {
+ previousSelectedComponent.getDecorators().remove(focusDecorator);
+ previousSelectedComponent = null;
+ }
+ if (node == null || !(node.getUserData() instanceof Component)) {
+ // TODO make the inspectors able to deal with things like
+ // TablePane.Row
+ componentPropertyInspector.setSource(null);
+ componentStyleInspector.setSource(null);
+ return;
+ }
+ Component selectedComp = (Component) node.getUserData();
+ if (selectedComp != null
+ && selectedComp.getDecorators().indexOf(focusDecorator) == -1) {
+ selectedComp.getDecorators().add(focusDecorator);
+ previousSelectedComponent = selectedComp;
+ }
+
+ if (selectedComp instanceof FakeWindow) {
+ selectedComp = ((FakeWindow) selectedComp).window;
+ }
+ componentPropertyInspector.setSource(selectedComp);
+ componentStyleInspector.setSource(selectedComp);
+ }
+
+ @Override
+ public void selectedPathsChanged(TreeView treeView, Sequence<Path> previousSelectedPaths) {
+ // if the selection becomes empty, remove the decorator
+ if (treeView.getSelectedNode() == null && previousSelectedComponent != null
+ && previousSelectedComponent.getDecorators().indexOf(focusDecorator) > -1) {
+ previousSelectedComponent.getDecorators().remove(focusDecorator);
+ }
+ }
+
+ });
+
+ playgroundCardPane.getComponentMouseButtonListeners().add(
+ new ComponentMouseButtonListener.Adapter() {
+ @Override
+ public boolean mouseClick(Component component, Button button, int x, int y,
+ int count) {
+ if (count == 1) {
+ Component comp = playgroundCardPane.getDescendantAt(x, y);
+ if (comp != null) {
+ TreeNode treeNode = componentToTreeNode.get(comp);
+ Path path = getPathForNode(treeView, treeNode);
+ if (path != null) {
+ treeView.setSelectedPath(path);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ });
+
+ reloadButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(org.apache.pivot.wtk.Button button) {
+ playgroundCardPane.remove(loadedComponent);
+ widgetToID = null;
+ componentToTreeNode = null;
+ loadedComponent = null;
+ try {
+ load(file);
+ } catch (RuntimeException exception) {
+ exception.printStackTrace();
+ BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
+ } catch (IOException exception) {
+ exception.printStackTrace();
+ BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
+ } catch (SerializationException exception) {
+ exception.printStackTrace();
+ BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
+ } catch (ParserConfigurationException exception) {
+ exception.printStackTrace();
+ BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
+ } catch (SAXException exception) {
+ exception.printStackTrace();
+ BXMLExplorer.displayLoadException(exception, BXMLExplorerDocument.this.getWindow());
+ }
+ }
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Path getPathForNode(TreeView treeView, TreeNode treeNode) {
+ List<Object> treeData = (List<Object>) treeView.getTreeData();
+ Sequence.Tree.ItemIterator<Object> itemIterator = Sequence.Tree.depthFirstIterator(treeData);
+ while (itemIterator.hasNext()) {
+ Object node = itemIterator.next();
+ if (node == treeNode) {
+ return itemIterator.getPath();
+ }
+ }
+ return null;
+ }
+
+ public File getLoadedFile() {
+ return file;
+ }
+
+ public void load(File f) throws IOException, SerializationException, ParserConfigurationException, SAXException {
+ BXMLSerializer serializer = new BXMLSerializer();
+ serializer.setLocation(f.toURI().toURL());
+ final FileInputStream in = new FileInputStream(f);
+ try {
+ Object obj = serializer.readObject(in);
+ if (!(obj instanceof Component)) {
+ throw new IllegalStateException("obj " + obj + " is of class " + obj.getClass()
+ + " which is not a subtype of Component");
+ }
+ // create an inverse map so we can IDs for widgets
+ widgetToID = new HashMap<Object, String>();
+ for (String key : serializer.getNamespace()) {
+ widgetToID.put(serializer.getNamespace().get(key), key);
+ }
+ // we can't add a Window into the component hierarchy, so fake it
+ if (obj instanceof Window) {
+ obj = new FakeWindow((Window) obj);
+ }
+ // create the explorer tree
+ componentToTreeNode = new HashMap<Object, TreeNode>();
+ // the root node is not visible
+ final TreeBranch rootbranch = new TreeBranch("");
+ rootbranch.add(analyseObjectTree(obj));
+ treeView.setTreeData(rootbranch);
+ treeView.expandAll();
+ // add the loaded widget to the display
+ this.loadedComponent = (Component) obj;
+ playgroundCardPane.add((Component) obj);
+ } finally {
+ in.close();
+ }
+ final FileInputStream in2 = new FileInputStream(f);
+ try {
+ CreateHighlightedXML xml = new CreateHighlightedXML();
+ bxmlSourceTextPane.setDocument(xml.prettyPrint(in2));
+ } finally {
+ in2.close();
+ }
+ this.file = f;
+ }
+
+ @SuppressWarnings("unchecked")
+ private TreeNode analyseObjectTree(Object container) {
+ // We don't want the RowSequence object to show up in the tree, it doesn't look neat
+ if (container instanceof TablePane) {
+ TreeBranch branch = new TreeBranch(nameForObject(container));
+ TablePane table = (TablePane) container;
+ for (TablePane.Row row : table.getRows()) {
+ TreeNode childBranch = analyseObjectTree(row);
+ branch.add(childBranch);
+ }
+ setComponentIconOnTreeNode(container, branch);
+ return branch;
+ }
+
+ // We don't want to analyse the components that are added as part of the
+ // skin, so use similar logic to BXMLSerializer
+ DefaultProperty defaultProperty = container.getClass().getAnnotation(DefaultProperty.class);
+ if (defaultProperty != null) {
+ TreeBranch branch = new TreeBranch(nameForObject(container));
+ String defaultPropertyName = defaultProperty.value();
+ BeanAdapter beanAdapter = new BeanAdapter(container);
+ if (!beanAdapter.containsKey(defaultPropertyName)) {
+ throw new IllegalStateException("default property " + defaultPropertyName
+ + " not found on " + container);
+ }
+ Object defaultPropertyValue = beanAdapter.get(defaultPropertyName);
+ if (defaultPropertyValue != null) {
+ if (defaultPropertyValue instanceof Component) {
+ TreeNode childBranch = analyseObjectTree(defaultPropertyValue);
+ branch.add(childBranch);
+ }
+ }
+ // An empty branch looks untidy if it has an arrow next to it,
+ // so make empty branches into nodes.
+ if (branch.isEmpty()) {
+ TreeNode node = new TreeNode(branch.getText());
+ setComponentIconOnTreeNode(container, node);
+ return node;
+ } else {
+ setComponentIconOnTreeNode(container, branch);
+ return branch;
+ }
+ }
+
+ if (container instanceof Sequence<?>) {
+ TreeBranch branch = new TreeBranch(nameForObject(container));
+ Iterable<Object> sequence = (Iterable<Object>) container;
+ for (Object child : sequence) {
+ TreeNode childBranch = analyseObjectTree(child);
+ branch.add(childBranch);
+ }
+ setComponentIconOnTreeNode(container, branch);
+ return branch;
+ }
+
+ TreeNode node = new TreeNode(nameForObject(container));
+ setComponentIconOnTreeNode(container, node);
+ return node;
+ }
+
+ private void setComponentIconOnTreeNode(Object container, TreeNode branch) {
+ componentToTreeNode.put(container, branch);
+ branch.setUserData(container);
+ setComponentIconOnTreeNode(branch, container);
+ }
+
+ private static void setComponentIconOnTreeNode(TreeNode treeNode, Object comp) {
+ String resource = null;
+ if (comp instanceof Label) {
+ resource = "label.png";
+ }
+ if (comp instanceof ImageView) {
+ resource = "/org/apache/pivot/tutorials/IMG_0725_2.jpg";
+ }
+ if (comp instanceof PushButton) {
+ resource = "pushbutton.png";
+ }
+ if (comp instanceof RadioButton) {
+ resource = "radiobutton.png";
+ }
+ if (comp instanceof Checkbox) {
+ resource = "checkbox.png";
+ }
+ if (comp instanceof LinkButton) {
+ resource = "linkbutton.png";
+ }
+ if (comp instanceof TablePane) {
+ resource = "tablepane.png";
+ }
+ if (resource != null) {
+ URL url = BXMLExplorerDocument.class.getResource(resource);
+ if (url == null) {
+ throw new IllegalStateException("could not load resource " + resource);
+ }
+ treeNode.setIcon(url);
+ }
+ }
+
+ private String nameForObject(Object obj) {
+ if (obj instanceof FakeWindow) {
+ obj = ((FakeWindow) obj).window;
+ }
+ String bxmlID = widgetToID.get(obj);
+ if (bxmlID == null) {
+ return obj.getClass().getSimpleName();
+ } else {
+ return obj.getClass().getSimpleName() + " " + bxmlID;
+ }
+ }
+
+ private static class MyTreeViewNodeRenderer extends TreeViewNodeRenderer {
+ public MyTreeViewNodeRenderer() {
+ setFillIcon(true);
+ setIconWidth(32);
+ setIconHeight(32);
+ }
+ }
+
+}
Propchange: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
------------------------------------------------------------------------------
svn:eol-style = native