Search in sources :

Example 11 with TableModelDVO

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

the class DaoWizardViewController method menuToVoEditorOnAction.

/********************************
	 * 작성일 : 2016. 2. 27. 작성자 : KYJ
	 *
	 * 내용 : VO에티터로 결과내용을 전달처리한다.
	 *******************************/
public void menuToVoEditorOnAction(ActionEvent e) {
    ObservableList<TbpSysDaoColumnsDVO> items = tbMappings.getItems();
    if (items.isEmpty())
        return;
    DatabaseTypeMappingFunction typeConverter = new DatabaseTypeMappingFunction();
    try {
        FXMLLoader loader = FxUtil.createNewFxmlLoader();
        loader.setLocation(getClass().getResource("VoEditorView.fxml"));
        BorderPane root = loader.load();
        VoEditorController controller = loader.getController();
        List<TableModelDVO> resultItems = items.stream().map(m -> {
            TableModelDVO dvo = new TableModelDVO();
            dvo.setName(ValueUtil.getPrefixLowerTextMyEdit(m.getColumnName()));
            String programType = m.getProgramType();
            if (programType == null || programType.isEmpty()) {
                programType = typeConverter.apply(m.getColumnType());
            }
            dvo.setType(programType);
            return dvo;
        }).collect(Collectors.toList());
        controller.addItem(resultItems);
        SharedMemory.getSystemLayoutViewController().loadNewSystemTab("New VO", root);
    } catch (IOException e1) {
        LOGGER.error(ValueUtil.toString(e1));
    }
}
Also used : SimpleSQLResultView(com.kyj.fx.voeditor.visual.component.popup.SimpleSQLResultView) Arrays(java.util.Arrays) Menus(com.kyj.fx.voeditor.visual.component.Menus) DbUtil(com.kyj.fx.voeditor.visual.util.DbUtil) NumberingCellValueFactory(com.kyj.fx.voeditor.visual.component.NumberingCellValueFactory) LoggerFactory(org.slf4j.LoggerFactory) NullExpresion(com.kyj.fx.voeditor.visual.util.NullExpresion) MeerketAbstractVoOpenClassResourceView(com.kyj.fx.voeditor.visual.component.popup.MeerketAbstractVoOpenClassResourceView) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ContextMenu(javafx.scene.control.ContextMenu) Map(java.util.Map) FileUtil(com.kyj.fx.voeditor.visual.util.FileUtil) TableView(javafx.scene.control.TableView) TbpSysDaoColumnsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoColumnsDVO) Path(java.nio.file.Path) EditorUtil(com.kyj.fx.voeditor.util.EditorUtil) DatabaseTypeMappingFunction(com.kyj.fx.voeditor.visual.functions.DatabaseTypeMappingFunction) ClassTypeResourceLoader(com.kyj.fx.voeditor.visual.momory.ClassTypeResourceLoader) TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) SqlKeywords(com.kyj.fx.voeditor.visual.component.text.SqlKeywords) TextField(javafx.scene.control.TextField) Pair(javafx.util.Pair) MenuItem(javafx.scene.control.MenuItem) QuerygenUtil(kyj.Fx.dao.wizard.core.util.QuerygenUtil) TbpSysDaoMethodsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO) Set(java.util.Set) KeyEvent(javafx.scene.input.KeyEvent) DatabaseTableView(com.kyj.fx.voeditor.visual.component.popup.DatabaseTableView) FxDAOReadFunction(com.kyj.fx.voeditor.visual.functions.FxDAOReadFunction) ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) TableDVO(kyj.Fx.dao.wizard.core.model.vo.TableDVO) Collectors(java.util.stream.Collectors) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) Stream(java.util.stream.Stream) Optional(java.util.Optional) ChoiceBoxTableCell(javafx.scene.control.cell.ChoiceBoxTableCell) DateUtil(com.kyj.fx.voeditor.visual.util.DateUtil) CommonsContextMenu(com.kyj.fx.voeditor.visual.component.CommonsContextMenu) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) BaseOpenClassResourceView(com.kyj.fx.voeditor.visual.component.popup.BaseOpenClassResourceView) TextArea(javafx.scene.control.TextArea) MouseEvent(javafx.scene.input.MouseEvent) CommonContextMenuEvent(com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) DialogUtil(com.kyj.fx.voeditor.visual.util.DialogUtil) Function(java.util.function.Function) TbmSysDaoDVO(kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO) TableColumn(javafx.scene.control.TableColumn) Wizardtype(com.kyj.fx.voeditor.visual.framework.daowizard.GargoyleDaoWizardFactory.Wizardtype) FXMLLoader(javafx.fxml.FXMLLoader) FxCollectors(com.kyj.fx.voeditor.visual.util.FxCollectors) JavaTextView(com.kyj.fx.voeditor.visual.component.popup.JavaTextView) DaoWizard(kyj.Fx.dao.wizard.DaoWizard) LinkedHashSet(java.util.LinkedHashSet) ClassMeta(com.kyj.fx.voeditor.core.model.meta.ClassMeta) FxDAOSaveFunction(com.kyj.fx.voeditor.visual.functions.FxDAOSaveFunction) ObjectProperty(javafx.beans.property.ObjectProperty) Logger(org.slf4j.Logger) DaoWizardConverter(com.kyj.fx.voeditor.visual.util.DaoWizardConverter) Label(javafx.scene.control.Label) Iterator(java.util.Iterator) FieldMeta(com.kyj.fx.voeditor.core.model.meta.FieldMeta) DatabaseTypeMappingResourceLoader(kyj.Fx.dao.wizard.memory.DatabaseTypeMappingResourceLoader) IOException(java.io.IOException) LockImagedYnColumn(com.kyj.fx.voeditor.visual.component.LockImagedYnColumn) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) TbpSysDaoFieldsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoFieldsDVO) StringConverter(javafx.util.StringConverter) File(java.io.File) ActionEvent(javafx.event.ActionEvent) SelectionMode(javafx.scene.control.SelectionMode) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) ResultDialog(com.kyj.fx.voeditor.visual.component.ResultDialog) Collections(java.util.Collections) SharedMemory(com.kyj.fx.voeditor.visual.momory.SharedMemory) BorderPane(javafx.scene.layout.BorderPane) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) IOException(java.io.IOException) TbpSysDaoColumnsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoColumnsDVO) FXMLLoader(javafx.fxml.FXMLLoader) DatabaseTypeMappingFunction(com.kyj.fx.voeditor.visual.functions.DatabaseTypeMappingFunction)

