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


Java WeakListChangeListener类代码示例

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


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

示例1: getOutputToScreenLogger

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
private ListChangeListener<String> getOutputToScreenLogger() {
    outputListener = new ListChangeListener<String>() {
        boolean first = true;

        @Override
        public void onChanged(ListChangeListener.Change<? extends String> change) {
            change.next();
            Platform.runLater(() -> {
                List<? extends String> changedList = change.getList();
                for (int index = first ? 0 : change.getFrom(); index < change.getTo(); index++) {
                    String added = changedList.get(index);
                    if (added != null) {
                        outputTextArea.appendText(added);
                    }
                }
                first = false;
            });
        }
    };
    return new WeakListChangeListener<>(outputListener);
}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:22,代码来源:ImagingController.java

示例2: createTaskTable

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
private AbstractTableView<ITask> createTaskTable(DoubleProperty horizontalScrollValue,
                                                 DoubleProperty verticalScrollValue) {
    taskTableView = new TaskTableView<>(horizontalScrollValue, verticalScrollValue);

    taskTableView.setRoot(new TreeItem<>(new Task()));
    taskTableView.setRowFactory(new TaskTreeTableViewRowFactory(this, new TaskTableDragAndDrop(this)));
    taskTableView.setRowFactory(new TaskTreeTableViewRowFactory(this, new TaskTableDragAndDrop(this)));
    taskListChangeListener = this::taskChangeListenerHandler;
    project.getTaskList().addListener(new WeakListChangeListener<>(taskListChangeListener));

    taskChangeListener = this::refreshSelectedTask;
    taskTableView.getSelectionModel().selectedItemProperty().addListener(new WeakChangeListener<>(taskChangeListener));

    taskTreeItemsChangeListener = this::setSelectedTaskNull;
    taskTableView.getRoot().getChildren().addListener(new WeakListChangeListener<>(taskTreeItemsChangeListener));
    return taskTableView;
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:18,代码来源:MainWindowController.java

示例3: createResourceTable

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
private AbstractTableView<IResource> createResourceTable(DoubleProperty horizontalScrollValue,
                                                         DoubleProperty verticalScrollValue) {
    resourceTableView = new ResourceTableView<>(horizontalScrollValue, verticalScrollValue);

    resourceTableView.setRoot(new TreeItem<>(new Resource()));
    resourceTableView.setRowFactory(new ResourceTreeTableViewRowFactory(this, new ResourceTableDragAndDrop(this)));
    resourceListChangeListener = this::resourceChangeListenerHandler;
    project.getResourceList().addListener(new WeakListChangeListener<>(resourceListChangeListener));

    resourceChangeListener = this::refreshSelectedResource;
    resourceTableView.getSelectionModel().selectedItemProperty().addListener(new WeakChangeListener<>(resourceChangeListener));

    resourceTreeItemsChangeListener = this::setSelectedResourceNull;
    resourceTableView.getRoot().getChildren().addListener(new WeakListChangeListener<>(resourceTreeItemsChangeListener));
    return resourceTableView;
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:17,代码来源:MainWindowController.java

示例4: AutoTreeItem

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
/**
 * Instantiates a new AutoTreeItem, sets it's Value to passed value and it's Graphic to passed node.
 *
 * @param value
 *            the Value
 * @param node
 *            the Graphic
 */
@SuppressWarnings("unchecked")
public AutoTreeItem(T value, Node node) {
	super(value, node);
	if (value != null) {
		ObservableList<T> valueChildren = value.getChildren();
		if (valueChildren != null) {
			for (T valueChild : valueChildren) {
				AutoTreeItem<T> treeItemChild = new AutoTreeItem<T>(valueChild);
				treeItemChild.setExpanded(true);
				getChildren().add(treeItemChild);
			}
			value.getChildren().addListener(new WeakListChangeListener<>(childrenListener));
		}
	}
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:24,代码来源:AutoTreeItem.java

示例5: initListEvents

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
private void initListEvents() {
	this.listChangeListener = new ListChangeListener<SourceType>() {
		@Override
		public void onChanged(
				Change<? extends SourceType> listEvent) {
			
			// We have to stage delete events, because if we process them
			// separately, there will be unwanted ChangeEvents on the
			// targetList
			List<TargetType> deleteStaging = new ArrayList<>();
			
			
			while (listEvent.next()) {
				if (listEvent.wasUpdated()) {
					processUpdateEvent(listEvent);
				} else if (listEvent.wasReplaced()) {
					processReplaceEvent(listEvent, deleteStaging);
				} else if (listEvent.wasAdded()) {
					processAddEvent(listEvent);
				} else if (listEvent.wasRemoved()) {
					processRemoveEvent(listEvent, deleteStaging);
				}
			}
			
			// Process the staged elements
			processStagingLists(deleteStaging);
		}
	};
	modelListProperty().addListener(
			new WeakListChangeListener<>(listChangeListener));
	
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:33,代码来源:ListTransformation.java

示例6: registerListeners

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
@Override protected void registerListeners() {
    super.registerListeners();
    tile.getBarChartItems().addListener(new WeakListChangeListener<>(change -> {
        while (change.next()) {
            if (change.wasAdded()) {
                change.getAddedSubList().forEach(addedItem -> {
                    barChartPane.getChildren().add(addedItem);
                    addedItem.addChartDataEventListener(updateHandler);
                    EventHandler<MouseEvent> clickHandler = e -> tile.fireTileEvent(new TileEvent(EventType.SELECTED_CHART_DATA, addedItem.getChartData()));
                    handlerMap.put(addedItem, clickHandler);
                    addedItem.setOnMousePressed(clickHandler);
                });
                updateChart();
            } else if (change.wasRemoved()) {
                change.getRemoved().forEach(removedItem -> {
                    removedItem.removeChartDataEventListener(updateHandler);
                    removedItem.removeEventHandler(MouseEvent.MOUSE_PRESSED, handlerMap.get(removedItem));
                    barChartPane.getChildren().remove(removedItem);
                });
                updateChart();
            }
        }
    }));

    pane.widthProperty().addListener(paneSizeListener);
    pane.heightProperty().addListener(paneSizeListener);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:28,代码来源:BarChartTileSkin.java

示例7: setListeners

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
public void setListeners() {
    resourceListChangeListener = change -> {
        while (change.next()) {
            if (change.wasAdded()) {
                change.getAddedSubList().forEach(this::addResourceLabel);
            }
            if (change.wasRemoved()) {
                change.getRemoved().forEach(this::removeResourceLabel);
            }
        }
    };
    taskBar.getTask().getResourceList().addListener(new WeakListChangeListener<>(resourceListChangeListener));
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:14,代码来源:TaskBarLabel.java

示例8: setListeners

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
/**
 * Метод инициализирующий листенеры.
 *
 */
public void setListeners(MainWindowController controller) {
    // Листенер который следит за добавлением новых задач.
    // Нужен для обновления связей при изменении положения задачи в таблице задач (при драг'н'дропе).
    // Если после драг'н'дропа не обновить связь, то она работает не корректно.
    // TODO: 04.03.2016 По хорошему необходимо обновлять связь только у тех задач которые добавились, а не перерисовывать все связи.
    taskListChangeListener = change -> {
        while (change.next()) {
            if (change.wasAdded()) {
                Platform.runLater(() -> refreshRelationsDiagram(controller));
            }
        }
    };
    controller.getProject().getTaskList().addListener(new WeakListChangeListener<>(taskListChangeListener));
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:19,代码来源:RelationsLayer.java

示例9: ObservableListBuffering

import javafx.collections.WeakListChangeListener; //导入依赖的package包/类
/**
 * @param newBeanType
 *            bean type
 * @param newPropertyName
 *            bean property name
 * @param newSubject
 *            property value
 */
public ObservableListBuffering(final Class<?> newBeanType, final String newPropertyName,
		final ObservableList<E> newSubject)
{
	super(FXCollections.observableArrayList());

	if (newBeanType != null || !(newSubject instanceof ReadOnlyProperty<?>))
	{
		beanType = newBeanType;
	}
	else
	{
		final Object bean = ((ReadOnlyProperty<?>) newSubject).getBean();
		beanType = (bean != null ? bean.getClass() : null);
	}

	if (newPropertyName != null || !(newSubject instanceof ReadOnlyProperty<?>))
	{
		propertyName = newPropertyName;
	}
	else
	{
		propertyName = ((ReadOnlyProperty<?>) newSubject).getName();
	}

	subject = Objects.requireNonNull(newSubject);

	addAll(subject);

	thisListener = c -> {
		if (equalsBuffering)
		{
			buffering.setValue(!equalsSubject());
		}
		else
		{
			buffering.setValue(true);
		}
		validate();
	};

	subjectListener = c -> {
		if (!buffering.getValue())
		{
			revert();
		}
	};

	addListener(thisListener);

	weakSubjectListener = new WeakListChangeListener<E>(subjectListener);
	subject.addListener(weakSubjectListener);

	validate();
}
 
开发者ID:ben12,项目名称:reta,代码行数:63,代码来源:ObservableListBuffering.java


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