use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.
the class AbstractTableColumnInformationController method getImage.
/**
* resources패키지로부터 image를 가져오는 처리
*
* @param name
* @return
*/
static ImageView getImage(String name) {
try {
String name2 = "META-INF/images/keyImages/" + name + ".png";
InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(name2);
return new ImageView(new Image(is));
} catch (Exception e) {
// not important...
}
return new ImageView();
}
use of javafx.scene.image.ImageView in project Gargoyle by callakrsos.
the class DialogUtil method showLoginDialog.
/**
* login Dialog 로그인 처리 다이얼로그
*
* @param consumer
* @return
*/
public static <T> Optional<Pair<String, String>> showLoginDialog(Consumer<? super Pair<String, String>> consumer) {
// Create the custom dialog.
Dialog<Pair<String, String>> dialog = new Dialog<>();
dialog.setTitle("Login Dialog");
dialog.setHeaderText("Look, a Custom Login Dialog");
dialog.setGraphic(new ImageView(new Image("file:resources/images/login.png")));
// Set the button types.
ButtonType loginButtonType = new ButtonType("Login", ButtonData.OK_DONE);
ButtonType localButtonType = new ButtonType("Local", ButtonData.APPLY);
dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, localButtonType, ButtonType.CANCEL);
// Create the username and password labels and fields.
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField username = new TextField();
username.setPromptText("Username");
PasswordField password = new PasswordField();
password.setPromptText("Password");
grid.add(new Label("Username:"), 0, 0);
grid.add(username, 1, 0);
grid.add(new Label("Password:"), 0, 1);
grid.add(password, 1, 1);
// Enable/Disable login button depending on whether a username was
// entered.
Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
loginButton.setDisable(true);
// Do some validation (using the Java 8 lambda syntax).
username.textProperty().addListener((observable, oldValue, newValue) -> {
loginButton.setDisable(newValue.trim().isEmpty());
});
dialog.getDialogPane().setContent(grid);
// Request focus on the username field by default.
Platform.runLater(() -> username.requestFocus());
// Convert the result to a username-password-pair when the login button
// is clicked.
dialog.setResultConverter(dialogButton -> {
if (dialogButton == loginButtonType) {
return new Pair<>(username.getText(), password.getText());
} else if (dialogButton == localButtonType) {
return new Pair<>(MEMO_LOCAL_USER, "");
}
return null;
});
Optional<Pair<String, String>> result = dialog.showAndWait();
result.ifPresent(consumer);
return result;
}
use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.
the class CustomTreeItem method buildItem.
/**
* build custom tree item
*
* @param title
* @param owner
* @param assignedText
* @param addIcon
*/
private void buildItem(String title, String owner, String addIcon) {
GridPane itemContainer = new GridPane();
// additioanl icon
if (addIcon != null) {
Image icon = new Image("/icons/" + addIcon);
ImageView iconContainer = new ImageView(icon);
itemContainer.add(iconContainer, 0, 0);
}
itemTitle.setText(title);
itemTitle.getStyleClass().add("treeItemTitle");
itemContainer.add(itemTitle, 1, 0);
if (owner != null && !"".equals(owner)) {
this.owner = new Label("(" + owner + ")");
this.owner.getStyleClass().add("treeItemChildText");
itemContainer.add(this.owner, 2, 0);
}
Image itemIcon = new Image("/icons/" + treeItemType.getIcon());
ImageView itemIconContainer = new ImageView(itemIcon);
setValue(itemContainer);
setGraphic(itemIconContainer);
}
use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.
the class CustomTreeItem method buildDefaultItem.
/**
* build default tree item
*
* @param title
*/
private void buildDefaultItem(String title) {
Image itemIcon = new Image("/icons/" + treeItemType.getIcon());
ImageView itemIconContainer = new ImageView(itemIcon);
setValue(title);
setGraphic(itemIconContainer);
}
use of javafx.scene.image.ImageView in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method initializeInlineComponent.
/**
* Initialize in-line built component
*/
private void initializeInlineComponent() {
updateBtn.setGraphic(new ImageView(new Image("/icons/apply.png")));
newProfileBtn.setGraphic(new ImageView(new Image("/icons/add_profile.png")));
stopUpdateBtn.setGraphic(new ImageView(new Image("/icons/stop_update.png")));
devicesTreeArrowContainer.setImage(leftArrow);
// mapped profiles enabling with property
profileListBox.disableProperty().bind(disableProfileProperty);
newProfileBtn.disableProperty().bind(disableProfileProperty);
profileDetailLabel.disableProperty().bind(disableProfileProperty);
profileListBox.getItems().clear();
profileListBox.setItems(FXCollections.observableArrayList(getProfilesNameList()));
profileListBox.valueProperty().addListener(new UpdateProfileListener<>(profileListBox.getSelectionModel()));
updateProfileListProperty.bind(ProfileManager.getInstance().getUpdatedProperty());
updateProfileListProperty.addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
List<String> profiles = getProfilesNameList();
profileListBox.setItems(FXCollections.observableArrayList(profiles));
if (!profiles.contains(currentSelectedProfile)) {
tableView.reset();
profileDetailContainer.setVisible(false);
}
});
tableView = new PacketTableView(230, this, true);
profileTableViewContainer.getChildren().add(tableView);
serverStatusIcon.setImage(new Image("/icons/offline.png"));
// initialize right click menu
rightClickPortMenu = new ContextMenu();
addMenuItem(rightClickPortMenu, "Acquire", ContextMenuClickType.ACQUIRE, false);
addMenuItem(rightClickPortMenu, "Force Acquire", ContextMenuClickType.FORCE_ACQUIRE, false);
addMenuItem(rightClickPortMenu, "Release Acquire", ContextMenuClickType.RELEASE_ACQUIRE, false);
rightClickProfileMenu = new ContextMenu();
addMenuItem(rightClickProfileMenu, "Play", ContextMenuClickType.PLAY, false);
addMenuItem(rightClickProfileMenu, "Pause", ContextMenuClickType.PAUSE, false);
addMenuItem(rightClickProfileMenu, "Stop", ContextMenuClickType.STOP, false);
rightClickGlobalMenu = new ContextMenu();
addMenuItem(rightClickGlobalMenu, "Release All Ports", ContextMenuClickType.RELEASE_ALL, false);
addMenuItem(rightClickGlobalMenu, "Acquire All Ports", ContextMenuClickType.ACQUIRE_ALL, false);
addMenuItem(rightClickGlobalMenu, "Force Acquire All Ports", ContextMenuClickType.FORCE_ACQUIRE_ALL, false);
addMenuItem(rightClickGlobalMenu, "Re-Acquire my Ports", ContextMenuClickType.ACQUIRE_MY_PORT, false);
// initialize multiplexer
multiplierView = new MultiplierView(this);
multiplierOptionContainer.getChildren().add(multiplierView);
notificationPanel = new NotificationPanel();
notificationPanel.setNotificationMsg(DISABLED_MULTIPLIER_MSG);
notificationPanelHolder.getChildren().add(notificationPanel);
// add close
TrexApp.getPrimaryStage().setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
// handle aplpication close
DialogManager.getInstance().closeAll();
handleAppClose();
}
});
TrexApp.getPrimaryStage().setOnShown(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
TrexApp.getPrimaryStage().focusedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
if (newValue && tableView.isStreamEditingWindowOpen()) {
tableView.setStreamEditingWindowOpen(false);
streamTableUpdated();
}
});
}
});
TrexApp.getPrimaryStage().setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
System.exit(0);
}
});
logContainer.getChildren().add(LogsController.getInstance().getView());
consoleLogContainer.getChildren().add(LogsController.getInstance().getConsoleLogView());
// initialize countdown service
countdownService = new CountdownService();
countdownService.setPeriod(Duration.seconds(Constants.REFRESH_ONE_INTERVAL_SECONDS));
countdownService.setRestartOnFailure(false);
countdownService.setOnSucceeded((WorkerStateEvent event) -> {
int count = (int) event.getSource().getValue();
countdownValue.setText(String.valueOf(count) + " Sec");
if (count == 0) {
doUpdateAssignedProfile(getSelectedPortIndex());
}
});
devicesTree.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
handleTreeItemSelectionChanged();
}
});
}
Aggregations