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


Java BooleanBinding类代码示例

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


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

示例1: initRegisteredCommandsListener

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
private void initRegisteredCommandsListener() {
	this.registeredCommands.addListener((ListChangeListener<Command>) c -> {
		while (c.next()) {
			if (registeredCommands.isEmpty()) {
				executable.unbind();
				running.unbind();
				progress.unbind();
			} else {
				BooleanBinding executableBinding = constantOf(true);
				BooleanBinding runningBinding = constantOf(false);

				for (Command registeredCommand : registeredCommands) {
					ReadOnlyBooleanProperty currentExecutable = registeredCommand.executableProperty();
					ReadOnlyBooleanProperty currentRunning = registeredCommand.runningProperty();
					executableBinding = executableBinding.and(currentExecutable);
					runningBinding = runningBinding.or(currentRunning);
				}
				executable.bind(executableBinding);
				running.bind(runningBinding);

				initProgressBinding();
			}
		}
	});
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:26,代码来源:CompositeCommand.java

示例2: toBooleanBinding

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
public static BooleanBinding toBooleanBinding(final ObservableValue<Boolean> ov) {
  if (ov == null) {
    throw new NullPointerException("Operand cannot be null.");
  }

  return new BooleanBinding() {
    {
      super.bind(ov);
    }

    @Override
    public void dispose() {
      super.unbind(ov);
    }

    @Override
    protected boolean computeValue() {
      return ov.getValue() != Boolean.FALSE;
    }

    @Override
    public ObservableList<?> getDependencies() {
      return FXCollections.singletonObservableList(ov);
    }
  };
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:27,代码来源:BeanConvertUtil.java

示例3: initialize

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle rb) {

	rack.getItems().addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8));
	rack.getSelectionModel().select(0);
	slot.getItems().addAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8));
	slot.getSelectionModel().select(0);

	session.bind(host.textProperty(), "connect.host");

	BooleanBinding disabled = bindings.connectedProperty().or(bindings.progressProperty());
	connect.disableProperty().bind(disabled.or(host.textProperty().isEmpty()));
	host.disableProperty().bind(disabled);
	rack.disableProperty().bind(disabled);
	slot.disableProperty().bind(disabled);
	watchdog.disableProperty().bind(disabled);
	disconnect.disableProperty().bind(bindings.connectedProperty().not().or(bindings.progressProperty()));

	bindings.connectedProperty().addListener((l, a, con) -> update(con));
	pingService.setOnPingFailed(this::pingFailed);

	watchdog.selectedProperty().bindBidirectional(bindings.pingWatchdogProperty());
	session.bind(watchdog.selectedProperty(), "ping.watchdog");
	reset();
}
 
开发者ID:comtel2000,项目名称:mokka7,代码行数:26,代码来源:ConnectViewPresenter.java

示例4: buildAdditionalDisableCondition

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

示例5: initializeProperties

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
private void initializeProperties() {
    imagesFoundProperty = new SimpleBooleanProperty(Boolean.FALSE);
    nameBinding = tfName.textProperty().isEmpty();
    selectedBinding = cbMap.getSelectionModel().selectedIndexProperty().isEqualTo(-1);
    
    disableBinding = new BooleanBinding() {
        {
            super.bind(imagesFoundProperty, nameBinding, selectedBinding);
        }

        @Override
        protected boolean computeValue() {
            if (imagesFoundProperty.not().getValue()) {
                return true;
            }
            
            return nameBinding.getValue() || selectedBinding.getValue();
        }
    };
    
    bCreate.disableProperty().bind(disableBinding);
}
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:23,代码来源:MapWizardPresenter.java

示例6: initialize

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    UIUtils.makeClearable(searchTextField);

    BooleanBinding disableMatchBrowsing = Bindings.createBooleanBinding(matchRows::isEmpty, matchRows);
    nextButton.disableProperty().bind(disableMatchBrowsing);
    previousButton.disableProperty().bind(disableMatchBrowsing);

    // TODO regex mode feature
    regexCheckBox.setDisable(true);

    search.textProperty().bind(searchTextField.textProperty());
    search.matchCaseProperty().bind(matchCaseCheckBox.selectedProperty());
    search.regexModeProperty().bind(regexCheckBox.selectedProperty());

    Binding<Integer> matchRowsCount = Bindings.createObjectBinding(matchRows::size, matchRows);
    Binding<Integer> currentMatchRowIndexOneBased = Bindings.createObjectBinding(() -> {
        return currentMatchRowIndex.get() == null ? 0 : currentMatchRowIndex.get() + 1;
    }, currentMatchRowIndex);
    matchNavigationLabel.currentCountProperty().bind(currentMatchRowIndexOneBased);
    matchNavigationLabel.totalCountProperty().bind(matchRowsCount);
    matchNavigationLabel.visibleProperty().bind(currentMatchRowIndex.isNotNull());
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:24,代码来源:SearchController.java

