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


Java ObservableBooleanValue类代码示例

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


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

示例1: addSceneLifecycleHooks

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
/**
 * This method adds listeners for the {@link SceneLifecycle}.
 */
static void addSceneLifecycleHooks(ViewModel viewModel, ObservableBooleanValue viewInSceneProperty) {
    if(viewModel != null) {

        if(viewModel instanceof SceneLifecycle) {
            SceneLifecycle lifecycleViewModel = (SceneLifecycle) viewModel;

            PreventGarbageCollectionStore.getInstance().put(viewInSceneProperty);

            viewInSceneProperty.addListener((observable, oldValue, newValue) -> {
	if(newValue) {
		lifecycleViewModel.onViewAdded();
	} else {
		lifecycleViewModel.onViewRemoved();
                    PreventGarbageCollectionStore.getInstance().remove(viewInSceneProperty);
	}
});
        }
    }
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:23,代码来源:ViewLoaderReflectionUtils.java

示例2: buildAdditionalDisableCondition

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
@Override
@FXThread
protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() {

    final VirtualResourceTree<C> resourceTree = getResourceTree();
    final MultipleSelectionModel<TreeItem<VirtualResourceElement<?>>> selectionModel = resourceTree.getSelectionModel();
    final ReadOnlyObjectProperty<TreeItem<VirtualResourceElement<?>>> selectedItemProperty = selectionModel.selectedItemProperty();

    final Class<C> type = getObjectsType();
    final BooleanBinding typeCondition = new BooleanBinding() {

        @Override
        protected boolean computeValue() {
            final TreeItem<VirtualResourceElement<?>> treeItem = selectedItemProperty.get();
            return treeItem == null || !type.isInstance(treeItem.getValue().getObject());
        }

        @Override
        public Boolean getValue() {
            return computeValue();
        }
    };

    return Bindings.or(selectedItemProperty.isNull(), typeCondition);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:VirtualAssetEditorDialog.java

示例3: getTable

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
/**
 * Generate the table layout for table selectors.
 * The method should be overridden when the table layout needs to be customised.
 * @param context the context for preparing the controller.
 * @return the table layout.
 */
protected BODTOTable<T> getTable(ViewContextBase context) {
	BODTOTable<T> table = new BODTOTable<>();	
	configureCommands(table.getCommands());
	table.getCommands().end();
	context.autoInjectBean(table);

	UserPermissions userPermissions = getUserPermissions();
	Iterable<String> columns = getTableColumns().stream()
			.filter(s -> Optional.ofNullable(userPermissions.isVisible(s)).map(ObservableBooleanValue::get).orElse(true))
			::iterator;
	
	TableColumnBinding<BODTO<T>> tcb = new TableColumnBinding<>(BeanUtils.getBeanInfo(toClass),	columns, "id"::equals);
	tcb.setConverterFactory(this::getConverter);
	Bindings.bindContent(table.getTable().getColumns(), tcb);

	table.getCommands()
		.cru()
	.end();
			
	refresh(table, context);
	table.addQueryListener(o -> refresh(table, context));
	table.addFlowLifecycle(new FlowLifeCycle.OnRefresh((c,f) -> refresh(table, context)));
	return table;
}
 
开发者ID:salimvanak,项目名称:myWMS,代码行数:31,代码来源:BODTOPlugin.java

示例4: getTable

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
/**
 * Generate the table layout for table selectors.
 * The method should be overridden when the table layout needs to be customised.
 * @param context the context for preparing the controller.
 * @return the table layout.
 */
protected CrudTable<T> getTable(ViewContextBase context) {
	CrudTable<T> table = new CrudTable<>();	
	
	configureCommands(table.getCommands());
	table.getCommands().end();
	UserPermissions userPermissions = getUserPermissions();
	Iterable<String> columns = getTableColumns().stream()
			.filter(s -> Optional.ofNullable(userPermissions.isVisible(s)).map(ObservableBooleanValue::get).orElse(true))
			::iterator;

	TableColumnBinding<T> tcb = new TableColumnBinding<>(getBeanInfo(),	columns, "id"::equals);
	tcb.setConverterFactory(this::getConverter);
	Bindings.bindContent(table.getTable().getColumns(), tcb);
	table.getCommands()
		.crud(isCreateAllowed(), true, true, true, isDeleteAllowed())
	.end();
	
	context.autoInjectBean(table);
	Runnable refreshData = () -> refresh(table, context);
	
	refreshData.run();
	
	table.addQueryListener(o -> refreshData.run());		
	return table;
}
 
开发者ID:salimvanak,项目名称:myWMS,代码行数:32,代码来源:CRUDPlugin.java

示例5: bind

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void bind(EditorHelper e, String id, BasicEntityEditor node) {
	ObservableValue value = e.getValueProperty(id);
	Class type = e.getValueClass(id);
	
	if (BasicEntity.class.isAssignableFrom(type)) {
		node.configure(getContext(), type);
	}
	
	ObservableBooleanValue editable = e.getEditableProperty(id, value);
	ObservableBooleanValue visible = e.getVisibleProperty(id, value);

	StringConverter converter = e.getConverter(id, value);			
	if (converter != null) node.setConverter(converter);

	bindBidirectionalValue(node, node.valueProperty(), value);
	if (editable != null) node.disableProperty().bind(BooleanExpression.booleanExpression(editable).not());
	if (visible != null) node.visibleProperty().bind(visible);
	e.onBind(id, value, node);
}
 
开发者ID:salimvanak,项目名称:myWMS,代码行数:22,代码来源:MyWMSEditor.java

示例6: rebuildSceneGraph

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
/**
 * Reconstruct the scene graph
 * */
private void rebuildSceneGraph(
	final long t,
	final ObservableBooleanValue isDebug,
	final ObservableList<Node> graph
) {
	graph.clear();
	terrain.iterateTiles(currentAngle).forEachRemaining(tile -> {
		final Point2D l = terrain.correctedIsoCoord(tile.pos, currentAngle);
		tile.rebuildSceneGraph(isDebug, currentAngle);
		tile.subGraph.setTranslateX(l.getX());
		tile.subGraph.setTranslateY(l.getY());
		graph.add(tile.subGraph);
	});

	for (final Sprite s : allSprites) s.invalidate();
}
 
开发者ID:CLowcay,项目名称:iso-game-engine,代码行数:20,代码来源:Stage.java

示例7: decision

import javafx.beans.value.ObservableBooleanValue; //导入依赖的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

示例8: handle

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
@Override
public void handle(MouseEvent e) {
    adjustingTooltip.set(true);

    Node chartNode = (Node) e.getSource();

    tooltip.show(chartNode, e.getScreenX(), e.getScreenY());
    setLabelPosition(e);

    ObservableBooleanValue stillHovering = chartNode.hoverProperty().or(adjustingTooltip);
    stillHovering.addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean nowHovering) {
            if (!nowHovering) {
                stillHovering.removeListener(this);
                tooltip.hide();
            }
        }
    });

    T chartData = (T) chartNode.getUserData();
    String txt = textProvider.apply(chartData);
    tooltip.setText(txt);

    adjustingTooltip.set(false);
}
 
