Search in sources :

Example 1 with JavaTextView

use of com.kyj.fx.voeditor.visual.component.popup.JavaTextView in project Gargoyle by callakrsos.

the class SystemLayoutViewController method openJava.

/**
	 * 자바파일을 연다.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 2. 22.
	 * @param file
	 * @throws IOException
	 */
private void openJava(File file) throws IOException {
    try {
        String content1 = FileUtils.readFileToString(file, "UTF-8");
        JavaTextView javaTextView = new JavaTextView(content1, false);
        //2016-10-03 editable 주석 해제.
        //			javaTextView.setEditable(false);
        loadNewSystemTab(file.getName(), javaTextView);
    } catch (IOException e1) {
        LOGGER.debug(ValueUtil.toString(e1));
        throw e1;
    }
}
Also used : JavaTextView(com.kyj.fx.voeditor.visual.component.popup.JavaTextView) IOException(java.io.IOException)

Example 2 with JavaTextView

use of com.kyj.fx.voeditor.visual.component.popup.JavaTextView in project Gargoyle by callakrsos.

the class VoEditorController method btnGenerateOnMouseClick.

/********************************
	 * 작성일 : 2016. 6. 6. 작성자 : KYJ
	 *
	 * 생성 마우스 클릭
	 *
	 * @param me
	 ********************************/
