Search in sources :

Example 1 with TableMasterDVO

use of kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO in project Gargoyle by callakrsos.

the class DaoWizardViewController method btnDaoDatabaseMouseClick.

/**
	 * 데이터베이스 선택시....
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 21.
	 * @param e
	 */
@FXML
public void btnDaoDatabaseMouseClick(MouseEvent e) {
    DatabaseTableView view = new DatabaseTableView();
    TableDVO tableDVO = view.show();
    if (tableDVO != null) {
        TableMasterDVO tableMasterDVO = tableDVO.getTableMasterDVO();
        txtTableName.setText(tableMasterDVO.getTableName());
        // TbmSysDaoDVO tbmSysDaoDVO = new TbmSysDaoDVO();
        tbmSysDaoDVOProperty.get().setTableName(tableMasterDVO.getTableName());
    }
}
Also used : TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) TableDVO(kyj.Fx.dao.wizard.core.model.vo.TableDVO) DatabaseTableView(com.kyj.fx.voeditor.visual.component.popup.DatabaseTableView) FXML(javafx.fxml.FXML)

Example 2 with TableMasterDVO

use of kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO in project Gargoyle by callakrsos.

the class DatabaseTableView method listView.

/**
	 * TODO 테이블 조회
	 *
	 * @Date 2015. 10. 16.
	 * @param tableName
	 * @return
	 * @throws Exception
	 * @User KYJ
	 */
private List<TableMasterDVO> listView(String viewName) throws Exception {
    String sql = ConfigResourceLoader.getInstance().get(ConfigResourceLoader.SQL_VIEWS);
    Map<String, Object> hashMap = new HashMap<String, Object>();
    hashMap.put("viewName", viewName);
    return DbUtil.select(sql, hashMap, new RowMapper<TableMasterDVO>() {

        @Override
        public TableMasterDVO mapRow(ResultSet rs, int rowNum) throws SQLException {
            TableMasterDVO tableMasterDVO = new TableMasterDVO();
            String tableName = rs.getString("TABLE_NAME");
            tableMasterDVO.setTableName(tableName);
            String className = ValueUtil.toDVOName(tableName);
            tableMasterDVO.setClassName(className);
            // tableMasterDVO.setDescription(rs.getString("COMMENTS"));
            return tableMasterDVO;
        }
    });
}
Also used : TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) HashMap(java.util.HashMap) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet)

Example 3 with TableMasterDVO

use of kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO in project Gargoyle by callakrsos.

the class DatabaseTableView method initialize.

@FXML
void initialize() {
    contextMenuTbModelMst = new ContextMenu();
    txtTableName.setOnKeyReleased(event -> {
        if (KeyCode.ENTER == event.getCode()) {
            String tableName = txtTableName.getText();
            requestTables(tableName);
        }
    });
    btnSearch.setOnMouseClicked(event -> {
        String name = txtTableName.getText();
        String selectedItem = choType.getSelectionModel().getSelectedItem();
        switch(selectedItem) {
            case TYPE_TABLE:
                requestTables(name);
                break;
            case TYPE_VIEW:
                requestViews(name);
        }
    });
    tbMaster.setOnMouseClicked(event -> {
        if (event.getClickCount() == 2) {
            tbModelMst.getItems().clear();
            TableMasterDVO selectedItem = tbMaster.getSelectionModel().getSelectedItem();
            try {
                if (selectedItem == null)
                    return;
                List<TableModelDVO> list = listColumns(selectedItem);
                tbModelMst.getItems().addAll(list);
            } catch (Exception e) {
                DialogUtil.showExceptionDailog(e, "데이터베이스 처리 에러");
            }
        }
    });
    btnSelect.setOnMouseClicked(event -> {
        if (tbMaster.getItems().isEmpty() || tbModelMst.getItems().isEmpty()) {
            return;
        }
        TableMasterDVO selectedItem = tbMaster.getSelectionModel().getSelectedItem();
        ObservableList<TableModelDVO> items = tbModelMst.getItems();
        tableDVO = new TableDVO(selectedItem, items);
        close();
    });
    MenuItem menuDelete = new MenuItem("삭제");
    menuDelete.setOnAction(event -> {
        TableViewSelectionModel<TableModelDVO> selectionModel = tbModelMst.getSelectionModel();
        int selectedIndex = selectionModel.getSelectedIndex();
        if (selectedIndex >= 0) {
            tbModelMst.getItems().remove(selectedIndex);
            selectionModel.clearSelection();
        }
    });
    // MenuItem menuDistinct = new MenuItem("중복제거");
    // menuDistinct.setOnAction(event -> {
    // ObservableList<TableModelDVO> items = tbModelMst.getItems();
    // items.stream().filter(distinctByKey(new Function<TableModelDVO,
    // ObservableList<TableModelDVO>>(){
    //
    // @Override
    // public ObservableList<TableModelDVO> apply(TableModelDVO t) {
    // // TODO Auto-generated method stub
    // return null;
    // }));
    contextMenuTbModelMst.getItems().add(menuDelete);
    tbModelMst.setContextMenu(contextMenuTbModelMst);
}
Also used : TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) TableDVO(kyj.Fx.dao.wizard.core.model.vo.TableDVO) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) SQLException(java.sql.SQLException) FXML(javafx.fxml.FXML)

Example 4 with TableMasterDVO

