/** * Constructs a new instance of this class. * * @param layouts a set of layouts this view is allowed to use * @param interactive whether the view allows user interaction * @param areaLayout an AreaLayout providing the base layout of the view area */ public DetailView( Set<Layout<? extends Object, ? extends DetailPanePresentation>> layouts, boolean interactive, AreaLayout areaLayout) { Timeline fadeOutTimeline = new Timeline(new KeyFrame(Duration.seconds(0.3), new KeyValue(opacityProperty(), 0))); Timeline fadeInTimeline = new Timeline(new KeyFrame(Duration.seconds(0.3), new KeyValue(opacityProperty(), 1))); content.addListener( new ChangeListener<MediaNode>() { @Override public void changed( ObservableValue<? extends MediaNode> observable, MediaNode oldValue, MediaNode newValue) { if (fadeOutTimeline.getStatus() != Status.RUNNING) { fadeOutTimeline.playFromStart(); } } }); delayedContent.addListener( new ChangeListener<MediaNode>() { @Override public void changed( ObservableValue<? extends MediaNode> observable, MediaNode oldValue, MediaNode newValue) { fadeInTimeline.playFromStart(); } }); /* * Listeners for media and derivedMedia to update the finalContent property. These are triggered when the content * property changes (as both properties bind to the content property) and may result in the finalContent to change. */ media.addListener(finalContentUpdater); /* * Change listener on finalContent to select an appropriate layout and update the UI. */ finalContent.addListener( new ChangeListener<Object>() { @Override public void changed( ObservableValue<? extends Object> observableValue, Object old, Object current) { @SuppressWarnings("unchecked") Layout<? extends Object, DetailPanePresentation> layout = (Layout<? extends Object, DetailPanePresentation>) (current == null ? null : Layout.findMostSuitableLayout(layouts, current.getClass())); /* * View only needs replacing when layout is a different one. Existing views * will be updated automatically through their binding with the presentation. */ if (layout != null && layout.equals(currentLayout)) { return; } currentLayout = layout; if (currentPresentation != null) { currentPresentation.content.unbindBidirectional(finalContent); currentPresentation = null; } if (currentLayout != null) { currentPresentation = currentLayout.createPresentation(); currentPresentation.setAreaLayout(areaLayout); currentPresentation.setInteractive(interactive); currentPresentation.content.bindBidirectional(finalContent); getChildren().setAll(currentLayout.createView(currentPresentation)); } else { getChildren().setAll(new Label("Unable to display information for: " + current)); } } }); }
@Override // This method is called by the FXMLLoader when initialization is complete public void initialize(URL fxmlFileLocation, ResourceBundle resources) { assert civilianAdministratorCheckBox != null : "fx:id=\"civilianAdministratorCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert officialsFilteredTableView != null : "fx:id=\"filteredPersonnelTableView\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert groundOfficerFilterCheckBox != null : "fx:id=\"groundOfficerFilterCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert navalOfficerFilterCheckBox != null : "fx:id=\"navalOfficerFilterCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert personnelNameColumn != null : "fx:id=\"personnelNameColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert personnelRankColumn != null : "fx:id=\"personnelRankColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert scientistFilterCheckBox != null : "fx:id=\"scientistFilterCheckBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillFilterComboBox != null : "fx:id=\"skillFilterComboBox\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillFilterMaxValueColumn != null : "fx:id=\"skillFilterMaxValueColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillFilterMaxValueComponent != null : "fx:id=\"skillFilterMaxValueComponent\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillFilterMinValueColumn != null : "fx:id=\"skillFilterMinValueColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillFilterMinValueComponent != null : "fx:id=\"skillFilterMinValueComponent\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillFiltersNameColumn != null : "fx:id=\"skillFiltersNameColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillFiltersTableView != null : "fx:id=\"skillFiltersTableView\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert assignmentsFilterComboBox != null; assert assigmentsListView != null; assert createTeamMenuItem != null : "fx:id=\"createTeamMenuItem\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert assignOfficialMenuItem != null; assert skillsTableView != null : "fx:id=\"skillsTableView\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert skillColumn != null : "fx:id=\"skillColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; assert levelColumn != null : "fx:id=\"levelColumn\" was not injected: check your FXML file 'PersonnelManagementScreen.fxml'."; // initialize your logic here: all @FXML variables will have been // injected initializeCompositeMatcher(); initializeFilteredPersonnelTableView(); initializeSkillFilterTab(); initializeAssignmentListViewAndFilters(); createTeamMenuItem .disableProperty() .bind( Bindings.select(officialsFilteredTableView.selectionModelProperty(), "selectedItem") .isNull()); final ObjectBinding<Official> selectedPersonnel = Bindings.select(officialsFilteredTableView.selectionModelProperty(), "selectedItem"); detailsPaneController .officialProperty() .bind(officialsFilteredTableView.getSelectionModel().selectedItemProperty()); skillColumn.setCellValueFactory( new Callback<CellDataFeatures<SkillLevel, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<SkillLevel, String> p) { SkillLevel value = p.getValue(); return Bindings.selectString(value, "skill", "name"); } }); levelColumn.setCellValueFactory(new PropertyValueFactory<SkillLevel, Integer>("level")); selectedPersonnel.addListener( new ChangeListener<Official>() { @Override public void changed( ObservableValue<? extends Official> arg0, Official arg1, Official arg2) { updateSkills(); } }); updateOfficialFiltersResult(); }