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


Java WeakInvalidationListener类代码示例

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


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

示例1: JFXTreeCell

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
public JFXTreeCell() {

        selectedPane.getStyleClass().add("selection-bar");
        selectedPane.setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
        selectedPane.setPrefWidth(3);
        selectedPane.setMouseTransparent(true);
        selectedProperty().addListener((o, oldVal, newVal) -> selectedPane.setVisible(newVal ? true : false));

        final InvalidationListener treeItemInvalidationListener = observable -> {
            TreeItem<T> oldTreeItem = treeItemRef == null ? null : treeItemRef.get();
            if (oldTreeItem != null) {
                oldTreeItem.graphicProperty().removeListener(weakTreeItemGraphicListener);
            }

            TreeItem<T> newTreeItem = getTreeItem();
            if (newTreeItem != null) {
                newTreeItem.graphicProperty().addListener(weakTreeItemGraphicListener);
                treeItemRef = new WeakReference<>(newTreeItem);
            }
        };
        final WeakInvalidationListener weakTreeItemListener = new WeakInvalidationListener(treeItemInvalidationListener);
        treeItemProperty().addListener(weakTreeItemListener);
        if (getTreeItem() != null) {
            getTreeItem().graphicProperty().addListener(weakTreeItemGraphicListener);
        }
    }
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:27,代码来源:JFXTreeCell.java

示例2: initModule

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
@Override
public void initModule() {
    module.disableProperty().bind(controller.selectedResourceProperty().isNull());

    module.getResourceTypeComboBox().setItems(FXCollections.observableArrayList(ResourceType.values()));

    resourceChangeListener = this::selectedResourceObserver;
    nameFieldInvalidationListener = this::nameFieldUnfocused;
    emailFieldInvalidationListener = this::emailFieldUnfocused;
    descriptionTextAreaInvalidationListener = this::descriptionTextAreaUnfocused;

    controller.selectedResourceProperty().addListener(new WeakChangeListener<>(resourceChangeListener));

    module.getNameField().setOnKeyPressed(this::nameFieldObserver);
    module.getResourceTypeComboBox().setOnAction(this::resourceTypeComboBoxObserver);
    module.getEmailField().setOnKeyPressed(this::emailFieldObserver);
    module.getDescriptionTextArea().setOnKeyPressed(this::descriptionTextAreaObserver);

    module.getNameField().focusedProperty().addListener(new WeakInvalidationListener(nameFieldInvalidationListener));
    module.getEmailField().focusedProperty().addListener(new WeakInvalidationListener(emailFieldInvalidationListener));
    module.getDescriptionTextArea().focusedProperty().addListener(new WeakInvalidationListener(descriptionTextAreaInvalidationListener));
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:23,代码来源:ResourceInformationModuleController.java

示例3: bind

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
/**
 * @param property
 * @param dest
 */
public <T> void bind(final Property<T> property, final ObservableValue<? extends T> dest) {
	InvalidationListener invalidationListener = new InvalidationListener() {
		@Override
		public void invalidated(Observable observable) {
			property.setValue(dest.getValue());
		}
	};

	WeakInvalidationListener weakInvalidationListener = new WeakInvalidationListener(invalidationListener);

	invalidationListeners.put(dest, weakInvalidationListener);

	dest.addListener(weakInvalidationListener);
	property.setValue(dest.getValue());

	hardRefs.add(dest);
	hardRefs.add(invalidationListener);
}
 
开发者ID:ipfaffen,项目名称:prishonor,代码行数:23,代码来源:WeakBinder.java

示例4: ServerPane

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ServerPane(final ServerData serverData) {
	this.serverData = assertNotNull(serverData, "serverData");
	this.server = assertNotNull(serverData.getServer(), "serverData.server");
	loadDynamicComponentFxml(ServerPane.class, this);

	try {
		url = JavaBeanObjectPropertyBuilder.create().bean(server).name(Server.PropertyEnum.url.name()).build();
		name = JavaBeanStringPropertyBuilder.create().bean(server).name(Server.PropertyEnum.name.name()).build();
	} catch (NoSuchMethodException e) {
		throw new RuntimeException(e);
	}
	urlTextField.textProperty().bindBidirectional(url, new UrlStringConverter());
	nameTextField.textProperty().bindBidirectional(name);

	acceptInvitationCheckBox.selectedProperty().bindBidirectional(serverData.acceptInvitationProperty());
	nameLabel.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());
	nameTextField.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());
	urlLabel.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());
	urlTextField.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());

	addWeakPropertyChangeListener(server, Server.PropertyEnum.url, updateCompletePropertyChangeListener);
	serverData.acceptInvitationProperty().addListener(new WeakInvalidationListener(updateCompleteInvalidationListener));
	updateComplete();
}
 
开发者ID:subshare,项目名称:subshare,代码行数:26,代码来源:ServerPane.java

