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/05/02 01:48:51 UTC
svn commit: r1098443 - in
/pivot/trunk/tests/src/org/apache/pivot/tests/issues: Pivot734.java
pivot_734.bxml
Author: smartini
Date: Sun May 1 23:48:50 2011
New Revision: 1098443
URL: http://svn.apache.org/viewvc?rev=1098443&view=rev
Log:
Simple Test to see the issue PIVOT-734
Added:
pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot734.java
pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_734.bxml
Added: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot734.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot734.java?rev=1098443&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot734.java (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot734.java Sun May 1 23:48:50 2011
@@ -0,0 +1,110 @@
+/*
+ * 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.tests.issues;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.collections.Sequence;
+import org.apache.pivot.collections.Sequence.Tree.Path;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Button;
+import org.apache.pivot.wtk.ButtonPressListener;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.TreeView;
+import org.apache.pivot.wtk.TreeViewSelectionListener;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtk.content.TreeBranch;
+
+public class Pivot734 implements Application {
+
+ private Window window = null;
+ private TreeView tree;
+ private PushButton treeAddButton;
+
+ public Pivot734() {
+
+ }
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ BXMLSerializer bxmlSerializer = new BXMLSerializer();
+ window = (Window) bxmlSerializer.readObject(Pivot734.class, "pivot_734.bxml");
+ controlTree(bxmlSerializer);
+ window.open(display);
+ }
+
+ private void controlTree(BXMLSerializer bxmlSerializer) {
+ treeAddButton = (PushButton) bxmlSerializer.getNamespace().get("treeAddButton");
+ tree = (TreeView) bxmlSerializer.getNamespace().get("tree");
+ tree.getTreeViewSelectionListeners().add(new TreeViewSelectionListener() {
+
+ public void selectedPathAdded(TreeView treeView, Path path) {
+ System.out.println("selectedPathAdded");
+ }
+
+ public void selectedPathRemoved(TreeView treeView, Path path) {
+ System.out.println("selectedPathRemoved");
+ }
+
+ public void selectedPathsChanged(TreeView treeView, Sequence<Path> previousSelectedPaths) {
+ System.out.println("selectedPathsChanged");
+ }
+
+ public void selectedNodeChanged(TreeView treeView, Object previousSelectedNode) {
+ System.out.println("selectedNodeChanged");
+ }
+ });
+ treeAddButton.getButtonPressListeners().add(new ButtonPressListener() {
+
+ public void buttonPressed(Button button) {
+ Object x = tree.getSelectedNode();
+ System.out.println("add a new element to :: " + x);
+
+ if (x != null && x instanceof TreeBranch)
+ {
+ TreeBranch treeBranch = new TreeBranch("new branch");
+ ((TreeBranch)x).add(treeBranch);
+ }
+
+ }
+ });
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(Pivot734.class, args);
+ }
+
+}
Added: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_734.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_734.bxml?rev=1098443&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_734.bxml (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_734.bxml Sun May 1 23:48:50 2011
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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="Tree Views" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:app="org.apache.pivot.tests.issues"
+ xmlns:content="org.apache.pivot.wtk.content"
+ xmlns="org.apache.pivot.wtk"
+>
+ <Border>
+
+ <BoxPane orientation="horizontal">
+ <BoxPane orientation="vertical">
+ <PushButton bxml:id="treeAddButton" buttonData="add"/>
+ <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+ <!--
+ <TreeView bxml:id="tree" styles="{}">
+ //-->
+ <TreeView bxml:id="tree" styles="{showEmptyBranchControls:false}">
+ <treeData>
+ <content:TreeBranch >
+ <content:TreeBranch text="Activity">
+ <content:TreeNode text="Camping" />
+ </content:TreeBranch>
+ <content:TreeBranch text="Occasion">
+ </content:TreeBranch>
+ <content:TreeBranch text="Games">
+ <content:TreeNode text="Foosball" />
+ <content:TreeNode text="Ping Pong" />
+ <content:TreeNode text="Air Hockey" />
+ </content:TreeBranch>
+ </content:TreeBranch>
+ </treeData>
+
+ </TreeView>
+ </ScrollPane>
+ </BoxPane>
+ </BoxPane>
+
+ </Border>
+
+</Window>