Search in sources :

Example 1 with VoEditorConverter

use of com.kyj.fx.voeditor.visual.util.VoEditorConverter 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)

Aggregations

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