use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.
the class SystemLayoutViewController method initialize.
@FXML
public void initialize() {
// 쿼리 리스너를 등록
DbUtil.registQuertyListener(this);
try {
FXMLLoader loader = FxUtil.createNewFxmlLoader();
loader.setLocation(SystemLayoutViewController.class.getResource("DAOLoaderView.fxml"));
TitledPane titledPane = loader.load();
VBox.setVgrow(titledPane, Priority.ALWAYS);
accordionItems.getChildren().add(titledPane);
DAOLoaderController controller = loader.getController();
controller.setSystemLayoutViewController(this);
} catch (IOException e1) {
e1.printStackTrace();
}
SharedMemory.setSystemLayoutView(this);
SharedMemory.setWorkspaceTab(tabPanWorkspace);
// tab key에 대한 이벤트 처리 등록....
SharedMemory.getPrimaryStage().addEventHandler(KeyEvent.ANY, event -> {
boolean isCloseALLtabKeyCode = event.isControlDown() && event.isShiftDown() && KeyCode.W == event.getCode();
boolean isTabMoveCode = event.isControlDown() && isNumberCode(event.getCode());
ObservableList<DockTab> tabs = tabPanWorkspace.getTabs();
if (isCloseALLtabKeyCode) {
LOGGER.debug("CLOSE ALL TABS...");
for (int i = tabs.size() - 1; i > 0; i--) {
tabs.remove(i);
}
} else if (isTabMoveCode) {
int tabIndex = Integer.parseInt(event.getCode().getName());
if (tabIndex > 0 && tabs.size() < tabIndex)
return;
LOGGER.debug("MOVE TAB" + event.getCode().getName());
tabPanWorkspace.getSelectionModel().select(tabIndex - 1);
}
});
String baseDir = ResourceLoader.getInstance().get(ResourceLoader.BASE_DIR);
selectDirFile = new File(baseDir);
createNewTreeViewMenuItems();
webvWelcome.getEngine().setJavaScriptEnabled(true);
webvWelcome.getEngine().load(HOME_URL);
txtUrl.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
if (KeyCode.ENTER == event.getCode()) {
webvWelcome.getEngine().load(txtUrl.getText());
}
});
btnUrlSearch.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
if (event.getClickCount() >= 1) {
webvWelcome.getEngine().load(txtUrl.getText());
}
});
webvWelcome.setOnKeyPressed(key -> {
if (key.getCode() == KeyCode.F12) {
FxUtil.createStageAndShow("Simple Web Console", new WebViewConsole(webvWelcome));
}
});
treeProjectFile.setRoot(createNewTree(selectDirFile));
treeProjectFile.setShowRoot(false);
// 트리 컨테스트 요청 이벤트
treeProjectFile.setOnContextMenuRequested(this::treeProjectFileOnContextMenuRequested);
// 트리 마우스 이벤트
treeProjectFile.setOnMouseClicked(this::treeProjectFileOnMouseClick);
// 트리 키 이벤트
treeProjectFile.addEventHandler(KeyEvent.KEY_PRESSED, this::treeProjectFileOnKeyPressed);
/** 플러그인들을 로드함. **/
Platform.runLater(new Runnable() {
@Override
public void run() {
List<JarWrapper> load = PluginLoader.getInstance().load();
load.stream().forEach(jarWrapper -> {
try {
String displayMenuName = jarWrapper.getDisplayMenuName();
MenuItem pluginMenu = new MenuItem(displayMenuName);
pluginMenu.setUserData(jarWrapper);
pluginMenu.setOnAction(event -> {
JarWrapper jar = (JarWrapper) pluginMenu.getUserData();
try {
Class<?> nodeClass = jar.getNodeClass();
Object newInstance = jar.loader.loadClass(nodeClass.getName()).newInstance();
if (newInstance instanceof CloseableParent<?>) {
loadNewSystemTab(jar.getDisplayMenuName(), (CloseableParent<?>) newInstance);
} else {
loadNewSystemTab(jar.getDisplayMenuName(), (Parent) newInstance, SkinManager.getInstance().getJavafxDefaultSkin());
}
} catch (Exception e) {
LOGGER.error("regist fail plugin.");
LOGGER.error(ValueUtil.toString(e));
}
});
try {
Class<GagoyleParentBeforeLoad> setBeforeParentLoadListenerClass = jarWrapper.getSetOnParentBeforeLoadedListenerClass();
if (setBeforeParentLoadListenerClass != null)
setOnbeforeParentLoad(setBeforeParentLoadListenerClass.newInstance());
} catch (Exception e) {
LOGGER.error("regist fail 'GagoyleParentBeforeLoad' listener.");
}
try {
Class<GagoyleParentOnLoaded> addOnParentLoadedListenerClass = jarWrapper.getAddOnParentLoadedListenerClass();
if (addOnParentLoadedListenerClass != null)
addOnParentLoadedListener(addOnParentLoadedListenerClass.newInstance());
} catch (Exception e) {
LOGGER.error("regist fail 'GagoyleParentOnLoaded' listener.");
}
menuPlugins.getItems().add(pluginMenu);
} catch (Exception e) {
LOGGER.debug(ValueUtil.toString(e));
}
});
}
});
//tab image 아이콘 처리
try (InputStream is = getClass().getResourceAsStream("/META-INF/images/eclipse/eview16/packages.gif")) {
tabPackageExplorer.setGraphic(new ImageView(new Image(is)));
} catch (IOException e) {
e.printStackTrace();
}
tabPanWorkspace.getTabs().addListener(dockTabCloseListener);
}
use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.
the class Main method loadMainLayout.
/********************************
* 작성일 : 2016. 7. 26. 작성자 : KYJ
*
* Appliucation 메인로직.
*
* @return
* @throws IOException
********************************/
BorderPane loadMainLayout() throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("layout/SystemLayoutView.fxml"));
BorderPane borderpane = loader.load();
return borderpane;
}
use of javafx.fxml.FXMLLoader in project jabref by JabRef.
the class ControlHelper method loadFXMLForControl.
/**
* Loads the FXML file associated to the passed control.
* The FMXL file should have the same name as the control with ending ".fxml" appended
*/
public static void loadFXMLForControl(Parent control) {
Class<?> clazz = control.getClass();
String clazzName = clazz.getSimpleName();
FXMLLoader fxmlLoader = new FXMLLoader(clazz.getResource(clazzName + ".fxml"), Localization.getMessages());
fxmlLoader.setController(control);
fxmlLoader.setRoot(control);
try {
fxmlLoader.load();
// Add our base css file
control.getStylesheets().add(0, AbstractView.class.getResource("Main.css").toExternalForm());
// Add language resource
} catch (IOException exception) {
LOGGER.error(exception);
}
}
use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.
the class DialogUtil method open.
/**
* 특정 location에 위치한 fxml파일을 팝업형태로 로드한다.
*
* @Date 2015. 10. 15.
* @param packageLocation
* @param fxmlName
* @param width
* @param height
* @param modal
* @throws IOException
* @User KYJ
*/
public static void open(Class<?> packageLocation, String fxmlName, int width, int height, boolean modal) throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(packageLocation.getResource(fxmlName));
Parent parent = loader.load();
BorderPane borderPane = new BorderPane(parent);
Stage stage = new Stage();
Scene scene = new Scene(borderPane, width, height);
stage.setScene(scene);
if (modal)
stage.initModality(Modality.WINDOW_MODAL);
stage.setAlwaysOnTop(true);
stage.initOwner(SharedMemory.getPrimaryStage());
stage.show();
// stage.setScene(borderPane, 800, 500);
}
use of javafx.fxml.FXMLLoader in project Gargoyle by callakrsos.
the class TextCompareExam method start.
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(DiffAppController.class.getResource("TextBaseDiffApp.fxml"));
BorderPane load = loader.load();
loader.getController();
// ReadOnlyConsole center = ReadOnlySingletonConsole.getInstance();
//
// BorderPane borderPane = new BorderPane(center);
// borderPane.getStylesheets().add(SkinManager.getInstance().getSkin());
// Button button = new Button("테스트");
// TextField textField = new TextField();
//
// button.setOnMouseClicked(event -> {
// center.appendText(textField.getText());
// });
Scene scene = new Scene(load);
primaryStage.setScene(scene);
primaryStage.show();
}
Aggregations