public RoutingAdrController() { masterData.addListener( new ListChangeListener<ModelRoutingData>() { @Override public void onChanged(ListChangeListener.Change<? extends ModelRoutingData> change) { updateFilteredData(auxFilterData, auxFilterField); } }); }
public void init() { pieChart = new PieChart(pieChartData); chartPane.getChildren().add(pieChart); AnchorPane.setBottomAnchor(pieChart, 0.0); AnchorPane.setLeftAnchor(pieChart, 0.0); AnchorPane.setTopAnchor(pieChart, 45.0); AnchorPane.setRightAnchor(pieChart, 0.0); autoRefreshCheckBox.setSelected(lastAutoRefresh); observableList.addListener(this); }
private void initContentArea() { contentArea = new BorderPane(); AnchorPane p = new AnchorPane(); AnchorPane.setLeftAnchor(contentArea, 0.0); AnchorPane.setRightAnchor(contentArea, 0.0); AnchorPane.setTopAnchor(contentArea, 0.0); AnchorPane.setBottomAnchor(contentArea, 0.0); p.getChildren().add(contentArea); FlingPane flingPanel = new FlingPane(); flingPanel.setFlingDirection(FlingDirection.HORIZONTAL); AnchorPane.setLeftAnchor(flingPanel, 0.0); AnchorPane.setRightAnchor(flingPanel, 0.0); AnchorPane.setTopAnchor(flingPanel, 0.0); final HBox itemsPanel = new HBox(); itemsPanel.getStyleClass().add("advanced-tab-item-panel"); flingPanel.setContent(itemsPanel); items.addListener( new ListChangeListener<AdvancedStackItem>() { @Override public void onChanged( javafx.collections.ListChangeListener.Change<? extends AdvancedStackItem> c) { while (c.next()) { if (c.wasPermutated()) { } else { if (c.wasRemoved()) {} if (c.wasAdded()) { for (AdvancedStackItem i : c.getAddedSubList()) { Label l = new Label(null, new ImageView(i.getIconDescriptorProperty().getImage())); itemsPanel.getChildren().add(l); l.getStyleClass().add("advanced-tab-item"); EventHandler<MouseEvent> h = new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.isStillSincePress()) {} } }; itemsPanel.setOnMouseClicked(h); } } } } } }); p.getChildren().add(flingPanel); container.setCenter(p); }
public MarketDataDolarController() { items = ""; masterData.addListener( new ListChangeListener<ModelMarketData>() { @Override public void onChanged(ListChangeListener.Change<? extends ModelMarketData> change) { updateFilteredData(auxFilterData, auxFilterField); } }); }
@Test public void observableList() throws Exception { ObservableList<String> source = FXCollections.observableArrayList(); source.addAll("alpha", "beta"); ObservableList<String> dest = ObservableMirrors.mirrorList(source, gate); Queue<ListChangeListener.Change<? extends String>> changes = new LinkedList<>(); dest.addListener(changes::add); // Expect a single change with two added items. source.addAll("gamma", "delta"); assertEquals(1, gate.getTaskQueueSize()); gate.waitAndRun(); ListChangeListener.Change<? extends String> change = changes.poll(); change.next(); assertTrue(change.wasAdded()); assertEquals(2, change.getAddedSize()); assertEquals(ImmutableList.of("gamma", "delta"), change.getAddedSubList()); // Expect four queued changes with coherent/correct deltas unaffected by later changes to the // src list. source.remove(3); // remove delta source.add("phi"); source.remove(3); // remove phi source.add("epsilon"); assertEquals(4, gate.getTaskQueueSize()); gate.waitAndRun(); gate.waitAndRun(); change = changes.poll(); change.next(); assertTrue(change.wasRemoved()); assertEquals(1, change.getRemovedSize()); assertEquals("delta", change.getRemoved().get(0)); change = changes.poll(); change.next(); assertTrue(change.wasAdded()); assertEquals("phi", change.getAddedSubList().get(0)); gate.waitAndRun(); changes.poll(); gate.waitAndRun(); changes.poll(); // Expect a set on the source list to show up as a replace event on the dest list. source.set(0, "zero"); gate.waitAndRun(); change = changes.poll(); change.next(); assertTrue(change.toString(), change.wasReplaced()); assertEquals(0, change.getFrom()); assertEquals(1, change.getTo()); assertEquals("zero", change.getAddedSubList().get(0)); }
static <E> Subscription observeQuasiChanges( ObservableList<? extends E> list, QuasiChangeObserver<? super E> observer) { if (list instanceof LiveList) { LiveList<? extends E> lst = (LiveList<? extends E>) list; return lst.observeQuasiChanges(observer); } else { ListChangeListener<E> listener = ch -> { QuasiListChange<? extends E> change = QuasiListChange.from(ch); observer.onChange(change); }; list.addListener(listener); return () -> list.removeListener(listener); } }
public VitalModelImpl(DeviceListModel deviceListModel, ObservableList<NumericFx> numericList) { this.deviceListModel = deviceListModel; this.numericList = numericList; numericList.addListener( new OnListChange<>((fx) -> addNumeric(fx), null, (fx) -> removeNumeric(fx))); numericList.forEach((fx) -> addNumeric(fx)); this.elementObserver = new ElementObserver<Vital>( extractor, new Callback<Vital, InvalidationListener>() { @Override public InvalidationListener call(final Vital e) { return new InvalidationListener() { @Override public void invalidated(Observable observable) { beginChange(); int i = 0; final int size = size(); for (; i < size; ++i) { if (get(i) == e) { nextUpdate(i); } } endChange(); } }; } }, this); addListener( new ListChangeListener<Vital>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Vital> c) { updateState(); } }); }
// function adds a listner to todoListView's selected item so that the user selected todo list can // be tracked and // completeTaskListView and incompleteTaskListView can be updated with selected todo list's // corresponding tasks private void setSelectedToDoListListener() { ObservableList<ToDoList> selectedToDoListTask = todoListView.getSelectionModel().getSelectedItems(); // listener to monitor change in selected To Do list selectedToDoListTask.addListener( (Observable e) -> { ToDoList selectedToDo = todoListView.getSelectionModel().getSelectedItem(); // if an item is selected if (selectedToDo != null) { if (toDoListTasksInfoVBox.disabledProperty().get()) { toDoListTasksInfoVBox.disableProperty().set(false); } // set incompleteTaskListView to selected item's incomplete task list incompleteTaskListView.itemsProperty().setValue(selectedToDo.getIncompleteTaskList()); // set completeTaskListView to selected item's complete task list completeTaskListView.itemsProperty().setValue(selectedToDo.getCompleteTaskList()); incompleteTaskListView.requestFocus(); incompleteTaskListView.getSelectionModel().clearSelection(); } else { // if no item is selected incompleteTaskListView.setItems(null); completeTaskListView.setItems(null); toDoListTasksInfoVBox.disableProperty().set(true); taskInfoVBox.disableProperty().set(true); } }); }
private void onSelectDispute(Dispute dispute) { if (dispute == null) { if (root.getChildren().size() > 1) root.getChildren().remove(1); selectedDispute = null; } else if (selectedDispute != dispute) { this.selectedDispute = dispute; boolean isTrader = disputeManager.isTrader(dispute); TableGroupHeadline tableGroupHeadline = new TableGroupHeadline(); tableGroupHeadline.setText("Messages"); tableGroupHeadline.prefWidthProperty().bind(root.widthProperty()); AnchorPane.setTopAnchor(tableGroupHeadline, 10d); AnchorPane.setRightAnchor(tableGroupHeadline, 0d); AnchorPane.setBottomAnchor(tableGroupHeadline, 0d); AnchorPane.setLeftAnchor(tableGroupHeadline, 0d); ObservableList<DisputeDirectMessage> list = dispute.getDisputeDirectMessagesAsObservableList(); SortedList<DisputeDirectMessage> sortedList = new SortedList<>(list); sortedList.setComparator((o1, o2) -> o1.getDate().compareTo(o2.getDate())); list.addListener((ListChangeListener<DisputeDirectMessage>) c -> scrollToBottom()); messageListView = new ListView<>(sortedList); messageListView.setId("message-list-view"); messageListView.prefWidthProperty().bind(root.widthProperty()); messageListView.setMinHeight(150); AnchorPane.setTopAnchor(messageListView, 30d); AnchorPane.setRightAnchor(messageListView, 0d); AnchorPane.setLeftAnchor(messageListView, 0d); messagesAnchorPane = new AnchorPane(); messagesAnchorPane.prefWidthProperty().bind(root.widthProperty()); VBox.setVgrow(messagesAnchorPane, Priority.ALWAYS); inputTextArea = new TextArea(); inputTextArea.setPrefHeight(70); inputTextArea.setWrapText(true); Button sendButton = new Button("Send"); sendButton.setDefaultButton(true); sendButton.setOnAction(e -> onSendMessage(inputTextArea.getText(), dispute)); sendButton.setDisable(true); inputTextArea .textProperty() .addListener( (observable, oldValue, newValue) -> { sendButton.setDisable( newValue.length() == 0 && tempAttachments.size() == 0 && dispute.disputeResultProperty().get() == null); }); Button uploadButton = new Button("Add attachments"); uploadButton.setOnAction(e -> onRequestUpload()); sendMsgInfoLabel = new Label(); sendMsgInfoLabel.setVisible(false); sendMsgInfoLabel.setManaged(false); sendMsgInfoLabel.setPadding(new Insets(5, 0, 0, 0)); sendMsgProgressIndicator = new ProgressIndicator(0); sendMsgProgressIndicator.setPrefHeight(24); sendMsgProgressIndicator.setPrefWidth(24); sendMsgProgressIndicator.setVisible(false); sendMsgProgressIndicator.setManaged(false); dispute .isClosedProperty() .addListener( (observable, oldValue, newValue) -> { messagesInputBox.setVisible(!newValue); messagesInputBox.setManaged(!newValue); AnchorPane.setBottomAnchor(messageListView, newValue ? 0d : 120d); }); if (!dispute.isClosed()) { HBox buttonBox = new HBox(); buttonBox.setSpacing(10); buttonBox .getChildren() .addAll(sendButton, uploadButton, sendMsgProgressIndicator, sendMsgInfoLabel); if (!isTrader) { Button closeDisputeButton = new Button("Close ticket"); closeDisputeButton.setOnAction(e -> onCloseDispute(dispute)); closeDisputeButton.setDefaultButton(true); Pane spacer = new Pane(); HBox.setHgrow(spacer, Priority.ALWAYS); buttonBox.getChildren().addAll(spacer, closeDisputeButton); } messagesInputBox = new VBox(); messagesInputBox.setSpacing(10); messagesInputBox.getChildren().addAll(inputTextArea, buttonBox); VBox.setVgrow(buttonBox, Priority.ALWAYS); AnchorPane.setRightAnchor(messagesInputBox, 0d); AnchorPane.setBottomAnchor(messagesInputBox, 5d); AnchorPane.setLeftAnchor(messagesInputBox, 0d); AnchorPane.setBottomAnchor(messageListView, 120d); messagesAnchorPane .getChildren() .addAll(tableGroupHeadline, messageListView, messagesInputBox); } else { AnchorPane.setBottomAnchor(messageListView, 0d); messagesAnchorPane.getChildren().addAll(tableGroupHeadline, messageListView); } messageListView.setCellFactory( new Callback<ListView<DisputeDirectMessage>, ListCell<DisputeDirectMessage>>() { @Override public ListCell<DisputeDirectMessage> call(ListView<DisputeDirectMessage> list) { return new ListCell<DisputeDirectMessage>() { final Pane bg = new Pane(); final ImageView arrow = new ImageView(); final Label headerLabel = new Label(); final Label messageLabel = new Label(); final HBox attachmentsBox = new HBox(); final AnchorPane messageAnchorPane = new AnchorPane(); final Label statusIcon = new Label(); final double arrowWidth = 15d; final double attachmentsBoxHeight = 20d; final double border = 10d; final double bottomBorder = 25d; final double padding = border + 10d; { bg.setMinHeight(30); messageLabel.setWrapText(true); headerLabel.setTextAlignment(TextAlignment.CENTER); attachmentsBox.setSpacing(5); statusIcon.setStyle("-fx-font-size: 10;"); messageAnchorPane .getChildren() .addAll(bg, arrow, headerLabel, messageLabel, attachmentsBox, statusIcon); } @Override public void updateItem(final DisputeDirectMessage item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { /* messageAnchorPane.prefWidthProperty().bind(EasyBind.map(messageListView.widthProperty(), w -> (double) w - padding - GUIUtil.getScrollbarWidth(messageListView)));*/ if (!messageAnchorPane.prefWidthProperty().isBound()) messageAnchorPane .prefWidthProperty() .bind( messageListView .widthProperty() .subtract(padding + GUIUtil.getScrollbarWidth(messageListView))); AnchorPane.setTopAnchor(bg, 15d); AnchorPane.setBottomAnchor(bg, bottomBorder); AnchorPane.setTopAnchor(headerLabel, 0d); AnchorPane.setBottomAnchor(arrow, bottomBorder + 5d); AnchorPane.setTopAnchor(messageLabel, 25d); AnchorPane.setBottomAnchor(attachmentsBox, bottomBorder + 10); boolean senderIsTrader = item.isSenderIsTrader(); boolean isMyMsg = isTrader ? senderIsTrader : !senderIsTrader; arrow.setVisible(!item.isSystemMessage()); arrow.setManaged(!item.isSystemMessage()); statusIcon.setVisible(false); if (item.isSystemMessage()) { headerLabel.setStyle("-fx-text-fill: -bs-green; -fx-font-size: 11;"); bg.setId("message-bubble-green"); messageLabel.setStyle("-fx-text-fill: white;"); } else if (isMyMsg) { headerLabel.setStyle("-fx-text-fill: -fx-accent; -fx-font-size: 11;"); bg.setId("message-bubble-blue"); messageLabel.setStyle("-fx-text-fill: white;"); if (isTrader) arrow.setId("bubble_arrow_blue_left"); else arrow.setId("bubble_arrow_blue_right"); sendMsgProgressIndicator .progressProperty() .addListener( (observable, oldValue, newValue) -> { if ((double) oldValue == -1 && (double) newValue == 0) { if (item.arrivedProperty().get()) showArrivedIcon(); else if (item.storedInMailboxProperty().get()) showMailboxIcon(); } }); if (item.arrivedProperty().get()) showArrivedIcon(); else if (item.storedInMailboxProperty().get()) showMailboxIcon(); // TODO show that icon on error /*else if (sendMsgProgressIndicator.getProgress() == 0) showNotArrivedIcon();*/ } else { headerLabel.setStyle("-fx-text-fill: -bs-light-grey; -fx-font-size: 11;"); bg.setId("message-bubble-grey"); messageLabel.setStyle("-fx-text-fill: black;"); if (isTrader) arrow.setId("bubble_arrow_grey_right"); else arrow.setId("bubble_arrow_grey_left"); } if (item.isSystemMessage()) { AnchorPane.setLeftAnchor(headerLabel, padding); AnchorPane.setRightAnchor(headerLabel, padding); AnchorPane.setLeftAnchor(bg, border); AnchorPane.setRightAnchor(bg, border); AnchorPane.setLeftAnchor(messageLabel, padding); AnchorPane.setRightAnchor(messageLabel, padding); AnchorPane.setLeftAnchor(attachmentsBox, padding); AnchorPane.setRightAnchor(attachmentsBox, padding); } else if (senderIsTrader) { AnchorPane.setLeftAnchor(headerLabel, padding + arrowWidth); AnchorPane.setLeftAnchor(bg, border + arrowWidth); AnchorPane.setRightAnchor(bg, border); AnchorPane.setLeftAnchor(arrow, border); AnchorPane.setLeftAnchor(messageLabel, padding + arrowWidth); AnchorPane.setRightAnchor(messageLabel, padding); AnchorPane.setLeftAnchor(attachmentsBox, padding + arrowWidth); AnchorPane.setRightAnchor(attachmentsBox, padding); AnchorPane.setRightAnchor(statusIcon, padding); } else { AnchorPane.setRightAnchor(headerLabel, padding + arrowWidth); AnchorPane.setLeftAnchor(bg, border); AnchorPane.setRightAnchor(bg, border + arrowWidth); AnchorPane.setRightAnchor(arrow, border); AnchorPane.setLeftAnchor(messageLabel, padding); AnchorPane.setRightAnchor(messageLabel, padding + arrowWidth); AnchorPane.setLeftAnchor(attachmentsBox, padding); AnchorPane.setRightAnchor(attachmentsBox, padding + arrowWidth); AnchorPane.setLeftAnchor(statusIcon, padding); } AnchorPane.setBottomAnchor(statusIcon, 7d); headerLabel.setText(formatter.formatDateTime(item.getDate())); messageLabel.setText(item.getMessage()); if (item.getAttachments().size() > 0) { AnchorPane.setBottomAnchor( messageLabel, bottomBorder + attachmentsBoxHeight + 10); attachmentsBox .getChildren() .add( new Label("Attachments: ") { { setPadding(new Insets(0, 0, 3, 0)); if (isMyMsg) setStyle("-fx-text-fill: white;"); else setStyle("-fx-text-fill: black;"); } }); item.getAttachments() .stream() .forEach( attachment -> { final Label icon = new Label(); setPadding(new Insets(0, 0, 3, 0)); if (isMyMsg) icon.getStyleClass().add("attachment-icon"); else icon.getStyleClass().add("attachment-icon-black"); AwesomeDude.setIcon(icon, AwesomeIcon.FILE_TEXT); icon.setPadding(new Insets(-2, 0, 0, 0)); icon.setTooltip(new Tooltip(attachment.getFileName())); icon.setOnMouseClicked(event -> onOpenAttachment(attachment)); attachmentsBox.getChildren().add(icon); }); } else { attachmentsBox.getChildren().clear(); AnchorPane.setBottomAnchor(messageLabel, bottomBorder + 10); } // TODO There are still some cell rendering issues on updates setGraphic(messageAnchorPane); } else { messageAnchorPane.prefWidthProperty().unbind(); AnchorPane.clearConstraints(bg); AnchorPane.clearConstraints(headerLabel); AnchorPane.clearConstraints(arrow); AnchorPane.clearConstraints(messageLabel); AnchorPane.clearConstraints(statusIcon); AnchorPane.clearConstraints(attachmentsBox); setGraphic(null); } } /* private void showNotArrivedIcon() { statusIcon.setVisible(true); AwesomeDude.setIcon(statusIcon, AwesomeIcon.WARNING_SIGN, "14"); Tooltip.install(statusIcon, new Tooltip("Message did not arrive. Please try to send again.")); statusIcon.setTextFill(Paint.valueOf("#dd0000")); }*/ private void showMailboxIcon() { statusIcon.setVisible(true); AwesomeDude.setIcon(statusIcon, AwesomeIcon.ENVELOPE_ALT, "14"); Tooltip.install(statusIcon, new Tooltip("Message saved in receivers mailbox")); statusIcon.setTextFill(Paint.valueOf("#0f87c3")); } private void showArrivedIcon() { statusIcon.setVisible(true); AwesomeDude.setIcon(statusIcon, AwesomeIcon.OK, "14"); Tooltip.install(statusIcon, new Tooltip("Message arrived at receiver")); statusIcon.setTextFill(Paint.valueOf("#0f87c3")); } }; } }); if (root.getChildren().size() > 1) root.getChildren().remove(1); root.getChildren().add(1, messagesAnchorPane); scrollToBottom(); } }
void setApp(CoordinatingClass application1) { this.application = application1; allMembers = FXCollections.observableArrayList(application.getMembers().values()); allMembersList.setItems(allMembers); allMembers.addListener( new ListChangeListener<Member>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Member> c) { allMembersList.setItems(allMembers); } }); currentMembers = FXCollections.observableArrayList(); usableFormations = FXCollections.observableArrayList(); currentMembers.addListener( new ListChangeListener<Member>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Member> c) { currentMembersList.setItems(currentMembers); usableFormations = FXCollections.observableArrayList( application.getUsableFormations(application.createGroup(currentMembers))); usableFormationList.setItems(usableFormations); } }); allFormations = FXCollections.observableArrayList(application.getFormations().values()); formationList.setItems(allFormations); allFormations.addListener( new ListChangeListener<Formation>() { @Override public void onChanged( javafx.collections.ListChangeListener.Change<? extends Formation> c) { formationList.setItems(allFormations); usableFormations = FXCollections.observableArrayList( application.getUsableFormations(application.createGroup(currentMembers))); usableFormationList.setItems(usableFormations); } }); formComposition = FXCollections.observableArrayList(); formComposition.addListener( new ListChangeListener<String>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends String> c) { currentFormationComposition.setItems(formComposition); } }); allMechs = FXCollections.observableArrayList(application.getMechs().values()); mechList.setItems(allMechs); allMechs.addListener( new ListChangeListener<Mech>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Mech> c) { mechList.setItems(allMechs); } }); currentVarients = FXCollections.observableArrayList(application.getMechs().get("JR7-F").getVarients()); varientList.setItems(currentVarients); pollLists(); }
@Override public void initialize(URL url, ResourceBundle rb) { TableColumnCodigo.setCellValueFactory(cellData -> cellData.getValue().CodigoProperty()); TableColumnNome.setCellValueFactory(cellData -> cellData.getValue().NomeProperty()); TableColumnServico.setCellValueFactory(cellData -> cellData.getValue().ServicoProperty()); // TableColumnVencimento.setCellValueFactory(cellData -> cellData.getValue().StatusProperty()); TableColumnValor.setCellValueFactory(cellData -> cellData.getValue().ValorProperty()); TableColumnSituacao.setCellValueFactory(cellData -> cellData.getValue().SituacaoProperty()); try { carregaTabela(); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if (itens.size() > 0) TableViewBuscar.setItems(itens); itens.addListener( new ListChangeListener<BuscaCadastroContaReceberFiltro>() { @Override public void onChanged( javafx.collections.ListChangeListener.Change< ? extends BuscaCadastroContaReceberFiltro> arg0) { TextFieldTotal.setText(Integer.toString(TableViewBuscar.getItems().size())); } }); FilteredList<BuscaCadastroContaReceberFiltro> filteredData = new FilteredList<>(itens, p -> true); TextFieldFiltro.textProperty() .addListener( (observable, oldValue, newValue) -> { TextFieldTotal.setText(Integer.toString(TableViewBuscar.getItems().size())); filteredData.setPredicate( person -> { if (newValue == null || newValue.isEmpty()) { return true; } String lowerCaseFilter = newValue.toLowerCase(); if (person.getNome().toLowerCase().indexOf(lowerCaseFilter) != -1) { return true; } return false; }); }); SortedList<BuscaCadastroContaReceberFiltro> sortedData = new SortedList<>(filteredData); sortedData.comparatorProperty().bind(TableViewBuscar.comparatorProperty()); TableViewBuscar.setItems(sortedData); ButtonOk.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (TableViewBuscar.getSelectionModel().getSelectedItems().size() < 1) { Alerta alerta = new Alerta("Busca", "Conta não selecionada!"); alerta.Alertar(BuscaCadastroContaReceberView.myStage); return; } try { // if (opt == 0){ CadastroContasReceberController.setcontareceber( ControllerContaReceber.BuscaContaReceber( TableViewBuscar.getSelectionModel().getSelectedItems().get(0).getCodigo())); CadastroContasReceberController.tela.carregaInfo(); // }else if(opt == 1){ // CadastroMatriculaController.setaluno(ControllerAluno.BuscaAluno(TableViewBuscar.getSelectionModel().getSelectedItems().get(0).getCodigo())); // CadastroMatriculaController.tela.carregaInfoAluno(); // } } catch (ClassNotFoundException | SQLException e1) { e1.printStackTrace(); } BuscaCadastroContaReceberView.myStage.close(); } }); ButtonCancelar.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { BuscaCadastroContaReceberView.myStage.close(); } }); }
private CustomerController() { menuItems = ManagerController.getInstance().getMenuItems(); orderItems = FXCollections.observableArrayList(); orderItems.addListener( (ListChangeListener) change -> checkoutTab.setDisable(orderItems.isEmpty())); }
public VNodeImpl(VFlowModel flow) { this.flow = flow; setWidth(200); setHeight(150); setTitle("Node"); setValueObject(new DefaultValueObject(this)); valueObjectProperty.addListener( new ChangeListener<ValueObject>() { @Override public void changed( ObservableValue<? extends ValueObject> ov, ValueObject t, ValueObject t1) { if (t1 != null) { t1.setParent(VNodeImpl.this); } } }); connectors.addListener( new ListChangeListener<Connector>() { @Override public void onChanged(Change<? extends Connector> change) { while (change.next()) { if (change.wasPermutated()) { for (int i = change.getFrom(); i < change.getTo(); ++i) { // permutate } } else if (change.wasUpdated()) { // update item } else { if (change.wasRemoved()) { for (Connector connector : change.getRemoved()) { if (connector.isInput()) { inputs.remove(connector); } if (connector.isOutput()) { outputs.remove(connector); } connectorIdGenerator.getIds().remove(connector.getId()); } } else if (change.wasAdded()) { for (Connector connector : change.getAddedSubList()) { if (connector.isInput()) { inputs.add(connector); // System.out.println("added input:" + // unmodifiableInputs.size()); } if (connector.isOutput()) { outputs.add(connector); // System.out.println("added output:" + // unmodifiableOutputs.size()); } connector.setLocalId(connectorIdGenerator.newId()); } } } } } }); // // outputs.addListener(new ListChangeListener<Connector<FlowNode>>() { // @Override // public void onChanged(Change<? extends Connector<FlowNode>> change) { // throw new UnsupportedOperationException("Not supported yet."); // } // }); }