22 * or visit www.oracle.com if you need additional information or have any
23 */
24
25 package test.javaclient.shared;
26
27 import com.sun.javafx.application.PlatformImpl;
28 import java.util.logging.Level;
29 import java.util.logging.Logger;
30 import javafx.scene.Scene;
31 import javafx.scene.layout.Pane;
32 import javafx.scene.text.Text;
33 import javafx.stage.Stage;
34 import java.util.concurrent.CountDownLatch;
35 import javafx.application.Platform;
36 import javafx.scene.Group;
37 import javafx.scene.Node;
38 import javafx.scene.control.Button;
39 import javafx.scene.layout.VBox;
40 import javafx.scene.paint.Color;
41 import org.eclipse.swt.widgets.Shell;
42
43 /**
44 *
45 * @author shubov
46 */
47 public class CombinedTestChooserPresenter implements AbstractTestPresenter, AbstractFailureRegistrator {
48
49 private Pane pageContent;
50 private Node nodeForScreenshot;
51 protected final int width;
52 protected final int height;
53 private Scene scene = null;
54 protected final String title;
55 protected static final int TABS_SPACE = 110;
56 private final Pane buttons;
57 private Text getterNotifier;
58 static final String GETTER_NOTIFIER = "GETTER_NOTIFIER";
59 static final String FIN_NOTIFIER = "FIN_NOTIFIER";
60 public static final String PAGE_CONTENT = "AbstractApp.pageContent";
61 protected boolean mouseTransparent = false;
166 public void clearFailures() {
167 getterNotifier.setText("");
168 }
169
170 public String getFailures() {
171 return getterNotifier.getText();
172 }
173
174 public String getScreenshotPaneName() {
175 return PAGE_CONTENT;
176 }
177
178 public void show(Stage stage) {
179 stage.setX(0);
180 stage.setY(0);
181 stage.setTitle(title);
182 fillScene();
183 stage.setScene(scene);
184 stage.show();
185 stage.toFront();
186 stage.setFocused(true);
187 }
188
189 public void show(final Object frame, final Object panel) {
190 SwingAWTUtils.setJFrameTitle(frame, title);
191
192 final CountDownLatch sync = new CountDownLatch(1);
193 PlatformImpl.runAndWait(new Runnable() {
194
195 public void run() {
196 fillScene();
197 SwingAWTUtils.setJFXPanelScene(panel, scene);
198 SwingAWTUtils.setJFXPanelSize(panel, (int)scene.getWidth(), (int)scene.getHeight());
199 sync.countDown();
200 }
201 });
202
203 try {
204 sync.await();
205 } catch (InterruptedException ex) {
206 Logger.getLogger(CombinedTestChooserPresenter.class.getName()).log(Level.SEVERE, null, ex);
|
22 * or visit www.oracle.com if you need additional information or have any
23 */
24
25 package test.javaclient.shared;
26
27 import com.sun.javafx.application.PlatformImpl;
28 import java.util.logging.Level;
29 import java.util.logging.Logger;
30 import javafx.scene.Scene;
31 import javafx.scene.layout.Pane;
32 import javafx.scene.text.Text;
33 import javafx.stage.Stage;
34 import java.util.concurrent.CountDownLatch;
35 import javafx.application.Platform;
36 import javafx.scene.Group;
37 import javafx.scene.Node;
38 import javafx.scene.control.Button;
39 import javafx.scene.layout.VBox;
40 import javafx.scene.paint.Color;
41 import org.eclipse.swt.widgets.Shell;
42 import com.sun.javafx.stage.WindowHelper;
43
44 /**
45 *
46 * @author shubov
47 */
48 public class CombinedTestChooserPresenter implements AbstractTestPresenter, AbstractFailureRegistrator {
49
50 private Pane pageContent;
51 private Node nodeForScreenshot;
52 protected final int width;
53 protected final int height;
54 private Scene scene = null;
55 protected final String title;
56 protected static final int TABS_SPACE = 110;
57 private final Pane buttons;
58 private Text getterNotifier;
59 static final String GETTER_NOTIFIER = "GETTER_NOTIFIER";
60 static final String FIN_NOTIFIER = "FIN_NOTIFIER";
61 public static final String PAGE_CONTENT = "AbstractApp.pageContent";
62 protected boolean mouseTransparent = false;
167 public void clearFailures() {
168 getterNotifier.setText("");
169 }
170
171 public String getFailures() {
172 return getterNotifier.getText();
173 }
174
175 public String getScreenshotPaneName() {
176 return PAGE_CONTENT;
177 }
178
179 public void show(Stage stage) {
180 stage.setX(0);
181 stage.setY(0);
182 stage.setTitle(title);
183 fillScene();
184 stage.setScene(scene);
185 stage.show();
186 stage.toFront();
187 //stage.setFocused(true);
188 WindowHelper.setFocused(stage, true);
189 }
190
191 public void show(final Object frame, final Object panel) {
192 SwingAWTUtils.setJFrameTitle(frame, title);
193
194 final CountDownLatch sync = new CountDownLatch(1);
195 PlatformImpl.runAndWait(new Runnable() {
196
197 public void run() {
198 fillScene();
199 SwingAWTUtils.setJFXPanelScene(panel, scene);
200 SwingAWTUtils.setJFXPanelSize(panel, (int)scene.getWidth(), (int)scene.getHeight());
201 sync.countDown();
202 }
203 });
204
205 try {
206 sync.await();
207 } catch (InterruptedException ex) {
208 Logger.getLogger(CombinedTestChooserPresenter.class.getName()).log(Level.SEVERE, null, ex);
|