Search in sources :

Example 36 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class CommboBoxExam method start.

/* (non-Javadoc)
	 * @see javafx.application.Application#start(javafx.stage.Stage)
	 */
@Override
public void start(Stage primaryStage) throws Exception {
    FXMLLoader fxmlLoader = new FXMLLoader();
    fxmlLoader.setLocation(getClass().getResource("CommboBoxExam.fxml"));
    fxmlLoader.setController(this);
    Parent load = fxmlLoader.load();
    Scene value = new Scene(load);
    value.getStylesheets().add(getClass().getResource("CommboBoxExam.css").toExternalForm());
    primaryStage.setScene(value);
    primaryStage.show();
}
Also used : Parent(javafx.scene.Parent) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Example 37 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class FxUtil method newInstance.

private static <T, C> T newInstance(Class<?> controllerClass, Object rootInstance, boolean isSelfController, String _fxml, Consumer<T> option, Consumer<C> controllerAction) throws Exception {
    String fxml = _fxml;
    if (fxml == null) {
        FXMLController controller = getFxmlController(controllerClass);
        if (controller == null) {
            throw new GargoyleException("this is not FXMLController. check @FXMLController");
        }
        //controller.value();
        fxml = getFxml(controller);
    }
    URL resource = controllerClass.getResource(fxml);
    FXMLLoader loader = createNewFxmlLoader();
    loader.setLocation(resource);
    if (isSelfController && rootInstance != null) {
        try {
            loader.setRoot(rootInstance);
            loader.setController(rootInstance);
        } catch (Exception e) {
            throw new GargoyleException(e);
        }
    }
    T load = loader.load();
    C instanceController = loader.getController();
    // show warning...
    if (load == null) {
        LOGGER.warn("load result is empty.. controller class : {} ", controllerClass);
    }
    Method[] declaredMethods = controllerClass.getDeclaredMethods();
    //  2017-02-07 findfirst에서 어노테이션으로 선언된 다건의 함수를 호출하게 다시 유도.
    //  findfirst로 수정. @FxPostInitialize가 여러건있는경우를 잘못된 로직 유도를 방지.
    Stream.of(declaredMethods).filter(m -> m.getParameterCount() == 0 && m.getAnnotation(FxPostInitialize.class) != null).forEach(m -> {
        if (m.getModifiers() == Modifier.PUBLIC) {
            try {
                if (instanceController != null) {
                    Platform.runLater(() -> {
                        try {
                            m.setAccessible(true);
                            m.invoke(instanceController);
                        } catch (Exception e) {
                            LOGGER.error(ValueUtil.toString(e));
                        }
                    });
                }
            } catch (Exception e) {
                LOGGER.error(ValueUtil.toString(e));
            }
        }
    });
    if (option != null) {
        option.accept(load);
    }
    if (controllerAction != null)
        controllerAction.accept(instanceController);
    Platform.runLater(() -> {
        Parent parent = (Parent) load;
        List<Node> findAllByNodes = FxUtil.findAllByNodes(parent, v -> v instanceof Button);
        findAllByNodes.forEach(v -> {
            GargoyleButtonBuilder.applyStyleClass((Button) v, SkinManager.BUTTON_STYLE_CLASS_NAME);
        });
    });
    return load;
}
Also used : StageStyle(javafx.stage.StageStyle) PageOrientation(javafx.print.PageOrientation) Printer(javafx.print.Printer) SnapshotParameters(javafx.scene.SnapshotParameters) Transition(javafx.animation.Transition) AnimationType(jidefx.animation.AnimationType) PageLayout(javafx.print.PageLayout) TabPane(javafx.scene.control.TabPane) FontPosture(javafx.scene.text.FontPosture) Map(java.util.Map) Point2D(javafx.geometry.Point2D) PopOver(org.controlsfx.control.PopOver) Rectangle2D(javafx.geometry.Rectangle2D) Pair(javafx.util.Pair) Set(java.util.Set) SnapshotResult(javafx.scene.SnapshotResult) KeyEvent(javafx.scene.input.KeyEvent) Screen(javafx.stage.Screen) ScmCommitComposite(com.kyj.fx.voeditor.visual.component.scm.ScmCommitComposite) Platform(javafx.application.Platform) Stream(java.util.stream.Stream) Region(javafx.scene.layout.Region) FxContextManager(com.kyj.fx.voeditor.visual.framework.contextmenu.FxContextManager) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) MouseButton(javafx.scene.input.MouseButton) TreeItem(javafx.scene.control.TreeItem) DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) FXMLLoader(javafx.fxml.FXMLLoader) GargoyleButtonBuilder(com.kyj.fx.voeditor.visual.framework.builder.GargoyleButtonBuilder) Color(javafx.scene.paint.Color) Properties(java.util.Properties) TitledPane(javafx.scene.control.TitledPane) Node(javafx.scene.Node) PopupFeatures(javafx.scene.web.PopupFeatures) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) FileChooser(javafx.stage.FileChooser) Tab(javafx.scene.control.Tab) ImageView(javafx.scene.image.ImageView) ObservableValue(javafx.beans.value.ObservableValue) SkinManager(com.kyj.fx.voeditor.visual.momory.SkinManager) Image(javafx.scene.image.Image) Button(javafx.scene.control.Button) URL(java.net.URL) LoggerFactory(org.slf4j.LoggerFactory) JavaTextArea(com.kyj.fx.voeditor.visual.component.text.JavaTextArea) ToExcelFileFunction(com.kyj.fx.voeditor.visual.functions.ToExcelFileFunction) WebEvent(javafx.scene.web.WebEvent) JavaSVNManager(com.kyj.scm.manager.svn.java.JavaSVNManager) SvnChagnedCodeComposite(com.kyj.fx.voeditor.visual.component.scm.SvnChagnedCodeComposite) Parent(javafx.scene.Parent) FileSystemView(javax.swing.filechooser.FileSystemView) Task(javafx.concurrent.Task) InstanceTypes(com.kyj.fx.voeditor.visual.framework.InstanceTypes) ImageIO(javax.imageio.ImageIO) WindowEvent(javafx.stage.WindowEvent) TableView(javafx.scene.control.TableView) Method(java.lang.reflect.Method) AutoCompletionTextFieldBinding(impl.org.controlsfx.autocompletion.AutoCompletionTextFieldBinding) FxSVNHistoryDataSupplier(com.kyj.fx.voeditor.visual.component.scm.FxSVNHistoryDataSupplier) TextField(javafx.scene.control.TextField) GargoyleLoadBar(com.kyj.fx.voeditor.visual.component.bar.GargoyleLoadBar) Paper(javafx.print.Paper) BufferedImage(java.awt.image.BufferedImage) Predicate(java.util.function.Predicate) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) Font(javafx.scene.text.Font) Icon(javax.swing.Icon) Collectors(java.util.stream.Collectors) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize) MarginType(javafx.print.Printer.MarginType) List(java.util.List) Modifier(java.lang.reflect.Modifier) Scale(javafx.scene.transform.Scale) Optional(java.util.Optional) FontWeight(javafx.scene.text.FontWeight) AnimationUtils(jidefx.animation.AnimationUtils) Scene(javafx.scene.Scene) GargoyleBuilderFactory(com.kyj.fx.voeditor.visual.framework.builder.GargoyleBuilderFactory) WebEngine(javafx.scene.web.WebEngine) TextArea(javafx.scene.control.TextArea) MouseEvent(javafx.scene.input.MouseEvent) WebViewConsole(com.kyj.fx.voeditor.visual.component.console.WebViewConsole) Function(java.util.function.Function) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) Charset(java.nio.charset.Charset) State(javafx.concurrent.Worker.State) JavaTextView(com.kyj.fx.voeditor.visual.component.popup.JavaTextView) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) FxMemory(com.kyj.fx.voeditor.visual.momory.FxMemory) PrinterJob(javafx.print.PrinterJob) OutputStream(java.io.OutputStream) KeyCode(javafx.scene.input.KeyCode) WebView(javafx.scene.web.WebView) Modality(javafx.stage.Modality) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) CloseableParent(com.kyj.fx.voeditor.visual.main.layout.CloseableParent) TablePosition(javafx.scene.control.TablePosition) WritableImage(javafx.scene.image.WritableImage) FileInputStream(java.io.FileInputStream) Consumer(java.util.function.Consumer) GargoyleSynchLoadBar(com.kyj.fx.voeditor.visual.component.bar.GargoyleSynchLoadBar) Stage(javafx.stage.Stage) Closeable(java.io.Closeable) SwingFXUtils(javafx.embed.swing.SwingFXUtils) Window(javafx.stage.Window) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) SharedMemory(com.kyj.fx.voeditor.visual.momory.SharedMemory) Parent(javafx.scene.Parent) CloseableParent(com.kyj.fx.voeditor.visual.main.layout.CloseableParent) DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) Node(javafx.scene.Node) Method(java.lang.reflect.Method) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL) IOException(java.io.IOException) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) MouseButton(javafx.scene.input.MouseButton) Button(javafx.scene.control.Button) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController)