开发者ID:githublemming,项目名称:CloudTrailViewer,代码行数:27,代码来源:ChartHoverUtil.java

示例9: notEmpty

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
public static ObservableBooleanValue notEmpty(ObservableValue<String> source) {
	return Bindings.createBooleanBinding(() -> {
		final String s = source.getValue();
		
		return s != null && !s.trim().isEmpty();
	}, source);
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:8,代码来源:ObservableRules.java

示例10: createFxmlLoader

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
private FXMLLoader createFxmlLoader(String resource, ResourceBundle resourceBundle, View<?> codeBehind, Object root,
                                    ViewModel viewModel, ContextImpl context, ObservableBooleanValue viewInSceneProperty) throws IOException {
    // Load FXML file
    final URL location = FxmlViewLoader.class.getResource(resource);
    if (location == null) {
        throw new IOException("Error loading FXML - can't load from given resourcepath: " + resource);
    }

    final FXMLLoader fxmlLoader = new FXMLLoader();

    fxmlLoader.setRoot(root);
    fxmlLoader.setResources(resourceBundle);
    fxmlLoader.setLocation(location);

    // when the user provides a viewModel but no codeBehind, we need to use
    // the custom controller factory.
    // in all other cases the default factory can be used.
    if (viewModel != null && codeBehind == null) {
        fxmlLoader
                .setControllerFactory(new ControllerFactoryForCustomViewModel(viewModel, resourceBundle, context, viewInSceneProperty));
    } else {
        fxmlLoader.setControllerFactory(new DefaultControllerFactory(resourceBundle, context, viewInSceneProperty));
    }

    // When the user provides a codeBehind instance we take care of the
    // injection of the viewModel to this
    // controller here.
    if (codeBehind != null) {
        fxmlLoader.setController(codeBehind);

        if (viewModel == null) {
            handleInjection(codeBehind, resourceBundle, context, viewInSceneProperty);
        } else {
            handleInjection(codeBehind, resourceBundle, viewModel, context, viewInSceneProperty);
        }
    }

    return fxmlLoader;
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:40,代码来源:FxmlViewLoader.java

示例11: handleInjection

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
private static void handleInjection(View<?> codeBehind, ResourceBundle resourceBundle, ContextImpl context, ObservableBooleanValue viewInSceneProperty) {
    ResourceBundleInjector.injectResourceBundle(codeBehind, resourceBundle);

    Consumer<ViewModel> newVmConsumer = viewModel -> {
        ResourceBundleInjector.injectResourceBundle(viewModel, resourceBundle);
        ViewLoaderReflectionUtils.createAndInjectScopes(viewModel, context);
        ViewLoaderReflectionUtils.initializeViewModel(viewModel);

        ViewLoaderReflectionUtils.addSceneLifecycleHooks(viewModel, viewInSceneProperty);
    };

    ViewLoaderReflectionUtils.createAndInjectViewModel(codeBehind, newVmConsumer);
    ViewLoaderReflectionUtils.injectContext(codeBehind, context);
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:15,代码来源:FxmlViewLoader.java

示例12: ControllerFactoryForCustomViewModel

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
public ControllerFactoryForCustomViewModel(ViewModel customViewModel, ResourceBundle resourceBundle,
                                           ContextImpl context, ObservableBooleanValue viewInSceneProperty) {
    this.customViewModel = customViewModel;
    this.resourceBundle = resourceBundle;
    this.context = context;
    this.viewInSceneProperty = viewInSceneProperty;
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:8,代码来源:FxmlViewLoader.java

示例13: when

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
/**
 * A more general version of {@link Bindings#when(ObservableBooleanValue)}
 * that can accept general boolean properties as conditions.
 *
 * @param condition the condition to bind to
 *
 * @see Bindings#when(ObservableBooleanValue)
 */
public static When when(Property<Boolean> condition) {
  if (condition instanceof ObservableBooleanValue) {
    return Bindings.when((ObservableBooleanValue) condition);
  }
  SimpleBooleanProperty realCondition = new SimpleBooleanProperty();
  realCondition.bind(condition);
  return Bindings.when(realCondition);
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:17,代码来源:FxUtils.java

示例14: allTrue

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
private static ObservableBooleanValue allTrue(BooleanProperty... properties) {
  ObservableBooleanValue accu = new SimpleBooleanProperty(true);
  for (int i = 0; i < properties.length; i++) {
    accu = properties[i].and(accu);
  }
  return accu;
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:8,代码来源:WelcomeWizard.java

示例15: buildAdditionalDisableCondition

import javafx.beans.value.ObservableBooleanValue; //导入依赖的package包/类
@Override
@FXThread
protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() {
    final ResourceTree resourceTree = getResourceTree();
    final MultipleSelectionModel<TreeItem<ResourceElement>> selectionModel = resourceTree.getSelectionModel();
    final ReadOnlyObjectProperty<TreeItem<ResourceElement>> selectedItemProperty = selectionModel.selectedItemProperty();
    return selectedItemProperty.isNull();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:9,代码来源:AssetEditorDialog.java


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