Example usage for javafx.beans.property StringProperty get

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

Introduction

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

Prototype

T get();

Source Link

Document

Returns the current value of this ObservableObjectValue .

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

License:asdf

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

    prop2.bindBidirectional(prop1);/*from ww w.j  a v a  2s.c  om*/

    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

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:context.ui.control.codebooknetwork.CodebookNetworkController.java

/**
 *
 * @param event//ww w . j a  v  a  2  s . c  om
 */
@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:org.yardstick.spark.util.FXCSSUpdater.java

public void bindCss(final StringProperty cssProperty) {
    cssProperty.addListener(new ChangeListener<String>() {
        @Override/*from  www. j a v a  2  s  .  c  o m*/
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            cssHolder.str = cssProperty.get();
            Platform.runLater(new Runnable() {
                public void run() {
                    scene.getStylesheets().clear();
                    scene.getStylesheets().add("internal:stylesheet.css");
                }
            });
        }
    });
}

From source file:employees.Employees.java

@Override
public void start(Stage stage) throws Exception {
    //        Parent root = FXMLLoader.load(getClass().getResource("MainUI.fxml"));
    //        /*  w  w  w  .j  a  va  2 s. c  o m*/
    //        Scene scene = new Scene(root);
    //        
    //        stage.setScene(scene);
    //        stage.show();
    //new LoginStage();
    Task<String> inittask = inittasks.pingServer();
    StringProperty pingResponse = new SimpleStringProperty();
    StringProperty messages = new SimpleStringProperty();
    pingResponse.bind(inittask.valueProperty());
    messages.bind(inittask.messageProperty());
    inittask.stateProperty().addListener((workerState, oldState, newState) -> {
        if (newState == Worker.State.SUCCEEDED) {
            String response = pingResponse.get();
            JSONObject obj = new JSONObject(response);
            String Status = obj.getString("Status");
            if (Status.equals("OK")) {
                AlertDialog ad = new AlertDialog();
                ad.showDialog(AlertTypes.Types.INFORMATION, "Successfull", "PING OK", "Connection Successfull");
            }
        } else if (newState == Worker.State.CANCELLED) {
            AlertDialog ad = new AlertDialog();
            ad.showDialog(AlertTypes.Types.WARNING, "Operation Aborted", "Operation Aborted",
                    "Task Was Cancelled,The System Will Now Exit");
            System.exit(0);
        } else if (newState == Worker.State.FAILED) {
            StringBuilder errstr = new StringBuilder();
            errstr.append(
                    "An Error Has Occured While Connecting to The Server, A Description of the Error is Shown Below : \n");
            errstr.append(messages.toString());
            AlertDialog ad = new AlertDialog();
            ad.showDialog(AlertTypes.Types.ERROR, "An Error Occurred While Connecting to The Server", "Error",
                    messages.get());
            Optional<ButtonType> response = AlertDialog.showConfirmation(
                    "Unable to Connect to The Server: Would you Like To Review Your Network Settings?",
                    "Connection Settings Review", "Review Connection Settings?");
            if (response.get() == ButtonType.OK) {
                try {
                    new initSettingsStage();
                } catch (IOException ex) {
                    Logger.getLogger(Employees.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    });
    new Thread(inittask).start();

}

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 = "";
            }/*w w  w. jav  a2s.  c om*/
            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);
}

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 w  w w .  jav  a2 s  . co m*/
            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);
}