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


Java ObservableObjectValue类代码示例

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


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

示例1: getBackground

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Override
public ObservableObjectValue<Background> getBackground() {
	if (background == null) {
		synchronized (lock) {
			if (background == null) {
				ObservableObjectValue<Image> bgimg = getBackgroundImage();
				background = Bindings.createObjectBinding(() -> new Background(new BackgroundImage(
						bgimg.get(),
						BackgroundRepeat.NO_REPEAT,
						BackgroundRepeat.NO_REPEAT,
						BackgroundPosition.CENTER,
						new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, true, true, true, true))), bgimg);
			}
		}
	}
	return background;
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:18,代码来源:ImageBackgroundProvider.java

示例2: bind

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
/**
 * Bind the supplied extractor function which extracts the target data structure T from the source to the source
 * {@link ObservableObjectValue}, and optionally to the {@link CombinedGrouping} {@link ObservableObjectValue} from
 * the {@link AbstractViewController} superclass if present.
 * <p>
 * @param source the {@link ObservableObjectValue} encapsulating the source from which the target data structure can
 *            be extracted
 * @param targetExtractor a function which extracts the target from the source Object
 */
public void bind(ObservableObjectValue<? extends Object> source,
    Function<Object, T> targetExtractor)
{
    // The createObjectBinding() dependency varargs parameter specifies a number of Observables. If the value of any
    // of those changes, the Binding is triggered and the specified function is executed. This is IMHO not so
    // clearly documented in the createObjectBinding() javadoc.

    // The View does not support CombinedGrouping.
    if (getGrouping() == null)
    {
        sourceBinding = createObjectBinding(() -> targetExtractor.apply(source.get()), source);
    }
    // The View supports CombinedGrouping.
    else
    {
        sourceBinding = createObjectBinding(
            () -> targetExtractor.apply(source.get()),
            source,
            getGrouping());
    }
}
 
开发者ID:jvm-profiling-tools,项目名称:honest-profiler,代码行数:31,代码来源:AbstractProfileViewController.java

示例3: initializeTabChangeListener

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
public void initializeTabChangeListener(TabPane tabPane) {

        ReadOnlyObjectProperty<Tab> itemProperty = tabPane.getSelectionModel().selectedItemProperty();

        tabPane.setOnMouseReleased(event -> {
            Optional.ofNullable(itemProperty)
                    .map(ObservableObjectValue::get)
                    .filter(e -> e instanceof MyTab)
                    .map(e -> (MyTab) e)
                    .map(MyTab::getEditorPane)
                    .ifPresent(EditorPane::focus);
        });

        itemProperty.addListener((observable, oldValue, selectedTab) -> {
            Optional.ofNullable(selectedTab)
                    .filter(e -> e instanceof MyTab)
                    .map(e -> (MyTab) e)
                    .map(MyTab::getEditorPane)
                    .filter(EditorPane::getReady)
                    .ifPresent(EditorPane::updatePreviewUrl);
        });
    }
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:23,代码来源:TabService.java

示例4: setItem

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
public void setItem(Sensor<?> sensor, ObservableObjectValue<Color> color) {
    color.addListener((observable, oldValue, newValue) -> {
        valueLabel.setTextFill(newValue);
        nameLabel.setTextFill(newValue);
    });
    sensor.getUpdateCount().addListener((observable, oldValue, newValue) -> {
        valueLabel.setText(sensor.getCurrentValueAsString());
        nameLabel.setText(sensor.getName());
    });
    valueLabel.setText(sensor.getCurrentValueAsString());
    nameLabel.setText(sensor.getName());
    valueLabel.setTextFill(color.get());
    nameLabel.setTextFill(color.get());
}
 
开发者ID:dainesch,项目名称:HueSense,代码行数:15,代码来源:QuickItemPresenter.java

