use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.
the class FxUtil method createImageIconView.
/**
* 파일로부터 이미지를 그리기 위한 뷰를 반환한다.
*
* @Date 2015. 10. 14.
* @param file
* @return
* @User KYJ
*/
public static ImageView createImageIconView(File file) {
Image fxImage = null;
if (file.exists()) {
FileSystemView fileSystemView = FileSystemView.getFileSystemView();
Icon icon = fileSystemView.getSystemIcon(file);
BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(null, bufferedImage.getGraphics(), 0, 0);
fxImage = SwingFXUtils.toFXImage(bufferedImage, null);
} else {
return new ImageView();
}
return new ImageView(fxImage);
}
use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.
the class ScmTreeMaker method getFileImage.
private static ImageView getFileImage() {
ImageView iv = new ImageView();
try {
Image fxImage = new Image(ClassLoader.getSystemClassLoader().getResource("META-INF/images/nodeicons/file.png").openStream(), 15d, 15d, false, false);
iv.setImage(fxImage);
} catch (IOException e) {
e.printStackTrace();
}
return iv;
}
use of javafx.scene.image.ImageView 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.scene.image.ImageView in project bitsquare by bitsquare.
the class MainView method createSplashScreen.
private VBox createSplashScreen() {
VBox vBox = new VBox();
vBox.setAlignment(Pos.CENTER);
vBox.setSpacing(0);
vBox.setId("splash");
ImageView logo = new ImageView();
logo.setId("image-splash-logo");
// createBitcoinInfoBox
btcSplashInfo = new Label();
btcSplashInfo.textProperty().bind(model.btcInfo);
walletServiceErrorMsgListener = (ov, oldValue, newValue) -> {
btcSplashInfo.setId("splash-error-state-msg");
};
model.walletServiceErrorMsg.addListener(walletServiceErrorMsgListener);
btcSyncIndicator = new ProgressBar();
btcSyncIndicator.setPrefWidth(120);
btcSyncIndicator.progressProperty().bind(model.btcSyncProgress);
ImageView btcSyncIcon = new ImageView();
btcSyncIcon.setVisible(false);
btcSyncIcon.setManaged(false);
btcSyncIconIdListener = (ov, oldValue, newValue) -> {
btcSyncIcon.setId(newValue);
btcSyncIcon.setVisible(true);
btcSyncIcon.setManaged(true);
btcSyncIndicator.setVisible(false);
btcSyncIndicator.setManaged(false);
};
model.btcSplashSyncIconId.addListener(btcSyncIconIdListener);
HBox blockchainSyncBox = new HBox();
blockchainSyncBox.setSpacing(10);
blockchainSyncBox.setAlignment(Pos.CENTER);
blockchainSyncBox.setPadding(new Insets(40, 0, 0, 0));
blockchainSyncBox.setPrefHeight(50);
blockchainSyncBox.getChildren().addAll(btcSplashInfo, btcSyncIndicator, btcSyncIcon);
// create P2PNetworkBox
splashP2PNetworkLabel = new Label();
splashP2PNetworkLabel.setWrapText(true);
splashP2PNetworkLabel.setMaxWidth(500);
splashP2PNetworkLabel.setTextAlignment(TextAlignment.CENTER);
splashP2PNetworkLabel.textProperty().bind(model.p2PNetworkInfo);
splashP2PNetworkBusyAnimation = new BusyAnimation();
splashP2PNetworkErrorMsgListener = (ov, oldValue, newValue) -> {
if (newValue != null) {
splashP2PNetworkLabel.setId("splash-error-state-msg");
splashP2PNetworkBusyAnimation.stop();
} else if (model.splashP2PNetworkAnimationVisible.get()) {
splashP2PNetworkBusyAnimation.play();
}
};
model.p2pNetworkWarnMsg.addListener(splashP2PNetworkErrorMsgListener);
ImageView splashP2PNetworkIcon = new ImageView();
splashP2PNetworkIcon.setId("image-connection-tor");
splashP2PNetworkIcon.setVisible(false);
splashP2PNetworkIcon.setManaged(false);
HBox.setMargin(splashP2PNetworkIcon, new Insets(0, 0, 5, 0));
splashP2PNetworkIconIdListener = (ov, oldValue, newValue) -> {
splashP2PNetworkIcon.setId(newValue);
splashP2PNetworkIcon.setVisible(true);
splashP2PNetworkIcon.setManaged(true);
};
model.p2PNetworkIconId.addListener(splashP2PNetworkIconIdListener);
splashP2PNetworkVisibleListener = (ov, oldValue, newValue) -> splashP2PNetworkBusyAnimation.setIsRunning(newValue);
model.splashP2PNetworkAnimationVisible.addListener(splashP2PNetworkVisibleListener);
HBox splashP2PNetworkBox = new HBox();
splashP2PNetworkBox.setSpacing(10);
splashP2PNetworkBox.setAlignment(Pos.CENTER);
splashP2PNetworkBox.setPrefHeight(50);
splashP2PNetworkBox.getChildren().addAll(splashP2PNetworkLabel, splashP2PNetworkBusyAnimation, splashP2PNetworkIcon);
vBox.getChildren().addAll(logo, blockchainSyncBox, splashP2PNetworkBox);
return vBox;
}
use of javafx.scene.image.ImageView in project bitsquare by bitsquare.
the class MainView method createFooter.
private AnchorPane createFooter() {
// line
Separator separator = new Separator();
separator.setId("footer-pane-line");
separator.setPrefHeight(1);
setLeftAnchor(separator, 0d);
setRightAnchor(separator, 0d);
setTopAnchor(separator, 0d);
// BTC
Label btcInfoLabel = new Label();
btcInfoLabel.setId("footer-pane");
btcInfoLabel.textProperty().bind(model.btcInfo);
ProgressBar blockchainSyncIndicator = new ProgressBar(-1);
blockchainSyncIndicator.setPrefWidth(120);
blockchainSyncIndicator.setMaxHeight(10);
blockchainSyncIndicator.progressProperty().bind(model.btcSyncProgress);
model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
btcInfoLabel.setId("splash-error-state-msg");
if (btcNetworkWarnMsgPopup == null) {
btcNetworkWarnMsgPopup = new Popup<>().warning(newValue);
btcNetworkWarnMsgPopup.show();
}
} else {
btcInfoLabel.setId("footer-pane");
if (btcNetworkWarnMsgPopup != null)
btcNetworkWarnMsgPopup.hide();
}
});
model.btcSyncProgress.addListener((ov, oldValue, newValue) -> {
if ((double) newValue >= 1) {
blockchainSyncIndicator.setVisible(false);
blockchainSyncIndicator.setManaged(false);
}
});
HBox blockchainSyncBox = new HBox();
blockchainSyncBox.setSpacing(10);
blockchainSyncBox.setAlignment(Pos.CENTER);
blockchainSyncBox.getChildren().addAll(btcInfoLabel, blockchainSyncIndicator);
setLeftAnchor(blockchainSyncBox, 10d);
setBottomAnchor(blockchainSyncBox, 7d);
// version
Label versionLabel = new Label();
versionLabel.setId("footer-pane");
versionLabel.setTextAlignment(TextAlignment.CENTER);
versionLabel.setAlignment(Pos.BASELINE_CENTER);
versionLabel.setText(model.version);
root.widthProperty().addListener((ov, oldValue, newValue) -> {
versionLabel.setLayoutX(((double) newValue - versionLabel.getWidth()) / 2);
});
setBottomAnchor(versionLabel, 7d);
// P2P Network
Label p2PNetworkLabel = new Label();
p2PNetworkLabel.setId("footer-pane");
setRightAnchor(p2PNetworkLabel, 33d);
setBottomAnchor(p2PNetworkLabel, 7d);
p2PNetworkLabel.textProperty().bind(model.p2PNetworkInfo);
ImageView p2PNetworkIcon = new ImageView();
setRightAnchor(p2PNetworkIcon, 10d);
setBottomAnchor(p2PNetworkIcon, 7d);
p2PNetworkIcon.setOpacity(0.4);
p2PNetworkIcon.idProperty().bind(model.p2PNetworkIconId);
p2PNetworkLabel.idProperty().bind(model.p2pNetworkLabelId);
model.p2pNetworkWarnMsg.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
p2PNetworkWarnMsgPopup = new Popup<>().warning(newValue);
p2PNetworkWarnMsgPopup.show();
} else if (p2PNetworkWarnMsgPopup != null) {
p2PNetworkWarnMsgPopup.hide();
}
});
model.bootstrapComplete.addListener((observable, oldValue, newValue) -> {
p2PNetworkIcon.setOpacity(1);
});
return new AnchorPane(separator, blockchainSyncBox, versionLabel, p2PNetworkLabel, p2PNetworkIcon) {
{
setId("footer-pane");
setMinHeight(30);
setMaxHeight(30);
}
};
}
Aggregations