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


Java ListChangeListener类代码示例

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


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

示例1: initRegisteredCommandsListener

import javafx.collections.ListChangeListener; //导入依赖的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: addColection

import javafx.collections.ListChangeListener; //导入依赖的package包/类
/**
 * Pridá kolekci do registru
 *
 * @param items Kolekce, která se má přidat
 */
public void addColection(ObservableList<? extends DatabaseItem> items) {
    items.addListener((ListChangeListener<DatabaseItem>) c -> {
        while (c.next()) {
            if (c.wasAdded()) {
                this.registry.addAll(c.getAddedSubList());
            }
            if (c.wasRemoved()) {
                this.registry.removeAll(c.getRemoved());
            }
        }
    });
    for (DatabaseItem item : items) {
        this.registry.add(item);
    }
}
 
开发者ID:stechy1,项目名称:drd,代码行数:21,代码来源:ItemRegistry.java

示例3: NotificationBarPane

import javafx.collections.ListChangeListener; //导入依赖的package包/类
public NotificationBarPane(Node content) {
    super(content);
    progressBar = new ProgressBar();
    label = new Label("infobar!");
    bar = new HBox(label);
    bar.setMinHeight(0.0);
    bar.getStyleClass().add("info-bar");
    bar.setFillHeight(true);
    setBottom(bar);
    // Figure out the height of the bar based on the CSS. Must wait until after we've been added to the parent node.
    sceneProperty().addListener(o -> {
        if (getParent() == null) return;
        getParent().applyCss();
        getParent().layout();
        barHeight = bar.getHeight();
        bar.setPrefHeight(0.0);
    });
    items = FXCollections.observableArrayList();
    items.addListener((ListChangeListener<? super Item>) change -> {
        config();
        showOrHide();
    });
}
 
开发者ID:Techsoul192,项目名称:legendary-guide,代码行数:24,代码来源:NotificationBarPane.java

示例4: SimpleBookmarkStore

import javafx.collections.ListChangeListener; //导入依赖的package包/类
/**
 * Create an instance of a {@link SimpleBookmarkStore}.
 * <p>
 * If it observed that the {@link org.dnacronym.hygene.parser.GfaFile} in {@link GraphStore} has changed, it will
 * clear all current {@link SimpleBookmark}s and load the {@link Bookmark}s associated with the new
 * {@link org.dnacronym.hygene.parser.GfaFile}.
 * <p>
 * It uses the {@link GraphDimensionsCalculator} as a reference for each internal {@link SimpleBookmark}.
 *
 * @param graphStore                the {@link GraphStore} to be observed by this class
 * @param graphVisualizer           the {@link GraphVisualizer} to be used by this class
 * @param graphDimensionsCalculator the {@link GraphDimensionsCalculator} to be used by this class
 * @param sequenceVisualizer        the {@link SequenceVisualizer} to be used by this class
 * @see SimpleBookmark
 */
