本文整理汇总了Java中javafx.beans.property.StringProperty.set方法的典型用法代码示例。如果您正苦于以下问题:Java StringProperty.set方法的具体用法?Java StringProperty.set怎么用?Java StringProperty.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.beans.property.StringProperty
的用法示例。
在下文中一共展示了StringProperty.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canCreateOrRenameCondition
import javafx.beans.property.StringProperty; //导入方法依赖的package包/类
protected boolean canCreateOrRenameCondition(ContextCondition condition, StringProperty conditionName) {
String name = conditionName.get().trim();
if(name.isEmpty()) {
DialogHelper.showErrorAlert("Condition name", "The name must be non-empty!");
conditionName.set(nameForCondition(condition));
return false;
}
if(condition.getStation().getFilters().values().contains(condition)) {
if(!condition.getStation().getFilterName(condition).equals(name)) {
if(condition.getStation().getFilters().keySet().contains(name)) {
DialogHelper.showErrorAlert("Rename condition", "The name must be unique!");
conditionName.set(nameForCondition(condition));
return false;
}
}
}
else {
if(condition.getStation().getFilters().keySet().contains(name)) {
DialogHelper.showErrorAlert("New condition", "The name must be unique!");
conditionName.set(nameForCondition(condition));
return false;
}
}
return true;
}
示例2: bind
import javafx.beans.property.StringProperty; //导入方法依赖的package包/类
public void bind(final StringProperty property, final String propertyName) {
String value = props.getProperty(propertyName);
if (value != null) {
property.set(value);
}
property.addListener(new InvalidationListener() {
@Override
public void invalidated(Observable o) {
props.setProperty(propertyName, property.getValue());
}
});
}
示例3: testNestedRows
import javafx.beans.property.StringProperty; //导入方法依赖的package包/类
@Test
public void testNestedRows() {
ObservableList<SpecificationRow<StringProperty>> rows =
FXCollections.observableList(
Collections.singletonList(specRow),
identityExtractor()
);
rows.addListener((Observable obs) -> listenerCalls++);
assertEquals("listener calls before change", 0, listenerCalls);
toBeChanged.set("XXX");
assertEquals("listener calls after change", 1, listenerCalls);
StringProperty toBeAddedChangedRemoved = new SimpleStringProperty("");
rows.get(0).getCells().put("toBeAddedChangedRemoved", toBeAddedChangedRemoved);
assertEquals("listener calls after adding", 2, listenerCalls);
toBeAddedChangedRemoved.set("ASDF");
assertEquals("listener calls after changing added", 3, listenerCalls);
rows.get(0).getCells().remove("toBeAddedChangedRemoved");
assertEquals("listener calls after removing", 4, listenerCalls);
toBeAddedChangedRemoved.set("SHOULD NOT FIRE EVENT");
assertEquals("listener calls after changing cell that was removed", 4, listenerCalls);
}
示例4: bind
import javafx.beans.property.StringProperty; //导入方法依赖的package包/类
private void bind(StringProperty stringProperty, IntegerProperty integerProperty) {
stringProperty.set(integerProperty.getValue().toString());
}