use of kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO in project Gargoyle by callakrsos.

the class VoEditorController method initialize.

/**
	 * 이벤트 초기화
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 15.
	 */
@FXML
public void initialize() {
    colType.setCellFactory(new ClassTypeCheckBoxCellFactory());
    colName.setCellFactory(TextFieldTableCell.forTableColumn());
    colSize.setCellFactory(TextFieldTableCell.forTableColumn());
    colDesc.setCellFactory(TextFieldTableCell.forTableColumn());
    CommonsContextMenu.addMenus(tbVoEditor, (Menus.useCudButtons() | Menus.UP | Menus.DOWN));
    // tbVoEditor.setContextMenu();
    tbVoEditor.addEventHandler(ActionEvent.ACTION, event -> {
        if (event instanceof CommonContextMenuEvent) {
            CommonContextMenuEvent _event = (CommonContextMenuEvent) event;
            int mode = _event.getMode();
            ObservableList<TableModelDVO> items = tbVoEditor.getItems();
            int selectedIndex = tbVoEditor.getSelectionModel().getSelectedIndex();
            int rowSize = items.size();
            boolean isMove = false;
            if (Menus.isAdd(mode)) {
                items.add(defaultTableModelDVO());
                isMove = true;
            } else if (Menus.isDelete(mode)) {
                items.remove(selectedIndex);
                isMove = true;
            } else if (Menus.isUp(mode)) {
                btnUpOnMouseClick();
            } else if (Menus.isDown(mode)) {
                btnDownOnMouseClick();
            }
            if (isMove) {
                tbVoEditor.getSelectionModel().select(rowSize - 1);
            }
        }
    });
    // 컨트롤 키를 누르면 그리드 데이터 이동처리.
    tbVoEditor.setOnKeyPressed(event -> {
        if (event.isControlDown()) {
            KeyCode code = event.getCode();
            switch(code) {
                case UP:
                    btnUpOnMouseClick();
                    break;
                case DOWN:
                    btnDownOnMouseClick();
                    break;
                default:
                    break;
            }
            event.consume();
        }
    });
    btnGenerate.addEventHandler(MouseEvent.MOUSE_CLICKED, this::btnGenerateOnMouseClick);
    btnSelect.setOnMouseClicked(this::btnSelectOnMouseClick);
    btnDatabase.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            DatabaseTableView databaseTableView = new DatabaseTableView();
            TableDVO show = databaseTableView.show();
            if (show != null) {
                TableMasterDVO tableMasterDVO = show.getTableMasterDVO();
                List<TableModelDVO> tableModelDVOList = show.getTableModelDVOList();
                ObservableList<TableModelDVO> items = tbVoEditor.getItems();
                if (tableMasterDVO != null) {
                    txtClassName.setText(tableMasterDVO.getClassName());
                    txtAreaDesc.setText(tableMasterDVO.getDescription());
                }
                if (tableModelDVOList != null) {
                    items.clear();
                    items.addAll(tableModelDVOList);
                }
            }
        }
    });
}
Also used : TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) CommonContextMenuEvent(com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent) MouseEvent(javafx.scene.input.MouseEvent) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) DatabaseTableView(com.kyj.fx.voeditor.visual.component.popup.DatabaseTableView) ClassTypeCheckBoxCellFactory(com.kyj.fx.voeditor.visual.component.ClassTypeCheckBoxCellFactory) TableDVO(kyj.Fx.dao.wizard.core.model.vo.TableDVO) ObservableList(javafx.collections.ObservableList) KeyCode(javafx.scene.input.KeyCode) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) FXML(javafx.fxml.FXML)

Example 5 with TableMasterDVO

use of kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO in project Gargoyle by callakrsos.

the class ExcelUtilTest method makeExcelFile.

@org.junit.Before
public void makeExcelFile() throws Exception {
    List<TableMasterDVO> listTable = VoWizardUtil.listTable("tbm_sm_user");
    List<TableModelDVO> listColumns = VoWizardUtil.listColumns(listTable.get(0));
    File userDir = SystemUtils.getUserDir();
    createExcelFile = VoWizardUtil.createExcelFile(userDir, "TbmSmUserDVO.xlsx", listColumns, true);
}
Also used : TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) File(java.io.File)

Aggregations

TableMasterDVO (kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO)6 SQLException (java.sql.SQLException)3 FXML (javafx.fxml.FXML)3 TableDVO (kyj.Fx.dao.wizard.core.model.vo.TableDVO)3 TableModelDVO (kyj.Fx.dao.wizard.core.model.vo.TableModelDVO)3 DatabaseTableView (com.kyj.fx.voeditor.visual.component.popup.DatabaseTableView)2 ClassTypeCheckBoxCellFactory (com.kyj.fx.voeditor.visual.component.ClassTypeCheckBoxCellFactory)1 CommonContextMenuEvent (com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent)1 GargoyleFileAlreadyExistException (com.kyj.fx.voeditor.visual.exceptions.GargoyleFileAlreadyExistException)1 File (java.io.File)1 ResultSet (java.sql.ResultSet)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ObservableList (javafx.collections.ObservableList)1 ContextMenu (javafx.scene.control.ContextMenu)1 MenuItem (javafx.scene.control.MenuItem)1 KeyCode (javafx.scene.input.KeyCode)1 MouseEvent (javafx.scene.input.MouseEvent)1