Example 12 with TableModelDVO

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

the class VoEditorController method replace.

private void replace(int idx1, int idx2) {
    TableModelDVO tableModelDVO1 = tbVoEditor.getItems().get(idx1);
    TableModelDVO tableModelDVO2 = tbVoEditor.getItems().get(idx2);
    tbVoEditor.getItems().set(idx2, tableModelDVO1);
    tbVoEditor.getItems().set(idx1, tableModelDVO2);
}
Also used : TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO)

Example 13 with TableModelDVO

use of kyj.Fx.dao.wizard.core.model.vo.TableModelDVO 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 14 with TableModelDVO

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

the class VoEditorController method defaultTableModelDVO.

/**
	 * 디폴트 TableModelDVO 반환
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 15.
	 * @return
	 */
private TableModelDVO defaultTableModelDVO() {
    TableModelDVO tableModelDVO = new TableModelDVO();
    String typeName = ConfigResourceLoader.getInstance().get(ConfigResourceLoader.VOEDITOR_DEFAULT_TYPE_NAME);
    tableModelDVO.setType(typeName);
    return tableModelDVO;
}
Also used : TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO)

Example 15 with TableModelDVO

use of kyj.Fx.dao.wizard.core.model.vo.TableModelDVO 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

TableModelDVO (kyj.Fx.dao.wizard.core.model.vo.TableModelDVO)16 List (java.util.List)7 File (java.io.File)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 TableMasterDVO (kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO)5 ClassMeta (com.kyj.fx.voeditor.core.model.meta.ClassMeta)4 GargoyleFileAlreadyExistException (com.kyj.fx.voeditor.visual.exceptions.GargoyleFileAlreadyExistException)4 DatabaseTypeMappingFunction (com.kyj.fx.voeditor.visual.functions.DatabaseTypeMappingFunction)4 ObservableList (javafx.collections.ObservableList)4 FXML (javafx.fxml.FXML)4 ParseException (com.github.javaparser.ParseException)3 FieldMeta (com.kyj.fx.voeditor.core.model.meta.FieldMeta)3 DatabaseTableView (com.kyj.fx.voeditor.visual.component.popup.DatabaseTableView)3 JavaTextView (com.kyj.fx.voeditor.visual.component.popup.JavaTextView)3 CommonContextMenuEvent (com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent)3 SQLException (java.sql.SQLException)3 TableDVO (kyj.Fx.dao.wizard.core.model.vo.TableDVO)3 VoEditor (com.kyj.fx.voeditor.core.VoEditor)2 EditorUtil (com.kyj.fx.voeditor.util.EditorUtil)2