Java 类javafx.collections.ListChangeListener 实例源码
项目:easyMvvmFx
文件:CompositeCommand.java
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();
}
}
});
}
项目:drd
文件:ItemRegistry.java
/**
* 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);
}
}
项目:hygene
文件:SimpleBookmarkStore.java
/**
* 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);
}
});
}
项目:voogasalad-ltub
文件:LevelEditorHolder.java
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();
}
});
}
项目:marathonv5
文件:CollatedTreeItem.java
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());
}
}
});
}
项目:stvs
文件:HybridSpecification.java
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());
}
}
}
项目:JavaFX-EX
文件:RecentFileMenuSupport.java
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();
}
项目:H-Uppaal
文件:EdgeController.java
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;
}
}
}
}
}
});
}
项目:H-Uppaal
文件:LocationController.java
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;
}
}
}
}
}
});
}
项目:qgu
文件:QGUViewController.java
@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
}
项目:qgu
文件:TaskTableView.java
/*********************************************
* *
* 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
}
项目:creacoinj
文件:NotificationBarPane.java
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();
});
}
项目:shuffleboard
文件:DashboardTabPane.java
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);
});
}
}
}
项目:shuffleboard
文件:WidgetGalleryController.java
@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();
});
}
}
}
});
}
项目:boutique-de-jus
文件:ProcessController.java
@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());
}
项目:redisfx
文件:FormDialog.java
private GridPane getContentPane() {
contentPane.setHgap(10);
contentPane.setVgap(10);
// top-align all child nodes
contentPane.getChildren().addListener((ListChangeListener<Node>) c -> {
while (c.next()) {
if (c.wasAdded()) {
c.getAddedSubList().forEach(node ->
GridPane.setValignment(node, VPos.TOP));
}
}
});
ColumnConstraints titleCC = new ColumnConstraints();
titleCC.setPrefWidth(100);
ColumnConstraints valueCC = new ColumnConstraints();
valueCC.setFillWidth(true);
valueCC.setHgrow(Priority.ALWAYS);
contentPane.getColumnConstraints().addAll(titleCC, valueCC);
VBox.setVgrow(contentPane, Priority.ALWAYS);
return contentPane;
}
项目:drd
文件:ObservableMergers.java
@SafeVarargs
public static <T> void mergeList(ObservableList<T> into, ObservableList<T>... lists) {
final ObservableList<T> list = into;
for (ObservableList<T> l : lists) {
list.addAll(l);
l.addListener((ListChangeListener<T>) c -> {
while (c.next()) {
if (c.wasAdded()) {
list.addAll(c.getAddedSubList());
}
if (c.wasRemoved()) {
list.removeAll(c.getRemoved());
}
}
});
}
}
项目:legendary-guide
文件:NotificationBarPane.java
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();
});
}
项目:dragdropfx
文件:DragDropFX.java
@Override
public Void call(Object p) {
if(isIgnored(p)){return null;}
final TableView<?> t = (TableView<?>) p;
DnDPrepare.tableColumns(DragDropFX.this, t.getColumns());
t.getColumns().addListener(new ListChangeListener<TableColumn<?,?>>(){
@Override
public void onChanged(
javafx.collections.ListChangeListener.Change<? extends TableColumn<?, ?>> arg0) {
while(arg0.next()){
if(arg0.wasAdded()){
DnDPrepare.tableColumns(DragDropFX.this, arg0.getAddedSubList());
}
}
}
});
return null;
}
项目:H-Uppaal
文件:MessageCollectionPresentation.java
private void initializeErrorsListener() {
final VBox children = (VBox) lookup("#children");
final Map<CodeAnalysis.Message, MessagePresentation> messageMessagePresentationMap = new HashMap<>();
final Consumer<CodeAnalysis.Message> addMessage = (message) -> {
final MessagePresentation messagePresentation = new MessagePresentation(message);
messageMessagePresentationMap.put(message, messagePresentation);
children.getChildren().add(messagePresentation);
};
messages.forEach(addMessage);
messages.addListener(new ListChangeListener<CodeAnalysis.Message>() {
@Override
public void onChanged(final Change<? extends CodeAnalysis.Message> c) {
while (c.next()) {
c.getAddedSubList().forEach(addMessage::accept);
c.getRemoved().forEach(message -> {
children.getChildren().remove(messageMessagePresentationMap.get(message));
messageMessagePresentationMap.remove(message);
});
}
}
});
}
项目:H-Uppaal
文件:SubComponentController.java
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 SubComponent) {
if (nearable.equals(getSubComponent())) {
SelectHelper.addToSelection(SubComponentController.this);
break;
}
}
}
}
}
});
}
项目:Recordian
文件:NewLogEntryTabController.java
/**
* Sets the items for all combo boxes in newLogEntryTab view
*/
private void setAllComboBoxItems(){
Consumer<ComboBox<String>> disableComboBoxIfEmpty = (comboBox) -> {
if (comboBox.getItems().isEmpty()) {
comboBox.setDisable(true);
} else {comboBox.setDisable(false);}
};
// Establish process for populating a combo box
BiConsumer<ComboBox<String>, ObservableList<String>> setComboBoxItems = (comboBox, observableList) -> {
observableList.addListener((ListChangeListener<String>) c -> {
comboBox.setItems(observableList);
disableComboBoxIfEmpty.accept(comboBox);
});
comboBox.setItems(observableList);
disableComboBoxIfEmpty.accept(comboBox);
};
// Set company combo box items
sortedCompanyNames = new SortedList<>(companyNames, String.CASE_INSENSITIVE_ORDER);
setComboBoxItems.accept(companyComboBox, sortedCompanyNames);
// Set location combo box items
sortedLocationNames = new SortedList<>(locationNames, String.CASE_INSENSITIVE_ORDER);
setComboBoxItems.accept(locationComboBox, sortedLocationNames);
// Set supervisor combo box items
sortedSupervisorDisplayNames = new SortedList<>(supervisorDisplayNames, String.CASE_INSENSITIVE_ORDER);
setComboBoxItems.accept(supervisorComboBox, sortedSupervisorDisplayNames);
}
项目:hygene
文件:GraphVisualizer.java
/**
* Create a new {@link GraphVisualizer} instance.
* <p>
* The passed {@link GraphStore} is observed by this class. If the {@link GraphStore}
* {@link org.dnacronym.hygene.parser.GfaFile} is updated, it will prompt a redraw. Changing the properties of this
* class will also prompt a redraw if the {@link org.dnacronym.hygene.parser.GfaFile} in {@link GraphStore} is not
* {@code null}.
*
* @param graphDimensionsCalculator {@link GraphDimensionsCalculator} used to calculate node positions
* @param query the {@link Query} used to get the currently queried nodes
* @param bookmarkStore the {@link BookmarkStore} used to draw bookmark indications
* @param graphAnnotation the {@link GraphAnnotation} used to draw annotations
*/
@Inject
public GraphVisualizer(final GraphDimensionsCalculator graphDimensionsCalculator, final Query query,
final BookmarkStore bookmarkStore, final GraphAnnotation graphAnnotation,
final GraphStore graphStore) {
HygeneEventBus.getInstance().register(this);
this.graphDimensionsCalculator = graphDimensionsCalculator;
this.query = query;
this.bookmarkStore = bookmarkStore;
this.colorRoulette = new ColorRoulette();
this.graphAnnotation = graphAnnotation;
this.graphStore = graphStore;
selectedSegmentProperty = new SimpleObjectProperty<>();
selectedSegmentProperty.addListener((observable, oldValue, newValue) -> draw());
hoveredSegmentProperty = new SimpleObjectProperty<>();
hoveredSegmentProperty.addListener((observable, oldValue, newValue) -> draw());
genomePaths = FXCollections.observableArrayList(new HashSet<>());
selectedGenomePaths = FXCollections.observableHashMap();
selectedGenomePaths.addListener((MapChangeListener<String, Color>) change -> draw());
edgeColorProperty = new SimpleObjectProperty<>(DEFAULT_EDGE_COLOR);
nodeHeightProperty = new SimpleDoubleProperty(DEFAULT_NODE_HEIGHT);
graphDimensionsCalculator.getNodeHeightProperty().bind(nodeHeightProperty);
edgeColorProperty.addListener((observable, oldValue, newValue) -> draw());
nodeHeightProperty.addListener((observable, oldValue, newValue) -> draw());
Node.setColorScheme(BasicSettingsViewController.NODE_COLOR_SCHEMES.get(0).getValue());
displayLaneBordersProperty = new SimpleBooleanProperty();
displayLaneBordersProperty.addListener((observable, oldValue, newValue) -> draw());
graphDimensionsCalculator.getGraphProperty()
.addListener((observable, oldValue, newValue) -> setGraph(newValue));
graphDimensionsCalculator.getObservableQueryNodes()
.addListener((ListChangeListener<Node>) change -> draw());
query.getQueriedNodes().addListener((ListChangeListener<Integer>) observable -> draw());
segmentDrawingToolkit = new SegmentDrawingToolkit();
snpDrawingToolkit = new SnpDrawingToolkit();
edgeDrawingToolkit = new EdgeDrawingToolkit();
graphAnnotationVisualizer = new GraphAnnotationVisualizer(graphDimensionsCalculator);
graphAnnotation.indexBuiltProperty().addListener((observable, oldValue, newValue) -> draw());
nodeHeightProperty.addListener((observable, oldValue, newValue) -> {
segmentDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
snpDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
draw();
});
segmentDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
snpDrawingToolkit.setNodeHeight(nodeHeightProperty.get());
}
项目:SunburstChart
文件:TreeNode.java
private void init() {
// Add this node to parents children
if (null != parent) { parent.getChildren().add(this); }
children.addListener((ListChangeListener<TreeNode>) c -> {
while (c.next()) {
if (c.wasRemoved()) { c.getRemoved().forEach(removedItem -> removedItem.removeAllTreeNodeEventListeners()); }
}
getTreeRoot().fireTreeNodeEvent(CHILDREN_CHANGED);
});
}
项目:marathonv5
文件:NavigatorPanel.java
public VLToolBar createToolbar(ResourceView resourceView) {
VLToolBar toolbar = new VLToolBar();
Button expandAll = FXUIUtils.createButton("expandAll", "Expand the resource tree");
expandAll.setOnAction((event) -> resourceView.expandAll());
toolbar.add(expandAll);
Button collapseAll = FXUIUtils.createButton("collapseAll", "Collapse the resource tree");
collapseAll.setOnAction((event) -> resourceView.collapseAll());
toolbar.add(collapseAll);
toolbar.add(new Separator(javafx.geometry.Orientation.VERTICAL));
Button cut = FXUIUtils.createButton("cut", "Cut the selected content to clipboard");
cut.setOnAction((event) -> resourceView.cut());
toolbar.add(cut);
Button copy = FXUIUtils.createButton("copy", "Copy the selected content to clipboard");
copy.setOnAction((event) -> resourceView.copy());
toolbar.add(copy);
Button paste = FXUIUtils.createButton("paste", "Paste clipboard contents");
paste.setOnAction((event) -> resourceView.paste());
toolbar.add(paste);
ListChangeListener<? super TreeItem<Resource>> listener = new ListChangeListener<TreeItem<Resource>>() {
@Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends TreeItem<Resource>> c) {
cut.setDisable(resourceView.getSelectionModel().getSelectedItems().size() <= 0);
copy.setDisable(resourceView.getSelectionModel().getSelectedItems().size() <= 0);
paste.setDisable(resourceView.getSelectionModel().getSelectedItems().size() != 1);
}
};
resourceView.getSelectionModel().getSelectedItems().addListener(listener);
return toolbar;
}
项目:fx-animation-editor
文件:NodeChangeListener.java
private void onNodesChanged(ListChangeListener.Change<? extends NodeModel> change) {
while (change.next()) {
if (change.wasAdded()) {
change.getAddedSubList().forEach(this::onNodeAdded);
}
if (change.wasRemoved()) {
change.getRemoved().forEach(this::onNodeRemoved);
}
}
}
项目:TechnicalAnalysisTool
文件:MainChartCanvas.java
@Override
public void onChanged(ListChangeListener.Change<? extends OHLC> c) {
while(c.next()) {
if (c.wasAdded()) {
draw();
}
}
}
项目:marathonv5
文件:JavaFxRecorderHook.java
public static void premain(final String args, Instrumentation instrumentation) throws Exception {
instrumentation.addTransformer(new MenuItemTransformer());
instrumentation.addTransformer(new FileChooserTransformer());
logger.info("JavaVersion: " + System.getProperty("java.version"));
final int port;
if (args != null && args.trim().length() > 0) {
port = Integer.parseInt(args.trim());
} else {
throw new Exception("Port number not specified");
}
windowTitle = System.getProperty("start.window.title", "");
ObservableList<Stage> stages = StageHelper.getStages();
stages.addListener(new ListChangeListener<Stage>() {
boolean done = false;
@Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Stage> c) {
if (done) {
return;
}
if (!"".equals(windowTitle)) {
logger.warning("WindowTitle is not supported yet... Ignoring it.");
}
c.next();
if (c.wasAdded()) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override public Object run() {
return new JavaFxRecorderHook(port);
}
});
done = true;
}
}
});
}
项目:easyMvvmFx
文件:ModelWrapper.java
public FxListPropertyField(ListPropertyAccessor<M, E> accessor, Supplier<ListProperty<E>> propertySupplier, List<E> defaultValue) {
this.accessor = accessor;
this.defaultValue = defaultValue;
this.targetProperty = propertySupplier.get();
this.targetProperty.setValue(FXCollections.observableArrayList());
this.targetProperty.addListener((ListChangeListener<E>) change -> ModelWrapper.this.propertyWasChanged());
}
项目:easyMvvmFx
文件:ModelWrapper.java
public BeanListPropertyField(ListGetter<M, E> getter, ListSetter<M, E> setter, Supplier<ListProperty<E>> propertySupplier, List<E> defaultValue) {
this.defaultValue = defaultValue;
this.getter = getter;
this.setter = setter;
this.targetProperty = propertySupplier.get();
this.targetProperty.setValue(FXCollections.observableArrayList());
this.targetProperty.addListener((ListChangeListener<E>) change -> propertyWasChanged());
}
项目:easyMvvmFx
文件:ListTransformation.java
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));
}
项目:easyMvvmFx
文件:ListTransformation.java
/**
* Maps an add event of the model list to new elements of the {@link #viewModelList}.
*
* @param listEvent
* to analyze
*/
private void processAddEvent(
ListChangeListener.Change<? extends SourceType> listEvent) {
final List<TargetType> toAdd = new ArrayList<>();
for (int index = listEvent.getFrom(); index < listEvent.getTo(); index++) {
final SourceType item = listEvent.getList().get(index);
toAdd.add(function.apply(item));
}
viewModelList.addAll(listEvent.getFrom(), toAdd);
}
项目:easyMvvmFx
文件:ListTransformation.java
/**
* Maps an update event of the model list to new elements of the {@link #viewModelList}.
*
* @param listEvent
* to process
*/
private void processUpdateEvent(ListChangeListener.Change<? extends SourceType> listEvent) {
for (int i = listEvent.getFrom(); i < listEvent.getTo(); i++) {
SourceType item = listEvent.getList().get(i);
viewModelList.set(i, ListTransformation.this.function.apply(item));
}
}
项目:easyMvvmFx
文件:ListTransformation.java
/**
* Maps an replace event of the model list to new elements of the {@link #viewModelList}.
*
* @param listEvent
* to process
*/
private void processReplaceEvent(
ListChangeListener.Change<? extends SourceType> listEvent, List<TargetType> deletedStaging) {
processRemoveEvent(listEvent, deletedStaging);
processStagingLists(deletedStaging);
processAddEvent(listEvent);
}
项目:easyMvvmFx
文件:ValidationVisualizerBase.java
@Override
public void initVisualization(final ValidationStatus result, final Control control, boolean required) {
if (required) {
applyRequiredVisualization(control, required);
}
applyVisualization(control, result.getHighestMessage(), required);
result.getMessages().addListener((ListChangeListener<ValidationMessage>) c -> {
while (c.next()) {
Platform.runLater(() -> applyVisualization(control, result.getHighestMessage(), required));
}
});
}
项目:fx-animation-editor
文件:TimelineSceneSynchronizer.java
@Inject
public TimelineSceneSynchronizer(TimelineModel timelineModel, SceneModel sceneModel) {
this.timelineModel = timelineModel;
this.sceneModel = sceneModel;
timelineModel.selectedKeyFrameProperty().addListener((v, o, n) -> updateBindings());
timelineModel.getKeyFrames().addListener((ListChangeListener<? super KeyFrameModel>) change -> updateBindings());
}
项目:Planchester
文件:DutyRosterController.java
@FXML
public void initialize() {
staticAgenda = agenda;
staticScrollPane = scrollPane;
getGroupColorsFromCSS();
initializeAppointmentGroupsForEventtypes(); //must be the first initialize-call
initialzeCalendarSettings();
initialzeCalendarView();
agenda.setOnMouseClicked(event -> {
if(event.getTarget().toString().contains("DayBodyPane")) {
resetSideContent();
removeSelection();
}
});
agenda.selectedAppointments().addListener((ListChangeListener<Agenda.Appointment>) c -> {
if(agenda.selectedAppointments().isEmpty()) {
resetSideContent();
return;
}
resetSideContent();
selectedAppointment = agenda.selectedAppointments().get(0);
showDutyDetailView();
});
Permission permission = AccountAdministrationManager.getInstance().getUserPermissions();
if(AccountAdministrationManager.getInstance().getSectionType() != null) {
dutyRosterLabel.setText("Duty Roster: " + AccountAdministrationManager.getInstance().getSectionType());
}
publishDutyRoster.setVisible(permission.isPublishDutyRoster());
}
项目:TechnicalAnalysisTool
文件:OBVCanvas.java
@Override
public void onChanged(ListChangeListener.Change<? extends OHLC> c) {
while(c.next()) {
if (c.wasAdded()) {
draw();
}
}
}
项目:TechnicalAnalysisTool
文件:RSMCanvas.java
@Override
public void onChanged(ListChangeListener.Change<? extends OHLC> c) {
while(c.next()) {
if (c.wasAdded()) {
draw();
}
}
}
项目:javafx-qiniu-tinypng-client
文件:ModelWrapper.java
public FxListPropertyField(ListPropertyAccessor<M, E> accessor, Supplier<ListProperty<E>> propertySupplier, List<E> defaultValue) {
this.accessor = accessor;
this.defaultValue = defaultValue;
this.targetProperty = propertySupplier.get();
this.targetProperty.setValue(FXCollections.observableArrayList());
this.targetProperty.addListener((ListChangeListener<E>) change -> ModelWrapper.this.propertyWasChanged());
}