示例5: SelectBindingHelper

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
@SuppressWarnings("all")
private SelectBindingHelper(Binding<?> binding, ObservableValue<?> firstProperty, String... steps) {
    if (firstProperty == null) {
        throw new NullPointerException("Must specify the root");
    }
    if (steps == null) {
        steps = new String[0];
    }

    this.binding = binding;

    final int n = steps.length;
    for (int i = 0; i < n; i++) {
        if (steps[i] == null) {
            throw new NullPointerException("all steps must be specified");
        }
    }

    this.observer = new WeakInvalidationListener(this);
    this.propertyNames = new String[n];
    System.arraycopy(steps, 0, this.propertyNames, 0, n);
    this.propRefs = new PropertyReference<?>[n];
    this.properties = new ObservableValue<?>[n + 1];
    this.properties[0] = firstProperty;
    this.properties[0].addListener(this.observer);
}
 
开发者ID:SkyLandTW,项目名称:JXTN,代码行数:27,代码来源:SelectBinding.java

示例6: YearView

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
private YearView() {

            localeInvalidationListener = new InvalidationListener() {
                @Override
                public void invalidated(Observable observable) {
                    updateCells();
                }
            };
            getStyleClass().add(CSS_CALENDAR_YEAR_VIEW);
            // When the locale changes, update the contents (month names).
            calendarView.localeProperty().addListener(new WeakInvalidationListener(localeInvalidationListener));
        }
 
开发者ID:scourgemancer,项目名称:graphing-loan-analyzer,代码行数:13,代码来源:CalendarViewSkin.java