Example 38 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class SVNTreeView method menuCheckoutOnAction.

/**
	 * Checkout..
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 4. 4.
	 * @param e
	 */
public void menuCheckoutOnAction(ActionEvent e) {
    TreeItem<SVNItem> selectedItem = getSelectionModel().getSelectedItem();
    SVNItem value = selectedItem.getValue();
    if (value instanceof SVNRepository) {
        DialogUtil.showMessageDialog(SharedMemory.getPrimaryStage(), "Root can't checout ");
        return;
    }
    String path = value.getPath();
    String url = value.getManager().getUrl();
    LOGGER.debug(url + path);
    try {
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(getClass().getResource("CheckoutView.fxml"));
        Stage stage = new Stage();
        stage.setScene(new Scene(loader.load()));
        CheckoutController controller = loader.getController();
        controller.setFileName(value.getSimpleName());
        controller.setSVNItem(value);
        stage.initOwner(SharedMemory.getPrimaryStage());
        stage.show();
    } catch (IOException e1) {
        LOGGER.error(ValueUtil.toString(e1));
    }
}
Also used : Stage(javafx.stage.Stage) IOException(java.io.IOException) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Example 39 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class DAOLoaderController method tbSrchDaoOnMouseClick.

@FXML
public void tbSrchDaoOnMouseClick(MouseEvent e) {
    if (e.getClickCount() == 2) {
        Platform.runLater(() -> {
            try {
                Map<String, Object> selectedItem = tbSrchDao.getSelectionModel().getSelectedItem();
                if (selectedItem == null)
                    return;
                TbmSysDaoDVO tbmSysDAO = new TbmSysDaoDVO();
                tbmSysDAO.setClassName(selectedItem.get("CLASS_NAME").toString());
                tbmSysDAO.setPackageName(selectedItem.get("PACKAGE_NAME").toString());
                tbmSysDAO.setLocation(selectedItem.get("LOCATION").toString());
                tbmSysDAO.setClassDesc(selectedItem.get("CLASS_DESC").toString());
                Object object = selectedItem.get("TABLE_NAME");
                if (object != null)
                    tbmSysDAO.setTableName(object.toString());
                FxUtil.load(DAOLoaderController.class);
                //new FXMLLoader();
                FXMLLoader loader = FxUtil.createNewFxmlLoader();
                loader.setLocation(getClass().getResource("DaoWizardView.fxml"));
                BorderPane pane = loader.load();
                DaoWizardViewController controller = loader.getController();
                controller.setTbmSysDaoProperty(tbmSysDAO);
                /*2016-10-26 by kyj change code  tab handling -> loadNewSystem api */
                //					Tab tab = new Tab("DaoWizard", pane);
                //					this.systemRoot.addTabItem(tab);
                //					tab.getTabPane().getSelectionModel().select(tab);
                SharedMemory.getSystemLayoutViewController().loadNewSystemTab("DaoWizard", pane);
            //2016-09-23 굳히 재조회 할 필요없으므로 주석.
            //					List<Map<String, Object>> listDAO = listDAO(txtSrchTable.getText().trim());
            //					tbSrchDao.getItems().addAll(listDAO);
            } catch (Exception e1) {
                LOGGER.error(e1.toString());
                DialogUtil.showExceptionDailog(e1);
            }
        });
    }
}
Also used : BorderPane(javafx.scene.layout.BorderPane) TbmSysDaoDVO(kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO) FXMLLoader(javafx.fxml.FXMLLoader) FXML(javafx.fxml.FXML)