示例7: configuraBindings

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
private void configuraBindings() {
	// esse binding só e false quando os campos da tela estão preenchidos
	BooleanBinding camposPreenchidos = txtConsc.textProperty().isEmpty().or(txtDesc.textProperty().isEmpty())
			.or(dpVencimento.valueProperty().isNull());
	// indica se há algo selecionado na tabela
	BooleanBinding algoSelecionado = tblContas.getSelectionModel().selectedItemProperty().isNull();
	// alguns botões só são habilitados se algo foi selecionado na tabela
	btnApagar.disableProperty().bind(algoSelecionado);
	btnAtualizar.disableProperty().bind(algoSelecionado);
	btnLimpart.disableProperty().bind(algoSelecionado);
	// o botão salvar só é habilitado se as informações foram preenchidas e não tem nada na tela
	btnSalvar.disableProperty().bind(algoSelecionado.not().or(camposPreenchidos));
	// quando algo é selecionado na tabela, preenchemos os campos de entrada com os valores para o 
	// usuário editar
	tblContas.getSelectionModel().selectedItemProperty().addListener((b, o, n) -> {
		if (n != null) {
			LocalDate data = null;
			data = n.getDataVencimento().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
			txtConsc.setText(n.getConcessionaria());
			txtDesc.setText(n.getDescricao());
			dpVencimento.setValue(data);
		}
	});
}
 
开发者ID:jesuino,项目名称:livro-javafx-pratico,代码行数:25,代码来源:ContasController.java

示例8: updateHost

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
private void updateHost() {

        Dialog<String> dialog = new Dialog<String>("Host", null);

        TextField hostField = new TextField(TicTacToe.getHost());
        dialog.setContent(hostField);

        Button okButton = new Button("OK");
        okButton.setOnAction(e -> {
            dialog.setResult(hostField.getText());
            dialog.hide();
        });

        BooleanBinding urlBinding = Bindings.createBooleanBinding(
                () -> isUrlValid(hostField.getText()),
                hostField.textProperty());
        okButton.disableProperty().bind(urlBinding.not());

        Button cancelButton = new Button("CANCEL");
        cancelButton.setOnAction(e -> dialog.hide());
        dialog.getButtons().addAll(okButton,cancelButton);
        dialog.showAndWait().ifPresent( url -> TicTacToe.setHost(url));

    }
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:25,代码来源:MainView.java

示例9: initialize

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
@FXML
private void initialize() {
  setupWindowCloseRequestListener();

  fileExplorer.addEventHandler(ResourceEvent.openResourceEvent(),
      e -> openResources(e.getResourceItems()));

  setRootDir(
      getFurthestExistingSubDir(FileSystemView.getFileSystemView().getDefaultDirectory(), "mpl"));

  ObservableList<ResourceItem> items = fileExplorer.getSelectedItems();
  BooleanBinding disable = Bindings.createBooleanBinding(() -> items.size() != 1, items);
  newFileMenuItem.disableProperty().bind(disable);
  newDirectoryMenuItem.disableProperty().bind(disable);
  renameResourceMenuItem.disableProperty().bind(disable);
  contextNewFileMenuItem.disableProperty().bind(disable);
  contextNewDirectoryMenuItem.disableProperty().bind(disable);
  contextRenameResourceMenuItem.disableProperty().bind(disable);
}
 
开发者ID:Adrodoc55,项目名称:MPL,代码行数:20,代码来源:MplIdeController.java

示例10: ViewCustomer

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
/**
 * Constructor
 */
public ViewCustomer() {
    // Create left part: Products
    Label productsLabel = new Label("Products");
    HBox  buyGroup      = new HBox(buyButton, quantityInput);
    VBox  productsBox   = new VBox(productsLabel, productsTableView, buyGroup);
    this.quantityInput.setPromptText("Quantity...");

    // Create right part: Orders
    Label ordersLAbel = new Label("Orders");
    VBox  ordersBox   = new VBox(ordersLAbel, ordersTableView);

    // Setting up splitpane with product and orders section
    SplitPane contentPane = new SplitPane(productsBox, ordersBox);
    contentPane.prefHeightProperty().bind(this.heightProperty());
    this.setMinHeight(300);

    // Add Splitpane to View
    this.getChildren().add(contentPane);

    // Activate add button only when all required input fields are filled
    BooleanBinding booleanBinding = quantityInput
            .textProperty()
            .isEqualTo("");
    buyButton.disableProperty().bind(booleanBinding);
}
 
开发者ID:senycorp,项目名称:FPT-1516,代码行数:29,代码来源:ViewCustomer.java

示例11: getHasMissingConnectionSettingsBinding

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
private BooleanBinding getHasMissingConnectionSettingsBinding() {

        BooleanBinding hasMissingPassword = youTrackPassword.isEmpty();
        BooleanBinding hasMissingOAuthSettings = hasMissingPassword
                .or(youTrackOAuth2ServiceId.isEmpty())
                .or(youTrackOAuth2ServiceSecret.isEmpty())
                .or(youTrackHubUrl.isEmpty());
        BooleanBinding hasMissingPermanentToken = youTrackPermanentToken.isEmpty();

        return youTrackUrl.isEmpty()
                .or(youTrackVersion.isNull())
                .or(youTrackAuthenticationMethod.isNull())
                .or(youTrackUsername.isEmpty())
                .or(requiresPassword.and(hasMissingPassword))
                .or(requiresOAuthSettings.and(hasMissingOAuthSettings))
                .or(requiresPermanentToken.and(hasMissingPermanentToken));
    }
 