示例5: initializeRulesPane

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
private void initializeRulesPane() {
    ObservableObjectValue<Colorizer> selectedColorizer = colorizersPane.selectedItemProperty();
    selectedColorizerPane.disableProperty().bind(Bindings.isNull(selectedColorizer));

    ListBinding<StyleRule> selectedColorizerRules = UIUtils.selectList(selectedColorizer, Colorizer::getRules);
    rulesPane.setItemFactory(StyleRule::new);
    rulesPane.setItemDuplicator(StyleRule::new);
    rulesPane.getList().itemsProperty().bind(selectedColorizerRules);
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:10,代码来源:ColorizersController.java

示例6: makeDeleteMcdirButton

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
private Button makeDeleteMcdirButton(GameVersionProvider provider, Parent parent) {
	Button button = new Button();
	ObservableObjectValue<Image> deleteIcon = ImageLoading.load("img/org.to2mbn.lolixl.ui.sidebar.version/delete_mcdir.png");
	button.backgroundProperty().bind(Bindings.createObjectBinding(() -> new Background(new BackgroundImage(deleteIcon.get(), null, null, null, null)), deleteIcon));
	button.setOnAction(event -> provider.delete());
	return button;
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:8,代码来源:GameVersionsPresenter.java

示例7: testObservableObjectValue

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void testObservableObjectValue(){
    ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>(person);

    assertThat(actual).hasValue(person);

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

示例8: shoud_pass_if_actual_has_given_value

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void shoud_pass_if_actual_has_given_value(){
    TestPerson person = new TestPerson("Name");
    ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>(person);

    new ObservableValueAssertions<>(actual).hasValue(person);
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:8,代码来源:ObservableValueAssertions_hasValue_Test.java

示例9: should_fail_if_actual_has_wrong_value

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void should_fail_if_actual_has_wrong_value(){
    try{
        TestPerson person = new TestPerson("Name");
        TestPerson other = new TestPerson("Other");

        ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>(person);

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

示例10: should_fail_if_expectedValue_is_null

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void should_fail_if_expectedValue_is_null(){
    try{
        TestPerson person = new TestPerson("Name");
        ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>(person);

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

示例11: should_pass_if_actual_has_expected_value

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void should_pass_if_actual_has_expected_value() {
    TestPerson person = new TestPerson("Name");

    ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>(person);
    ObservableObjectValue<TestPerson> expected = new SimpleObjectProperty<>(person);

    new ObservableValueAssertions<>(actual).hasSameValue(expected);
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:10,代码来源:ObservableValueAssertions_hasSameValue_Test.java

示例12: should_pass_if_both_observables_has_value_of_null

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void should_pass_if_both_observables_has_value_of_null(){
    ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>();
    ObservableObjectValue<TestPerson> expected = new SimpleObjectProperty<>();

    new ObservableValueAssertions<>(actual).hasSameValue(expected);
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:8,代码来源:ObservableValueAssertions_hasSameValue_Test.java

示例13: should_fail_if_only_actual_has_value_of_null

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void should_fail_if_only_actual_has_value_of_null(){
    TestPerson person = new TestPerson("Name");

    ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>();
    ObservableObjectValue<TestPerson> expected = new SimpleObjectProperty<>(person);

    try{
        new ObservableValueAssertions<>(actual).hasSameValue(expected);

    } catch(AssertionError error){
        assertThat(error).hasMessageContaining("<null> but was <Name>");
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:15,代码来源:ObservableValueAssertions_hasSameValue_Test.java

示例14: should_fail_if_only_expected_has_value_of_null

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void should_fail_if_only_expected_has_value_of_null(){
    TestPerson person = new TestPerson("Name");

    ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>(person);
    ObservableObjectValue<TestPerson> expected = new SimpleObjectProperty<>();

    try{
        new ObservableValueAssertions<>(actual).hasSameValue(expected);

    } catch(AssertionError error){
        assertThat(error).hasMessageContaining("<Name> but was <null>");
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:15,代码来源:ObservableValueAssertions_hasSameValue_Test.java

示例15: should_fail_if_actual_has_wrong_value

import javafx.beans.value.ObservableObjectValue; //导入依赖的package包/类
@Test
public void should_fail_if_actual_has_wrong_value() {
    try {
        TestPerson person = new TestPerson("Name");
        TestPerson other = new TestPerson("Other");

        ObservableObjectValue<TestPerson> actual = new SimpleObjectProperty<>(person);
        ObservableObjectValue<TestPerson> expected = new SimpleObjectProperty<>(other);

        new ObservableValueAssertions<>(actual).hasSameValue(expected);
        fail("Should throw an AsssertionError");
    } catch (AssertionError error) {
        assertThat(error).hasMessageContaining("<Name> but was <Other>");
    }
}
 
开发者ID:lestard,项目名称:assertj-javafx,代码行数:16,代码来源:ObservableValueAssertions_hasSameValue_Test.java


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