public SQLHistorySearchCtrl( SQLTextAreaServices sqlTextAreaServices, Session session, ObservableList<SQLHistoryEntry> items) { _sqlTextAreaServices = sqlTextAreaServices; FxmlHelper<SQLHistorySearchView> fxmlHelper = new FxmlHelper<>(SQLHistorySearchView.class); _view = fxmlHelper.getView(); _dialog = new Stage(); _dialog.setTitle( new I18n(getClass()) .t("SQLHistorySearchCtrl.title", session.getMainTabContext().getSessionTabTitle())); _dialog.initModality(Modality.WINDOW_MODAL); _dialog.initOwner(AppState.get().getPrimaryStage()); Region region = fxmlHelper.getRegion(); _dialog.setScene(new Scene(region)); GuiUtils.makeEscapeClosable(region); new StageDimensionSaver( "sqlhistorysearch", _dialog, new Pref(getClass()), region.getPrefWidth(), region.getPrefHeight(), _dialog.getOwner()); _view.cboFilterType.setItems( FXCollections.observableList(Arrays.asList(SqlHistoryFilterType.values()))); _view.cboFilterType.getSelectionModel().selectFirst(); _view.btnApply.setOnAction(e -> onApply()); _view.chkFiltered.setOnAction(e -> onChkFiltered()); _view.split.getItems().add(_tblHistory); _view.split.getItems().add(_txtSqlPreview); _originalTableLoader = new RowObjectTableLoader<>(); _originalTableLoader.initColsByAnnotations(SQLHistoryEntry.class); _originalTableLoader.addRowObjects(items); _currentLoader = _originalTableLoader.cloneLoader(); _currentLoader.load(_tblHistory); _tblHistory .getSelectionModel() .selectedItemProperty() .addListener((observable, oldValue, newValue) -> onTableSelectionChanged()); _tblHistory.setOnMouseClicked(e -> onTblHistoryClicked(e)); _txtSqlPreview.setEditable(false); _dialog.setOnCloseRequest(e -> close()); _view.txtFilter.requestFocus(); _splitPositionSaver.apply(_view.split); _dialog.showAndWait(); }
private void close() { _splitPositionSaver.save(_view.split); }