Example usage for javafx.beans.property StringProperty set

List of usage examples for javafx.beans.property StringProperty set

Introduction

In this page you can find the example usage for javafx.beans.property StringProperty set.

Prototype

void set(T value);

Source Link

Document

Set the wrapped value.

Usage

From source file:Main.java

public static void main(String[] args) {
    StringProperty password = new SimpleStringProperty("java2s.com");
    password.set("example.com");
    System.out.println("Modified StringProperty " + password.get());
}

From source file:Main.java

public static void main(String[] args) {
    User contact = new User("Jame", "Bind");
    StringProperty fname = new SimpleStringProperty();
    fname.bindBidirectional(contact.firstNameProperty());

    contact.firstNameProperty().set("new value");
    fname.set("New First Name");

    System.out.println("firstNameProperty = " + contact.firstNameProperty().get());
    System.out.println("fname = " + fname.get());

}

From source file:Main.java

License:asdf

public static void main(String[] args) {
    StringProperty prop1 = new SimpleStringProperty("");
    StringProperty prop2 = new SimpleStringProperty("");

    prop2.bindBidirectional(prop1);/*w w  w.ja va2  s.c  o  m*/

    System.out.println("prop1.isBound() = " + prop1.isBound());
    System.out.println("prop2.isBound() = " + prop2.isBound());

    prop1.set("asdf");
    System.out.println(prop2.get());

    prop2.set(prop2.get());
    System.out.println(prop1.get());
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("Keyboard");
    Group root = new Group();
    Scene scene = new Scene(root, 530, 300, Color.WHITE);

    final StringProperty statusProperty = new SimpleStringProperty();

    InnerShadow iShadow = InnerShadowBuilder.create().offsetX(3.5f).offsetY(3.5f).build();
    final Text status = TextBuilder.create().effect(iShadow).x(100).y(50).fill(Color.LIME)
            .font(Font.font(null, FontWeight.BOLD, 35)).translateY(50).build();
    status.textProperty().bind(statusProperty);
    statusProperty.set("Line\nLine2\nLine");
    root.getChildren().add(status);/*from   w w  w .  j a v  a2s .com*/

    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:context.ui.control.codebooknetwork.CodebookNetworkController.java

/**
 *
 * @param event// w ww.  ja v  a2s.  c  o  m
 */
@Override
public void handleStep3RunButton(ActionEvent event) {
    if (!this.validateInputOutput()) {
        return;
    }
    CodebookApplicationTaskInstance instance = (CodebookApplicationTaskInstance) getTaskInstance();
    CodebookNetworkConfigurationController confController = (CodebookNetworkConfigurationController) configurationController;
    StringProperty inputPath = basicInputViewController.getSelectedItemLabel().textProperty();
    StringProperty inputname = basicInputViewController.getSelectedCorpusName();
    CorpusData input = new CorpusData(inputname, inputPath);
    instance.setInput(input);

    final StringProperty outputPath = basicOutputViewController.getOutputDirTextField().textProperty();

    final String subdirectory = outputPath.get() + "/CB-Results/";
    FileHandler.createDirectory(subdirectory);
    System.out.println("Created sub dir: " + subdirectory);

    FileList output = new FileList(NamingPolicy.generateOutputName(inputname.get(), outputPath.get(), instance),
            subdirectory);
    instance.setTextOutput(output);

    StringProperty tabularName = NamingPolicy.generateTabularName(inputname.get(), outputPath.get(), instance);
    StringProperty csvTabularPath = NamingPolicy.generateTabularPath(inputname.get(), outputPath.get(),
            instance);
    StringProperty gexfTabularPath = NamingPolicy.generateTabularPath(inputname.get(), outputPath.get(),
            instance, ".gexf");

    csvTabularPath.set(FilenameUtils.getFullPath(csvTabularPath.get()) + "CorpusNetwork.csv");
    gexfTabularPath.set(FilenameUtils.getFullPath(gexfTabularPath.get()) + "CorpusNetwork.gexf");
    System.out.println("CSV Path: " + csvTabularPath.get() + "\nGexF Path: " + gexfTabularPath.get());

    List<TabularData> td = new ArrayList<TabularData>();
    td.add(0, new TabularData(tabularName, csvTabularPath));
    td.add(1, new TabularData(new SimpleStringProperty(tabularName.get() + "-gexf"), gexfTabularPath));

    instance.setTabularOutput(td);

    instance.setCodebookFile(confController.getCodebookFile());
    instance.setDistance(confController.getDistance());
    instance.setIsDrop(confController.getCodebookMode());
    instance.setIsNormal(confController.getCodebookMethod());
    if (confController.getAggregationType() == 0) { // per document
        instance.setNetInputCorpus(false);
    } else { //per corpus
        instance.setNetInputCorpus(true);
    }
    instance.setNetOutputCSV(true);
    instance.setNetOutputGEXF(true);
    instance.setNetOutputType(confController.getNetworkType());
    instance.setNetwork(true);
    instance.setSeparator(confController.getUnitOfAnalysis());
    instance.setCustomTag(confController.getCustomTag());

    CTask task = new CodebookApplicationTask(this.getProgress(), this.getProgressMessage());
    task.setTaskInstance(instance);
    task.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent t) {
            activeAllControls();
            nextStepsViewController = new CodebookNetworkNextStepsController(
                    NamingPolicy.generateTaskName(CodebookApplicationTaskInstance.class).get());
            nextStepsViewController.setParent(CodebookNetworkController.this);
            nextStepsViewController.setOutputDir(outputPath.get());
            nextStepsViewController.setTabular(getTaskInstance().getTabularOutput(0));
            nextStepsViewController.setFilelist((FileList) getTaskInstance().getTextOutput());
            nextStepsViewController.init();
            ProjectManager.getThisProject().addResult(getTaskInstance().getTabularOutput(0));
            ProjectManager.getThisProject().addData(getTaskInstance().getTextOutput());
            //                ProjectManager.getThisProject().addResult(getTaskInstance().getTabularOutput(1));
            if (isNew()) {
                ProjectManager.getThisProject().addTask(getTaskInstance());
                setNew(false);
            }
            showNextStepPane(nextStepsViewController);
        }
    });
    getProgressBar().setVisible(true);
    deactiveAllControls();
    task.start();

    setTaskInstance(task.getTaskInstance());

}

