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 [3/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/SplashScreenTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/SplashScreenTest.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/SplashScreenTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/SplashScreenTest.java Sat Dec 24 16:07:37 2011
@@ -1,226 +1,226 @@
-/*
- * 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;
-
-import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.SplashScreen;
-import java.util.Date;
-import java.util.Random;
-
-import org.apache.pivot.beans.BXMLSerializer;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.util.concurrent.Task;
-import org.apache.pivot.util.concurrent.TaskExecutionException;
-import org.apache.pivot.util.concurrent.TaskListener;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.Container;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.Meter;
-import org.apache.pivot.wtk.Orientation;
-import org.apache.pivot.wtk.TaskAdapter;
-import org.apache.pivot.wtk.Window;
-
-/**
- * Test Application for demonstrating the <code>--preserveSplashScreen</code>
- * Pivot startup property.<br/>
- *
- * This desktop application simulates some task processing while a SplashScreen
- * is displayed, before forcing the Pivot host window to become visible which in
- * turn hides the SplashScreen.<br/>The progress of the simulated tasks is shown
- * using a Pivot Meter that paints onto the SplashScreen as the tasks
- * 'complete'. <br/><br/>
- *
- * If <code>--preserveSplashScreen</code> is set to <code>true</code> and there
- * is a SplashScreen, DesktopApplicationContext will not make the Pivot host
- * window visible until
- * {@link DesktopApplicationContext#replaceSplashScreen(Display)
- * replaceSplashScreen(Display)} is called.<br/><br/>
- *
- * If <code>--preserveSplashScreen</code> is set to <code>false</code>, is not
- * supplied, or there is no SplashScreen, DesktopApplicationContext make the
- * Pivot host window visible as normal. Any calls to
- * {@link DesktopApplicationContext#replaceSplashScreen(Display)
- * replaceSplashScreen(Display)} will have no effect.<br/><br/>
- *
- * <b>Example usage</b> (all one line)
- * <pre>
- * java -classpath bin;
- * -splash:bin/org/apache/pivot/tests/splash.png
- * org.apache.pivot.tests.SplashScreenTest
- * --preserveSplashScreen=true
- * --fullScreen=false
- * </pre>
- *
- * @see SplashScreen
- * @see DesktopApplicationContext#replaceSplashScreen(Display)
- * @see DesktopApplicationContext#PRESERVE_SPLASH_SCREEN_ARGUMENT
- */
-public class SplashScreenTest implements Application {
-
- private static class SplashScreenProgressOverlay {
- private final SplashScreen splashScreen;
- private final Meter meter = new Meter(Orientation.HORIZONTAL);
- private Graphics2D graphics;
-
- private SplashScreenProgressOverlay() {
- this.splashScreen = SplashScreen.getSplashScreen();
- if (splashScreen != null) {
- configureMeter(256, 16);
- configureGraphics();
- }
- else {
- System.err.println("Splash Screen not found");
- }
- }
-
- // Increment the Meter by a percentage supplied as a double between
- // 0.0 and and 1.0 (representing 0% and 100% respectively)
- private void increment(final double increment) {
- if (splashScreen == null) {
- return ;
- }
-
- double percentage = meter.getPercentage() + increment;
- meter.setPercentage(Math.min(percentage, 1.0f));
- if (splashScreen != null) {
- meter.paint(graphics);
- splashScreen.update();
- }
- System.out.println(String.format("Completed : %3.0f%%", getPercentage() * 100));
- }
-
- private double getPercentage() {
- return meter.getPercentage();
- }
-
- private void configureMeter(final int width, final int height) {
- meter.setSize(width, height);
- meter.setPercentage(0);
- meter.getStyles().put("gridFrequency", 1);
- }
-
- // Align the Meter on the SplashScreen, centered horizontally,
- // 10 pixels from the bottom edge
- private void configureGraphics() {
- Rectangle splash = splashScreen.getBounds();
- int x = ((splash.width - meter.getBounds().width) / 2);
- int y = (splash.height - meter.getBounds().height - 10);
- graphics = splashScreen.createGraphics();
- graphics.translate(x, y);
- }
- }
-
-
- @Override
- public void startup(final Display display, Map<String, String> properties) throws Exception {
-
- System.out.println("Startup the application at " + new Date());
- System.out.println("To show the Splash Screen, remember to run with the arguments: "
- + "-splash:/org/apache/pivot/tests/splash.png "
- + "--preserveSplashScreen=true "
- + ", or no splash screen will be shown"
- );
-
- // Create a Task that will load a BXML file and simulate some other
- // processing while updating a progress meter on the SplashScreen
- final Task<Void> prepareApplicationTask = new Task<Void>() {
- final SplashScreenProgressOverlay progressOverlay = new SplashScreenProgressOverlay();
-
- @Override
- public Void execute() throws TaskExecutionException {
- // Load the main BXML
- progressOverlay.increment(0);
- loadBXML(display, 0.1);
-
- // Simulate other tasks until the progress meter has been filled
- final Random random = new Random();
- while (progressOverlay.getPercentage() < 1.0) {
- // Short random sleep to simulate some processing
- try {
- Thread.sleep(random.nextInt(50) + 100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- // Update the progress meter by a random amount
- progressOverlay.increment((1 + random.nextInt(10)) / 100.0);
- }
- return null;
- }
-
- // Load the Pivot UI
- private void loadBXML(final Display display, final double weight) {
- try {
- Window window = (Window) new BXMLSerializer().readObject(this.getClass().getResource(
- "splash.bxml"));
- window.open(display);
- progressOverlay.increment(weight);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- };
-
- // Hide the SplashScreen when the Task finishes by making the Pivot host
- // window visible.
- final TaskListener<Void> taskListener = new TaskListener<Void>() {
- @Override
- public void taskExecuted(Task<Void> task) {
- finished();
- }
-
- @Override
- public void executeFailed(Task<Void> task) {
- System.err.println(String.format("Failed\n%s", task.getFault()));
- task.getFault().printStackTrace();
- finished();
- }
-
- private void finished() {
- DesktopApplicationContext.replaceSplashScreen(display);
- }
- };
-
- // Run the Task asynchronously
- prepareApplicationTask.execute(new TaskAdapter<Void>(taskListener));
- }
-
-
- public static void main(String[] args) {
- // Allow the BXML to be loaded on a background thread
- Container.setEventDispatchThreadChecker(null);
-
- // Start the application
- DesktopApplicationContext.main(SplashScreenTest.class, args);
- }
-
-
- @Override
- public boolean shutdown(boolean optional) throws Exception {
- System.out.println("Shutdown the application at " + new Date());
- return false;
- }
-
- @Override
- public void suspend() throws Exception {
- }
-
- @Override
- public void resume() throws Exception {
- }
-}
+/*
+ * 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;
+
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.SplashScreen;
+import java.util.Date;
+import java.util.Random;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.util.concurrent.Task;
+import org.apache.pivot.util.concurrent.TaskExecutionException;
+import org.apache.pivot.util.concurrent.TaskListener;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Container;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Meter;
+import org.apache.pivot.wtk.Orientation;
+import org.apache.pivot.wtk.TaskAdapter;
+import org.apache.pivot.wtk.Window;
+
+/**
+ * Test Application for demonstrating the <code>--preserveSplashScreen</code>
+ * Pivot startup property.<br/>
+ *
+ * This desktop application simulates some task processing while a SplashScreen
+ * is displayed, before forcing the Pivot host window to become visible which in
+ * turn hides the SplashScreen.<br/>The progress of the simulated tasks is shown
+ * using a Pivot Meter that paints onto the SplashScreen as the tasks
+ * 'complete'. <br/><br/>
+ *
+ * If <code>--preserveSplashScreen</code> is set to <code>true</code> and there
+ * is a SplashScreen, DesktopApplicationContext will not make the Pivot host
+ * window visible until
+ * {@link DesktopApplicationContext#replaceSplashScreen(Display)
+ * replaceSplashScreen(Display)} is called.<br/><br/>
+ *
+ * If <code>--preserveSplashScreen</code> is set to <code>false</code>, is not
+ * supplied, or there is no SplashScreen, DesktopApplicationContext make the
+ * Pivot host window visible as normal. Any calls to
+ * {@link DesktopApplicationContext#replaceSplashScreen(Display)
+ * replaceSplashScreen(Display)} will have no effect.<br/><br/>
+ *
+ * <b>Example usage</b> (all one line)
+ * <pre>
+ * java -classpath bin;
+ * -splash:bin/org/apache/pivot/tests/splash.png
+ * org.apache.pivot.tests.SplashScreenTest
+ * --preserveSplashScreen=true
+ * --fullScreen=false
+ * </pre>
+ *
+ * @see SplashScreen
+ * @see DesktopApplicationContext#replaceSplashScreen(Display)
+ * @see DesktopApplicationContext#PRESERVE_SPLASH_SCREEN_ARGUMENT
+ */
+public class SplashScreenTest implements Application {
+
+ private static class SplashScreenProgressOverlay {
+ private final SplashScreen splashScreen;
+ private final Meter meter = new Meter(Orientation.HORIZONTAL);
+ private Graphics2D graphics;
+
+ private SplashScreenProgressOverlay() {
+ this.splashScreen = SplashScreen.getSplashScreen();
+ if (splashScreen != null) {
+ configureMeter(256, 16);
+ configureGraphics();
+ }
+ else {
+ System.err.println("Splash Screen not found");
+ }
+ }
+
+ // Increment the Meter by a percentage supplied as a double between
+ // 0.0 and and 1.0 (representing 0% and 100% respectively)
+ private void increment(final double increment) {
+ if (splashScreen == null) {
+ return ;
+ }
+
+ double percentage = meter.getPercentage() + increment;
+ meter.setPercentage(Math.min(percentage, 1.0f));
+ if (splashScreen != null) {
+ meter.paint(graphics);
+ splashScreen.update();
+ }
+ System.out.println(String.format("Completed : %3.0f%%", getPercentage() * 100));
+ }
+
+ private double getPercentage() {
+ return meter.getPercentage();
+ }
+
+ private void configureMeter(final int width, final int height) {
+ meter.setSize(width, height);
+ meter.setPercentage(0);
+ meter.getStyles().put("gridFrequency", 1);
+ }
+
+ // Align the Meter on the SplashScreen, centered horizontally,
+ // 10 pixels from the bottom edge
+ private void configureGraphics() {
+ Rectangle splash = splashScreen.getBounds();
+ int x = ((splash.width - meter.getBounds().width) / 2);
+ int y = (splash.height - meter.getBounds().height - 10);
+ graphics = splashScreen.createGraphics();
+ graphics.translate(x, y);
+ }
+ }
+
+
+ @Override
+ public void startup(final Display display, Map<String, String> properties) throws Exception {
+
+ System.out.println("Startup the application at " + new Date());
+ System.out.println("To show the Splash Screen, remember to run with the arguments: "
+ + "-splash:/org/apache/pivot/tests/splash.png "
+ + "--preserveSplashScreen=true "
+ + ", or no splash screen will be shown"
+ );
+
+ // Create a Task that will load a BXML file and simulate some other
+ // processing while updating a progress meter on the SplashScreen
+ final Task<Void> prepareApplicationTask = new Task<Void>() {
+ final SplashScreenProgressOverlay progressOverlay = new SplashScreenProgressOverlay();
+
+ @Override
+ public Void execute() throws TaskExecutionException {
+ // Load the main BXML
+ progressOverlay.increment(0);
+ loadBXML(display, 0.1);
+
+ // Simulate other tasks until the progress meter has been filled
+ final Random random = new Random();
+ while (progressOverlay.getPercentage() < 1.0) {
+ // Short random sleep to simulate some processing
+ try {
+ Thread.sleep(random.nextInt(50) + 100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // Update the progress meter by a random amount
+ progressOverlay.increment((1 + random.nextInt(10)) / 100.0);
+ }
+ return null;
+ }
+
+ // Load the Pivot UI
+ private void loadBXML(final Display display, final double weight) {
+ try {
+ Window window = (Window) new BXMLSerializer().readObject(this.getClass().getResource(
+ "splash.bxml"));
+ window.open(display);
+ progressOverlay.increment(weight);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+
+ // Hide the SplashScreen when the Task finishes by making the Pivot host
+ // window visible.
+ final TaskListener<Void> taskListener = new TaskListener<Void>() {
+ @Override
+ public void taskExecuted(Task<Void> task) {
+ finished();
+ }
+
+ @Override
+ public void executeFailed(Task<Void> task) {
+ System.err.println(String.format("Failed\n%s", task.getFault()));
+ task.getFault().printStackTrace();
+ finished();
+ }
+
+ private void finished() {
+ DesktopApplicationContext.replaceSplashScreen(display);
+ }
+ };
+
+ // Run the Task asynchronously
+ prepareApplicationTask.execute(new TaskAdapter<Void>(taskListener));
+ }
+
+
+ public static void main(String[] args) {
+ // Allow the BXML to be loaded on a background thread
+ Container.setEventDispatchThreadChecker(null);
+
+ // Start the application
+ DesktopApplicationContext.main(SplashScreenTest.class, args);
+ }
+
+
+ @Override
+ public boolean shutdown(boolean optional) throws Exception {
+ System.out.println("Shutdown the application at " + new Date());
+ return false;
+ }
+
+ @Override
+ public void suspend() throws Exception {
+ }
+
+ @Override
+ public void resume() throws Exception {
+ }
+}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/SplashScreenTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java Sat Dec 24 16:07:37 2011
@@ -1,45 +1,45 @@
-/*
- * 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;
-
-import org.apache.pivot.json.JSON;
-import org.apache.pivot.wtk.content.TableViewCellRenderer;
-
-/**
- * Minimal sample for a customized version of table cell renderer.
- * Renders cell contents as a string, but in this case, transformed.
- * <br/>
- * Note that here it's possible to extends Label implements TableView.CellRenderer,
- * or even to extends directly TableViewCellRenderer
- * (because it extends Label and implements TableView.CellRenderer).
- */
-public class TableViewCellRendererCustom extends TableViewCellRenderer {
-
- @Override
- public String toString(Object row, String columnName) {
- Object cellData = JSON.get(row, columnName);
- String text = (cellData == null) ? null : cellData.toString();
- if (text == null) {
- return text;
- }
- else {
- // return new StringBuffer(text).reverse().toString(); // reverse text
- return text.toUpperCase(); // to upper text
- }
- }
-
-}
+/*
+ * 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;
+
+import org.apache.pivot.json.JSON;
+import org.apache.pivot.wtk.content.TableViewCellRenderer;
+
+/**
+ * Minimal sample for a customized version of table cell renderer.
+ * Renders cell contents as a string, but in this case, transformed.
+ * <br/>
+ * Note that here it's possible to extends Label implements TableView.CellRenderer,
+ * or even to extends directly TableViewCellRenderer
+ * (because it extends Label and implements TableView.CellRenderer).
+ */
+public class TableViewCellRendererCustom extends TableViewCellRenderer {
+
+ @Override
+ public String toString(Object row, String columnName) {
+ Object cellData = JSON.get(row, columnName);
+ String text = (cellData == null) ? null : cellData.toString();
+ if (text == null) {
+ return text;
+ }
+ else {
+ // return new StringBuffer(text).reverse().toString(); // reverse text
+ return text.toUpperCase(); // to upper text
+ }
+ }
+
+}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/TableViewCellRendererCustom.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java Sat Dec 24 16:07:37 2011
@@ -1,42 +1,42 @@
-/*
- * 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;
-
-/**
- * Test utilities methods.
- */
-public class TestUtils {
-
- private static final String NA = "not available";
-
- public TestUtils() {
- }
-
- static final void testJavaSecurity() {
- try {
- System.out.println("The current SecurityManager is: " + System.getSecurityManager());
-
- System.out.println("Your operating system is: " + System.getProperty("os.name", NA));
- System.out.println("The JVM you are running is: " + System.getProperty("java.version", NA));
- System.out.println("Your user home directory is: " + System.getProperty("user.home", NA));
- System.out.println("Your JRE installation directory is: " + System.getProperty("java.home", NA));
- } catch (Exception e) {
- System.err.println("Caught exception: " + e.toString());
- }
- }
-
-}
+/*
+ * 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;
+
+/**
+ * Test utilities methods.
+ */
+public class TestUtils {
+
+ private static final String NA = "not available";
+
+ public TestUtils() {
+ }
+
+ static final void testJavaSecurity() {
+ try {
+ System.out.println("The current SecurityManager is: " + System.getSecurityManager());
+
+ System.out.println("Your operating system is: " + System.getProperty("os.name", NA));
+ System.out.println("The JVM you are running is: " + System.getProperty("java.version", NA));
+ System.out.println("Your user home directory is: " + System.getProperty("user.home", NA));
+ System.out.println("Your JRE installation directory is: " + System.getProperty("java.home", NA));
+ } catch (Exception e) {
+ System.err.println("Caught exception: " + e.toString());
+ }
+ }
+
+}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/context_menus.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/context_menus.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/context_menus.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/context_menus.bxml Sat Dec 24 16:07:37 2011
@@ -1,53 +1,53 @@
-<?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.
--->
-
-<menus:ContextMenus title="Context Menus" maximized="true"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns:menus="org.apache.pivot.tests"
- xmlns="org.apache.pivot.wtk"
->
- <Border styles="{color:10}">
- <TablePane styles="{horizontalSpacing:1, verticalSpacing:1,
- showHorizontalGridLines:true, showVerticalGridLines:true,
- horizontalGridColor:10, verticalGridColor:10}"
- >
- <columns>
- <TablePane.Column width="1*"/>
- <TablePane.Column width="1*"/>
- </columns>
-
- <TablePane.Row height="1*">
- <ImageView image="@anchor.png">
- <userData description="anchor"/>
- </ImageView>
- <ImageView image="@bell.png">
- <userData description="bell"/>
- </ImageView>
- </TablePane.Row>
-
- <TablePane.Row height="1*">
- <ImageView image="@clock.png">
- <userData description="clock"/>
- </ImageView>
- <ImageView image="@cup.png">
- <userData description="cup"/>
- </ImageView>
- </TablePane.Row>
- </TablePane>
- </Border>
-</menus:ContextMenus>
+<?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.
+-->
+
+<menus:ContextMenus title="Context Menus" maximized="true"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:menus="org.apache.pivot.tests"
+ xmlns="org.apache.pivot.wtk"
+>
+ <Border styles="{color:10}">
+ <TablePane styles="{horizontalSpacing:1, verticalSpacing:1,
+ showHorizontalGridLines:true, showVerticalGridLines:true,
+ horizontalGridColor:10, verticalGridColor:10}"
+ >
+ <columns>
+ <TablePane.Column width="1*"/>
+ <TablePane.Column width="1*"/>
+ </columns>
+
+ <TablePane.Row height="1*">
+ <ImageView image="@anchor.png">
+ <userData description="anchor"/>
+ </ImageView>
+ <ImageView image="@bell.png">
+ <userData description="bell"/>
+ </ImageView>
+ </TablePane.Row>
+
+ <TablePane.Row height="1*">
+ <ImageView image="@clock.png">
+ <userData description="clock"/>
+ </ImageView>
+ <ImageView image="@cup.png">
+ <userData description="cup"/>
+ </ImageView>
+ </TablePane.Row>
+ </TablePane>
+ </Border>
+</menus:ContextMenus>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/context_menus.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/context_menus.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml Sat Dec 24 16:07:37 2011
@@ -1,27 +1,27 @@
-<?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.
--->
-
-<tests:CustomPanel title="Custom Panel Title" maximized="true" field="Field in Custom Panel"
- xmlns:bxml="http://pivot.apache.org/bxml"
- xmlns:tests="org.apache.pivot.tests"
- xmlns="org.apache.pivot.wtk">
- <BoxPane styles="{padding:4, horizontalAlignment:'center', verticalAlignment:'center'}">
- <Label text="Custom panel: Label"/>
- <TextInput bxml:id="textInput" text="Custom panel: TextInput" editable="false"/>
- </BoxPane>
-</tests:CustomPanel>
+<?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.
+-->
+
+<tests:CustomPanel title="Custom Panel Title" maximized="true" field="Field in Custom Panel"
+ xmlns:bxml="http://pivot.apache.org/bxml"
+ xmlns:tests="org.apache.pivot.tests"
+ xmlns="org.apache.pivot.wtk">
+ <BoxPane styles="{padding:4, horizontalAlignment:'center', verticalAlignment:'center'}">
+ <Label text="Custom panel: Label"/>
+ <TextInput bxml:id="textInput" text="Custom panel: TextInput" editable="false"/>
+ </BoxPane>
+</tests:CustomPanel>
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/custom_panel.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/dialog_test.bxml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/dialog_test.bxml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot686.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot686.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot686.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot686.java Sat Dec 24 16:07:37 2011
@@ -1,95 +1,95 @@
-/*
- * 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.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.TextInput;
-import org.apache.pivot.wtk.Window;
-
-public class Pivot686 implements Application {
- private Window window = null;
- private TextInput textInput = null;
- private PushButton pushButton = null;
-
- @Override
- public void startup(Display display, Map<String, String> properties)
- throws Exception {
- System.out.println("startup: start");
-
- BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (Window)bxmlSerializer.readObject(this.getClass(), "pivot_686.bxml");
- initializeFields(bxmlSerializer);
- window.open(display);
-
- textInput.requestFocus(); // force focus on TextInput, Ok when run as a Java Application
- System.out.println("textInput has focus: " + textInput.isFocused());
-
- System.out.println("startup: end");
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
- private void initializeFields(BXMLSerializer serializer) {
- System.out.println("initializeFields: start");
-
- textInput = (TextInput)serializer.getNamespace().get("textInput");
- textInput.requestFocus(); // note that this has no effect here
- System.out.println("textInput has focus: " + textInput.isFocused());
-
- pushButton = (PushButton)serializer.getNamespace().get("pushButton");
- pushButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- String msg = "You clicked me!";
- System.out.println(msg);
- // Alert.alert(MessageType.INFO, msg, window);
-
- textInput.setText("");
- textInput.requestFocus();
- }
- });
-
- System.out.println("initializeFields: end");
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(Pivot686.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.tests.issues;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+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.TextInput;
+import org.apache.pivot.wtk.Window;
+
+public class Pivot686 implements Application {
+ private Window window = null;
+ private TextInput textInput = null;
+ private PushButton pushButton = null;
+
+ @Override
+ public void startup(Display display, Map<String, String> properties)
+ throws Exception {
+ System.out.println("startup: start");
+
+ BXMLSerializer bxmlSerializer = new BXMLSerializer();
+ window = (Window)bxmlSerializer.readObject(this.getClass(), "pivot_686.bxml");
+ initializeFields(bxmlSerializer);
+ window.open(display);
+
+ textInput.requestFocus(); // force focus on TextInput, Ok when run as a Java Application
+ System.out.println("textInput has focus: " + textInput.isFocused());
+
+ System.out.println("startup: end");
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ private void initializeFields(BXMLSerializer serializer) {
+ System.out.println("initializeFields: start");
+
+ textInput = (TextInput)serializer.getNamespace().get("textInput");
+ textInput.requestFocus(); // note that this has no effect here
+ System.out.println("textInput has focus: " + textInput.isFocused());
+
+ pushButton = (PushButton)serializer.getNamespace().get("pushButton");
+ pushButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ String msg = "You clicked me!";
+ System.out.println(msg);
+ // Alert.alert(MessageType.INFO, msg, window);
+
+ textInput.setText("");
+ textInput.requestFocus();
+ }
+ });
+
+ System.out.println("initializeFields: end");
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(Pivot686.class, args);
+ }
+
+}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot686.java
------------------------------------------------------------------------------
svn:eol-style = native
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=1222994&r1=1222993&r2=1222994&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 Sat Dec 24 16:07:37 2011
@@ -1,215 +1,215 @@
-/*
- * 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 java.util.Date;
-
-import org.apache.pivot.beans.BXMLSerializer;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.Button;
-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;
-import org.apache.pivot.wtk.TreeView;
-import org.apache.pivot.wtk.Window;
-
-public class Pivot694 implements Application {
- private Window window = 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;
-
- private PushButton clearSelectionButton = null;
- private PushButton clearButton = null;
-
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- System.out.println("startup: start");
-
- System.out.println("Test for clearing (selection) in many Components");
-
- BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (Window)bxmlSerializer.readObject(this.getClass(), "pivot_694.bxml");
- 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");
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (window != null) {
- window.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
- private void initializeFields(BXMLSerializer serializer) {
- System.out.println("initializeFields: start");
-
-// 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");
-
- clearSelectionButton = (PushButton)serializer.getNamespace().get("clearSelectionButton");
- clearSelectionButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- System.out.println("Clearing selection from " + button.getName() + " at " + new Date());
-
-// TODO: for release 2.1 ... maybe generalizing some test here
-// pushButtons.clearSelection();
-// toggleButtons.clearSelection();
-// radioButtons.clearSelection();
-// checkButtons.clearSelection();
-// checkTriButtons.clearSelection();
-//
-// calendarButton.clearSelection();
-// spinner.clearSelection();
-//
-// listButton1.clearSelection();
-// listButton2.clearSelection();
-
- listView1.clearSelection();
- listView2.clearSelection();
- tableView1.clearSelection();
- tableView2.clearSelection();
- treeView1.clearSelection();
- treeView2.clearSelection();
-
- }
- });
-
- clearButton = (PushButton)serializer.getNamespace().get("clearButton");
- clearButton.getButtonPressListeners().add(new ButtonPressListener() {
- @Override
- public void buttonPressed(Button button) {
- System.out.println("Clearing data from " + button.getName() + " at " + new Date());
-
-// 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);
-
- // 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);
-
-// 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) ...
-
- }
- });
-
- 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);
- }
-
-}
+/*
+ * 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 java.util.Date;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.Button;
+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;
+import org.apache.pivot.wtk.TreeView;
+import org.apache.pivot.wtk.Window;
+
+public class Pivot694 implements Application {
+ private Window window = 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;
+
+ private PushButton clearSelectionButton = null;
+ private PushButton clearButton = null;
+
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ System.out.println("startup: start");
+
+ System.out.println("Test for clearing (selection) in many Components");
+
+ BXMLSerializer bxmlSerializer = new BXMLSerializer();
+ window = (Window)bxmlSerializer.readObject(this.getClass(), "pivot_694.bxml");
+ 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");
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (window != null) {
+ window.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ private void initializeFields(BXMLSerializer serializer) {
+ System.out.println("initializeFields: start");
+
+// 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");
+
+ clearSelectionButton = (PushButton)serializer.getNamespace().get("clearSelectionButton");
+ clearSelectionButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ System.out.println("Clearing selection from " + button.getName() + " at " + new Date());
+
+// TODO: for release 2.1 ... maybe generalizing some test here
+// pushButtons.clearSelection();
+// toggleButtons.clearSelection();
+// radioButtons.clearSelection();
+// checkButtons.clearSelection();
+// checkTriButtons.clearSelection();
+//
+// calendarButton.clearSelection();
+// spinner.clearSelection();
+//
+// listButton1.clearSelection();
+// listButton2.clearSelection();
+
+ listView1.clearSelection();
+ listView2.clearSelection();
+ tableView1.clearSelection();
+ tableView2.clearSelection();
+ treeView1.clearSelection();
+ treeView2.clearSelection();
+
+ }
+ });
+
+ clearButton = (PushButton)serializer.getNamespace().get("clearButton");
+ clearButton.getButtonPressListeners().add(new ButtonPressListener() {
+ @Override
+ public void buttonPressed(Button button) {
+ System.out.println("Clearing data from " + button.getName() + " at " + new Date());
+
+// 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);
+
+ // 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);
+
+// 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) ...
+
+ }
+ });
+
+ 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);
+ }
+
+}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot694.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java Sat Dec 24 16:07:37 2011
@@ -1,118 +1,118 @@
-/*
- * 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 java.io.IOException;
-
-import org.apache.pivot.beans.BXMLSerializer;
-import org.apache.pivot.collections.ArrayList;
-import org.apache.pivot.collections.Map;
-import org.apache.pivot.serialization.SerializationException;
-import org.apache.pivot.util.CalendarDate;
-import org.apache.pivot.wtk.Application;
-import org.apache.pivot.wtk.CalendarButton;
-import org.apache.pivot.wtk.CalendarButtonSelectionListener;
-import org.apache.pivot.wtk.DesktopApplicationContext;
-import org.apache.pivot.wtk.Dialog;
-import org.apache.pivot.wtk.DialogCloseListener;
-import org.apache.pivot.wtk.Display;
-import org.apache.pivot.wtk.Frame;
-import org.apache.pivot.wtk.ListButton;
-import org.apache.pivot.wtk.Window;
-
-public class Pivot714 implements Application {
-
- private Frame frame;
- private Dialog result;
- private Window owner;
- private DialogCloseListener dcl;
-
- public Pivot714() {
-
- }
-
- public Window getWindow(final Window owner) {
- this.owner = owner;
- final BXMLSerializer bxmlSerializer = new BXMLSerializer();
- try {
- result = (Dialog)bxmlSerializer.readObject(Pivot714.class.getResource("pivot_714.bxml"));
- } catch (IOException e) {
- e.printStackTrace();
- } catch (SerializationException e) {
- e.printStackTrace();
- }
-
- final ListButton motif = (ListButton)bxmlSerializer.getNamespace().get("motif");
-
- ArrayList<String> al = new ArrayList<String>();
- al.add("One");
- al.add("Two");
- motif.setListData(al);
-
- CalendarButton cbDate = (CalendarButton)bxmlSerializer.getNamespace().get("date");
- dcl = (new DialogCloseListener() {
- public void dialogClosed(Dialog dialog, boolean modal) {
- }
- });
- cbDate.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
- @Override
- public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
- }
- });
-
- return result;
- }
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- frame = new Frame();
- frame.setTitle("Pivot714");
-
- result = (Dialog) getWindow(frame.getRootOwner());
-
- frame.setPreferredSize(640, 480);
- frame.open(display);
-
- result.open(owner, dcl);
- }
-
- @Override
- public boolean shutdown(boolean optional) {
- if (result != null) {
- result.close();
- }
-
- if (frame != null) {
- frame.close();
- }
-
- return false;
- }
-
- @Override
- public void suspend() {
- }
-
- @Override
- public void resume() {
- }
-
- public static void main(String[] args) {
- DesktopApplicationContext.main(Pivot714.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.tests.issues;
+
+import java.io.IOException;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.ArrayList;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.serialization.SerializationException;
+import org.apache.pivot.util.CalendarDate;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.CalendarButton;
+import org.apache.pivot.wtk.CalendarButtonSelectionListener;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Dialog;
+import org.apache.pivot.wtk.DialogCloseListener;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.Frame;
+import org.apache.pivot.wtk.ListButton;
+import org.apache.pivot.wtk.Window;
+
+public class Pivot714 implements Application {
+
+ private Frame frame;
+ private Dialog result;
+ private Window owner;
+ private DialogCloseListener dcl;
+
+ public Pivot714() {
+
+ }
+
+ public Window getWindow(final Window owner) {
+ this.owner = owner;
+ final BXMLSerializer bxmlSerializer = new BXMLSerializer();
+ try {
+ result = (Dialog)bxmlSerializer.readObject(Pivot714.class.getResource("pivot_714.bxml"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (SerializationException e) {
+ e.printStackTrace();
+ }
+
+ final ListButton motif = (ListButton)bxmlSerializer.getNamespace().get("motif");
+
+ ArrayList<String> al = new ArrayList<String>();
+ al.add("One");
+ al.add("Two");
+ motif.setListData(al);
+
+ CalendarButton cbDate = (CalendarButton)bxmlSerializer.getNamespace().get("date");
+ dcl = (new DialogCloseListener() {
+ public void dialogClosed(Dialog dialog, boolean modal) {
+ }
+ });
+ cbDate.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
+ @Override
+ public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
+ }
+ });
+
+ return result;
+ }
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ frame = new Frame();
+ frame.setTitle("Pivot714");
+
+ result = (Dialog) getWindow(frame.getRootOwner());
+
+ frame.setPreferredSize(640, 480);
+ frame.open(display);
+
+ result.open(owner, dcl);
+ }
+
+ @Override
+ public boolean shutdown(boolean optional) {
+ if (result != null) {
+ result.close();
+ }
+
+ if (frame != null) {
+ frame.close();
+ }
+
+ return false;
+ }
+
+ @Override
+ public void suspend() {
+ }
+
+ @Override
+ public void resume() {
+ }
+
+ public static void main(String[] args) {
+ DesktopApplicationContext.main(Pivot714.class, args);
+ }
+
+}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot714.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot718.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot718.java?rev=1222994&r1=1222993&r2=1222994&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot718.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot718.java Sat Dec 24 16:07:37 2011
@@ -1,154 +1,154 @@
-/*
- * 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.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.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.ListView;
-import org.apache.pivot.wtk.ListViewSelectionListener;
-import org.apache.pivot.wtk.PushButton;
-import org.apache.pivot.wtk.Span;
-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;
-import org.apache.pivot.wtk.content.TreeNode;
-
-public class Pivot718 implements Application {
-
- private Window window = null;
- private TreeView tree;
- private PushButton treeDelButton;
- private ListView list;
- private PushButton listDelButton;
-
- public Pivot718() {
-
- }
-
- @Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
- BXMLSerializer bxmlSerializer = new BXMLSerializer();
- window = (Window) bxmlSerializer.readObject(Pivot718.class, "pivot_718.bxml");
-
- controlTree(bxmlSerializer);
- controlList(bxmlSerializer);
-
- window.open(display);
- }
-
- private void controlList(BXMLSerializer bxmlSerializer) {
- listDelButton = (PushButton) bxmlSerializer.getNamespace().get("listDelButton");
- list = (ListView) bxmlSerializer.getNamespace().get("list");
- list.getListViewSelectionListeners().add(new ListViewSelectionListener() {
-
- public void selectedRangeAdded(ListView listView, int rangeStart, int rangeEnd) {
- System.out.println("selectedRangeAdded");
- }
-
- public void selectedRangeRemoved(ListView listView, int rangeStart, int rangeEnd) {
- System.out.println("selectedRangeRemoved");
- }
-
- public void selectedRangesChanged(ListView listView,
- Sequence<Span> previousSelectedRanges) {
- System.out.println("selectedRangesChanged");
- }
-
- public void selectedItemChanged(ListView listView, Object previousSelectedItem) {
- System.out.println("selectedItemChanged :::" + listView.getSelectedItem());
- }
- });
- listDelButton.getButtonPressListeners().add(new ButtonPressListener() {
-
- @SuppressWarnings("unchecked")
- public void buttonPressed(Button button) {
- Object x = list.getSelectedItem();
- System.out.println("delete :: " + x);
- // List data = list.getListData();
- List<Object> data = (List<Object>) list.getListData();
- data.remove(x);
- }
- });
- }
-
- private void controlTree(BXMLSerializer bxmlSerializer) {
- treeDelButton = (PushButton) bxmlSerializer.getNamespace().get("treeDelButton");
- 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");
- }
- });
- treeDelButton.getButtonPressListeners().add(new ButtonPressListener() {
-
- public void buttonPressed(Button button) {
- TreeNode selectedNode = (TreeNode) tree.getSelectedNode();
- System.out.println("delete :: " + selectedNode);
- if (selectedNode != null) {
- TreeBranch parent = selectedNode.getParent();
- if (parent != null) {
- parent.remove(selectedNode);
- }
- }
- }
- });
- }
-
- @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(Pivot718.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.tests.issues;
+
+import org.apache.pivot.beans.BXMLSerializer;
+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.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.ListView;
+import org.apache.pivot.wtk.ListViewSelectionListener;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.Span;
+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;
+import org.apache.pivot.wtk.content.TreeNode;
+
+public class Pivot718 implements Application {
+
+ private Window window = null;
+ private TreeView tree;
+ private PushButton treeDelButton;
+ private ListView list;
+ private PushButton listDelButton;
+
+ public Pivot718() {
+
+ }
+
+ @Override
+ public void startup(Display display, Map<String, String> properties) throws Exception {
+ BXMLSerializer bxmlSerializer = new BXMLSerializer();
+ window = (Window) bxmlSerializer.readObject(Pivot718.class, "pivot_718.bxml");
+
+ controlTree(bxmlSerializer);
+ controlList(bxmlSerializer);
+
+ window.open(display);
+ }
+
+ private void controlList(BXMLSerializer bxmlSerializer) {
+ listDelButton = (PushButton) bxmlSerializer.getNamespace().get("listDelButton");
+ list = (ListView) bxmlSerializer.getNamespace().get("list");
+ list.getListViewSelectionListeners().add(new ListViewSelectionListener() {
+
+ public void selectedRangeAdded(ListView listView, int rangeStart, int rangeEnd) {
+ System.out.println("selectedRangeAdded");
+ }
+
+ public void selectedRangeRemoved(ListView listView, int rangeStart, int rangeEnd) {
+ System.out.println("selectedRangeRemoved");
+ }
+
+ public void selectedRangesChanged(ListView listView,
+ Sequence<Span> previousSelectedRanges) {
+ System.out.println("selectedRangesChanged");
+ }
+
+ public void selectedItemChanged(ListView listView, Object previousSelectedItem) {
+ System.out.println("selectedItemChanged :::" + listView.getSelectedItem());
+ }
+ });
+ listDelButton.getButtonPressListeners().add(new ButtonPressListener() {
+
+ @SuppressWarnings("unchecked")
+ public void buttonPressed(Button button) {
+ Object x = list.getSelectedItem();
+ System.out.println("delete :: " + x);
+ // List data = list.getListData();
+ List<Object> data = (List<Object>) list.getListData();
+ data.remove(x);
+ }
+ });
+ }
+
+ private void controlTree(BXMLSerializer bxmlSerializer) {
+ treeDelButton = (PushButton) bxmlSerializer.getNamespace().get("treeDelButton");
+ 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");
+ }
+ });
+ treeDelButton.getButtonPressListeners().add(new ButtonPressListener() {
+
+ public void buttonPressed(Button button) {
+ TreeNode selectedNode = (TreeNode) tree.getSelectedNode();
+ System.out.println("delete :: " + selectedNode);
+ if (selectedNode != null) {
+ TreeBranch parent = selectedNode.getParent();
+ if (parent != null) {
+ parent.remove(selectedNode);
+ }
+ }
+ }
+ });
+ }
+
+ @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(Pivot718.class, args);
+ }
+
+}
Propchange: pivot/trunk/tests/src/org/apache/pivot/tests/issues/Pivot718.java
------------------------------------------------------------------------------
svn:eol-style = native