use of com.kyj.fx.voeditor.visual.main.model.vo.Code in project Gargoyle by callakrsos.
the class DatabaseUrlManagementView method initialize.
@SuppressWarnings({ "rawtypes", "unchecked" })
@FXML
public void initialize() {
// /tbDatabase.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
colKey.setCellValueFactory(param -> {
Object object = param.getValue().get("seqNum");
return new SimpleObjectProperty<>(object);
});
String property = ResourceLoader.getInstance().get(ResourceLoader.DBMS_SUPPORT);
// 사용되지않은 코드
// String colOrder =
// ResourceLoader.getInstance().get(ResourceLoader.DATABASE_COLUMN_ORDER);
// 2015.11.30 데이터에 []코드를 삭제하면서 아래 코드존재가 불필요해서 주석
// 오류가 발생하여 임시 처리.
// if (colOrder != null) {
// colOrder = colOrder.replace("[", "");
// colOrder = colOrder.replace("]", "");
// }
List<Code> dbms = Stream.of(StringUtils.tokenizeToStringArray(property, ",")).map(t -> new Code(t, t)).collect(Collectors.toList());
colDbms = new ComboBoxTableColumn<>("dbms", FXCollections.observableArrayList(dbms), "code", "codeNm");
tbDatabase.getColumns().add(1, colDbms);
tbDatabase.getColumns().get(1).setText("DBMS");
tbDatabase.getColumns().get(1).setId("colDbms");
colColor = new ColorPickerTableColumn<Map<String, Object>>(colColor, "color");
colColor.setMaxWidth(50);
tbDatabase.getColumns().add(1, colColor);
tbDatabase.getColumns().get(1).setText("Color");
tbDatabase.getColumns().get(1).setId("colColor");
/*********************************************************/
// 파일 DagDrop 이벤트. URL에 새 데이터 add.
tbDatabase.setOnDragDropped(ev -> {
if (ev.getDragboard().hasFiles()) {
List<File> files = ev.getDragboard().getFiles();
files.stream().map(v -> {
return v.getAbsolutePath();
}).forEach(str -> {
Map<String, Object> map = new HashMap<String, Object>();
map.put(ResourceLoader.BASE_KEY_JDBC_URL, str);
tbDatabase.getItems().add(map);
});
ev.setDropCompleted(true);
ev.consume();
}
});
tbDatabase.setOnDragOver(ev -> {
if (ev.getDragboard().hasFiles()) {
ev.acceptTransferModes(TransferMode.LINK);
ev.consume();
}
});
/*********************************************************/
colPopup = new ButtonTableColumn() {
@Override
public void clickHandle(int nRow) {
try {
showSqlPane(nRow);
} catch (Exception e) {
DialogUtil.showExceptionDailog(e);
LOGGER.error(ValueUtil.toString(e));
}
}
};
colPing = new ButtonTableColumn("Ping") {
@Override
public void clickHandle(int nRow) {
try {
ping(nRow);
} catch (Exception e) {
DialogUtil.showExceptionDailog(e);
LOGGER.error(ValueUtil.toString(e));
}
}
};
colPopup.setMaxWidth(50);
tbDatabase.getColumns().add(1, colPopup);
tbDatabase.getColumns().get(1).setText("Popup");
tbDatabase.getColumns().get(1).setId("colPopup");
tbDatabase.getColumns().add(colPing);
setColumnText(colAlias, "alias");
colUrl.setPrefWidth(300);
setColumnText(colUrl, ResourceLoader.BASE_KEY_JDBC_URL);
setColumnText(colUserName, ResourceLoader.BASE_KEY_JDBC_ID);
setColumnText(colUserPassword, ResourceLoader.BASE_KEY_JDBC_PASS, param -> new PasswordTextFieldTableCell());
// colUserPassword.setCellValueFactory(param -> {
// Object initialValue =
// param.getValue().get(ResourceLoader.BASE_KEY_JDBC_PASS);
// SimpleObjectProperty<Object> simpleObjectProperty = new
// SimpleObjectProperty<>(initialValue);
// simpleObjectProperty.addListener((oba, oldval, newval) ->
// param.getValue().put(ResourceLoader.BASE_KEY_JDBC_PASS, newval));
// return simpleObjectProperty;
// });
// colUserPassword.setCellFactory(param -> new
// PasswordTextFieldTableCell());
observableArrayList = loadResource();
tbDatabase.getItems().addAll(observableArrayList);
}
use of com.kyj.fx.voeditor.visual.main.model.vo.Code in project Gargoyle by callakrsos.
the class DatabaseConfigView method btnSelectOnMouseClick.
@FXML
public void btnSelectOnMouseClick(MouseEvent event) {
Code selectedItem = choUrlItems.getSelectionModel().getSelectedItem();
if (selectedItem == null)
return;
Object code = selectedItem.getCode();
if (code != null) {
Map<String, Object> codeMap = (Map<String, Object>) code;
if (codeMap != null) {
Object url = codeMap.get(ResourceLoader.BASE_KEY_JDBC_URL);
Object id = codeMap.get(ResourceLoader.BASE_KEY_JDBC_ID);
Object pass = codeMap.get(ResourceLoader.BASE_KEY_JDBC_PASS);
Object dbms = codeMap.get(ResourceLoader.DBMS);
String driver = ResourceLoader.getInstance().get(ResourceLoader.DBMS + "." + dbms);
LOGGER.debug(String.format("url :%s id : %s , dbms: %s , driver : %s", id, url, dbms, driver));
Map<String, Object> linkedHashMap = new LinkedHashMap<>(4);
linkedHashMap.put(ResourceLoader.BASE_KEY_JDBC_URL, url);
linkedHashMap.put(ResourceLoader.BASE_KEY_JDBC_DRIVER, driver);
linkedHashMap.put(ResourceLoader.BASE_KEY_JDBC_ID, id);
linkedHashMap.put(ResourceLoader.BASE_KEY_JDBC_PASS, pass);
ObservableList<Map<String, Object>> load = load(linkedHashMap.entrySet());
ObservableList<Map<String, Object>> items = this.tbDatabase.getItems();
items.clear();
items.addAll(load);
}
}
}
use of com.kyj.fx.voeditor.visual.main.model.vo.Code in project Gargoyle by callakrsos.
the class ResourcesConfigView method loadResource.
/**
* 화면에 리소스를 읽어들인다.
*
* @return
*
* @작성자 : KYJ
* @작성일 : 2015. 11. 4.
*/
public ObservableList<Map<String, Object>> loadResource() {
Code selectedItem = choUrlItems.getSelectionModel().getSelectedItem();
if (selectedItem == null) {
selectedItem = choUrlItems.getItems().get(0);
}
Class<? extends IFileBaseConfiguration> code = (Class<? extends IFileBaseConfiguration>) selectedItem.getCode();
IFileBaseConfiguration instance = null;
if (code == ClassTypeResourceLoader.class) {
instance = ClassTypeResourceLoader.getInstance();
} else if (code == ConfigResourceLoader.class) {
instance = ConfigResourceLoader.getInstance();
} else if (code == ResourceLoader.class) {
instance = ResourceLoader.getInstance();
} else if (code == DatabaseTypeMappingResourceLoader.class) {
instance = DatabaseTypeMappingResourceLoader.getInstance();
} else {
instance = ResourceLoader.getInstance();
}
Set<Entry<Object, Object>> entry = instance.getEntry();
return load(entry);
}
Aggregations