From source file:com.adobe.ags.curly.controller.ActionRunner.java

private void applyVariablesToMap(Map<String, String> variables, Map<String, String> target) {
    Set<String> variableTokens = ActionUtils.getVariableNames(action);

    Set removeSet = new HashSet<>();
    Map<String, String> newValues = new HashMap<>();

    target.forEach((paramName, paramValue) -> {
        StringProperty paramNameProperty = new SimpleStringProperty(paramName);
        variableTokens.forEach((String originalName) -> {
            String[] variableNameParts = originalName.split("\\|");
            String variableName = variableNameParts[0];
            String variableNameMatchPattern = Pattern.quote("${" + originalName + "}");
            String val = variables.get(variableName);
            if (val == null) {
                val = "";
            }//from   ww  w  . j  a  v a2s. c om
            String variableValue = Matcher.quoteReplacement(val);
            //----
            String newParamValue = newValues.containsKey(paramNameProperty.get())
                    ? newValues.get(paramNameProperty.get())
                    : paramValue;
            String newParamName = paramNameProperty.get().replaceAll(variableNameMatchPattern, variableValue);
            paramNameProperty.set(newParamName);
            newParamValue = newParamValue.replaceAll(variableNameMatchPattern, variableValue);
            if (!newParamName.equals(paramName) || !newParamValue.equals(paramValue)) {
                removeSet.add(paramNameProperty.get());
                removeSet.add(paramName);
                newValues.put(newParamName, newParamValue);
            }
        });
    });
    target.keySet().removeAll(removeSet);
    target.putAll(newValues);
}

From source file:com.adobe.ags.curly.controller.ActionRunner.java

private void applyMultiVariablesToMap(Map<String, String> variables, Map<String, List<String>> target) {
    Set<String> variableTokens = ActionUtils.getVariableNames(action);

    Map<String, List<String>> newValues = new HashMap<>();
    Set removeSet = new HashSet<>();

    target.forEach((paramName, paramValues) -> {
        StringProperty paramNameProperty = new SimpleStringProperty(paramName);
        variableTokens.forEach((String originalName) -> {
            String[] variableNameParts = originalName.split("\\|");
            String variableName = variableNameParts[0];
            String variableNameMatchPattern = Pattern.quote("${" + originalName + "}");
            String val = variables.get(variableName);
            if (val == null) {
                val = "";
            }/*from  w w  w.  jav  a  2  s  .  c o  m*/
            String variableValue = Matcher.quoteReplacement(val);
            String newParamName = paramNameProperty.get().replaceAll(variableNameMatchPattern, variableValue);
            removeSet.add(paramNameProperty.get());
            removeSet.add(paramName);
            if (newValues.get(paramNameProperty.get()) == null) {
                newValues.put(paramNameProperty.get(), new ArrayList<>(paramValues.size()));
            }
            if (newValues.get(newParamName) == null) {
                newValues.put(newParamName, new ArrayList<>(paramValues.size()));
            }
            List<String> newParamValues = newValues.get(paramNameProperty.get());
            for (int i = 0; i < paramValues.size(); i++) {
                String newParamValue = newParamValues != null && newParamValues.size() > i
                        && newParamValues.get(i) != null ? newParamValues.get(i) : paramValues.get(i);

                // fix for removing JCR values (setting them to an empty
                // string deletes them from the JCR)
                if (null == newParamValue) {
                    newParamValue = "";
                }

                newParamValue = newParamValue.replaceAll(variableNameMatchPattern, variableValue);
                if (newParamName.contains("/") && newParamValue.equals("@" + newParamName)) {
                    // The upload name should actually be the file name, not the full path of the file.
                    removeSet.add(newParamName);
                    newValues.remove(newParamName);
                    newParamName = newParamName.substring(newParamName.lastIndexOf("/") + 1);
                    newValues.put(newParamName, newParamValues);
                }
                if (newValues.get(newParamName).size() == i) {
                    newValues.get(newParamName).add(newParamValue);
                } else {
                    newValues.get(newParamName).set(i, newParamValue);
                }
            }
            if (!paramNameProperty.get().equals(newParamName)) {
                newValues.remove(paramNameProperty.get());
            }
            paramNameProperty.set(newParamName);
        });
    });
    target.keySet().removeAll(removeSet);
    target.putAll(newValues);
}