Example usage for javafx.beans.property SimpleStringProperty SimpleStringProperty

List of usage examples for javafx.beans.property SimpleStringProperty SimpleStringProperty

Introduction

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

Prototype

public SimpleStringProperty(String initialValue) 

Source Link

Document

The constructor of StringProperty

Usage

From source file:com.adobe.ags.curly.model.ActionResult.java

public ActionResult(ActionRunner runner) {
    this.runner = runner;
    reportRow().add(new SimpleStringProperty(runner.getAction().getName()));
    reportRow().add(new SimpleStringProperty(""));
    reportRow().add(new SimpleIntegerProperty(0));
    reportRow().add(new SimpleStringProperty(""));
    reportRow().add(getDuration());/*w  ww  .  ja  v  a 2 s  . c o  m*/
    setStatus(NOT_STARTED, 0, "");
}

From source file:aajavafx.MedicinesController.java

/**
 * Initializes the controller class.//  www. ja v a2  s .c  o  m
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    idColumn.setCellValueFactory(cellData -> new SimpleStringProperty("" + cellData.getValue().getmedId()));
    nameColumn.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().getMedName()));
    volumeColumn
            .setCellValueFactory(cellData -> new SimpleStringProperty("" + cellData.getValue().getVolume()));
    measurementColumn.setCellValueFactory(
            cellData -> new SimpleStringProperty(cellData.getValue().getMedMeasurementUnit()));

    idField.setEditable(false);
    nameField.setEditable(false);
    volumeField.setEditable(false);
    measurementField.setEditable(false);

    try {
        //Populate table 
        tableMedicines.setItems(getMedicines());

    } catch (IOException ex) {
        Logger.getLogger(CustomerController.class.getName()).log(Level.SEVERE, null, ex);
    } catch (JSONException ex) {
        Logger.getLogger(CustomerController.class.getName()).log(Level.SEVERE, null, ex);
    }

    tableMedicines.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
        if (newSelection != null) {
            idField.setText("" + newSelection.getmedId());
            nameField.setText(newSelection.getMedName());
            volumeField.setText(newSelection.getVolume().toString());
            measurementField.setText(newSelection.getMedMeasurementUnit());
        }
    });
}

From source file:context.ui.misc.FileHandler.java

/**
 *
 * @param message//from   w ww  . ja  v  a2 s .com
 * @return
 */
public static FileData openFileChooser(String message) {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle(message);

    fileChooser.setInitialDirectory(new File(getLastFileLocation()));
    final File selectedFile = fileChooser.showOpenDialog(ContextFXController.getStage());
    if (selectedFile != null) {
        selectedFile.getAbsolutePath();
        FileData file = new FileData(new SimpleStringProperty(selectedFile.getName()), selectedFile);
        setLastFileLocation(selectedFile.getParent());
        return file;
    } else {
        System.out.println("Selected File is Null");
        return null;
    }
}

From source file:com.adobe.ags.curly.model.ActionResult.java

public ActionResult(String name, Exception ex) {
    reportRow().add(new SimpleStringProperty(name));
    reportRow().add(new SimpleStringProperty("Failure"));
    reportRow().add(new SimpleIntegerProperty(0));
    reportRow().add(new SimpleStringProperty(""));
    reportRow().add(getDuration());//from w w  w . j a  v  a2  s.  com
    setException(ex);
}

From source file:context.ui.misc.FileHandler.java

/**
 *
 * @param path//  w ww  .j  a v a 2 s.  co  m
 * @return
 */
public static StringProperty getFileNameProperty(String path) {
    return new SimpleStringProperty(getFileName(path));
}

From source file:sonicScream.controllers.CategoryTabControllerTest.java

@Before
public void setUp() throws URISyntaxException, IOException {
    URL location = getClass().getResource("/sonicScream/assets/test");
    Path folder = Paths.get(location.toURI());

    ObservableList<Script> scriptList = FXCollections.observableArrayList();

    Category category = mock(Category.class);
    when(category.getCategoryScripts()).thenReturn(scriptList);
    when(category.categoryNameProperty()).thenReturn(new SimpleStringProperty(Constants.CATEGORY_HEROES));

    List<Path> paths = FilesEx.listFiles(folder);
    Script realScript = new Script(paths.get(0), category);
    Script mockScript = mock(Script.class);//new Script(paths.get(0), category);
    when(mockScript.getRootNode()).thenReturn(realScript.getRootNode());
    when(mockScript.getSimpleTree()).thenReturn(realScript.getSimpleTree());
    when(mockScript.getParentCategoryName()).thenReturn(profileName);
    scriptList.add(mockScript);//from  w w  w.  j a  v a2s  .co m
    scriptList.add(mockScript);

    ArrayList<Category> categories = new ArrayList<>();
    categories.add(category);
    when(profile.getCategories()).thenReturn(categories);

    profile.getCategories().add(category);

    controller = new CategoryTabController(profile.getCategories().get(0));
}

From source file:com.loop81.fxcomparer.FXComparerController.java

/** 
 * Initiate the table by setting the correct width of the columns and adding a custom value-factory for the
 * size column. //from  w  ww.  j a va2s. co m
 */
