use of com.kyj.fx.voeditor.visual.component.grid.CommonsBaseGridView in project Gargoyle by callakrsos.
the class DAOLoaderController method menuHistoryOnAction.
/**
* 히스토리 이력을 살펴보는경우 사용
*
* @작성자 : KYJ
* @작성일 : 2015. 11. 6.
* @param event
*/
public void menuHistoryOnAction(ActionEvent event) {
Map<String, Object> selectedItem = tbSrchDao.getSelectionModel().getSelectedItem();
if (selectedItem == null)
return;
String packageName = ValueUtil.emptyThan(selectedItem.get("PACKAGE_NAME"), "").toString();
String className = ValueUtil.emptyThan(selectedItem.get("CLASS_NAME"), "").toString();
// Stage primaryStage = SharedMemory.getPrimaryStage();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("packageName", packageName);
paramMap.put("className", className);
try {
List<TbmSysDaoMethodsHDVO> select = listHistoryItems(paramMap);
CommonsBaseGridView<TbmSysDaoMethodsHDVO> commonsBaseGridView = new CommonsBaseGridView<>(TbmSysDaoMethodsHDVO.class, select);
TableViewSelectionModel<TbmSysDaoMethodsHDVO> selectionModel = commonsBaseGridView.getSelectionModel();
selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
BorderPane borderPane = new BorderPane();
Label value = new Label("History");
value.setStyle("-fx-font-size:75px");
borderPane.setTop(value);
SqlKeywords sqlKeyword = new SqlKeywords();
borderPane.setBottom(sqlKeyword);
SplitPane splitPane = new SplitPane(commonsBaseGridView, sqlKeyword);
splitPane.setOrientation(Orientation.VERTICAL);
borderPane.setCenter(splitPane);
commonsBaseGridView.setOnMouseClicked(ev -> {
if (ev.getClickCount() == 2) {
try {
TbmSysDaoMethodsHDVO selectedItem2 = commonsBaseGridView.getSelectionModel().getSelectedItem();
String histTsp = selectedItem2.getHistTsp();
String sqlBody = getSqlBody(histTsp);
sqlKeyword.setContent(sqlBody);
} catch (Exception e) {
LOGGER.error(ValueUtil.toString(e));
}
}
});
MenuItem compare = new MenuItem("Compare.");
compare.setDisable(true);
compare.setOnAction(ev -> {
ObservableList<TbmSysDaoMethodsHDVO> selectedItems = commonsBaseGridView.getSelectionModel().getSelectedItems();
if (selectedItems.size() == 2) {
compare(selectedItems.get(0), selectedItems.get(1));
}
});
ContextMenu historyContextMenu = new ContextMenu(compare);
historyContextMenu.setOnShowing(ev -> {
if (selectionModel.getSelectedItems().size() == 2) {
compare.setDisable(false);
} else {
compare.setDisable(true);
}
});
commonsBaseGridView.setContextMenu(historyContextMenu);
Scene scene = new Scene(borderPane);
Stage stage = new Stage();
stage.initOwner(SharedMemory.getPrimaryStage());
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations