当前位置: 首页>>代码示例>>Java>>正文


Java StringExpression类代码示例

本文整理汇总了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;
}
 
开发者ID:Adrodoc55,项目名称:MPL,代码行数:27,代码来源:MplIdeController.java

示例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);
	}
}
 
开发者ID:chilloutman,项目名称:photo-flow,代码行数:19,代码来源:PhotoController.java

示例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);
}
 
开发者ID:dizitart,项目名称:nitrite-database,代码行数:13,代码来源:RootController.java

示例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);
}
 
开发者ID:stechy1,项目名称:drd,代码行数:13,代码来源:StringConvertors.java

示例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(""))
    );
}
 
开发者ID:proofy,项目名称:willow-browser,代码行数:15,代码来源:StatusDisplay.java

示例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);
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:9,代码来源:StringTest.java

示例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);
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:7,代码来源:FilePersistence.java

示例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;
}
 
开发者ID:twasyl,项目名称:jstackfx,代码行数:7,代码来源:TooltipUtils.java

示例9: newText

import javafx.beans.binding.StringExpression; //导入依赖的package包/类
default Text newText(StringExpression textBinding) {
    Text text = newText(textBinding.get());
    text.textProperty().bind(textBinding);
    return text;
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:6,代码来源:UIFactory.java

示例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);
}
 
开发者ID:automenta,项目名称:netentionj-desktop,代码行数:19,代码来源:StatusDisplay.java

示例11: testStringExpression

import javafx.beans.binding.StringExpression; //导入依赖的package包/类
@Test
public void testStringExpression(){
    final StringExpression actual = Bindings.createStringBinding(() -> null);

    assertThat(actual).hasNullValue();
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:7,代码来源:String_HasNullValue_Test.java

示例12: testStringExpression

import javafx.beans.binding.StringExpression; //导入依赖的package包/类
@Test
public void testStringExpression(){
    final StringExpression actual = Bindings.createStringBinding(() -> "test");

    assertThat(actual).hasNotNullValue();
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:7,代码来源:String_HasNotNullValue_Test.java

示例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(")");
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:12,代码来源:ActorCell.java


注:本文中的javafx.beans.binding.StringExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。