public void btnGenerateOnMouseClick(MouseEvent me) {
    try {
        checkValidation();
        String className = txtClassName.getText();
        String location = txtLocation.getText();
        String packageName = txtPackageName.getText();
        String extendsBaseClass = ConfigResourceLoader.getInstance().get(ConfigResourceLoader.VOEDITOR_DEFAULT_EXTENDS_CLASS);
        ObservableList<TableModelDVO> items = tbVoEditor.getItems();
        ClassMeta classMeta = EditorUtil.extractedClassMeta(className, packageName, extendsBaseClass);
        VoEditorConverter converter = new VoEditorConverter(classMeta, items);
        VoEditor voEditor = converter.convert();
        if (location != null && !location.isEmpty()) {
            Optional<Pair<String, String>> showYesOrNoDialog = DialogUtil.showYesOrNoDialog("파일생성여부", "파일도 만드시겠습니까? ");
            showYesOrNoDialog.ifPresent(string -> {
                if ("Y".equals(string.getValue())) {
                    try {
                        voEditor.toFile(location);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
        JavaTextView simpleTextView = new JavaTextView(voEditor.toText());
        simpleTextView.show();
    } catch (Exception e) {
        DialogUtil.showExceptionDailog(e);
        return;
    }
}
Also used : VoEditorConverter(com.kyj.fx.voeditor.visual.util.VoEditorConverter) JavaTextView(com.kyj.fx.voeditor.visual.component.popup.JavaTextView) ClassMeta(com.kyj.fx.voeditor.core.model.meta.ClassMeta) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) FileNotFoundException(java.io.FileNotFoundException) GargoyleFileAlreadyExistException(com.kyj.fx.voeditor.visual.exceptions.GargoyleFileAlreadyExistException) ParseException(com.github.javaparser.ParseException) IOException(java.io.IOException) VoEditor(com.kyj.fx.voeditor.core.VoEditor) Pair(javafx.util.Pair)

Example 3 with JavaTextView

use of com.kyj.fx.voeditor.visual.component.popup.JavaTextView in project Gargoyle by callakrsos.

the class DaoWizardViewController method btnGenerateOnMouseClick.

/**
	 * DAO Wizard 생성 버튼 이벤트
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 28.
	 */
@FXML
public void btnGenerateOnMouseClick(MouseEvent event) {
    try {
        int checkValidation = checkValidation();
        String className = txtClassName.getText();
        String location = txtDaoLocation.getText();
        String packageName = txtPackageName.getText();
        String desc = txtAreaDaoDesc.getText();
        // 저장처리전 검증 및 위자드로 한번 확인
        String extendsBaseClass = ConfigResourceLoader.getInstance().get(ConfigResourceLoader.DAO_WIZARD_DEFAULT_EXTENDS_CLASS);
        ClassMeta classMeta = EditorUtil.extractedClassMeta(className, packageName, extendsBaseClass);
        classMeta.setDesc(desc);
        // TbmSysDaoDVO tbmSysDaoDVO = tbmSysDaoDVOProperty.get();
        // tbmSysDaoDVO.setClassName(className);
        // tbmSysDaoDVO.setLocation(location);
        // tbmSysDaoDVO.setPackageName(packageName);
        // tbmSysDaoDVO.setDesc(desc);
        // tbmSysDaoDVO.setExtendClassNameStr(extendsBaseClass);
        DaoWizardConverter converter = new DaoWizardConverter(classMeta, tbmSysDaoDVOProperty.get());
        converter.createWizard(Wizardtype.meerkatbase);
        DaoWizard<ClassMeta, TbpSysDaoMethodsDVO, FieldMeta> daowizard = converter.convert();
        if (location != null && !location.isEmpty()) {
            Optional<Pair<String, String>> showYesOrNoDialog = DialogUtil.showYesOrNoDialog("파일생성여부", "파일도 만드시겠습니까? ");
            showYesOrNoDialog.ifPresent(string -> {
                if ("Y".equals(string.getValue())) {
                    try {
                        daowizard.toFile(ValueUtil.appendBaseDir(location));
                    } catch (Exception e) {
                        DialogUtil.showExceptionDailog(e);
                    }
                }
            });
        }
        // 위의 검증작업에서 이상없을시 데이터베이스 저장작업
        if (checkValidation == MESSAGE_CODES.indexOf(MSG_NOMAL)) {
            JavaTextView simpleTextView = new JavaTextView(daowizard.toText());
            simpleTextView.show();
            Optional<Pair<String, String>> showYesOrNoDialog = DialogUtil.showYesOrNoDialog(MESSAGE_CODES.get(checkValidation), "Code : [" + checkValidation + "]\n" + MESSAGE_CODES.get(checkValidation) + "\nDo you want save. ?");
            showYesOrNoDialog.ifPresent(option -> {
                if ("Y".equals(option.getValue())) {
                    TbmSysDaoDVO saveTbmSysDaoDVO = this.tbmSysDaoDVOProperty.get();
                    saveTbmSysDaoDVO.setClassName(className);
                    saveTbmSysDaoDVO.setLocation(location);
                    saveTbmSysDaoDVO.setPackageName(packageName);
                    saveTbmSysDaoDVO.setClassDesc(desc);
                    saveTbmSysDaoDVO.setExtendsClassName(extendsBaseClass);
                    save(saveTbmSysDaoDVO);
                }
            });
        } else {
            DialogUtil.showMessageDialog("Error Code[" + checkValidation + "]\n" + MESSAGE_CODES.get(checkValidation));
        }
    // if (checkValidation == MESSAGE_CODES.indexOf(MSG_NOMAL)) {
    //
    // } else {
    // DialogUtil.showMessageDialog(MESSAGE_CODES.get(checkValidation));
    // }
    } catch (Exception e) {
        DialogUtil.showExceptionDailog(e, e.getMessage());
    }
}
Also used : TbpSysDaoMethodsDVO(kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO) TbmSysDaoDVO(kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO) DaoWizardConverter(com.kyj.fx.voeditor.visual.util.DaoWizardConverter) JavaTextView(com.kyj.fx.voeditor.visual.component.popup.JavaTextView) ClassMeta(com.kyj.fx.voeditor.core.model.meta.ClassMeta) FieldMeta(com.kyj.fx.voeditor.core.model.meta.FieldMeta) IOException(java.io.IOException) Pair(javafx.util.Pair) FXML(javafx.fxml.FXML)

Aggregations

JavaTextView (com.kyj.fx.voeditor.visual.component.popup.JavaTextView)3 IOException (java.io.IOException)3 ClassMeta (com.kyj.fx.voeditor.core.model.meta.ClassMeta)2 Pair (javafx.util.Pair)2 ParseException (com.github.javaparser.ParseException)1 VoEditor (com.kyj.fx.voeditor.core.VoEditor)1 FieldMeta (com.kyj.fx.voeditor.core.model.meta.FieldMeta)1 GargoyleFileAlreadyExistException (com.kyj.fx.voeditor.visual.exceptions.GargoyleFileAlreadyExistException)1 DaoWizardConverter (com.kyj.fx.voeditor.visual.util.DaoWizardConverter)1 VoEditorConverter (com.kyj.fx.voeditor.visual.util.VoEditorConverter)1 FileNotFoundException (java.io.FileNotFoundException)1 FXML (javafx.fxml.FXML)1 TableModelDVO (kyj.Fx.dao.wizard.core.model.vo.TableModelDVO)1 TbmSysDaoDVO (kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO)1 TbpSysDaoMethodsDVO (kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO)1