本文整理汇总了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();
}
}
});
}
示例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);
}
};
}
示例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();
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
});
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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));
}
示例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;
}
示例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);
}