changeset 34:12755a7f1135

JemmyFX: accordion minor fixes
author Oleg Barbashov <oleg.barbashov@oracle.com>
date Wed, 20 Jun 2012 18:17:43 +0400
parents 1a668f909aca
children 10bce7582356
files tools/Jemmy/JemmyFX/samples/org/jemmy/samples/accordion/AccordionApp.java tools/Jemmy/JemmyFX/samples/org/jemmy/samples/accordion/AccordionSample.java tools/Jemmy/JemmyFX/samples/org/jemmy/samples/accordion/AccordionTest.java tools/Jemmy/JemmyFX/samples/org/jemmy/samples/input/MouseDNDSample.java tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/AccordionWrap.java
diffstat 5 files changed, 149 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/accordion/AccordionApp.java	Wed Jun 20 17:11:33 2012 +0400
+++ b/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/accordion/AccordionApp.java	Wed Jun 20 18:17:43 2012 +0400
@@ -1,6 +1,26 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
 
 package org.jemmy.samples.accordion;
@@ -9,8 +29,6 @@
 import javafx.application.Application;
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
-import javafx.geometry.Pos;
-import javafx.scene.Node;
 import javafx.scene.Scene;
 import javafx.scene.control.Accordion;
 import javafx.scene.control.Button;
@@ -19,13 +37,29 @@
 import javafx.scene.layout.VBox;
 import javafx.stage.Stage;
 
+/**
+ * This small FX app is used in Accordion JemmyFX samples. It displays an Accordion control that contains two titled panes.
+ * Button "reset" is used to return accordion to initial state.
+ *
+ */
+
 public class AccordionApp extends Application {
     Accordion accordion = new Accordion();
 
+    /**
+     *
+     * @param args
+     * @throws AWTException
+     */
     public static void main(String[] args) throws AWTException {
         launch(args);
     }
 
+    /**
+     *
+     * @param stage
+     * @throws Exception
+     */
     @Override
     public void start(Stage stage) throws Exception {
         VBox box = new VBox();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/accordion/AccordionSample.java	Wed Jun 20 18:17:43 2012 +0400
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.jemmy.samples.accordion;
+
+import javafx.scene.control.Accordion;
+import org.jemmy.fx.AppExecutor;
+import org.jemmy.fx.SceneDock;
+import org.jemmy.fx.control.AccordionDock;
+import org.jemmy.fx.control.LabeledDock;
+import org.jemmy.fx.control.TitledPaneDock;
+import org.jemmy.resources.StringComparePolicy;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AccordionSample {
+    static SceneDock scene;
+    
+    @BeforeClass
+    public static void launch() {
+        AppExecutor.executeNoBlock(AccordionApp.class);
+        scene = new SceneDock();
+    }
+
+    @Before
+    public void reset() {
+        new LabeledDock(scene.asParent(), "Reset", StringComparePolicy.EXACT).mouse().click();
+    }
+
+    /**
+     * How to expand TitledPane of Accordion control by title of TitledPane using Selectable interface.
+     */
+    @Test
+    public void selectByTitle() {
+        new AccordionDock(scene.asParent(), Accordion.class).
+                asTitleSelectable().selector().select("First pane");
+    }
+
+    /**
+     * How to expand TitledPane of Accordion control by TitledPane object using Selectable interface.
+     */
+    @Test
+    public void selectByTitlePane() {
+        AccordionDock accordion = new AccordionDock(scene.asParent(), Accordion.class);
+        // first you need find a titled pane you are going to select
+        TitledPaneDock first_pane = new TitledPaneDock(scene.asParent(), "First pane", StringComparePolicy.EXACT);
+        // then select it through selectable interface
+        accordion.asTitledPaneSelectable().selector().select(first_pane.wrap().getControl());
+    }
+
+    /**
+     * How to expand or collapse a single TitledPane.
+     */
+    @Test
+    public void expandAndCollapse() {
+        // you could manually collapse the expanded titled pane
+        new TitledPaneDock(new AccordionDock(scene.asParent(), Accordion.class).asParent(), "Second pane", StringComparePolicy.EXACT).
+                asCollapsible().collapse();
+        // similarly, you can expand
+        // note that titled pane is just another node an so you can find it within any container
+        new TitledPaneDock(scene.asParent(), "First pane", StringComparePolicy.EXACT).asExpandable().expand();
+    }
+
+    /**
+     * How to collapse everything.
+     */
+    @Test
+    public void collapseTitlePane() {
+        // you can collapse everything by selecting null
+        new AccordionDock(scene.asParent(), Accordion.class).asTitleSelectable().selector().select(null);
+    }
+
+    /**
+     * How to use properties.
+     */
+    @Test
+    public void properties() {
+        AccordionDock accordion = new AccordionDock(scene.asParent(), Accordion.class);
+        // you can use following properties: SelectedTitle, Titles, SelectedTitledPane, TitledPanes
+        Assert.assertEquals(accordion.getSelectedTitle(), accordion.getTitles().get(1));
+        Assert.assertEquals(accordion.getSelectedTitledPane(), accordion.getTitledPanes().get(1));
+    }
+}
--- a/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/accordion/AccordionTest.java	Wed Jun 20 17:11:33 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.jemmy.samples.accordion;
-
-import javafx.scene.control.Accordion;
-import org.jemmy.fx.AppExecutor;
-import org.jemmy.fx.SceneDock;
-import org.jemmy.fx.control.AccordionDock;
-import org.jemmy.fx.control.LabeledDock;
-import org.jemmy.fx.control.TitledPaneDock;
-import org.jemmy.resources.StringComparePolicy;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AccordionTest {
-    static SceneDock scene;
-    
-    @BeforeClass
-    public static void launch() {
-        AppExecutor.executeNoBlock(AccordionApp.class);
-        scene = new SceneDock();
-    }
-
-    @Before
-    public void reset() {
-        new LabeledDock(scene.asParent(), "Reset", StringComparePolicy.EXACT).mouse().click();
-    }
-
-    /**
-     * How to expand TitledPane of Accordion control by title of TitledPane using Selectable interface.
-     */
-    @Test
-    public void selectByTitle() {
-        new AccordionDock(scene.asParent(), Accordion.class).
-                asTitleSelectable().selector().select("First pane");
-    }
-
-    /**
-     * How to expand TitledPane of Accordion control by TitledPane object using Selectable interface.
-     */
-    @Test
-    public void selectByTitlePane() {
-        AccordionDock accordion = new AccordionDock(scene.asParent(), Accordion.class);
-        // first you need find a titled pane you are going to select
-        TitledPaneDock first_pane = new TitledPaneDock(scene.asParent(), "First pane", StringComparePolicy.EXACT);
-        // then select it through selectable interface
-        accordion.asTitledPaneSelectable().selector().select(first_pane.wrap().getControl());
-    }
-
-    /**
-     * How to expand or collapse a single TitledPane.
-     */
-    @Test
-    public void expandAndCollapse() {
-        // you could manually collapse the expanded titled pane
-        new TitledPaneDock(new AccordionDock(scene.asParent(), Accordion.class).asParent(), "Second pane", StringComparePolicy.EXACT).
-                asCollapsible().collapse();
-        // similarly, you can expand
-        // note that titled pane is just another node an so you can find it within any container
-        new TitledPaneDock(scene.asParent(), "First pane", StringComparePolicy.EXACT).asExpandable().expand();
-    }
-
-    /**
-     * How to collapse everything.
-     */
-    @Test
-    public void collapseTitlePane() {
-        // you can collapse everything by selecting null
-        new AccordionDock(scene.asParent(), Accordion.class).asTitleSelectable().selector().select(null);
-    }
-
-    /**
-     * How to use properties.
-     */
-    @Test
-    public void properties() {
-        AccordionDock accordion = new AccordionDock(scene.asParent(), Accordion.class);
-        // you can use following properties: SelectedTitle, Titles, SelectedTitledPane, TitledPanes
-        Assert.assertEquals(accordion.getSelectedTitle(), accordion.getTitles().get(1));
-        Assert.assertEquals(accordion.getSelectedTitledPane(), accordion.getTitledPanes().get(1));
-    }
-}
--- a/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/input/MouseDNDSample.java	Wed Jun 20 17:11:33 2012 +0400
+++ b/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/input/MouseDNDSample.java	Wed Jun 20 18:17:43 2012 +0400
@@ -47,7 +47,6 @@
         redTarget.drag().dnd(new Point(10, 10));
 
         checkMouseEvent(RED, MouseEvent.MOUSE_PRESSED, MouseButton.PRIMARY, 50, 50, 1);
-        checkMouseEvent(RED, MouseEvent.MOUSE_DRAGGED, MouseButton.PRIMARY, 50, 50, 1);
         checkMouseEvent(RED, MouseEvent.MOUSE_DRAGGED, MouseButton.PRIMARY, 10, 10, 1);
         checkMouseEvent(RED, MouseEvent.MOUSE_RELEASED, MouseButton.PRIMARY, 10, 10, 1);
     }
@@ -60,7 +59,6 @@
         redTarget.drag().dnd(blueTarget.wrap(), new Point(10, 10));
 
         checkMouseEvent(RED, MouseEvent.MOUSE_PRESSED, MouseButton.PRIMARY, 50, 50, 1);
-        checkMouseEvent(RED, MouseEvent.MOUSE_DRAGGED, MouseButton.PRIMARY, 50, 50, 1);
         checkMouseEvent(RED, MouseEvent.MOUSE_DRAGGED, MouseButton.PRIMARY, -90, 10, 1);
         checkMouseEvent(RED, MouseEvent.MOUSE_RELEASED, MouseButton.PRIMARY, -90, 10, 1);
     }
