Search in sources :

Example 1 with VoEditor

use of com.kyj.fx.voeditor.core.VoEditor 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 2 with VoEditor

use of com.kyj.fx.voeditor.core.VoEditor in project Gargoyle by callakrsos.

the class DefaultGenerateVoEditorFunction method apply.

@Override
public VoEditor apply(ClassMeta t, List<FieldMeta> fields) {
    VoEditor voEditor = new VoEditor(t, fields);
    voEditor.build();
    return voEditor;
}
Also used : VoEditor(com.kyj.fx.voeditor.core.VoEditor)

Example 3 with VoEditor

use of com.kyj.fx.voeditor.core.VoEditor in project Gargoyle by callakrsos.

the class SimpleTest method test.

@Test
public void test() throws Exception {
    FieldMeta fieldMeta = new FieldMeta((Modifier.PRIVATE), "sample", String.class);
    fieldMeta.setPrimarykey(true);
    fieldMeta.setAlias("키속성");
    FieldMeta fieldMeta2 = new FieldMeta((Modifier.PRIVATE), "sample2", String.class);
    FieldMeta fieldMeta3 = new FieldMeta((Modifier.PRIVATE), "check", boolean.class);
    FieldMeta fieldMeta4 = new FieldMeta((Modifier.PRIVATE), "count", int.class);
    FieldMeta fieldMeta5 = new FieldMeta((Modifier.PRIVATE), "name", StringProperty.class, SimpleStringProperty.class);
    FieldMeta fieldMeta6 = new FieldMeta((Modifier.PRIVATE), "name2", StringProperty.class, SimpleStringProperty.class);
    /*
		 * , FxVo.class, new Class<?>[] { IExtractClass .class, IExtractField
		 * .class }
		 */
    ClassMeta classMeta = new ClassMeta("com.sample", "Simple");
    VoEditor voEditor = new VoEditor(classMeta, fieldMeta, fieldMeta2, fieldMeta3, fieldMeta4, fieldMeta5, fieldMeta6);
    voEditor.build();
    String text = voEditor.toText();
    LOGGER.debug(text);
}
Also used : FieldMeta(com.kyj.fx.voeditor.core.model.meta.FieldMeta) ClassMeta(com.kyj.fx.voeditor.core.model.meta.ClassMeta) VoEditor(com.kyj.fx.voeditor.core.VoEditor) Test(org.junit.Test)

Example 4 with VoEditor

use of com.kyj.fx.voeditor.core.VoEditor in project Gargoyle by callakrsos.

the class VoWizardUtil method toVoString.

/**
	 * VO문자열로 리턴
	 *
	 * @param classMeta
	 * @param models
	 * @return
	 * @throws Exception
	 */
public static String toVoString(ClassMeta classMeta, List<TableModelDVO> models) throws Exception {
    VoEditorConverter converter = new VoEditorConverter(classMeta, models);
    VoEditor voEditor = converter.convert();
    return voEditor.toText();
}
Also used : VoEditor(com.kyj.fx.voeditor.core.VoEditor)

Example 5 with VoEditor

use of com.kyj.fx.voeditor.core.VoEditor in project Gargoyle by callakrsos.

the class VOEditorParser2 method main.

public static void main(String[] args) throws ParseException, IOException {
    String fileName = "C:\\Users\\KYJ\\JAVA_FX\\gagoyleWorkspace\\VisualFxVoEditor\\src\\main\\java\\com\\kyj\\fx\\voeditor\\visual\\main\\model\\vo\\ClassPathEntry.java";
    FileInputStream in = new FileInputStream(fileName);
    CompilationUnit cu;
    try {
        // parse the file
        cu = JavaParser.parse(in);
    } finally {
        in.close();
    }
    PackageDeclaration packageDeclaration = cu.getPackage();
    // System.out.println(packageDeclaration.getName().toString());
    // System.out.println();
    // System.out.println(String.format("package name : %s",
    // packageDeclaration.getName().getName()));
    ClassMeta classMeta = new ClassMeta("");
    classMeta.setPackageName(packageDeclaration.getName().toString());
    ArrayList<FieldMeta> fields = new ArrayList<FieldMeta>();
    VoEditor voEditor = new VoEditor(classMeta, fields);
    List<Node> childrenNodes = cu.getChildrenNodes();
    for (Node n : childrenNodes) {
    }
    new MethodVisitor().visit(cu, null);
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) ClassMeta(com.kyj.fx.voeditor.core.model.meta.ClassMeta) FieldMeta(com.kyj.fx.voeditor.core.model.meta.FieldMeta) Node(com.github.javaparser.ast.Node) ArrayList(java.util.ArrayList) FileInputStream(java.io.FileInputStream) PackageDeclaration(com.github.javaparser.ast.PackageDeclaration) VoEditor(com.kyj.fx.voeditor.core.VoEditor)

Aggregations

VoEditor (com.kyj.fx.voeditor.core.VoEditor)5 ClassMeta (com.kyj.fx.voeditor.core.model.meta.ClassMeta)3 FieldMeta (com.kyj.fx.voeditor.core.model.meta.FieldMeta)2 ParseException (com.github.javaparser.ParseException)1 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 Node (com.github.javaparser.ast.Node)1 PackageDeclaration (com.github.javaparser.ast.PackageDeclaration)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 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Pair (javafx.util.Pair)1 TableModelDVO (kyj.Fx.dao.wizard.core.model.vo.TableModelDVO)1 Test (org.junit.Test)1