Search in sources :

Example 41 with JFXPanel

use of javafx.embed.swing.JFXPanel in project dwoss by gg-net.

the class SwingCore method wrap.

public static JFXPanel wrap(Pane p) throws InterruptedException {
    final JFXPanel fxp = jfxPanel();
    final CountDownLatch cdl = new CountDownLatch(1);
    if (Platform.isFxApplicationThread()) {
        fxp.setScene(new Scene(p, Color.TRANSPARENT));
        SWING_PARENT_HELPER.put(fxp.getScene(), fxp);
        cdl.countDown();
    } else {
        Platform.runLater(() -> {
            fxp.setScene(new Scene(p));
            SWING_PARENT_HELPER.put(fxp.getScene(), fxp);
            cdl.countDown();
        });
    }
    cdl.await();
    return fxp;
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) CountDownLatch(java.util.concurrent.CountDownLatch) Scene(javafx.scene.Scene)

Example 42 with JFXPanel

use of javafx.embed.swing.JFXPanel in project dwoss by gg-net.

the class SwingCore method ensurePlatformIsRunning.

public static void ensurePlatformIsRunning() {
    if (!started) {
        startHelper = new JFXPanel();
        started = true;
    }
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel)

Example 43 with JFXPanel

use of javafx.embed.swing.JFXPanel in project dwoss by gg-net.

the class ShipmentUpdateTryout method tryout.

@Test
public void tryout() throws InterruptedException {
    Dl.remote().add(Mandators.class, new Mandators() {

        @Override
        public Mandator loadMandator() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public DefaultCustomerSalesdata loadSalesdata() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ReceiptCustomers loadReceiptCustomers() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public SpecialSystemCustomers loadSystemCustomers() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Contractors loadContractors() {
            return new Contractors(EnumSet.allOf(TradeName.class), EnumSet.allOf(TradeName.class));
        }

        @Override
        public PostLedger loadPostLedger() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ShippingTerms loadShippingTerms() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    // To start the platform
    new JFXPanel();
    Shipment s = new Shipment();
    Platform.runLater(() -> {
        ShipmentUpdateStage stage = new ShipmentUpdateStage(s);
        stage.showAndWait();
        System.out.println(stage.getShipment());
        complete = true;
    });
    while (!complete) {
        Thread.sleep(500);
    }
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) Shipment(eu.ggnet.dwoss.stock.ee.entity.Shipment) Mandators(eu.ggnet.dwoss.mandator.Mandators) Test(org.junit.Test)

Example 44 with JFXPanel

use of javafx.embed.swing.JFXPanel in project dwoss by gg-net.

the class DocumentUpdateView method initFxComponents.

private void initFxComponents() {
    final JFXPanel jfxp = new JFXPanel();
    positionPanelFx.add(jfxp, BorderLayout.CENTER);
    Platform.runLater(() -> {
        BorderPane pane = new BorderPane();
        Scene scene = new Scene(pane, Color.ALICEBLUE);
        positionsFxList = new ListView<>();
        positionsFxList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
        positionsFxList.setCellFactory(new PositionListCell.Factory());
        positionsFxList.setItems(positions);
        positionsFxList.setOnMouseClicked((mouseEvent) -> {
            if (mouseEvent.getButton().equals(MouseButton.PRIMARY) && mouseEvent.getClickCount() == 2) {
                if (isChangeAllowed()) {
                    Ui.exec(() -> {
                        controller.editPosition(positionsFxList.getSelectionModel().getSelectedItem());
                        Platform.runLater(() -> positionsFxList.refresh());
                    });
                } else {
                    Ui.build(this).alert("Ă„nderung an Positionen ist nicht erlaubt.");
                }
            }
        });
        pane.setCenter(positionsFxList);
        jfxp.setScene(scene);
    });
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) BorderPane(javafx.scene.layout.BorderPane) PositionListCell(eu.ggnet.dwoss.redtapext.ui.cao.common.PositionListCell) Scene(javafx.scene.Scene)

Example 45 with JFXPanel

use of javafx.embed.swing.JFXPanel in project dwoss by gg-net.

the class ReportHtmlTryout method tryout.

@Test
public void tryout() throws InterruptedException, InvocationTargetException, MalformedURLException {
    Report report = new Report("TestReport", ALSO, _2011_10_01, _2011_10_07);
    report.setComment("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
    // Implicit start the platform.
    new JFXPanel();
    Platform.runLater(() -> {
        Stage stage = new Stage();
        stage.setTitle("HtmlViewer");
        WebView view = new WebView();
        view.getEngine().loadContent(Css.toHtml5WithStyle(report.toHtml()));
        BorderPane p = new BorderPane(view);
        Scene scene = new Scene(p, Color.ALICEBLUE);
        stage.setScene(scene);
        stage.showAndWait();
        complete = true;
    });
    while (!complete) {
        Thread.sleep(500);
    }
}
Also used : JFXPanel(javafx.embed.swing.JFXPanel) BorderPane(javafx.scene.layout.BorderPane) Report(eu.ggnet.dwoss.report.ee.entity.Report) Stage(javafx.stage.Stage) WebView(javafx.scene.web.WebView) Scene(javafx.scene.Scene) Test(org.junit.Test)

Aggregations

JFXPanel (javafx.embed.swing.JFXPanel)50 Scene (javafx.scene.Scene)16 Test (org.junit.Test)16 CountDownLatch (java.util.concurrent.CountDownLatch)11 Dimension (java.awt.Dimension)6 BorderPane (javafx.scene.layout.BorderPane)6 Stage (javafx.stage.Stage)6 FXMLLoader (javafx.fxml.FXMLLoader)5 WebView (javafx.scene.web.WebView)5 BaseDocumentTest (com.kasirgalabs.etumulator.document.BaseDocumentTest)4 BorderLayout (java.awt.BorderLayout)4 WindowAdapter (java.awt.event.WindowAdapter)4 WindowEvent (java.awt.event.WindowEvent)4 ExecutorService (java.util.concurrent.ExecutorService)4 JFrame (javax.swing.JFrame)4 WebEngine (javafx.scene.web.WebEngine)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 Random (java.util.Random)2 FutureTask (java.util.concurrent.FutureTask)2 Memory (php.runtime.Memory)2