Search in sources :

Example 1 with ResourceLoader

use of com.kyj.fx.voeditor.visual.momory.ResourceLoader in project Gargoyle by callakrsos.

the class ResourcesConfigView method btnSaveOnMouseClick.

@FXML
public void btnSaveOnMouseClick(MouseEvent event) {
    try {
        ResourceLoader instance = ResourceLoader.getInstance();
        Map<String, Object> bufMap = new HashMap<>();
        tbDatabase.getItems().forEach(item -> {
            Object key = item.get("key");
            Object value = item.get("value");
            if (key == null)
                return;
            bufMap.put(key.toString(), value.toString());
        });
        instance.putAll(bufMap);
        DialogUtil.showMessageDialog("Save Complete...");
    } catch (Exception e) {
        DialogUtil.showExceptionDailog(e);
    }
}
Also used : ClassTypeResourceLoader(com.kyj.fx.voeditor.visual.momory.ClassTypeResourceLoader) DatabaseTypeMappingResourceLoader(kyj.Fx.dao.wizard.memory.DatabaseTypeMappingResourceLoader) ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) HashMap(java.util.HashMap) FXML(javafx.fxml.FXML)

Example 2 with ResourceLoader

use of com.kyj.fx.voeditor.visual.momory.ResourceLoader in project Gargoyle by callakrsos.

the class SVNConfigView method btnSaveOnMouseClick.

@FXML
public void btnSaveOnMouseClick(MouseEvent event) {
    try {
        ResourceLoader instance = ResourceLoader.getInstance();
        Map<String, Object> bufMap = new HashMap<>();
        tbDatabase.getItems().forEach(item -> {
            Object key = item.get("key");
            Object value = item.get("value");
            if (key == null)
                return;
            bufMap.put(key.toString(), value.toString());
        });
        instance.putAll(bufMap);
        DialogUtil.showMessageDialog("Save Complete...");
    } catch (Exception e) {
        DialogUtil.showExceptionDailog(e);
    }
}
Also used : ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) HashMap(java.util.HashMap) SQLException(java.sql.SQLException) FXML(javafx.fxml.FXML)

Example 3 with ResourceLoader

use of com.kyj.fx.voeditor.visual.momory.ResourceLoader in project Gargoyle by callakrsos.

the class SVNConfigView method loadResource.

/**
	 * 화면에 리소스를 읽어들인다.
	 *
	 * @return
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 11. 4.
	 */
public ObservableList<Map<String, Object>> loadResource() {
    ResourceLoader instance = ResourceLoader.getInstance();
    Set<Entry<Object, Object>> entry = instance.getEntry();
    return load(entry);
}
Also used : ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) Entry(java.util.Map.Entry)

Example 4 with ResourceLoader

use of com.kyj.fx.voeditor.visual.momory.ResourceLoader in project Gargoyle by callakrsos.

the class DatabaseUrlManagementView method loadResource.

/**
	 * 화면에 리소스를 읽어들인다.
	 *
	 *
	 * 변경이력 : 2015.11.30, kyj, static 으로 변경
	 *
	 * @return
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 11. 4.
	 */
@SuppressWarnings("unchecked")
public static ObservableList<Map<String, Object>> loadResource() {
    ResourceLoader instance = ResourceLoader.getInstance();
    ObservableList<Map<String, Object>> observableArrayList = FXCollections.observableArrayList();
    Enumeration<Object> keySet = instance.keySet();
    while (keySet.hasMoreElements()) {
        Object _key = keySet.nextElement();
        if (_key == null)
            continue;
        String key = (String) _key;
        if (!key.startsWith("database.info."))
            continue;
        String value = instance.get(key);
        if ("jdbc.pass".equals(key))
            value = decryp(value);
        JSONObject json = ValueUtil.toJSONObject(value);
        Map<String, Object> map = new HashMap<String, Object>(json);
        map.put("seqNum", key);
        observableArrayList.add(0, map);
    }
    return observableArrayList;
}
Also used : ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) JSONObject(org.json.simple.JSONObject) HashMap(java.util.HashMap) JSONObject(org.json.simple.JSONObject) Map(java.util.Map) HashMap(java.util.HashMap)

