Search in sources :

Example 6 with GargoyleException

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;
}
Also used : DockNode(com.kyj.fx.voeditor.visual.component.dock.pane.DockNode) Node(javafx.scene.Node) InstanceTypes(com.kyj.fx.voeditor.visual.framework.InstanceTypes) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController)

Example 7 with GargoyleException

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) {
                }
            }
        }
    }
}
Also used : FileWrapper(com.kyj.fx.voeditor.visual.component.FileWrapper) Properties(java.util.Properties) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) File(java.io.File) SVNWcDbClient(com.kyj.scm.manager.svn.java.SVNWcDbClient) IOException(java.io.IOException) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException)

Example 8 with GargoyleException

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;
}
Also used : ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) DatabaseMetaData(java.sql.DatabaseMetaData)

Example 9 with GargoyleException

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;
}
Also used : ResultSet(java.sql.ResultSet) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException) DatabaseMetaData(java.sql.DatabaseMetaData) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

GargoyleException (com.kyj.fx.voeditor.visual.exceptions.GargoyleException)9 ArrayList (java.util.ArrayList)5 DatabaseMetaData (java.sql.DatabaseMetaData)4 ResultSet (java.sql.ResultSet)4 DockNode (com.kyj.fx.voeditor.visual.component.dock.pane.DockNode)2 InstanceTypes (com.kyj.fx.voeditor.visual.framework.InstanceTypes)2 FXMLController (com.kyj.fx.voeditor.visual.framework.annotation.FXMLController)2 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 List (java.util.List)2 ObservableList (javafx.collections.ObservableList)2 Node (javafx.scene.Node)2 FileWrapper (com.kyj.fx.voeditor.visual.component.FileWrapper)1 GargoyleLoadBar (com.kyj.fx.voeditor.visual.component.bar.GargoyleLoadBar)1 GargoyleSynchLoadBar (com.kyj.fx.voeditor.visual.component.bar.GargoyleSynchLoadBar)1 WebViewConsole (com.kyj.fx.voeditor.visual.component.console.WebViewConsole)1 JavaTextView (com.kyj.fx.voeditor.visual.component.popup.JavaTextView)1 FxSVNHistoryDataSupplier (com.kyj.fx.voeditor.visual.component.scm.FxSVNHistoryDataSupplier)1 ScmCommitComposite (com.kyj.fx.voeditor.visual.component.scm.ScmCommitComposite)1