use of kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO in project Gargoyle by callakrsos.
the class DAOLoaderController method tbSrchDaoOnMouseClick.
@FXML
public void tbSrchDaoOnMouseClick(MouseEvent e) {
if (e.getClickCount() == 2) {
Platform.runLater(() -> {
try {
Map<String, Object> selectedItem = tbSrchDao.getSelectionModel().getSelectedItem();
if (selectedItem == null)
return;
TbmSysDaoDVO tbmSysDAO = new TbmSysDaoDVO();
tbmSysDAO.setClassName(selectedItem.get("CLASS_NAME").toString());
tbmSysDAO.setPackageName(selectedItem.get("PACKAGE_NAME").toString());
tbmSysDAO.setLocation(selectedItem.get("LOCATION").toString());
tbmSysDAO.setClassDesc(selectedItem.get("CLASS_DESC").toString());
Object object = selectedItem.get("TABLE_NAME");
if (object != null)
tbmSysDAO.setTableName(object.toString());
FxUtil.load(DAOLoaderController.class);
//new FXMLLoader();
FXMLLoader loader = FxUtil.createNewFxmlLoader();
loader.setLocation(getClass().getResource("DaoWizardView.fxml"));
BorderPane pane = loader.load();
DaoWizardViewController controller = loader.getController();
controller.setTbmSysDaoProperty(tbmSysDAO);
/*2016-10-26 by kyj change code tab handling -> loadNewSystem api */
// Tab tab = new Tab("DaoWizard", pane);
// this.systemRoot.addTabItem(tab);
// tab.getTabPane().getSelectionModel().select(tab);
SharedMemory.getSystemLayoutViewController().loadNewSystemTab("DaoWizard", pane);
//2016-09-23 굳히 재조회 할 필요없으므로 주석.
// List<Map<String, Object>> listDAO = listDAO(txtSrchTable.getText().trim());
// tbSrchDao.getItems().addAll(listDAO);
} catch (Exception e1) {
LOGGER.error(e1.toString());
DialogUtil.showExceptionDailog(e1);
}
});
}
}
use of kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO in project Gargoyle by callakrsos.
the class DaoWizardViewController method initialize.
@FXML
public void initialize() {
tbParams.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
// this.colProgramTypeLock.setCellValueFactory(v ->
// v.getValue().lockYnProperty());
// this.colProgramTypeLock.setCellFactory(v ->{
// return
// });
tbmSysDaoDVOProperty = new SimpleObjectProperty<>(new TbmSysDaoDVO());
colParamTestValue.setCellFactory(TextFieldTableCell.forTableColumn());
methodDesc.setCellFactory(TextFieldTableCell.forTableColumn());
methodName.setCellFactory(TextFieldTableCell.forTableColumn());
// [시작] 넘버링 컬럼
colMethodNo.setCellValueFactory(new NumberingCellValueFactory<>(tbMethods.getItems()));
/*
* 2015-11-02 기존에 사용하던 NumberingCellValueFactory을 적용할 수 없음.
* colParamNo컬럼같은경우는 method에 따라 데이터의 주소값이 바뀌는 타입이라 주소값이 바뀌는 상태에선 적절한 넘버링
* 데이터가 화면에 보여주지않음. 하여 주소값을 계속 유지시킬 수 있도록 tbMethods에서 선택된 메소드정보에서 값을
* 참조하여 넘버링을 시킴.
*
* 2016-04-19 파람의 아이템을 삭제하고 다시 호출했을때 인덱스 순서가 맞지않던 버그 fix
*/
colParamNo.setCellValueFactory(param -> {
return new ReadOnlyObjectWrapper<Integer>(tbParams.getItems().indexOf(param.getValue()) + 1);
});
// [끝] 넘버링 컬럼
colParamTypes.setCellFactory(ChoiceBoxTableCell.forTableColumn("Nomal", "Arrays"));
// 텍스트의 내용이 변경되면 메모리에 적재시키기 위한 이벤트 함수.
// 2015.11.17 키 이벤트가 눌릴때 처리되지않게함, 타이밍 문제가 있어, 저장시에 문제가 있음.
// txtSql.getCodeArea().setOnKeyPressed();
txtSql.getCodeArea().setOnKeyReleased(event -> {
if (!event.isShortcutDown()) {
TbpSysDaoMethodsDVO selectedMethodItem = getSelectedMethodItem();
if (selectedMethodItem != null)
selectedMethodItem.setSqlBody(txtSql.getText());
}
});
StringConverter<String> classConverter = new StringConverter<String>() {
@Override
public String toString(String clazz) {
if (clazz == null || clazz.isEmpty())
return "";
String result = clazz;
int lastIndexOf = clazz.lastIndexOf('.');
if (lastIndexOf >= 0) {
result = clazz.substring(lastIndexOf + 1);
}
return result;
}
@Override
public String fromString(String clazz) {
return clazz;
}
};
// 메소드 컬럼에서 Result Vo Class를 더블클릭한경우 VO참조를 걸 수 있도록 팝업창을 뜨는 로직 포함되있음.
colResultVoClass.setCellFactory(param -> {
TextFieldTableCell<TbpSysDaoMethodsDVO, String> textFieldTableCell = new TextFieldTableCell<>();
textFieldTableCell.setOnMouseClicked(event -> {
if (event.getClickCount() == 2) {
String clazz = textFieldTableCell.getItem();
try {
BaseOpenClassResourceView view = null;
if (ValueUtil.isNotEmpty(clazz)) {
view = new MeerketAbstractVoOpenClassResourceView(clazz);
} else {
view = new MeerketAbstractVoOpenClassResourceView();
}
view.setConsumer(str -> {
if (str == null || str.isEmpty())
return;
try {
int selectedItem = tbMethods.getSelectionModel().getSelectedIndex();
tbMethods.getItems().get(selectedItem).setResultVoClass(str);
} catch (Exception e) {
DialogUtil.showExceptionDailog(e, "로드할 수 없는 클래스 유형입니다.");
return;
}
});
ResultDialog<String> show = view.show();
show.consume();
} catch (Exception e) {
e.printStackTrace();
}
}
});
textFieldTableCell.setConverter(classConverter);
return textFieldTableCell;
});
colResultVoClass.setCellValueFactory(param -> param.getValue().resultVoClassProperty());
// SQL 에디터 마우스 클릭이벤트, 선택한 메소드 항목이 없다면 Editable을 활성화 시키지않는다.
txtSql.getCodeArea().setOnMouseClicked(event -> {
if (!event.isShortcutDown()) {
int selectedMethodIndex = getSelectedMethodIndex();
if (selectedMethodIndex == -1) {
txtSql.getCodeArea().setEditable(false);
} else {
txtSql.getCodeArea().setEditable(true);
}
}
});
// 2016-08-27 custom 항목 추가. 이 항목추가시 typeMapping.properties 파일의 항목도 추가야함.
ObservableList<String> collect = DatabaseTypeMappingResourceLoader.getInstance().getEntry().stream().map(v -> v.getValue().toString()).distinct().collect(FxCollectors.toObservableList());
collect.addAll(Arrays.asList("Integer", "Long", "Double"));
colProgramType.setCellFactory(ChoiceBoxTableCell.forTableColumn(collect));
lblMessage.setText(MSG_NO_WARNNING);
// 메뉴등록작업
applyContextMenu();
}
use of kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO in project Gargoyle by callakrsos.
the class DaoWizardViewController method addDefDaoMethod.
/**
* 디폴트 메소드를 추가함.
*
* @작성자 : KYJ
* @작성일 : 2015. 10. 22.
* @param methodName
* @return
*/
private TbpSysDaoMethodsDVO addDefDaoMethod(String methodName, boolean select) {
TbmSysDaoDVO tbmSysDaoDVO = tbmSysDaoDVOProperty.get();
TbpSysDaoMethodsDVO e = new TbpSysDaoMethodsDVO(tbmSysDaoDVO);
e.setMethodName(methodName);
// UI에 데이터를 보여줌
tbMethods.getItems().add(e);
if (select) {
tbMethods.getSelectionModel().select(e);
}
/* 메모리에 데이터 적재 */
List<TbpSysDaoMethodsDVO> tbpSysDaoMethodsDVOList = tbmSysDaoDVO.getTbpSysDaoMethodsDVOList();
tbpSysDaoMethodsDVOList.add(e);
return e;
}
use of kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO 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());
}
}
use of kyj.Fx.dao.wizard.core.model.vo.TbmSysDaoDVO in project Gargoyle by callakrsos.
the class DaoWizardViewController method setTbmSysDaoProperty.
/**
* 파라미터로 온 데이터 바인딩
*
* @작성자 : KYJ
* @작성일 : 2015. 11. 2.
* @param dvo
*/
public void setTbmSysDaoProperty(TbmSysDaoDVO tbmSysDaoDVO) {
// tbMethods.getItems().clear();
// this.tbmSysDaoDVOProperty.setValue(tbmSysDaoDVO);
txtPackageName.setText(tbmSysDaoDVO.getPackageName());
txtClassName.setText(tbmSysDaoDVO.getClassName());
txtDaoLocation.setText(ValueUtil.removeBaseDir(tbmSysDaoDVO.getLocation()));
txtAreaDaoDesc.setText(tbmSysDaoDVO.getClassDesc());
txtTableName.setText(tbmSysDaoDVO.getTableName());
TbmSysDaoDVO apply = fxDAOReadFunction.apply(tbmSysDaoDVO);
this.tbmSysDaoDVOProperty.set(apply);
List<TbpSysDaoMethodsDVO> tbpSysDaoMethodsDVOList = apply.getTbpSysDaoMethodsDVOList();
tbMethods.getItems().clear();
tbMethods.getItems().addAll(tbpSysDaoMethodsDVOList);
}
Aggregations