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


Java ObservableStringValue类代码示例

本文整理汇总了Java中javafx.beans.value.ObservableStringValue的典型用法代码示例。如果您正苦于以下问题:Java ObservableStringValue类的具体用法?Java ObservableStringValue怎么用?Java ObservableStringValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObservableStringValue类属于javafx.beans.value包,在下文中一共展示了ObservableStringValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: defaultPackageNameProperty

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
/**
 * Returns the default value for the package name
 *
 * @param injector  the injector, in case an implementing class needs it
 * @return          the default package name 
 */
default ObservableStringValue defaultPackageNameProperty(Injector injector) {
    final TranslatorSupport<?> support = new TranslatorSupport<>(injector, this);
    
    if (this instanceof ProjectProperty) {
        final ProjectProperty project = (ProjectProperty) this;
        return createStringBinding(
            support::defaultPackageName, 
            project.nameProperty(), 
            project.companyNameProperty()
        );
    } else if (this instanceof HasAliasProperty) {
        final HasAliasProperty alias = (HasAliasProperty) this;
        return createStringBinding(support::defaultPackageName, alias.aliasProperty());
    } else {
        return createStringBinding(support::defaultPackageName, nameProperty());
    }
}
 
开发者ID:speedment,项目名称:speedment,代码行数:24,代码来源:HasPackageNameProperty.java

