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


Java Bindings类代码示例

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


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

示例1: initProgressBinding

import javafx.beans.binding.Bindings; //导入依赖的package包/类
private void initProgressBinding() {
	DoubleExpression tmp = constantOf(0);

	for (Command command : registeredCommands) {
		final ReadOnlyDoubleProperty progressProperty = command.progressProperty();

		/**
		 * When the progress of a command is "undefined", the progress property has a value of -1.
		 * But in our use case we like to have a value of 0 in this case. 
		 * Therefore we create a custom binding here.
		 */
		final DoubleBinding normalizedProgress = Bindings
				.createDoubleBinding(() -> (progressProperty.get() == -1) ? 0.0 : progressProperty.get(),
						progressProperty);

		tmp = tmp.add(normalizedProgress);
	}
	
	int divisor = registeredCommands.isEmpty() ? 1 : registeredCommands.size();
	progress.bind(Bindings.divide(tmp, divisor));
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:22,代码来源:CompositeCommand.java

示例2: initialize

import javafx.beans.binding.Bindings; //导入依赖的package包/类
@FXML
private void initialize() {
	// Replace constants in instructions label
	instructionsLabel.setText(instructionsLabel.getText()
			.replace("${version}", TLD_VERSION)
			.replace("${exe_path}", OPERATING_SYSTEM.getExampleExecutablePath())
			.replace("${dll_name}", DLL_NAME));

	// Selected file depends on the path in the text field
	// Not bound the "traditional" way as that caused duplicate calls to createPathFromText
	fileTextField.setOnKeyReleased(ke -> selectedFile.setValue(createPathFromText(fileTextField.getText())));

	// Only able to change file path when not currently patching
	fileTextField.disableProperty().bind(working);

	// File status depends on selected file
	fileStatusBinding = Bindings.createObjectBinding(this::calculateHashes, selectedFile);
	fileStatusProperty.bind(fileStatusBinding);

	// File status label responds to selected file status
	fileStatusLabel.textProperty().bind(Bindings.createStringBinding(
			() -> fileStatusProperty.getValue().getDisplayName(), fileStatusProperty));
	fileStatusLabel.textFillProperty().bind(Bindings.createObjectBinding(
			() -> fileStatusProperty.getValue().getDisplayColor(), fileStatusProperty));

	// File select button should be focused (runLater -> when Scene graph is established)
	Platform.runLater(() -> fileSelectButton.requestFocus());

	// Patch button should only be enabled if file is valid and not currently patching
	patchButton.disableProperty().bind(
			Bindings.createBooleanBinding(() -> !fileStatusProperty.getValue().isValid(), fileStatusProperty)
					.or(working));
	patchButton.textProperty().bind(Bindings.createStringBinding(
			() -> fileStatusProperty.getValue().getButtonText(), fileStatusProperty));
}
 
开发者ID:zeobviouslyfakeacc,项目名称:ModLoaderInstaller,代码行数:36,代码来源:MainPanel.java

示例3: defineTableButtons

import javafx.beans.binding.Bindings; //导入依赖的package包/类
private void defineTableButtons() {
    Button addButton = new Button("Add", addIconView);
    addButton.setOnAction(actionEvent -> new NewJWKView(primaryStage, rootPane, jwkSetData).initialize());

    Button removeButton = new Button("Remove", removeIconView);
    removeButton.setOnAction(actionEvent -> onRemove(tableView));
    removeButton.disableProperty().bind(Bindings.isEmpty(tableView.getSelectionModel().getSelectedItems()));

    Button importButton = new Button("Import", importIconView);
    importButton.setOnAction(actionEvent -> onImport());

    buttonRow = new HBox(30);  // Buttons
    buttonRow.setPadding(new Insets(10, 10, 10, 10));
    buttonRow.getChildren().addAll(addButton, removeButton, importButton);

}
 
开发者ID:atbashEE,项目名称:atbash-octopus,代码行数:17,代码来源:JWKView.java

示例4: defineTableButtons

import javafx.beans.binding.Bindings; //导入依赖的package包/类
private void defineTableButtons() {
    Button cancelButton = new Button("Cancel");
    cancelButton.setOnAction(actionEvent -> new JWKView(primaryStage, rootPane, jwkSetData).initialize());

    Button importPublicButton = new Button("Import public");
    importPublicButton.setOnAction(actionEvent -> importPublicKey());

    importPublicButton.disableProperty().bind(Bindings.createBooleanBinding(this::isImportPublicButtonDisabled, tableView.getSelectionModel().getSelectedItems()));

    Button importButton = new Button("Import");
    importButton.setOnAction(actionEvent -> importKey());
    importButton.disableProperty().bind(Bindings.isEmpty(tableView.getSelectionModel().getSelectedItems()));

    buttonRow = new HBox(30);  // Buttons
    buttonRow.setPadding(new Insets(10, 10, 10, 10));
    buttonRow.getChildren().addAll(cancelButton, importPublicButton, importButton);

}
 
开发者ID:atbashEE,项目名称:atbash-octopus,代码行数:19,代码来源:ImportJWKView.java

示例5: bind

import javafx.beans.binding.Bindings; //导入依赖的package包/类
public void bind(TestdataLinkMappingPresenter presenter) {
    this.presenter = presenter;
    
    saveMaxEntities = presenter.getSaveMaxEntities();
    
    entityProperty.unbind();
    entityProperty.setValue(0);
    entityProperty.bind(super.progressProperty());
    
    this.presenter.getProgressBarPercentInformation().textProperty().bind(
            Bindings.createStringBinding(() -> {
                int process = (int) (entityProperty.getValue() * 100.0d);
                if (process <= 0) {
                    process = 0;
                } else {
                    ++process;
                }

                return process + "%"; // NOI18N
            },
            entityProperty));
    
    this.presenter.progressPropertyFromEntityDream().unbind();
    this.presenter.progressPropertyFromEntityDream().bind(super.progressProperty());
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:26,代码来源:LinkMappingService.java

示例6: HighlightCell

import javafx.beans.binding.Bindings; //导入依赖的package包/类
public HighlightCell(StringProperty textToHighlight) {
    super();

    this.backgroundProperty().bind(Bindings.when(Bindings.and(Bindings.isNotNull(textToHighlight), Bindings.equal(itemProperty(), textToHighlight)))
            .then(HIGHLIGHT_BACKGROUND)
            .otherwise(Background.EMPTY));
}
 
开发者ID:CrazyBBB,项目名称:tenhou-visualizer,代码行数:8,代码来源:HighlightCell.java

示例7: bind

import javafx.beans.binding.Bindings; //导入依赖的package包/类
/**
 * Invokes {@link DateControl#bind(DateControl, boolean)} and adds some more
 * bindings between this control and the given control.
 *
 * @param otherControl the control that will be bound to this control
 * @param bindDate     if true will also bind the date property
 */
public final void bind(DayViewBase otherControl, boolean bindDate) {
    super.bind(otherControl, bindDate);

    Bindings.bindBidirectional(
            otherControl.earlyLateHoursStrategyProperty(),
            earlyLateHoursStrategy);
    Bindings.bindBidirectional(otherControl.hoursLayoutStrategyProperty(),
            hoursLayoutStrategyProperty());
    Bindings.bindBidirectional(otherControl.hourHeightProperty(),
            hourHeightProperty());
    Bindings.bindBidirectional(otherControl.hourHeightCompressedProperty(),
            hourHeightCompressedProperty());
    Bindings.bindBidirectional(otherControl.visibleHoursProperty(),
            visibleHoursProperty());
    Bindings.bindBidirectional(otherControl.enableCurrentTimeMarkerProperty(),
            enableCurrentTimeMarkerProperty());
    Bindings.bindBidirectional(otherControl.trimTimeBoundsProperty(),
            trimTimeBoundsProperty());
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:27,代码来源:DayViewBase.java

示例8: unbind

import javafx.beans.binding.Bindings; //导入依赖的package包/类
public final void unbind(DayViewBase otherControl) {
    super.unbind(otherControl);

    Bindings.unbindBidirectional(
            otherControl.earlyLateHoursStrategyProperty(),
            earlyLateHoursStrategy);
    Bindings.unbindBidirectional(otherControl.hoursLayoutStrategyProperty(),
            hoursLayoutStrategyProperty());
    Bindings.unbindBidirectional(otherControl.hourHeightProperty(),
            hourHeightProperty());
    Bindings.unbindBidirectional(
            otherControl.hourHeightCompressedProperty(),
            hourHeightCompressedProperty());
    Bindings.unbindBidirectional(otherControl.visibleHoursProperty(),
            visibleHoursProperty());
    Bindings.unbindBidirectional(otherControl.enableCurrentTimeMarkerProperty(),
            enableCurrentTimeMarkerProperty());
    Bindings.unbindBidirectional(otherControl.trimTimeBoundsProperty(),
            trimTimeBoundsProperty());
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:21,代码来源:DayViewBase.java

示例9: bind

import javafx.beans.binding.Bindings; //导入依赖的package包/类
public void bind(TestdataExerciseTermPresenter presenter) {
    this.presenter = presenter;
    
    saveMaxEntities = presenter.getSaveMaxEntities();
    
    entityProperty.unbind();
    entityProperty.setValue(0);
    entityProperty.bind(super.progressProperty());
    
    this.presenter.getProgressBarPercentInformation().textProperty().bind(
            Bindings.createStringBinding(() -> {
                int process = (int) (entityProperty.getValue() * 100.0d);
                if (process <= 0) {
                    process = 0;
                } else {
                    ++process;
                }

                return process + "%"; // NOI18N
            },
            entityProperty));
    
    this.presenter.progressPropertyFromEntityDream().unbind();
    this.presenter.progressPropertyFromEntityDream().bind(super.progressProperty());
}
 
开发者ID:Naoghuman,项目名称:ABC-List,代码行数:26,代码来源:ExerciseTermService.java

示例10: initialize

import javafx.beans.binding.Bindings; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    this.title = resources.getString(R.Translate.ITEM_TYPE_WEAPON_MELE);
    this.imageChooserTitle = resources.getString(R.Translate.ITEM_IMAGE_CHOOSE_DIALOG);

    txtName.textProperty().bindBidirectional(model.name);
    txtDescription.textProperty().bindBidirectional(model.description);

    cmbWeaponType.setItems(FXCollections.observableArrayList(MeleWeaponType.values()));
    cmbWeaponType.valueProperty().bindBidirectional(model.weaponType);
    cmbWeaponType.converterProperty().setValue(StringConvertors.forMeleWeaponType(translator));
    cmbWeaponClass.setItems(FXCollections.observableArrayList(MeleWeaponClass.values()));
    cmbWeaponClass.valueProperty().bindBidirectional(model.weaponClass);
    cmbWeaponClass.converterProperty()
        .setValue(StringConvertors.forMeleWeaponClass(translator));

    FormUtils.initTextFormater(txtStrength, model.strength);
    FormUtils.initTextFormater(txtRampancy, model.rampancy);
    FormUtils.initTextFormater(txtDefenceNumber, model.defence);
    FormUtils.initTextFormater(txtWeight, model.weight);

    lblPrice.textProperty().bind(model.price.text);
    imageView.imageProperty().bindBidirectional(model.image);

    btnFinish.disableProperty().bind(Bindings.or(model.name.isEmpty(), model.imageRaw.isNull()));
}
 
开发者ID:stechy1,项目名称:drd,代码行数:27,代码来源:ItemWeaponMeleController.java

示例11: ShopEntry

import javafx.beans.binding.Bindings; //导入依赖的package包/类
/**
 * Vytvoří novou abstrakní nákupní položku
 */
public ShopEntry(ItemBase itemBase) {
    ammount.minValueProperty().bind(Bindings
        .when(inShoppingCart)
        .then(1)
        .otherwise(0));

    imageRaw.addListener((observable, oldValue, newValue) -> {
        final ByteArrayInputStream inputStream = new ByteArrayInputStream(newValue);
        image.set(new Image(inputStream));
    });

    this.itemBase = itemBase;
    this.id.bind(itemBase.idProperty());
    this.name.bind(itemBase.nameProperty());
    this.description.bind(itemBase.descriptionProperty());
    this.price = itemBase.getPrice();
    this.weight.bind(itemBase.weightProperty());
    this.author.bind(itemBase.authorProperty());
    this.downloaded.bindBidirectional(itemBase.downloadedProperty());
    this.uploaded.bindBidirectional(itemBase.uploadedProperty());
    this.imageRaw.bind(itemBase.imageProperty());
}
 
开发者ID:stechy1,项目名称:drd,代码行数:26,代码来源:ShopEntry.java

示例12: CSSTheme

import javafx.beans.binding.Bindings; //导入依赖的package包/类
public CSSTheme() {

        css.bind(Bindings.createStringBinding(() -> String.format(
                ".root { %n  "
               + "-fx-base: %s;%n  "
               + "-fx-background: %s;%n  "
               + "-fx-accent: %s;%n  "
               + "-fx-default-button: %s;%n  "
               + "-fx-focus-color: %s;%n  "
               + "-fx-faint-focus-color: %s;%n}",
                ColorEncoder.encodeColor((Color) base.get()),
                ColorEncoder.encodeColor((Color) background.get()),
                ColorEncoder.encodeColor((Color) accent.get()),
                ColorEncoder.encodeColor((Color) defaultButton.get()),
                ColorEncoder.encodeColor((Color) focusColor.get()),
                ColorEncoder.encodeColor((Color) faintFocusColor.get())),
                base, background, accent, defaultButton, focusColor, faintFocusColor));
    }
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:19,代码来源:CSSTheme.java

示例13: createContextMenu

import javafx.beans.binding.Bindings; //导入依赖的package包/类
private ContextMenu createContextMenu() {
    MenuItem insertRow = new MenuItem("Insert Row");
    MenuItem columnResize = new MenuItem("Resize columns");
    MenuItem deleteRow = new MenuItem("Delete Row");
    MenuItem comment = new MenuItem("Comment ...");

    insertRow.setAccelerator(new KeyCodeCombination(KeyCode.INSERT));
    insertRow.setOnAction(event -> insertRow());

    deleteRow.setAccelerator(new KeyCodeCombination(KeyCode.DELETE));
    deleteRow.setOnAction(event -> deleteRow());

    MenuItem addNewColumn = new MenuItem("New Column...");
    addNewColumn.setOnAction(event -> addNewColumn());

    comment.setOnAction(event -> addRowComment(event));
    comment.setAccelerator(KeyCodeCombination.keyCombination("Ctrl+k"));
    insertRow.disableProperty().bind(Bindings.not(tableView.editableProperty()));
    deleteRow.disableProperty().bind(Bindings.not(tableView.editableProperty()));
    addNewColumn.disableProperty().bind(Bindings.not(tableView.editableProperty()));
    columnResize.setAccelerator(KeyCodeCombination.keyCombination("Ctrl+R"));
    columnResize.setOnAction(event -> resizeColumns());

    return new ContextMenu(insertRow, deleteRow, addNewColumn, comment, columnResize);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:26,代码来源:SpecificationTableController.java

示例14: initRightClick

import javafx.beans.binding.Bindings; //导入依赖的package包/类
private void initRightClick() {
    fileTable.setRowFactory(param -> {
        final TableRow<File> row = new TableRow<>();
        final ContextMenu rowMenu = new ContextMenu();

        MenuItem addNewFile = new MenuItem("Add File");
        addNewFile.setOnAction(event -> addCvFile());

        MenuItem removeFile = new MenuItem("Remove file");
        removeFile.setOnAction(event -> removeCvFile());

        rowMenu.getItems().addAll(removeFile, addNewFile);
        row.contextMenuProperty()
                .bind(Bindings
                        .when(Bindings.isNotNull(row.itemProperty()))
                        .then(rowMenu)
                        .otherwise((ContextMenu) null));
        return row;
    });
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:21,代码来源:CvFilesWindowController.java

示例15: initRightClick

import javafx.beans.binding.Bindings; //导入依赖的package包/类
private void initRightClick() {
    millingTable.setRowFactory(param -> {
        final TableRow<Filed> row = new TableRow<>();
        final ContextMenu rowMenu = new ContextMenu();

        MenuItem showExtracted = new MenuItem("Show extracted");
        showExtracted.setOnAction(event -> showExtracted());

        MenuItem showParsed = new MenuItem("Show parsed");
        showParsed.setOnAction(event -> showParsed());

        row.setOnMouseClicked(event -> {
            if (event.getClickCount() == 2 && (!row.isEmpty())) {
                screensManager.showParsedFileData(row.getItem());
            }
        });

        rowMenu.getItems().addAll(showParsed, showExtracted);
        row.contextMenuProperty()
                .bind(Bindings
                        .when(Bindings.isNotNull(row.itemProperty()))
                        .then(rowMenu)
                        .otherwise((ContextMenu) null));
        return row;
    });
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:27,代码来源:ParsedFilesController.java


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