protected void setRootModel() { SingleResult sr = (SingleResult) controller.getModel(); rootModel = sr.getData(); ((FullTableStructureController) controller).processedElementProperty().addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> { AbstractTableStructure ts = (AbstractTableStructure) ((FullTableStructureController) controller).processedElementProperty().get(); ts.childTree().addListener((ListChangeListener<OperationData>) c -> { structureModelUpdated(); }); structureModelUpdated(); }); }
@Override public void changed(ObservableValue<? extends AbstractViewController> observable, AbstractViewController oldValue, AbstractViewController newValue) { FullTableStructureController c = (FullTableViewController) newValue; AbstractTableStructure ts = (AbstractTableStructure) c.processedElementProperty().get(); ts.childTree().addListener((ListChangeListener<OperationData>) e -> { Platform.runLater(()->structureModelUpdated(ts.childTree())); }); } });
titleContainer.getChildren().clear(); AbstractTableStructure ts = (AbstractTableStructure) ((FullTableStructureController) controller).processedElementProperty().get(); Iterator<OperationData> it = ts.childTree().iterator();
@Override public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) { this.configuration = configuration; this.controller = (AbstractViewController) controller; NodeHelper.loadFXML(getFxmlLocation(), this); filterTextField.managedProperty().bind(filterTextField.visibleProperty()); filterTextField.setVisible(false); filterTextField.setPromptText("Find in table"); if (configuration != null) { NodeHelper.setTitle(title, configuration, (AbstractViewController) controller, true); NodeHelper.styleClassSetAll(title, configuration, "titleStyleClass", "ep-edit-structure-title-label"); NodeHelper.styleClassAddAll(tableHeaderRootPane, configuration, "styleClass"); title.visibleProperty().bind(Bindings.isNotEmpty(title.textProperty())); elementsCountProperty().addListener((ChangeListener<Number>) (observable, oldValue, newValue) -> { if (newValue.intValue() > 0) { itemsCount.textProperty().set(""); } else { itemsCount.textProperty().set(String.format(dynMessageFormat, newValue.intValue())); } }); ((FullTableStructureController) controller).processedElementProperty().addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> { final AbstractTableStructure ts = (AbstractTableStructure) ((FullTableStructureController) controller).processedElementProperty().get(); doLayout(ts); buildFiltering(ts); }); } }
@Override public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) { NodeHelper.styleClassSetAll(this, configuration, "styleClass", "ep-tab-pane-header-wrapper"); titleContainer.getStyleClass().add("ep-tab-pane-header-content-wrapper"); getChildren().add(titleContainer); structureModelUpdated(FXCollections.observableArrayList()); if(((AbstractViewController)controller).getStructureContent()!= null) { FullTableStructureController c = (FullTableStructureController) ((AbstractViewController)controller).getStructureContent().getCurrentEditingTableStructure(); AbstractTableStructure ts = (AbstractTableStructure) c.processedElementProperty().get(); ts.childTree().addListener((ListChangeListener<OperationData>) e -> { Platform.runLater(()->structureModelUpdated(ts.childTree())); }); } else { ((AbstractViewController)controller).getStructureContent() .currentEditingTableStructureProperty() .addListener(new ChangeListener<AbstractViewController>() { @Override public void changed(ObservableValue<? extends AbstractViewController> observable, AbstractViewController oldValue, AbstractViewController newValue) { FullTableStructureController c = (FullTableViewController) newValue; AbstractTableStructure ts = (AbstractTableStructure) c.processedElementProperty().get(); ts.childTree().addListener((ListChangeListener<OperationData>) e -> { Platform.runLater(()->structureModelUpdated(ts.childTree())); }); } }); } }
/** * {@inheritDoc} */ @Override public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) { this.configuration = configuration; this.controller = (AbstractViewController) controller; loadFXML(); NodeHelper.styleClassAddAll(tableHeaderRootPane, configuration, "styleClass"); NodeHelper.setTitle(headerTitle, configuration, (AbstractViewController) controller, true); NodeHelper.styleClassSetAll(headerTitle, configuration, "titleStyleClass", "ep-table-title-label"); NodeHelper.styleClassAddAll(titleContainer, configuration, "titleContainerStyleClass"); filterTextField.managedProperty().bind(filterTextField.visibleProperty()); filterTextField.setPromptText("Find in table"); boolean filtrable = configuration.getBooleanProperty("filtrable", true); filterTextField.setVisible(filtrable); ((FullTableStructureController) controller).processedElementProperty().addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> { AbstractTableStructure ts = (AbstractTableStructure) ((FullTableStructureController) controller).processedElementProperty().get(); if (ts.getToolbar().isPresent()) { Node tb = ts.getToolbar().get(); HBox.setHgrow(tb, Priority.NEVER); actionsContainer.getChildren().add(tb); } }); setRootModel(); headerTitle.managedProperty().bind(headerTitle.visibleProperty()); headerTitle.visibleProperty().bind(Bindings.size(titleContainer.getChildren()).isEqualTo(0)); titleContainer.visibleProperty().bind(Bindings.size(titleContainer.getChildren()).greaterThan(0)); titleContainer.managedProperty().bind(titleContainer.visibleProperty()); }