Search in sources :

Example 1 with SwingClient

use of eu.ggnet.saft.runtime.SwingClient in project dwoss by gg-net.

the class ClientTryout method tryout.

@Test
public void tryout() throws InterruptedException {
    JFXPanel p = new JFXPanel();
    CountDownLatch cdl = new CountDownLatch(1);
    final SwingClient ac = new SwingClient() {

        @Override
        protected void close() {
            System.out.println("closing");
            cdl.countDown();
        }
    };
    ac.init();
    EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            ac.show("Tryout", null);
        }
    });
    cdl.await();
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) CountDownLatch(java.util.concurrent.CountDownLatch) SwingClient(eu.ggnet.saft.runtime.SwingClient) Test(org.junit.Test)

Example 2 with SwingClient

use of eu.ggnet.saft.runtime.SwingClient in project dwoss by gg-net.

the class RunClientFx method init.

@Override
public void init() throws Exception {
    LoggerFactory.getLogger(RunClientFx.class).info("JavaFx init");
    System.out.println("JavaFx init");
    String key = discoverConfigParameters();
    // Go to default, but inform on console abaout usage.
    if (!Configurations.containsConfig(key))
        usage(key);
    lookupConfig = Configurations.getConfigOrDefault(key);
    WildflyLookup wildflyLookup = new WildflyLookup(lookupConfig);
    Dl.local().add(RemoteLookup.class, wildflyLookup);
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new UnhandledExceptionCatcher());
    UiCore.overwriteFinalExceptionConsumer(new DwFinalExceptionConsumer());
    UiCore.registerExceptionConsumer(UserInfoException.class, new UserInfoExceptionConsumer());
    UiCore.registerExceptionConsumer(ConstraintViolationException.class, new ConstraintViolationConsumer());
    verifyRemoteConnection();
    EventQueue.invokeAndWait(() -> {
        swingClient = new SwingClient() {

            @Override
            protected void close() {
                System.out.println("Calling Close");
                Platform.exit();
                // Again, not perfect, but otherwise the application dosen't close and I don't know why yet.
                System.exit(0);
            }
        };
        swingClient.init();
    });
}
Also used : WildflyLookup(eu.ggnet.dwoss.assembly.remote.lookup.WildflyLookup) SwingClient(eu.ggnet.saft.runtime.SwingClient)

Aggregations

SwingClient (eu.ggnet.saft.runtime.SwingClient)2 WildflyLookup (eu.ggnet.dwoss.assembly.remote.lookup.WildflyLookup)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 JFXPanel (javafx.embed.swing.JFXPanel)1 Test (org.junit.Test)1