Search in sources :

Example 86 with Node

use of javafx.scene.Node in project jabref by JabRef.

the class ErrorConsoleController method createCellFactory.

private Callback<ListView<LogEventViewModel>, ListCell<LogEventViewModel>> createCellFactory() {
    return cell -> new ListCell<LogEventViewModel>() {

        private HBox graphic;

        private Node icon;

        private VBox message;

        private Label heading;

        private Label stacktrace;

        {
            graphic = new HBox(10);
            heading = new Label();
            stacktrace = new Label();
            message = new VBox();
            message.getChildren().setAll(heading, stacktrace);
            setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
        }

        @Override
        public void updateItem(LogEventViewModel event, boolean empty) {
            super.updateItem(event, empty);
            if (event == null || empty) {
                setGraphic(null);
            } else {
                icon = event.getIcon().getGraphicNode();
                heading.setText(event.getDisplayText());
                heading.getStyleClass().setAll(event.getStyleClass());
                stacktrace.setText(event.getStackTrace().orElse(""));
                graphic.getStyleClass().setAll(event.getStyleClass());
                graphic.getChildren().setAll(icon, message);
                setGraphic(graphic);
            }
        }
    };
}
Also used : Button(javafx.scene.control.Button) KeyBindingRepository(org.jabref.gui.keyboard.KeyBindingRepository) HBox(javafx.scene.layout.HBox) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) AbstractController(org.jabref.gui.AbstractController) Node(javafx.scene.Node) DialogService(org.jabref.gui.DialogService) IconTheme(org.jabref.gui.IconTheme) KeyEvent(javafx.scene.input.KeyEvent) VBox(javafx.scene.layout.VBox) Inject(javax.inject.Inject) FXML(javafx.fxml.FXML) SelectionMode(javafx.scene.control.SelectionMode) ListChangeListener(javafx.collections.ListChangeListener) ClipBoardManager(org.jabref.gui.ClipBoardManager) ObservableList(javafx.collections.ObservableList) Callback(javafx.util.Callback) ContentDisplay(javafx.scene.control.ContentDisplay) KeyBinding(org.jabref.gui.keyboard.KeyBinding) BuildInfo(org.jabref.logic.util.BuildInfo) HBox(javafx.scene.layout.HBox) ListCell(javafx.scene.control.ListCell) Node(javafx.scene.Node) Label(javafx.scene.control.Label) VBox(javafx.scene.layout.VBox)

Example 87 with Node

use of javafx.scene.Node in project Smartcity-Smarthouse by TechnionYP5777.

the class Controller method printUpdateMessage.

private void printUpdateMessage() {
    final ObservableList<Node> children = console.getChildren();
    Text text = new Text("Sending update message: {pulse: ");
    text.setStyle(STYLE_REG);
    children.add(0, text);
    text = new Text((int) Math.round(pulseSlider.getValue()) + "");
    text.setStyle(STYLE_PULSE);
    children.add(1, text);
    text = new Text(", systolicBP: ");
    text.setStyle(STYLE_REG);
    children.add(2, text);
    text = new Text((int) Math.round(bpRSlider.getHighValue()) + "");
    text.setStyle(STYLE_SYSTOLIC);
    children.add(3, text);
    text = new Text(", diastolicBP: ");
    text.setStyle(STYLE_REG);
    children.add(4, text);
    text = new Text((int) Math.round(bpRSlider.getLowValue()) + "");
    text.setStyle(STYLE_DIASTOLIC);
    children.add(5, text);
    text = new Text("}\n");
    text.setStyle(STYLE_REG);
    children.add(6, text);
}
Also used : Node(javafx.scene.Node) Text(javafx.scene.text.Text)

Example 88 with Node

use of javafx.scene.Node in project VocabHunter by VocabHunter.

the class SessionProvider method get.

@Override
public ControllerAndView<SessionController, Node> get() {
    FXMLLoader loader = loaderProvider.get();
    Node root = ViewFxml.SESSION.loadNode(loader);
    SessionController controller = loader.getController();
    return new ControllerAndView<>(controller, root);
}
Also used : Node(javafx.scene.Node) ControllerAndView(io.github.vocabhunter.gui.common.ControllerAndView) FXMLLoader(javafx.fxml.FXMLLoader)

Example 89 with Node

use of javafx.scene.Node in project trex-stateless-gui by cisco-system-traffic-generator.

the class ConnectDialogController method handleCloseDialog.

/**
     * Handle close button clicking
     *
     * @param event
     */
