use of com.kyj.fx.voeditor.visual.exceptions.GargoyleException in project Gargoyle by callakrsos.
the class FxUtil method load.
/********************************
* 작성일 : 2016. 5. 21. 작성자 : KYJ
*
* FXMLController 어노테이션 에 정의된 내용을 기준으로 FXML을 로드한다. </br>
* 아래메소드를 활용하는 경우
*
* PostInitialize 어노테이션을 활용하여 initialize() 수행후 후처리를 지정할 수 있음.
*
* @param controllerClass
* @param option
* @return
* @throws GargoyleException
* @throws NullPointerException
* @throws IOException
********************************/
public static <N, C> N load(Class<C> controllerClass, Object rootInstance, Consumer<N> option, Consumer<C> controllerAction) throws Exception {
if (controllerClass == null)
throw new NullPointerException("controller is null.");
String fullClassName = controllerClass.getCanonicalName();
FXMLController controller = getFxmlController(controllerClass);
if (controller == null) {
throw new GargoyleException("this is not FXMLController. check @FXMLController");
}
//controller.value();
String fxml = getFxml(controller);
if (ValueUtil.isEmpty(fxml))
throw new IllegalArgumentException("value is empty..");
InstanceTypes type = controller.instanceType();
N newInstance = null;
switch(type) {
case Singleton:
Node node = FxMemory.get(fullClassName);
if (node == null) {
newInstance = newInstance(controllerClass, rootInstance, controller.isSelfController(), fxml, option, controllerAction);
FxMemory.put(fullClassName, (Node) newInstance);
} else {
newInstance = (N) node;
}
break;
case RequireNew:
newInstance = newInstance(controllerClass, rootInstance, controller.isSelfController(), fxml, option, controllerAction);
break;
}
return newInstance;
}
use of com.kyj.fx.voeditor.visual.exceptions.GargoyleException in project Gargoyle by callakrsos.
the class SystemLayoutViewController method menuItemSCMGraphsOnAction.
/**
* SCM Graph분석 화면을 생성후 보여주는 처리를 함.
*
* @작성자 : KYJ
* @작성일 : 2016. 7. 21.
* @param event
*/
public void menuItemSCMGraphsOnAction(ActionEvent event) {
TreeItem<FileWrapper> selectedItem = treeProjectFile.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
FileWrapper value = selectedItem.getValue();
if (value.isSVNConnected()) {
File wcDbFile = value.getWcDbFile();
if (wcDbFile.exists()) {
try {
SVNWcDbClient client = new SVNWcDbClient(wcDbFile);
String rootUrl = client.getUrl();
LOGGER.debug("root URL : {}", rootUrl);
Properties properties = new Properties();
properties.put(JavaSVNManager.SVN_URL, rootUrl);
loadNewSystemTab("Scm Graph", FxUtil.createSVNGraph(properties));
} catch (GargoyleException e) {
LOGGER.error(ValueUtil.toString(e));
DialogUtil.showExceptionDailog(e, e.getErrorCode().getCodeMessage());
} catch (Exception e) {
}
}
}
}
}
use of com.kyj.fx.voeditor.visual.exceptions.GargoyleException in project Gargoyle by callakrsos.
the class DbUtil method pks.
public static <T> List<T> pks(Connection connection, String tableNamePattern, Function<ResultSet, T> converter) throws Exception {
if (converter == null)
throw new GargoyleException(GargoyleException.ERROR_CODE.PARAMETER_EMPTY, "converter is null ");
List<T> tables = new ArrayList<>();
DatabaseMetaData metaData = connection.getMetaData();
// metaData.getPrimaryKeys(null,
ResultSet rs = PRIMARY_CONVERTER.apply(tableNamePattern, metaData);
if (rs != null) {
while (rs.next()) {
tables.add(converter.apply(rs));
}
}
return tables;
}
use of com.kyj.fx.voeditor.visual.exceptions.GargoyleException in project Gargoyle by callakrsos.
the class DbUtil method columnsToMap.
public static <K, T> Map<K, T> columnsToMap(Connection connection, String tableNamePattern, Function<ResultSet, K> keyMapper, Function<ResultSet, T> valueMapper) throws Exception {
if (keyMapper == null || valueMapper == null)
throw new GargoyleException(GargoyleException.ERROR_CODE.PARAMETER_EMPTY, "converter is null ");
Map<K, T> tables = new LinkedHashMap<>();
// try (Connection connection = getConnection()) {
DatabaseMetaData metaData = connection.getMetaData();
ResultSet rs = COLUMN_CONVERTER.apply(tableNamePattern, metaData);
while (rs.next()) {
K k = keyMapper.apply(rs);
if (k == null)
continue;
T t = valueMapper.apply(rs);
tables.put(k, t);
}
return tables;
}
Aggregations