private void initiateTable() {
    columnName.prefWidthProperty().bind(compareTable.widthProperty().divide(5).multiply(3));
    columnName.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<ComparisonEntry, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(CellDataFeatures<ComparisonEntry, String> cell) {
                    return new SimpleStringProperty(cell.getValue().getOriginalEntry().getEntryName());
                }
            });

    columnState.prefWidthProperty().bind(compareTable.widthProperty().divide(5));
    columnState.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<ComparisonEntry, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(CellDataFeatures<ComparisonEntry, String> cell) {
                    return new SimpleObjectProperty<>(MessageBundle.getString(
                            "result.state." + cell.getValue().getChangeState().toString().toLowerCase()));
                }
            });

    columnChange.prefWidthProperty().bind(compareTable.widthProperty().divide(5));
    columnChange.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<ComparisonEntry, ChangeWrapper>, ObservableValue<ChangeWrapper>>() {
                @Override
                public ObservableValue<ChangeWrapper> call(
                        CellDataFeatures<ComparisonEntry, ChangeWrapper> cell) {
                    long sizeChange = cell.getValue().getSizeChange();
                    if (sizeChange == 0) {
                        return new SimpleObjectProperty<ChangeWrapper>(new ChangeWrapper());
                    } else if (sizeChange == Long.MIN_VALUE) {
                        return new SimpleObjectProperty<ChangeWrapper>(
                                new ChangeWrapper(MessageBundle.getString("general.not_avalible"), 0));
                    } else {
                        return new SimpleObjectProperty<ChangeWrapper>(
                                new ChangeWrapper(convertdifferenceToReadableString(sizeChange), sizeChange));
                    }
                }
            });
    columnChange.setComparator(new Comparator<ChangeWrapper>() {
        @Override
        public int compare(ChangeWrapper wrapper1, ChangeWrapper wrapper2) {
            return wrapper1.compareTo(wrapper2);
        }
    });
}

From source file:ch.chrigu.datastructures.demo.instances.CollectionInstance.java

private void initProperties() {
    this.name = new SimpleStringProperty(instance.getClass().getName());
    if (collectionOptions != null) {
        this.parametersProperty = new SimpleStringProperty(collectionOptions.toString());
    }//  ww  w  .  j av a  2 s  . c o  m
    lastMeasurementInMs = new SimpleLongProperty();
    elements = new SimpleStringProperty();
    size = new SimpleIntegerProperty();
    updateElements();
    updateSize();
}

From source file:com.properned.application.SystemController.java

public void initialize() {
    logger.info("Initialize System controller");
    localeButton.disableProperty().bind(multiLanguageProperties.isLoadedProperty().not());
    saveButton.disableProperty().bind(multiLanguageProperties.isDirtyProperty().not()
            .or(multiLanguageProperties.isLoadedProperty().not()));
    Stage primaryStage = Properned.getInstance().getPrimaryStage();
    primaryStage.titleProperty()//from  ww  w  .  ja  v  a  2 s . c  o  m
            .bind(multiLanguageProperties.baseNameProperty()
                    .concat(Bindings.when(multiLanguageProperties.isLoadedProperty())
                            .then(new SimpleStringProperty(" (")
                                    .concat(multiLanguageProperties.parentDirectoryPathProperty()).concat(")"))
                            .otherwise(""))
                    .concat(Bindings.when(multiLanguageProperties.isDirtyProperty()).then(" *").otherwise("")));

    FilteredList<String> filteredList = new FilteredList<>(multiLanguageProperties.getListMessageKey(),
            new Predicate<String>() {
                @Override
                public boolean test(String t) {
                    String filter = filterText.getText();
                    if (filter == null || filter.equals("")) {
                        return true;
                    }
                    return t.contains(filter);
                }
            });
    SortedList<String> sortedList = new SortedList<>(filteredList, new Comparator<String>() {
        @Override
        public int compare(String o1, String o2) {
            return o1.compareTo(o2);
        }
    });
    messageKeyList.setItems(sortedList);
    filterText.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            // Filter the list
            filteredList.setPredicate(new Predicate<String>() {
                @Override
                public boolean test(String t) {
                    String filter = filterText.getText();
                    if (filter == null || filter.equals("")) {
                        return true;
                    }
                    return t.contains(filter);
                }
            });

            // check the add button disabled status
            if (isKeyCanBeAdded(newValue)) {
                addButton.setDisable(false);
            } else {
                addButton.setDisable(true);
            }

        }

    });
    ChangeListener<String> changeMessageListener = new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            logger.info("Message key selection changed : " + newValue);
            valueList.setItems(FXCollections.observableArrayList());

            valueList.setItems(FXCollections
                    .observableArrayList(multiLanguageProperties.getMapPropertiesByLocale().keySet()));
        }
    };
    messageKeyList.getSelectionModel().selectedItemProperty().addListener(changeMessageListener);
    messageKeyList.setCellFactory(c -> new MessageKeyListCell(multiLanguageProperties));

    valueList.setCellFactory(c -> new ValueListCell(multiLanguageProperties, messageKeyList));

    filterText.setOnKeyReleased(new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent event) {
            if (event.getCode() == KeyCode.DOWN) {
                messageKeyList.requestFocus();
                event.consume();
            } else if (event.getCode() == KeyCode.ENTER) {
                addKey();
                event.consume();
            }
        }
    });
}