@FXML
public void handleCloseDialog(final MouseEvent event) {
    ConnectionManager.getInstance().setConnected(false);
    Node node = (Node) event.getSource();
    Stage stage = (Stage) node.getScene().getWindow();
    stage.hide();
}
Also used : Node(javafx.scene.Node) Stage(javafx.stage.Stage) FXML(javafx.fxml.FXML)

Example 90 with Node

use of javafx.scene.Node in project jgnash by ccavanaugh.

the class NetworkAuthenticator method getPasswordAuthentication.

@Override
protected PasswordAuthentication getPasswordAuthentication() {
    final Preferences auth = Preferences.userRoot().node(NODEHTTP);
    final ResourceBundle resources = ResourceUtils.getBundle();
    final char[][] pass = { null };
    final String[] user = new String[1];
    // get the password
    if (auth.get(HTTPPASS, null) != null && !auth.get(HTTPPASS, null).isEmpty()) {
        pass[0] = auth.get(HTTPPASS, null).toCharArray();
    }
    // get the user
    user[0] = auth.get(HTTPUSER, null);
    if (user[0] != null) {
        if (user[0].length() <= 0) {
            user[0] = null;
        }
    }
    // if either returns null, pop a dialog
    if (user[0] == null || pass[0] == null) {
        final Dialog<Pair<String, String>> dialog = new Dialog<>();
        dialog.setTitle(resources.getString("Title.HTTPProxy"));
        dialog.setHeaderText(resources.getString("Message.EnterNetworkAuth"));
        // Set the button types.
        final ButtonType loginButtonType = new ButtonType(resources.getString("Button.Ok"), ButtonBar.ButtonData.OK_DONE);
        dialog.getDialogPane().getStylesheets().addAll(MainView.DEFAULT_CSS);
        dialog.getDialogPane().getStyleClass().addAll("dialog");
        dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
        // Create the username and password labels and fields.
        final GridPane grid = new GridPane();
        grid.getStylesheets().addAll(MainView.DEFAULT_CSS);
        grid.getStyleClass().addAll("form");
        final TextField userNameField = new TextField();
        final PasswordField passwordField = new PasswordField();
        grid.add(new Label(resources.getString("Label.UserName")), 0, 0);
        grid.add(userNameField, 1, 0);
        grid.add(new Label(resources.getString("Label.Password")), 0, 1);
        grid.add(passwordField, 1, 1);
        // Enable/Disable login button depending on whether a username was entered.
        final Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
        loginButton.setDisable(true);
        // bind the button, must not be empty
        loginButton.disableProperty().bind(userNameField.textProperty().isEmpty());
        dialog.getDialogPane().setContent(grid);
        // Request focus on the username field by default.
        Platform.runLater(userNameField::requestFocus);
        dialog.setResultConverter(dialogButton -> {
            if (dialogButton == loginButtonType) {
                return new Pair<>(userNameField.getText(), passwordField.getText());
            }
            return null;
        });
        final Optional<Pair<String, String>> result = dialog.showAndWait();
        result.ifPresent(usernamePassword -> {
            user[0] = usernamePassword.getKey();
            pass[0] = usernamePassword.getValue().toCharArray();
        });
    }
    return new PasswordAuthentication(user[0], pass[0]);
}
Also used : GridPane(javafx.scene.layout.GridPane) Node(javafx.scene.Node) Label(javafx.scene.control.Label) Dialog(javafx.scene.control.Dialog) TextField(javafx.scene.control.TextField) ResourceBundle(java.util.ResourceBundle) PasswordField(javafx.scene.control.PasswordField) Preferences(java.util.prefs.Preferences) ButtonType(javafx.scene.control.ButtonType) Pair(javafx.util.Pair) PasswordAuthentication(java.net.PasswordAuthentication)

Aggregations

Node (javafx.scene.Node)130 Stage (javafx.stage.Stage)25 Parent (javafx.scene.Parent)23 Label (javafx.scene.control.Label)19 ArrayList (java.util.ArrayList)18 ObservableList (javafx.collections.ObservableList)16 Button (javafx.scene.control.Button)16 List (java.util.List)15 Scene (javafx.scene.Scene)15 FXML (javafx.fxml.FXML)14 BorderPane (javafx.scene.layout.BorderPane)13 IOException (java.io.IOException)12 HBox (javafx.scene.layout.HBox)12 Color (javafx.scene.paint.Color)12 Platform (javafx.application.Platform)10 Insets (javafx.geometry.Insets)10 FXCollections (javafx.collections.FXCollections)9 MouseEvent (javafx.scene.input.MouseEvent)9 VBox (javafx.scene.layout.VBox)9 FadeTransition (javafx.animation.FadeTransition)8