本文整理汇总了Java中javafx.beans.binding.StringExpression类的典型用法代码示例。如果您正苦于以下问题:Java StringExpression类的具体用法?Java StringExpression怎么用?Java StringExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringExpression类属于javafx.beans.binding包,在下文中一共展示了StringExpression类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAndAttachTab
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
private Tab createAndAttachTab(Path path) {
BorderPane pane = new BorderPane();
MplEditor editor = MplEditor.create(path, pane, eventBus, appMemento, this);
ReadOnlyBooleanProperty modifiedProperty = editor.modifiedProperty();
StringExpression titleText = Bindings.createStringBinding(() -> {
return modifiedProperty.get() ? "*" : "";
}, modifiedProperty).concat(path.getFileName());
Tab tab = new Tab();
tab.textProperty().bind(titleText);
tab.setContent(pane);
tab.setUserData(new MplEditorData(path, editor));
tab.setOnCloseRequest(e -> {
if (warnAboutUnsavedResources(Arrays.asList(tab)))
e.consume();
});
editorTabPane.getTabs().add(tab);
tab.setOnClosed(e -> {
editors.remove(path);
tabs.remove(path);
});
editors.put(path, editor);
tabs.put(path, tab);
return tab;
}
示例2: initializeLabels
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
private void initializeLabels() {
filePathLabel.textProperty().bind(stringProperty(photo, "filePath"));
StringExpression fileSize = Bindings.format("%.2f MB", numberProperty(photo, "fileSize").divide(1024*1014));
fileSizeLabel.textProperty().bind(fileSize);
stateLabel.textProperty().bind(objectProperty(photo, STATE_PROPERTY).asString("State: %s"));
try {
FileHandler fileHandler = photoFlow.fileHandler(photo.getProjectId().get());
String metadata = fileHandler.loadPhotoMetadata(photo);
metadataLabel.setText("Metadata/Exif:\n" + metadata);
metadataLabel.setVisible(!metadata.isEmpty());
} catch (FileHandlerException e) {
EventHandler.spawnError("Could not load any metadata from your photo :-(");
throw new RuntimeException(e);
}
}
示例3: setRootLayout
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
void setRootLayout(BorderPane rootLayout) {
this.rootLayout = rootLayout;
brightness.valueProperty().addListener((observable, oldValue, newValue) -> {
Double value = (Double) newValue;
value = value * 2.55;
StringExpression styleString = Bindings.format("-fx-base:rgb(%1$.0f , %1$.0f, %1$.0f)", value);
this.rootLayout.styleProperty().bind(styleString);
});
brightness.setMin(0);
brightness.setMax(100);
brightness.setValue(30.8);
}
示例4: forRaceAndProfessionConverter
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
public static StringExpression forRaceAndProfessionConverter(Translator translator, Hero hero) {
Race race = hero.getRace();
Profession profession = hero.getProfession();
if (race == null || profession == null) {
return Bindings.concat();
}
String translatedRace = translator.getRaceList().get(hero.getRace().ordinal());
String translatedProfession = translator.getProfessionList()
.get(hero.getProfession().ordinal());
return Bindings.concat(translatedRace, " ", translatedProfession);
}
示例5: StatusDisplay
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
public StatusDisplay(StringExpression statusProperty) {
Text statusText = new Text();
statusText.textProperty().bind(statusProperty);
HBox.setMargin(statusText, new Insets(1, 6, 3, 6));
setEffect(new DropShadow());
getStyleClass().add("status-background");
getChildren().add(statusText);
setVisible(false);
statusText.textProperty().addListener((observableValue, oldValue, newValue) ->
setVisible(newValue != null && !newValue.equals(""))
);
}
示例6: testStringExpression
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
@Test
public void testStringExpression(){
final StringExpression actual = Bindings.concat("hello", "world");
assertThat(actual).hasValue("helloworld");
assertThat(actual).hasSameValue(actual);
}
示例7: getTitle
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
public StringExpression getTitle() {
StringBinding fileName = ChainedBindingFunctions.from(editedFile).mapToString(File::getName);
StringBinding titleText = Bindings.when(editedFile.isNotNull()).then(fileName).otherwise("Untitled");
StringBinding dirtyFlag = Bindings.when(dirty).then("*").otherwise("");
return Bindings.concat(TITLE_BASE, titleText, dirtyFlag);
}
示例8: createNumberedTooltip
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
public static Tooltip createNumberedTooltip(final StringProperty label, final DoubleProperty value) {
final StringExpression text = label.concat(": ").concat(value.asString("%.0f"));
final Tooltip tooltip = new Tooltip();
tooltip.textProperty().bind(text);
return tooltip;
}
示例9: newText
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
default Text newText(StringExpression textBinding) {
Text text = newText(textBinding.get());
text.textProperty().bind(textBinding);
return text;
}
示例10: StatusDisplay
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
public StatusDisplay(StringExpression statusProperty) {
Label statusText = new Label();
statusText.setTextOverrun(OverrunStyle.ELLIPSIS);
statusText.textProperty().bind(statusProperty);
getStyleClass().add("status-background");
setVisible(true);
//statusText.textProperty().addListener((observableValue, oldValue, newValue) ->
//setVisible(newValue != null && !newValue.equals(""))
//);
getChildren().addAll(statusText, progressHolder);
}
示例11: testStringExpression
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
@Test
public void testStringExpression(){
final StringExpression actual = Bindings.createStringBinding(() -> null);
assertThat(actual).hasNullValue();
}
示例12: testStringExpression
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
@Test
public void testStringExpression(){
final StringExpression actual = Bindings.createStringBinding(() -> "test");
assertThat(actual).hasNotNullValue();
}
示例13: getTextBinding
import javafx.beans.binding.StringExpression; //导入依赖的package包/类
/**
* The string binding that represents the text to be shown in the Actor Cell.
*
* @param actor
* the {@link Actor} bind to
* @return the string binding
*/
private StringExpression getTextBinding(Actor actor) {
return Bindings.concat(actor.getElementInfo().nameProperty()).concat(" (")
.concat(checkIntervalProperty).concat(")");
}