@@ -74,9 +72,7 @@
                 Mouse.MouseButtons.BUTTON3, Keyboard.KeyboardModifiers.SHIFT_DOWN_MASK);
 
         checkMouseEvent(RED, MouseEvent.MOUSE_PRESSED, MouseButton.SECONDARY, 20, 20, 1);
-        checkMouseEvent(RED, MouseEvent.MOUSE_DRAGGED, MouseButton.SECONDARY, 20, 20, 1);
         checkMouseEvent(RED, MouseEvent.MOUSE_DRAGGED, MouseButton.SECONDARY, -90, 10, 1);
         checkMouseEvent(RED, MouseEvent.MOUSE_RELEASED, MouseButton.SECONDARY, -90, 10, 1);
     }
-
 }
--- a/tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/AccordionWrap.java	Wed Jun 20 17:11:33 2012 +0400
+++ b/tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/AccordionWrap.java	Wed Jun 20 18:17:43 2012 +0400
@@ -26,6 +26,10 @@
 import org.jemmy.lookup.LookupCriteria;
 import org.jemmy.timing.State;
 
+/**
+ * Wrapper for Accordion control. It implements Selectable to be able to select specific titled pane
+ * via Selectable.selector().select(STATE state).
+ */
 @ControlType(Accordion.class)
 @ControlInterfaces(value = {Selectable.class, Selectable.class},
                    encapsulates = {TitledPane.class, String.class},