Search in sources :

Example 1 with CommonsBaseGridView

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();
    }
}
Also used : SqlKeywords(com.kyj.fx.voeditor.visual.component.text.SqlKeywords) BorderPane(javafx.scene.layout.BorderPane) HashMap(java.util.HashMap) Label(javafx.scene.control.Label) TbmSysDaoMethodsHDVO(com.kyj.fx.voeditor.visual.main.model.vo.TbmSysDaoMethodsHDVO) MenuItem(javafx.scene.control.MenuItem) ContextMenu(javafx.scene.control.ContextMenu) SplitPane(javafx.scene.control.SplitPane) Scene(javafx.scene.Scene) CommonsBaseGridView(com.kyj.fx.voeditor.visual.component.grid.CommonsBaseGridView) Stage(javafx.stage.Stage)

Aggregations

CommonsBaseGridView (com.kyj.fx.voeditor.visual.component.grid.CommonsBaseGridView)1 SqlKeywords (com.kyj.fx.voeditor.visual.component.text.SqlKeywords)1 TbmSysDaoMethodsHDVO (com.kyj.fx.voeditor.visual.main.model.vo.TbmSysDaoMethodsHDVO)1 HashMap (java.util.HashMap)1 Scene (javafx.scene.Scene)1 ContextMenu (javafx.scene.control.ContextMenu)1 Label (javafx.scene.control.Label)1 MenuItem (javafx.scene.control.MenuItem)1 SplitPane (javafx.scene.control.SplitPane)1 BorderPane (javafx.scene.layout.BorderPane)1 Stage (javafx.stage.Stage)1