示例2: updateInfoPane

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
private void updateInfoPane(Theme selectedTheme) {
	view.themeNameLabel.textProperty().bind(selectedTheme.getLocalizedName());
	view.themeDescriptionLabel.textProperty().bind(selectedTheme.getDescription());
	view.themeAuthorsLabel.textProperty().bind(new StringBinding() {

		ObservableValue<ObservableStringValue[]> authorsBinding = selectedTheme.getAuthors();

		{
			bind(authorsBinding);
		}

		@Override
		protected String computeValue() {
			return Stream
					.of(authorsBinding.getValue())
					.map(ObservableStringValue::get)
					.collect(joining(", "));
		}
	});
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:21,代码来源:ThemesPresenter.java

示例3: getLocalizedName

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Override
default ObservableStringValue getLocalizedName() {
	return new StringBinding() {

		StringProperty aliasProperty = aliasProperty();

		{
			bind(aliasProperty);
		}

		@Override
		protected String computeValue() {
			String alias = aliasProperty.get();
			if (alias == null) {
				return getVersionNumber();
			}
			return alias;
		}
	};
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:21,代码来源:GameVersion.java

示例4: decision

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
/**
 * Returns a new observable string which contains either the contents of ifTrue, or ifFalse, depending on the condition
 * @param condition
 * @param ifTrue
 * @param ifFalse
 * @return
 */
public static ObservableStringValue decision(ObservableBooleanValue condition,
                                             ObservableStringValue ifTrue,
                                             ObservableStringValue ifFalse) {
    StringProperty ret = new SimpleStringProperty();
    condition.addListener((obs, ov, nv) -> {
        ret.set(nv ? ifTrue.get() : ifFalse.get());
    });
    ifTrue.addListener((obs, ov, nv) -> {
        if (condition.get()) {
            ret.set(nv);
        }
    });
    ifFalse.addListener((obs, ov, nv) -> {
        if (!condition.get()) {
            ret.set(nv);
        }
    });
    ret.set(condition.get() ? ifTrue.get() : ifFalse.get());

    return ret;
}
 
开发者ID:narrowtux,项目名称:SmartModInserter,代码行数:29,代码来源:Bindings.java

示例5: testObservableStringValue

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Test
public void testObservableStringValue(){
    ObservableStringValue actual = new SimpleStringProperty("test");

    assertThat(actual).hasValue("test");

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

示例6: should_fail_if_expected_value_is_null

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Test
public void should_fail_if_expected_value_is_null(){
    try{
        ObservableStringValue actual = new SimpleStringProperty("test123");

        new ObservableStringValueAssertions(actual).contains(null);
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("expected value may not be null");
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:12,代码来源:ObservableStringValueAssertions_contains_Test.java

示例7: getLocalizedName

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Override
public ObservableStringValue getLocalizedName() {
	if (isCurrentMcdir()) {
		return I18N.localize("org.to2mbn.lolixl.mcdir.default.name");
	}
	return FxConstants.string(location.toString());
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:8,代码来源:McdirGameVersionProvider.java

示例8: bindManagementTile

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
private void bindManagementTile() {
	Tile tile = new ItemTile(new DisplayableItem() {

		@Override
		public ObservableStringValue getLocalizedName() {
			return FxConstants.string("...");
		}
	});
	Panel panel = panelDisplayService.newPanel();
	panel.bindButton(tile);
	panel.bindItem(this);
	panel.contentProperty().set(view.rootContainer);
	homeContentPresenter.setManagementTile(tile);
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:15,代码来源:TileManagementPresenter.java

示例9: getProperty

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
public ObservableStringValue getProperty(final String columnName) {
	return Bindings.createStringBinding(() -> {
		String value = metadataMap.get(columnName);
		if (value == null)
			return "";
		return
				value;
	});
}
 
开发者ID:qupath,项目名称:qupath,代码行数:10,代码来源:ProjectMetadataEditorCommand.java

示例10: setTextFieldBehaviour

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
private static void setTextFieldBehaviour(TextInputControl text, boolean useDefaultValue, ObservableStringValue defaultValue, StringProperty customValue) {
    if (useDefaultValue) {
        customValue.unbind();
        text.textProperty().bind(defaultValue);
    } else {
        text.textProperty().unbind();
        text.setText(customValue.get());
        customValue.bind(text.textProperty());
    }
}
 
开发者ID:speedment,项目名称:speedment,代码行数:11,代码来源:AbstractTextItem.java

示例11: setupErrorMarker

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
/**
 * @deprecated Use {@link #setupErrorMarker(Control, StackPane, ValidBooleanBinding)} instead
 */
public static Node setupErrorMarker(Control initialControl, StackPane stackPane, ObservableStringValue reasonWhyControlInvalid)
{
	ValidBooleanBinding binding = new ValidBooleanBinding()
	{
		{
			bind(reasonWhyControlInvalid);
		}
		
		@Override
		protected boolean computeValue()
		{
			if (StringUtils.isNotBlank(reasonWhyControlInvalid.get()))
			{
				setInvalidReason(reasonWhyControlInvalid.get());
				return false;
			}
			else
			{
				clearInvalidReason();
				return true;
			}
		}
	};
	
	return setupErrorMarker(initialControl, stackPane, binding);
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:30,代码来源:ErrorMarkerUtils.java

示例12: should_fail_if_expected_value_is_null

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Test
public void should_fail_if_expected_value_is_null(){
    try{
        ObservableStringValue actual = new SimpleStringProperty("test");

        new ObservableStringValueAssertions(actual).hasValue(null);
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("expected value may not be null");
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:12,代码来源:ObservableStringValueAssertions_hasValue_Test.java

示例13: should_fail_if_actual_has_wrong_value

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Test
public void should_fail_if_actual_has_wrong_value(){
    try{
        ObservableStringValue actual = new SimpleStringProperty("test");

        new ObservableStringValueAssertions(actual).hasValue("testest");
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("<testest> but was <test>");
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:12,代码来源:ObservableStringValueAssertions_hasValue_Test.java

示例14: should_fail_if_actual_has_value_of_null

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Test
public void should_fail_if_actual_has_value_of_null(){
    try{
        ObservableStringValue actual = new SimpleStringProperty();

        new ObservableStringValueAssertions(actual).hasValue("test");
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("<test> but was <null>");
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:12,代码来源:ObservableStringValueAssertions_hasValue_Test.java

示例15: should_fail_if_actual_does_not_contain_expected_text

import javafx.beans.value.ObservableStringValue; //导入依赖的package包/类
@Test
public void should_fail_if_actual_does_not_contain_expected_text(){
    try{
        ObservableStringValue actual = new SimpleStringProperty("test123");

        new ObservableStringValueAssertions(actual).contains("st21");
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error);
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:12,代码来源:ObservableStringValueAssertions_contains_Test.java


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