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();
}
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;
}
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));
}
}
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);
}
});
}
}
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();
}
}
Aggregations