示例7: addDiffListener

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
public static <T, C extends Collection<T> & Observable> InvalidationListener addDiffListener(C collection, Consumer<? super T> foreachAdd, Consumer<? super T> foreachRemove) {
	CollectionDiffListener<T> differ = new CollectionDiffListener<>();
	differ.target = collection;
	differ.foreachAdd = foreachAdd;
	differ.foreachRemove = foreachRemove;
	collection.addListener(new WeakInvalidationListener(differ));
	differ.invalidated(collection);
	return differ;
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:10,代码来源:CollectionUtils.java

示例8: weakBind

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
private void weakBind(Runnable doBind, Node bindedNode, String propertyName, Observable... dependencies) {
	InvalidationListener listener = new DependenciesInvalidationListener(doBind, dependencies);
	WeakInvalidationListener weakListener = new WeakInvalidationListener(listener);
	Object prev = bindedNode.getProperties().put(propertyName, listener);
	Object prevWeak = bindedNode.getProperties().put(propertyName + ".weak", weakListener);
	if (prev instanceof DependenciesInvalidationListener) {
		for (Observable observable : ((DependenciesInvalidationListener) prev).dependencies) {
			observable.removeListener((InvalidationListener) prevWeak);
		}
	}
	for (Observable dep : dependencies) {
		dep.addListener(weakListener);
	}
	doBind.run();
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:16,代码来源:BlurBackgroundPane.java

示例9: MapTile

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
MapTile(BaseMap baseMap, int nearestZoom, long i, long j) {
        this.baseMap = baseMap;
        this.myZoom = nearestZoom;
        this.i = i;
        this.j = j;
        scale.setPivotX(0);
        scale.setPivotY(0);
        getTransforms().add(scale);
        debug("[JVDBG] load image [" + myZoom + "], i = " + i + ", j = " + j);

        ImageView iv = new ImageView();
        iv.setMouseTransparent(true);
        this.progress = ImageRetriever.fillImage(iv, myZoom, i, j);

//        Label l = new Label("Tile [" + myZoom + "], i = " + i + ", j = " + j);
        getChildren().addAll(iv);//,l);
        this.progress.addListener(o -> {
            if (this.progress.get() == 1.) {
                debug("[JVDBG] got image  [" + myZoom + "], i = " + i + ", j = " + j);
                this.setNeedsLayout(true);
            }
        });
        baseMap.zoom().addListener(new WeakInvalidationListener(zl));
        baseMap.translateXProperty().addListener(new WeakInvalidationListener(zl));
        baseMap.translateYProperty().addListener(new WeakInvalidationListener(zl));
        calculatePosition();
        this.setMouseTransparent(true);
    }
 
开发者ID:gluonhq,项目名称:maps,代码行数:29,代码来源:MapTile.java

示例10: PreviewStyledTextArea

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
PreviewStyledTextArea() {
	setEditable(false);
	setFocusTraversable(false);
	getStyleClass().add("padding");
	setUndoManager(UndoManagerFactory.zeroHistoryUndoManager(richChanges()));

	updateFont();

	optionsListener = e -> updateFont();
	WeakInvalidationListener weakOptionsListener = new WeakInvalidationListener(optionsListener);
	Options.fontFamilyProperty().addListener(weakOptionsListener);
	Options.fontSizeProperty().addListener(weakOptionsListener);
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:14,代码来源:PreviewStyledTextArea.java

示例11: setListeners

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
/**
 * Метод в котором определяются "слушатели" на заданные параметры,
 * при изменении которых происходит перерисовка строки с датами и диаграммы.
 *
 * @param projectStartDateProperty  Проперти начальной даты проекта
 * @param projectFinishDateProperty Проперти конечной даты проекта
 * @param zoomMultiplierProperty    Проперти множителя
 */
public void setListeners(ObjectProperty<LocalDate> projectStartDateProperty,
                         ObjectProperty<LocalDate> projectFinishDateProperty,
                         IntegerProperty zoomMultiplierProperty) {
    listener = observable -> refreshDateLine(
            projectStartDateProperty.getValue(),
            projectFinishDateProperty.getValue(),
            zoomMultiplierProperty.getValue());

    projectStartDateProperty.addListener(new WeakInvalidationListener(listener));
    projectFinishDateProperty.addListener(new WeakInvalidationListener(listener));
    zoomMultiplierProperty.addListener(new WeakInvalidationListener(listener));
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:21,代码来源:DateLine.java

示例12: MainWindowController

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
public MainWindowController(File projectFile, IProject project, CommandExecutor commandExecutor) {
    this.projectFile = projectFile;
    this.project = project;
    this.commandExecutor = commandExecutor;
    view = createMainWindow();
    projectDateListener = this::projectDateObserver;
    project.startDateProperty().addListener(new WeakInvalidationListener(projectDateListener));
    project.finishDateProperty().addListener(new WeakInvalidationListener(projectDateListener));
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:10,代码来源:MainWindowController.java

示例13: initModule

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
@Override
public void initModule() {
    // set disable if selected task is null
    module.disableProperty().bind(controller.selectedTaskProperty().isNull());
    // init listeners
    taskChangeListener = this::selectedTaskObserver;
    nameFieldInvalidationListener = this::nameFieldUnfocused;
    costFieldInvalidationListener = this::costFieldUnfocused;
    descriptionTextAreaInvalidationListener = this::descriptionTextAreaUnfocused;
    // set listener on selected task
    controller.selectedTaskProperty().addListener(new WeakChangeListener<>(taskChangeListener));
    // set handlers on fields events
    module.getNameField().setOnKeyPressed(this::nameFieldHandler);
    module.getStartDatePicker().setOnAction(this::startDatePickerHandler);
    module.getFinishDatePicker().setOnAction(this::finishDatePickerHandler);
    module.getDonePercentSlider().setOnMouseReleased(this::donePercentSliderHandler);
    module.getCostField().setOnKeyPressed(this::costFieldHandler);
    module.getDescriptionTextArea().setOnKeyPressed(this::descriptionTextAreaHandler);
    // set listeners to discard changes when field is unfocused
    module.getNameField().focusedProperty().addListener(new WeakInvalidationListener(nameFieldInvalidationListener));
    module.getCostField().focusedProperty().addListener(new WeakInvalidationListener(costFieldInvalidationListener));
    module.getDescriptionTextArea().focusedProperty().addListener(new WeakInvalidationListener(descriptionTextAreaInvalidationListener));
    // set day cells disabled outer valid range
    module.getStartDatePicker().setDayCellFactory(this::makeStartDatePickerCellsDisabled);
    module.getFinishDatePicker().setDayCellFactory(this::makeFinishDatePickerCellsDisabled);
    // set date enabled only by mouse
    module.getStartDatePicker().setEditable(false);
    module.getFinishDatePicker().setEditable(false);
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:30,代码来源:TaskInformationModuleController.java

示例14: ServerWizardPage

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
public ServerWizardPage(final ServerData serverData) {
	super("Server");
	this.serverData = assertNotNull(serverData, "serverData");
	acceptInvitationSourceWizardPage = new AcceptInvitationSourceWizardPage(serverData.getAcceptInvitationData());
	acceptInvitationInvalidationListener = observable -> {
		nextPageProperty().set(serverData.acceptInvitationProperty().get() ? acceptInvitationSourceWizardPage : null);
	};
	serverData.acceptInvitationProperty().addListener(new WeakInvalidationListener(acceptInvitationInvalidationListener));
}
 
开发者ID:subshare,项目名称:subshare,代码行数:10,代码来源:ServerWizardPage.java

示例15: SearchCriteriaPane

import javafx.beans.WeakInvalidationListener; //导入依赖的package包/类
public SearchCriteriaPane(final ImportPgpKeyFromServerData importPgpKeyFromServerData) {
	this.importPgpKeyFromServerData = assertNotNull(importPgpKeyFromServerData, "importPgpKeyFromServerData");
	loadDynamicComponentFxml(SearchCriteriaPane.class, this);
	queryStringTextField.textProperty().bindBidirectional(importPgpKeyFromServerData.queryStringProperty());
	importPgpKeyFromServerData.queryStringProperty().addListener(new WeakInvalidationListener(updateCompleteInvalidationListener));
	updateComplete();
}
 
开发者ID:subshare,项目名称:subshare,代码行数:8,代码来源:SearchCriteriaPane.java


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