Example usage for javafx.scene Node getProperties

List of usage examples for javafx.scene Node getProperties

Introduction

In this page you can find the example usage for javafx.scene Node getProperties.

Prototype

public final ObservableMap<Object, Object> getProperties() 

Source Link

Document

Returns an observable map of properties on this node for use primarily by application developers.

Usage

From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java

/**
 * Useful when taking a node already placed by a fxml file, for example, and wrapping it
 * in a stack pane/* w  w  w.j a va  2  s.c  o  m*/
 * WARNING - the mechanism of moving the properties isn't currently very smart - it should only target
 * GridPane properties, but it takes everything.
 * 
 * @return the replacementNode
 */
public static Node swapGridPaneComponents(Node placedNode, Node replacementNode, GridPane gp) {
    int index = gp.getChildren().indexOf(placedNode);
    if (index < 0) {
        throw new RuntimeException("Placed Node is not in the grid pane");
    }

    gp.getChildren().remove(index);
    gp.getChildren().add(index, replacementNode);

    //this transfers the node specific constraints
    replacementNode.getProperties().putAll(placedNode.getProperties());
    return replacementNode;
}

From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java

/**
 * Useful when taking a node already placed by a fxml file, for example, and wrapping it
 * in a stack pane/*from www  .  j  ava  2s  . c o  m*/
 * WARNING - the mechanism of moving the properties isn't currently very smart - it should only target
 * VBox properties, but it takes everything.
 * @return replacementNode
 */
public static StackPane swapVBoxComponents(Node placedNode, StackPane replacementNode, VBox vb) {
    int index = vb.getChildren().indexOf(placedNode);
    if (index < 0) {
        throw new RuntimeException("Placed Node is not in the vbox");
    }

    vb.getChildren().remove(index);
    vb.getChildren().add(index, replacementNode);

    //this transfers the node specific constraints
    replacementNode.getProperties().putAll(placedNode.getProperties());
    return replacementNode;
}

From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java

/**
 * Useful when taking a node already placed by a fxml file, for example, and wrapping it
 * in a stack pane//from  www  .  jav  a 2  s  .c  o  m
 * WARNING - the mechanism of moving the properties isn't currently very smart - it should only target
 * HBox properties, but it takes everything.
 * @return replacementNode
 */
public static StackPane swapHBoxComponents(Node placedNode, StackPane replacementNode, HBox hb) {
    int index = hb.getChildren().indexOf(placedNode);
    if (index < 0) {
        throw new RuntimeException("Placed Node is not in the vbox");
    }

    hb.getChildren().remove(index);
    hb.getChildren().add(index, replacementNode);

    //this transfers the node specific constraints
    replacementNode.getProperties().putAll(placedNode.getProperties());
    return replacementNode;
}

From source file:Main.java

public void focusChanged(ObservableValue<? extends Node> value, Node oldNode, Node newNode) {
    // Focus has changed to a new node
    String microHelpText = (String) newNode.getProperties().get("microHelpText");

    if (microHelpText != null && microHelpText.trim().length() > 0) {
        helpText.setText(microHelpText);
        helpText.setVisible(true);/*  w w  w.j  a v a 2  s. c om*/

        // Position the help text node
        double x = newNode.getLayoutX() + newNode.getLayoutBounds().getMinX()
                - helpText.getLayoutBounds().getMinX();
        double y = newNode.getLayoutY() + newNode.getLayoutBounds().getMinY()
                + newNode.getLayoutBounds().getHeight() - helpText.getLayoutBounds().getMinX();

        helpText.setLayoutX(x);
        helpText.setLayoutY(y);
        helpText.setWrappingWidth(newNode.getLayoutBounds().getWidth());
    } else {
        helpText.setVisible(false);
    }
}

From source file:com.heliosdecompiler.helios.gui.view.editors.DisassemblerView.java

@Override
public CompletableFuture<byte[]> save(Node node) {
    if (!(node instanceof CodeArea)) {
        return CompletableFuture.completedFuture(new byte[0]);
    }/* ww  w.j  a v a2s . c  om*/

    String assembledCode = ((CodeArea) node).getText();

    CompletableFuture<byte[]> future = new CompletableFuture<>();

    backgroundTaskHelper.submit(new BackgroundTask(
            Message.TASK_ASSEMBLE_FILE.format(node.getProperties().get("path").toString()), true, () -> {
                if (controller instanceof KrakatauDisassemblerController) {
                    KrakatauAssemblerSettings settings = new KrakatauAssemblerSettings();
                    settings.setPythonExecutable(new File(configuration.getString(Settings.PYTHON2_KEY)));
                    settings.setProcessCreator(processController::launchProcess);

                    try {
                        TransformationResult<byte[]> result = StandardTransformers.Assemblers.KRAKATAU
                                .assemble(assembledCode, settings);
                        if (result.getTransformationData().size() == 1) {
                            future.complete(result.getTransformationData().values().iterator().next());
                        } else {
                            future.completeExceptionally(new KrakatauException(KrakatauException.Reason.UNKNOWN,
                                    result.getStdout(), result.getStderr()));
                        }
                    } catch (TransformationException e) {
                        future.completeExceptionally(e);
                    }
                } else {
                    future.complete(new byte[0]);
                }
            }));

    return future;
}