Example 40 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.

the class DAOLoaderController method compare.

/********************************
	 * 작성일 : 2016. 4. 20. 작성자 : KYJ
	 *
	 * 두개의 데이터를 비교.
	 *
	 * @param tbmSysDaoMethodsHDVO
	 * @param tbmSysDaoMethodsHDVO2
	 ********************************/
private void compare(TbmSysDaoMethodsHDVO o1, TbmSysDaoMethodsHDVO o2) {
    try {
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(DiffAppController.class.getResource("TextBaseDiffApp.fxml"));
        BorderPane load = loader.load();
        TextBaseDiffAppController controller = loader.getController();
        controller.setCompare(new TextBaseComparator());
        controller.setDiff(getSqlBody(o1.getHistTsp()), getSqlBody(o2.getHistTsp()));
        Stage stage = new Stage();
        stage.initOwner(SharedMemory.getPrimaryStage());
        stage.centerOnScreen();
        stage.setScene(new Scene(load));
        stage.showAndWait();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : DiffAppController(com.kyj.fx.voeditor.visual.component.DiffAppController) TextBaseDiffAppController(com.kyj.fx.voeditor.visual.component.TextBaseDiffAppController) BorderPane(javafx.scene.layout.BorderPane) TextBaseComparator(com.kyj.fx.voeditor.visual.diff.TextBaseComparator) Stage(javafx.stage.Stage) TextBaseDiffAppController(com.kyj.fx.voeditor.visual.component.TextBaseDiffAppController) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Aggregations

FXMLLoader (javafx.fxml.FXMLLoader)252 IOException (java.io.IOException)148 Scene (javafx.scene.Scene)120 Parent (javafx.scene.Parent)79 Stage (javafx.stage.Stage)64 FXML (javafx.fxml.FXML)46 URL (java.net.URL)43 Pane (javafx.scene.layout.Pane)34 BorderPane (javafx.scene.layout.BorderPane)30 AnchorPane (javafx.scene.layout.AnchorPane)24 ActionEvent (javafx.event.ActionEvent)19 ResourceBundle (java.util.ResourceBundle)16 Initializable (javafx.fxml.Initializable)14 JFXButton (com.jfoenix.controls.JFXButton)13 KeyFrame (javafx.animation.KeyFrame)13 Timeline (javafx.animation.Timeline)13 StackPane (javafx.scene.layout.StackPane)13 Duration (javafx.util.Duration)13 Level (java.util.logging.Level)12 Logger (java.util.logging.Logger)12