Example 5 with ResourceLoader

use of com.kyj.fx.voeditor.visual.momory.ResourceLoader in project Gargoyle by callakrsos.

the class DatabaseUrlManagementView method btnSaveOnMouseClick.

@SuppressWarnings("unchecked")
@FXML
public void btnSaveOnMouseClick(MouseEvent event) {
    FileOutputStream out = null;
    ResourceLoader instance = ResourceLoader.getInstance();
    instance.initDataBaseInfo();
    try {
        String prefiixKey = "database.info.";
        Map<String, Object> map = new HashMap<>();
        List<String> colList = new ArrayList<String>();
        for (int i = 0; i < tbDatabase.getItems().size(); i++) {
            Map<String, Object> item = tbDatabase.getItems().get(i);
            //  item.get("seqNum");
            Object key = prefiixKey + i;
            JSONObject json = new JSONObject();
            json.put("seqNum", /*item.get("seqNum")*/
            key);
            json.put("dbms", item.get("dbms"));
            json.put("alias", item.get("alias"));
            json.put(ResourceLoader.BASE_KEY_JDBC_URL, item.get(ResourceLoader.BASE_KEY_JDBC_URL));
            json.put(ResourceLoader.BASE_KEY_JDBC_ID, item.get(ResourceLoader.BASE_KEY_JDBC_ID));
            json.put(ResourceLoader.BASE_KEY_JDBC_PASS, item.get(ResourceLoader.BASE_KEY_JDBC_PASS));
            json.put("color", item.get("color"));
            map.put(key.toString(), json.toJSONString());
        }
        tbDatabase.getColumns().forEach(col -> {
            if (col.isVisible())
                colList.add(col.getId());
        });
        map.put("database.column.order", colList.toString());
        {
            /*하나의 트랜잭션*/
            removeKeys();
            instance.putAll(map);
            delItems.clear();
        }
        //			tbDatabase.getItems().clear();
        tbDatabase.getItems().setAll(loadResource());
        DialogUtil.showMessageDialog("Save Complete...");
    } catch (Exception e) {
        DialogUtil.showExceptionDailog(e);
    } finally {
        try {
            if (out != null)
                out.close();
        } catch (IOException e) {
            LOGGER.error(ValueUtil.toString(e));
        }
    }
}
Also used : ConfigResourceLoader(com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) JSONObject(org.json.simple.JSONObject) HashMap(java.util.HashMap) FileOutputStream(java.io.FileOutputStream) ArrayList(java.util.ArrayList) JSONObject(org.json.simple.JSONObject) IOException(java.io.IOException) RuntimeException(com.sun.star.uno.RuntimeException) IOException(java.io.IOException) NotYetSupportException(com.kyj.fx.voeditor.visual.exceptions.NotYetSupportException) FXML(javafx.fxml.FXML)

Aggregations

ResourceLoader (com.kyj.fx.voeditor.visual.momory.ResourceLoader)7 ConfigResourceLoader (com.kyj.fx.voeditor.visual.momory.ConfigResourceLoader)5 HashMap (java.util.HashMap)5 FXML (javafx.fxml.FXML)4 RuntimeException (com.sun.star.uno.RuntimeException)2 SQLException (java.sql.SQLException)2 Entry (java.util.Map.Entry)2 JSONObject (org.json.simple.JSONObject)2 NotYetSupportException (com.kyj.fx.voeditor.visual.exceptions.NotYetSupportException)1 ClassTypeResourceLoader (com.kyj.fx.voeditor.visual.momory.ClassTypeResourceLoader)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 DatabaseTypeMappingResourceLoader (kyj.Fx.dao.wizard.memory.DatabaseTypeMappingResourceLoader)1