@Inject
public SimpleBookmarkStore(final GraphStore graphStore, final GraphVisualizer graphVisualizer,
                           final GraphDimensionsCalculator graphDimensionsCalculator,
                           final SequenceVisualizer sequenceVisualizer) {
    this.graphDimensionsCalculator = graphDimensionsCalculator;
    this.graphVisualizer = graphVisualizer;
    this.sequenceVisualizer = sequenceVisualizer;

    simpleBookmarks = new ArrayList<>();
    observableSimpleBookmarks = FXCollections.observableList(simpleBookmarks);
    observableSimpleBookmarks.addListener((ListChangeListener<SimpleBookmark>) listener -> graphVisualizer.draw());

    graphStore.getGfaFileProperty().addListener((observable, oldValue, newValue) -> {
        try {
            fileBookmarks = new FileBookmarks(new FileDatabase(newValue.getFileName()));

            simpleBookmarks.clear();
            addBookmarks(fileBookmarks.getAll());
        } catch (final SQLException | IOException e) {
            LOGGER.error("Unable to load bookmarks from file.", e);
        }
    });
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:39,代码来源:SimpleBookmarkStore.java

示例5: LevelEditorHolder

import javafx.collections.ListChangeListener; //导入依赖的package包/类
public LevelEditorHolder(ObservableList<LevelData> data, double prefHeight){
	this.content = new VBox();
	this.editors = new VBox();
	this.otherNodes = new VBox();
	this.content.getChildren().addAll(otherNodes, editors);
	this.levelData = data;
	this.setContent(content);

	content.setPrefHeight(prefHeight);
	levelData.addListener(new ListChangeListener<LevelData>(){
		@Override
		public void onChanged(Change<? extends LevelData> c) {
			render();
		}
	});
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:17,代码来源:LevelEditorHolder.java

示例6: CollatedTreeItem

import javafx.collections.ListChangeListener; //导入依赖的package包/类
public CollatedTreeItem() {
    children = FXCollections.observableArrayList();
    filteredChildren = new FilteredList<>(children, new Predicate<TreeItem<T>>() {
        @Override public boolean test(TreeItem<T> t) {
            return filter.test(t.getValue());
        }
    });
    sortedChildren = new SortedList<>(filteredChildren);
    ObservableList<TreeItem<T>> original = super.getChildren();
    sortedChildren.addListener(new ListChangeListener<TreeItem<T>>() {
        @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends TreeItem<T>> c) {
            while (c.next()) {
                original.removeAll(c.getRemoved());
                original.addAll(c.getFrom(), c.getAddedSubList());
            }
        }
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:CollatedTreeItem.java

示例7: onHybridRowChanged

import javafx.collections.ListChangeListener; //导入依赖的package包/类
private void onHybridRowChanged(ListChangeListener.Change<? extends HybridRow> change) {
  while (change.next()) {
    if (change.wasAdded()) {
      List<SpecificationRow<ConstraintCell>> rowsToBeAdded = new ArrayList<>();
      List<ConstraintDuration> durationsToBeAdded = new ArrayList<>();
      for (HybridRow row : change.getAddedSubList()) {
        SpecificationRow<ConstraintCell> rowToBeAdded = row.getSourceRow();
        rowToBeAdded.commentProperty().bindBidirectional(row.commentProperty());
        rowsToBeAdded.add(rowToBeAdded);
        durationsToBeAdded.add(row.getDuration().getCell());
      }
      getRows().addAll(change.getFrom(), rowsToBeAdded);
      getDurations().addAll(change.getFrom(), durationsToBeAdded);
    }
    if (change.wasRemoved()) {
      getRows().remove(change.getFrom(), change.getFrom() + change.getRemovedSize());
      getDurations().remove(change.getFrom(), change.getFrom() + change.getRemovedSize());
    }
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:21,代码来源:HybridSpecification.java

示例8: RecentFileMenuSupport

import javafx.collections.ListChangeListener; //导入依赖的package包/类
public RecentFileMenuSupport(Menu menu) {
  this.menu = menu;
  recents = FXCollections.observableArrayList();
  recents.addListener((ListChangeListener.Change<? extends Pair<File, MenuItem>> change) -> {
    while (change.next()) {
      if (change.wasRemoved()) {
        change.getRemoved().stream()
            .map(Pair::getValue)
            .forEach(menu.getItems()::remove);
      }
      else if (change.wasAdded()) {
        change.getAddedSubList().stream()
            .map(Pair::getValue)
            .forEach(item -> menu.getItems().add(0, item));
      }
      _save();
    }
  });
  _load();
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:21,代码来源:RecentFileMenuSupport.java

示例9: initializeSelectListener

import javafx.collections.ListChangeListener; //导入依赖的package包/类
private void initializeSelectListener() {
    SelectHelper.elementsToBeSelected.addListener(new ListChangeListener<Nearable>() {
        @Override
        public void onChanged(final Change<? extends Nearable> c) {
            while (c.next()) {
                if (c.getAddedSize() == 0) return;

                for (final Nearable nearable : SelectHelper.elementsToBeSelected) {
                    if (nearable instanceof Edge) {
                        if (nearable.equals(getEdge())) {
                            SelectHelper.addToSelection(EdgeController.this);
                            break;
                        }
                    }
                }
            }
        }
    });
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:20,代码来源:EdgeController.java

示例10: initializeSelectListener

import javafx.collections.ListChangeListener; //导入依赖的package包/类
private void initializeSelectListener() {
    SelectHelper.elementsToBeSelected.addListener(new ListChangeListener<Nearable>() {
        @Override
        public void onChanged(final Change<? extends Nearable> c) {
            while (c.next()) {
                if (c.getAddedSize() == 0) return;

                for (final Nearable nearable : SelectHelper.elementsToBeSelected) {
                    if (nearable instanceof Location) {
                        if (nearable.equals(getLocation())) {
                            SelectHelper.addToSelection(LocationController.this);
                            break;
                        }
                    }
                }
            }
        }
    });
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:20,代码来源:LocationController.java

示例11: initialize

import javafx.collections.ListChangeListener; //导入依赖的package包/类
@FXML
public void initialize() {		
	gantt.setTaskViewParent(taskPane);
	gantt.setTimelineViewParent(ganttPane);
	
	// initialize recent files menu and sync's it to the storageManager list
	storageManager.getRecentFiles().forEach(f -> openRecentItem.getItems().add(recentFileItem(f)));
	storageManager.getRecentFiles().addListener((ListChangeListener.Change<? extends File> c) -> {
		while(c.next()) {
			if(c.wasAdded()) {
				for(File addFile : c.getAddedSubList())
					openRecentItem.getItems().add(recentFileItem(addFile));
			}
			if(c.wasRemoved()) {
				for(File rmFile : c.getRemoved()) {
					openRecentItem.getItems().filtered(item -> { 
						return ((File)item.getUserData()).getName().equals(rmFile.getName()); 
					}).clear();
				}
			}
		} // end while
	}); // end lambda
}
 
开发者ID:vibridi,项目名称:qgu,代码行数:24,代码来源:QGUViewController.java

示例12: onChange

import javafx.collections.ListChangeListener; //导入依赖的package包/类
/*********************************************
 *                                           *
 * PRIVATE METHODS		                     *
 *                                           *
 *********************************************/
public void onChange(ListChangeListener.Change<? extends ObservableGanttTask> change) {
	while (change.next()) {
		if(change.wasAdded()) {				
			for (int i = 0; i < change.getAddedSize(); i++) {
				taskListener.taskAddedEvent(change.getFrom()+i, change.getAddedSubList().get(i).getTask());
			}
						
		} else if(change.wasRemoved()) {
			for (int i = 0; i < change.getRemovedSize(); i++) {
				taskListener.taskRemovedEvent(change.getFrom()+i);
			}
			
		} else if(change.wasPermutated()) {
			for (int i = change.getFrom(); i < change.getTo(); i++) {
				//permutate
			}
		}
	} // end while
}
 
开发者ID:vibridi,项目名称:qgu,代码行数:25,代码来源:TaskTableView.java

示例13: onTabsChanged

import javafx.collections.ListChangeListener; //导入依赖的package包/类
private static void onTabsChanged(ListChangeListener.Change<? extends Tab> change) {
  while (change.next()) {
    if (change.wasRemoved()) {
      change.getRemoved().stream()
          .flatMap(TypeUtils.castStream(DashboardTab.class))
          .forEach(tab -> {
            tab.getPopulateDebouncer().cancel();
            WidgetPane widgetPane = tab.getWidgetPane();
            List<Tile> tiles = new ArrayList<>(widgetPane.getTiles());
            tiles.stream()
                .map((Function<Tile, Component>) widgetPane::removeTile)
                .flatMap(c -> c.allComponents())
                .flatMap(TypeUtils.castStream(Sourced.class))
                .forEach(Sourced::removeAllSources);
          });
    }
  }
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:19,代码来源:DashboardTabPane.java

示例14: initialize

import javafx.collections.ListChangeListener; //导入依赖的package包/类
@FXML
private void initialize() throws IOException {
  root.getChildren().addListener((ListChangeListener<? super Node>) change -> {
    while (change.next()) {
      for (Node node : change.getAddedSubList()) {
        if (node instanceof WidgetGallery.WidgetGalleryItem) {
          WidgetGallery.WidgetGalleryItem galleryItem = (WidgetGallery.WidgetGalleryItem) node;
          galleryItem.setOnDragDetected(event -> {
            Dragboard dragboard = galleryItem.startDragAndDrop(TransferMode.COPY);

            // TODO type safety
            ClipboardContent clipboard = new ClipboardContent();
            clipboard.put(DataFormats.widgetType, galleryItem.getWidget().getName());
            dragboard.setContent(clipboard);
            event.consume();
          });
        }
      }
    }
  });
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:22,代码来源:WidgetGalleryController.java

示例15: initialize

import javafx.collections.ListChangeListener; //导入依赖的package包/类
@Override
    public void initialize(final URL location, final ResourceBundle resources) {

        startButton.disableProperty().bind(processRunning);
        stopButton.disableProperty().bind(processRunning.not());
//        restartButton.disableProperty().bind(processRunning.not());
        processRunning.addListener((observable, oldValue, newValue) -> {
            if (newValue) {
                processStatus.setFill(Color.GREEN);
            } else {
                processStatus.setFill(Color.RED);
            }
        });
        consoleArea.getChildren().addListener((ListChangeListener<Node>) c -> {
            final ObservableList<Node> textElements = consoleArea.getChildren();
            while (textElements.size() > consoleTextElements) {
                textElements.remove(0, textElements.size() - consoleTextElements);
        }
        });
        //TODO support mouse scroll on console area
        scrollPane.vvalueProperty().bind(consoleArea.heightProperty());

    }
 
开发者ID:gmuecke,项目名称:boutique-de-jus,代码行数:24,代码来源:ProcessController.java


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