开发者ID:pbauerochse,项目名称:youtrack-worklog-viewer,代码行数:18,代码来源:SettingsViewModel.java

示例12: initialize

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle rb)
{
    _activeProfile = getActiveProfile().orElse(null);
    if (_activeProfile != null)
    {
        SettingsService settings = (SettingsService) ServiceLocator.getService(SettingsService.class);
        settings.putSetting(Constants.SETTING_ACTIVE_PROFILE, _activeProfile.getProfileName());
        for (Category c : _activeProfile.getCategories())
        {
            MainTabPane.getTabs().add(new CategoryTabController(c));
        }
    }
   
    _tabSelection = MainTabPane.getSelectionModel();
    _tabSelection.selectFirst();   
    
    BooleanBinding enableButtonsBinding = ((CategoryTabController)_tabSelection.selectedItemProperty().get())
                .selectedScriptNodeProperty().isNull()
            .or(((CategoryTabController)_tabSelection.selectedItemProperty().get())
                .selectedScriptNodeIsLeafProperty().not());
    
    //Only enable the Replace button if we actually have a sound selected.
    ReplaceButton.disableProperty().bind(enableButtonsBinding);
    RevertButton.disableProperty().bind(enableButtonsBinding);
}
 
开发者ID:pingzing,项目名称:sonic-scream,代码行数:27,代码来源:MainController.java

示例13: initialise

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
public void initialise(final Button buttonUnseen, final Button buttonKnown, final Button buttonUnknown, final SessionModel sessionModel,
                        final ObjectBinding<WordState> wordStateProperty, final Runnable nextWordSelector) {
    this.sessionModel = sessionModel;
    this.nextWordSelector = nextWordSelector;

    SimpleBooleanProperty editableProperty = sessionModel.editableProperty();
    BooleanBinding resettableProperty = editableProperty.and(notEqual(WordState.UNSEEN, wordStateProperty));

    buttonUnseen.visibleProperty().bind(resettableProperty);
    buttonKnown.visibleProperty().bind(editableProperty);
    buttonUnknown.visibleProperty().bind(editableProperty);

    buttonUnseen.setOnAction(e -> processResponse(WordState.UNSEEN, false));
    buttonKnown.setOnAction(e -> processResponse(WordState.KNOWN, true));
    buttonUnknown.setOnAction(e -> processResponse(WordState.UNKNOWN, true));
}
 
开发者ID:VocabHunter,项目名称:VocabHunter,代码行数:17,代码来源:WordStateHandler.java

示例14: createCancelButton

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
public RfxContentBottomToolbarButton createCancelButton(UserInterfaceContainer userInterfaceContainer, RfxFormView formView) {
	@SuppressWarnings("rawtypes")
	GraphicalUserinterfaceController userInterfaceController = userInterfaceContainer
			.get(GraphicalUserinterfaceController.class);
	ViewContainer viewContainer = userInterfaceController
			.getViewContainer();
	LanguageProvider languageProvider = userInterfaceContainer
			.get(LanguageProvider.class);
	CancelItem cancelItem = new CancelItem(languageProvider, viewContainer,
			formView);
	RfxContentBottomToolbarButton cancelButton = new RfxContentBottomToolbarButton(cancelItem);
	RfxWindow window=userInterfaceContainer.get(RfxWindow.class);
	BooleanBinding extraWideBinding = window.getExtraWideBinding();
	cancelButton.visibleProperty().bind(extraWideBinding);
	return cancelButton;
}
 
开发者ID:ntenhoeve,项目名称:Introspect-Framework,代码行数:17,代码来源:RfxFormBottomToolBar.java

示例15: RfxAppTitleBar

import javafx.beans.binding.BooleanBinding; //导入依赖的package包/类
public RfxAppTitleBar(UserInterfaceContainer userInterfaceContainer) {
	
	RfxWindow rfxWindow=userInterfaceContainer.get(RfxWindow.class);
	BooleanBinding windowExtraHighBinding = rfxWindow.getExtraHighBinding();
	
	setMinHeight(BAR_HEIGHT);
	
	visibleProperty().bind(windowExtraHighBinding);
	NumberBinding heightBinding = Bindings.when(windowExtraHighBinding).then(BAR_HEIGHT)
			.otherwise(0);
	minHeightProperty().bind(heightBinding);
	maxHeightProperty().bind(heightBinding);

	String title = getTitle(userInterfaceContainer);
	Label titleLabel = new Label(title);
	String style = new RfxStyleProperties()
			.setTextFill(MaterialColorSetCssName.PRIMARY.FOREGROUND1())
			.setAlignment(Pos.CENTER_LEFT).setFont(MaterialFont.getTitle())
			.setPadding(0, 0, 0, 16).toString();
	titleLabel.setStyle(style);

	getChildren().add(titleLabel);
}
 
开发者ID:ntenhoeve,项目名称:Introspect-Framework,代码行数:24,代码来源:RfxAppTitleBar.java


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