List of usage examples for java.util Properties remove
@Override public synchronized boolean remove(Object key, Object value)
From source file:gdt.jgui.base.JBasesPanel.java
/** * Response on menu action//from ww w. j a va 2 s. com * @param console main console * @param locator$ the locator string. */ @Override public void response(JMainConsole console, String locator$) { try { System.out.println("JBasesPanel:response:locator=" + Locator.remove(locator$, Locator.LOCATOR_ICON)); Properties locator = Locator.toProperties(locator$); String text$ = locator.getProperty(JTextEditor.TEXT); String entiroot$ = locator.getProperty(BaseHandler.ENTIROOT); BaseHandler.createBlankDatabase(entiroot$ + "/" + text$); System.out.println("JBasesPanel:response:database created"); Entigrator entigrator = new Entigrator(new String[] { entiroot$ + "/" + text$ }); entigrator.indx_rebuild(null); System.out.println("JBasesPanel:response:index rebuilt"); String[] sa = entigrator.indx_listEntities(); Sack entity; String entityLocator$; for (String s : sa) { entity = entigrator.getEntityAtKey(s); if (entity == null) continue; if (!"extension".equals(entity.getProperty("entity"))) continue; entityLocator$ = EntityHandler.getEntityLocator(entigrator, entity); JEntityPrimaryMenu.reindexEntity(console, entityLocator$); } System.out.println("JBasesPanel:response:entities reindexed"); console.putEntigrator(entigrator); refreshAllEntitiesQuery(console, entigrator.getEntihome()); refreshListProcedure(console, entigrator.getEntihome()); System.out.println("JBasesPanel:response:refreshed queries and procedures"); JBaseNavigator jbn = new JBaseNavigator(); String jbnLocator$ = jbn.getLocator(); jbnLocator$ = Locator.append(jbnLocator$, Entigrator.ENTIHOME, entigrator.getEntihome()); JConsoleHandler.execute(console, jbnLocator$); } catch (Exception e) { Logger.getLogger(getClass().getName()).severe(e.toString()); } }
From source file:gdt.jgui.entity.fields.JFieldsFacetOpenItem.java
/** * Get the popup menu for the child node of the facet node * in the digest view.//from www . java 2 s .com * @return the popup menu. */ @Override public JPopupMenu getPopupMenu(final String digestLocator$) { System.out.println("JFieldsFacetOpenItem:getPopupMenu:digest locator=" + Locator.remove(digestLocator$, Locator.LOCATOR_ICON)); JPopupMenu popup = new JPopupMenu(); JMenuItem editItem = new JMenuItem("Edit"); popup.add(editItem); editItem.setHorizontalTextPosition(JMenuItem.RIGHT); editItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Properties locator = Locator.toProperties(digestLocator$); String encodedSelection$ = locator.getProperty(JEntityDigestDisplay.SELECTION); byte[] ba = Base64.decodeBase64(encodedSelection$); String selection$ = new String(ba, "UTF-8"); locator = Locator.toProperties(selection$); String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); String nodeType$ = locator.getProperty(JEntityDigestDisplay.NODE_TYPE); System.out.println("JFieldsFacetOpenItem:getPopupMenu:node type:" + nodeType$); Entigrator entigrator = console.getEntigrator(entihome$); // Sack entity=entigrator.getEntityAtKey(entityKey$); if (NODE_TYPE_FIELD_NAME.equals(nodeType$)) { String fieldName$ = locator.getProperty(Locator.LOCATOR_TITLE); JTextEditor te = new JTextEditor(); String teLocator$ = te.getLocator(); teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, fieldName$); if (entihome$ != null) teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$); if (entityKey$ != null) teLocator$ = Locator.append(teLocator$, EntityHandler.ENTITY_KEY, entityKey$); String foiLocator$ = getLocator(); foiLocator$ = Locator.append(foiLocator$, BaseHandler.HANDLER_METHOD, METHOD_RESPONSE); foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_ACTION, ACTION_DIGEST_CALL); foiLocator$ = Locator.append(foiLocator$, FIELD_NAME, fieldName$); foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(digestLocator$)); if (entihome$ != null) foiLocator$ = Locator.append(foiLocator$, Entigrator.ENTIHOME, entihome$); if (entityKey$ != null) foiLocator$ = Locator.append(foiLocator$, EntityHandler.ENTITY_KEY, entityKey$); System.out.println("JFieldsFacetOpenItem:getPopupMenu:name:locator=" + foiLocator$); teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(foiLocator$)); JConsoleHandler.execute(console, teLocator$); System.out.println("JFieldsFacetOpenItem:getPopupMenu:teLocator=" + teLocator$); return; } if (NODE_TYPE_FIELD_VALUE.equals(nodeType$)) { String fieldName$ = locator.getProperty(Locator.LOCATOR_TITLE); JTextEditor te = new JTextEditor(); String teLocator$ = te.getLocator(); teLocator$ = Locator.append(teLocator$, JTextEditor.TEXT, fieldName$); if (entihome$ != null) teLocator$ = Locator.append(teLocator$, Entigrator.ENTIHOME, entihome$); if (entityKey$ != null) teLocator$ = Locator.append(teLocator$, EntityHandler.ENTITY_KEY, entityKey$); String foiLocator$ = getLocator(); foiLocator$ = Locator.append(foiLocator$, BaseHandler.HANDLER_METHOD, METHOD_RESPONSE); foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_ACTION, ACTION_DIGEST_CALL); foiLocator$ = Locator.append(foiLocator$, FIELD_NAME, fieldName$); foiLocator$ = Locator.append(foiLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(digestLocator$)); if (entihome$ != null) foiLocator$ = Locator.append(foiLocator$, Entigrator.ENTIHOME, entihome$); if (entityKey$ != null) foiLocator$ = Locator.append(foiLocator$, EntityHandler.ENTITY_KEY, entityKey$); System.out.println("JFieldsFacetOpenItem:getPopupMenu:value:locator=" + foiLocator$); teLocator$ = Locator.append(teLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, Locator.compressText(foiLocator$)); JConsoleHandler.execute(console, teLocator$); return; } if (JEntityDigestDisplay.NODE_TYPE_FACET_OWNER.equals(nodeType$)) { JEntityDigestDisplay edd = new JEntityDigestDisplay(); String eddLocator$ = edd.getLocator(); eddLocator$ = Locator.append(eddLocator$, Entigrator.ENTIHOME, entihome$); eddLocator$ = Locator.append(eddLocator$, EntityHandler.ENTITY_KEY, entityKey$); eddLocator$ = Locator.append(eddLocator$, JEntityDigestDisplay.SELECTION, encodedSelection$); String requesterResponseLocator$ = Locator.compressText(eddLocator$); JFieldsEditor fieldsEditor = new JFieldsEditor(); String feLocator$ = fieldsEditor.getLocator(); feLocator$ = Locator.append(feLocator$, Entigrator.ENTIHOME, entihome$); feLocator$ = Locator.append(feLocator$, EntityHandler.ENTITY_KEY, entityKey$); feLocator$ = Locator.append(feLocator$, JRequester.REQUESTER_RESPONSE_LOCATOR, requesterResponseLocator$); feLocator$ = Locator.append(feLocator$, BaseHandler.HANDLER_METHOD, "instantiate"); JConsoleHandler.execute(console, feLocator$); } } catch (Exception ee) { Logger.getLogger(JFieldsFacetOpenItem.class.getName()).info(ee.toString()); } } }); return popup; }
From source file:gdt.jgui.entity.folder.JFolderPanel.java
/** * Execute the response locator./* w ww . ja v a 2 s. co m*/ * @param console the main console. * @param locator$ the locator string. */ @Override public void response(JMainConsole console, String locator$) { try { // System.out.println("FolderPanel:response:locator="+locator$); Properties locator = Locator.toProperties(locator$); String action$ = locator.getProperty(JRequester.REQUESTER_ACTION); if (ACTION_CREATE_FILE.equals(action$)) { String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); String text$ = locator.getProperty(JTextEditor.TEXT); File file = new File(entihome$ + "/" + entityKey$ + "/" + text$); if (!file.exists()) file.createNewFile(); locator$ = Locator.remove(locator$, JRequester.REQUESTER_ACTION); JConsoleHandler.execute(console, locator$); } if (ACTION_EDIT_FILE.equals(action$)) { String filePath$ = locator.getProperty(FILE_PATH); String text$ = locator.getProperty(JTextEditor.TEXT); File file = new File(filePath$); if (!file.exists()) file.createNewFile(); FileOutputStream fos = new FileOutputStream(file, false); Writer writer = new OutputStreamWriter(fos, "UTF-8"); writer.write(text$); writer.close(); fos.close(); locator$ = Locator.remove(locator$, JRequester.REQUESTER_ACTION); JConsoleHandler.execute(console, locator$); } if (ACTION_CREATE_FOLDER.equals(action$)) { String entihome$ = locator.getProperty(Entigrator.ENTIHOME); String text$ = locator.getProperty(JTextEditor.TEXT); Entigrator entigrator = console.getEntigrator(entihome$); Sack folder = entigrator.ent_new("folder", text$); folder = entigrator.ent_assignProperty(folder, "folder", folder.getProperty("label")); folder.putAttribute(new Core(null, "icon", "folder.png")); entigrator.save(folder); entigrator.saveHandlerIcon(JFolderPanel.class, "folder.png"); entityKey$ = folder.getKey(); File folderHome = new File(entihome$ + "/" + entityKey$); if (!folderHome.exists()) folderHome.mkdir(); JFolderPanel fp = new JFolderPanel(); String fLocator$ = fp.getLocator(); fLocator$ = Locator.append(fLocator$, Entigrator.ENTIHOME, entihome$); fLocator$ = Locator.append(fLocator$, EntityHandler.ENTITY_KEY, entityKey$); JEntityPrimaryMenu.reindexEntity(console, fLocator$); Stack<String> s = console.getTrack(); s.pop(); console.setTrack(s); JConsoleHandler.execute(console, fLocator$); } } catch (Exception e) { LOGGER.severe(e.toString()); } }
From source file:gdt.jgui.tool.JEntityEditor.java
/** * Execute the response locator./*from w ww.j a va 2s . com*/ * @param console the main console. * @param locator$ the response locator. * */ @Override public void response(JMainConsole console, String locator$) { // System.out.println("EntityEditor:response:"+Locator.remove(locator$,Locator.LOCATOR_ICON )); try { Properties locator = Locator.toProperties(locator$); String action$ = locator.getProperty(JRequester.REQUESTER_ACTION); String text$ = locator.getProperty(JTextEditor.TEXT); if (ACTION_ADD_ELEMENT.equals(action$)) { Entigrator entigrator = console.getEntigrator(entihome$); Sack entity = entigrator.getEntityAtKey(entityKey$); if (entity.existsElement(text$)) return; entity.createElement(text$); entity.putElementItem(text$, new Core(null, "item", null)); entigrator.save(entity); locator$ = getLocator(); locator$ = Locator.remove(locator$, BaseHandler.HANDLER_METHOD); locator$ = Locator.remove(locator$, JRequester.REQUESTER_ACTION); JConsoleHandler.execute(console, locator$); return; } if (ACTION_RENAME_ELEMENT.equals(action$)) { String entihome$ = locator.getProperty(Entigrator.ENTIHOME); Entigrator entigrator = console.getEntigrator(entihome$); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); String element$ = locator.getProperty(JTextEditor.TEXT); String oldElement$ = locator.getProperty(ELEMENT); Sack entity = entigrator.getEntityAtKey(entityKey$); entity.createElement(element$); entity.elementReplace(element$, entity.elementGet(oldElement$)); entity.removeElement(oldElement$); entigrator.save(entity); locator$ = Locator.append(locator$, Locator.LOCATOR_TITLE, "Edit"); locator$ = Locator.append(locator$, EntityHandler.ENTITY_ACTION, JEntityEditor.ENTITY_EDIT); locator$ = Locator.append(locator$, BaseHandler.HANDLER_CLASS, JEntityEditor.class.getName()); locator$ = Locator.append(locator$, ELEMENT, element$); JConsoleHandler.execute(console, locator$); } if (ACTION_EDIT_CELL.equals(action$)) { String entihome$ = locator.getProperty(Entigrator.ENTIHOME); Entigrator entigrator = console.getEntigrator(entihome$); String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); Sack entity = entigrator.getEntityAtKey(entityKey$); //System.out.println("EntityEditor:response:entity="+entity.getProperty("label")); String element$ = locator.getProperty(ELEMENT); text$ = locator.getProperty(JTextEditor.TEXT); System.out.println("EntityEditor:response:text=" + text$); if (Locator.LOCATOR_TRUE.equals(locator.getProperty(JTextEditor.IS_BASE64))) { byte[] ba = Base64.decodeBase64(text$); text$ = new String(ba, "UTF-8"); // System.out.println("EntityEditor:response:decoded text="+text$); } String cellField$ = locator.getProperty(CELL_FIELD); String core$ = locator.getProperty(CORE_NAME); Core core; if ("attributes".equals(element$)) core = entity.getAttribute(core$); else core = entity.getElementItem(element$, core$); if (core == null) // System.out.println("EntityEditor:response:cannot find core="+core$); if (CELL_FIELD_TYPE.equals(cellField$)) core.type = text$; else if (CELL_FIELD_NAME.equals(cellField$)) core.name = text$; else if (CELL_FIELD_VALUE.equals(cellField$)) core.value = text$; if ("attributes".equals(element$)) entity.putAttribute(core); else entity.putElementItem(element$, core); entigrator.save(entity); System.out.println("EntityEditor:response:entity saved"); locator$ = Locator.append(locator$, Locator.LOCATOR_TITLE, "Edit"); locator$ = Locator.append(locator$, EntityHandler.ENTITY_ACTION, JEntityEditor.ENTITY_EDIT); locator$ = Locator.append(locator$, BaseHandler.HANDLER_CLASS, JEntityEditor.class.getName()); locator$ = Locator.append(locator$, ELEMENT, element$); JConsoleHandler.execute(console, locator$); } } catch (Exception e) { LOGGER.severe(e.toString()); } }
From source file:gdt.jgui.entity.webset.JWeblinkEditor.java
/** * Execute the response locator.//ww w . j a va 2 s . c o m * @param console the main console. * @param locator$ the response locator. * */ @Override public void response(JMainConsole console, String locator$) { // System.out.println("WeblinksEditor:response:"+Locator.remove(locator$,Locator.LOCATOR_ICON )); try { Properties locator = Locator.toProperties(locator$); String action$ = locator.getProperty(JRequester.REQUESTER_ACTION); entihome$ = locator.getProperty(Entigrator.ENTIHOME); Entigrator entigrator = console.getEntigrator(entihome$); String text$ = locator.getProperty(JTextEditor.TEXT); if (ACTION_NEW_ENTITY.equals(action$)) { Sack newEntity = entigrator.ent_new("webset", text$); newEntity.createElement("fhandler"); newEntity.putElementItem("fhandler", new Core(null, WebsetHandler.class.getName(), null)); newEntity.putAttribute(new Core(null, "icon", "globe.png")); entigrator.save(newEntity); String icons$ = entihome$ + "/" + Entigrator.ICONS; Support.addHandlerIcon(JEntitiesPanel.class, "globe.png", icons$); newEntity = entigrator.ent_reindex(newEntity); reindex(console, entigrator, newEntity); JEntityFacetPanel efp = new JEntityFacetPanel(); String efpLocator$ = efp.getLocator(); efpLocator$ = Locator.append(efpLocator$, Locator.LOCATOR_TITLE, newEntity.getProperty("label")); efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, newEntity.getKey()); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_LABEL, newEntity.getProperty("label")); JEntityPrimaryMenu.reindexEntity(console, efpLocator$); Stack<String> s = console.getTrack(); s.pop(); console.setTrack(s); JConsoleHandler.execute(console, efpLocator$); return; } if (ACTION_SET_ICON.equals(action$)) { //System.out.println("WeblinkEditor:response:set icon:locator="+locator$); try { String iconFile$ = locator.getProperty(JIconSelector.ICON); // System.out.println("WeblinkEditor:response:set icon="+iconFile$); String icon$ = entigrator.readIconFromIcons(iconFile$); //icon$=IconSelector.resize16in24(getBackground(), icon$); Sack entity = entigrator.getEntityAtKey(entityKey$); entity.putElementItem("web.icon", new Core(null, webLinkKey$, icon$)); entigrator.save(entity); locator$ = Locator.remove(locator$, BaseHandler.HANDLER_METHOD); locator$ = Locator.remove(locator$, JRequester.REQUESTER_ACTION); JConsoleHandler.execute(console, locator$); } catch (Exception ee) { Logger.getLogger(getClass().getName()).info(ee.toString()); } return; } if (ACTION_ENCODE_PASSWORD.equals(action$)) { //System.out.println("WeblinkEditor:response:set icon:locator="+locator$); try { Sack entity = entigrator.getEntityAtKey(entityKey$); Core login = entity.getElementItem("web.login", webLinkKey$); if (login == null) { if (!entity.existsElement("web.login")) entity.createElement("web.login"); login = new Core(null, webLinkKey$, text$); } else login.value = text$; entity.putElementItem("web.login", login); entigrator.save(entity); locator$ = Locator.remove(locator$, BaseHandler.HANDLER_METHOD); locator$ = Locator.remove(locator$, JRequester.REQUESTER_ACTION); JConsoleHandler.execute(console, locator$); } catch (Exception ee) { Logger.getLogger(getClass().getName()).info(ee.toString()); } return; } } catch (Exception e) { Logger.getLogger(getClass().getName()).severe(e.toString()); } }
From source file:gdt.jgui.entity.fields.JFieldsEditor.java
/** * Execute the response locator./*from w ww. ja v a2 s . com*/ * @param console the main console. * @param locator$ the response locator. */ @Override public void response(JMainConsole console, String locator$) { // System.out.println("FieldsEditor:response:"+Locator.remove(locator$,Locator.LOCATOR_ICON )); try { Properties locator = Locator.toProperties(locator$); String action$ = locator.getProperty(JRequester.REQUESTER_ACTION); entihome$ = locator.getProperty(Entigrator.ENTIHOME); Entigrator entigrator = console.getEntigrator(entihome$); String text$ = locator.getProperty(JTextEditor.TEXT); if (ACTION_NEW_ENTITY.equals(action$)) { Sack newEntity = entigrator.ent_new("fields", text$); newEntity.createElement("field"); newEntity.putElementItem("field", new Core(null, "Name", "Value")); newEntity.createElement("fhandler"); newEntity.putElementItem("fhandler", new Core(null, FieldsHandler.class.getName(), null)); newEntity.putAttribute(new Core(null, "icon", "fields.png")); entigrator.save(newEntity); String icons$ = entihome$ + "/" + Entigrator.ICONS; Support.addHandlerIcon(getClass(), "fields.png", icons$); newEntity = entigrator.ent_reindex(newEntity); // newEntity.print(); reindex(console, entigrator, newEntity); JEntityFacetPanel efp = new JEntityFacetPanel(); String efpLocator$ = efp.getLocator(); efpLocator$ = Locator.append(efpLocator$, Locator.LOCATOR_TITLE, newEntity.getProperty("label")); efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, newEntity.getKey()); efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_LABEL, newEntity.getProperty("label")); JEntityPrimaryMenu.reindexEntity(console, efpLocator$); Stack<String> s = console.getTrack(); s.pop(); console.setTrack(s); JConsoleHandler.execute(console, efpLocator$); return; } String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY); Sack entity = entigrator.getEntityAtKey(entityKey$); String cellField$ = locator.getProperty(CELL_FIELD); String name$ = locator.getProperty(CELL_FIELD_NAME); Core core = entity.getElementItem("field", name$); if (CELL_FIELD_NAME.equals(cellField$)) core.name = text$; else if (CELL_FIELD_VALUE.equals(cellField$)) core.value = text$; // System.out.println("FieldsEditor:response:name="+core.name+" value="+core.value); entity.putElementItem("field", core); entigrator.save(entity); String feLocator$ = getLocator(); feLocator$ = Locator.append(locator$, Entigrator.ENTIHOME, entihome$); feLocator$ = Locator.append(locator$, EntityHandler.ENTITY_KEY, entityKey$); feLocator$ = Locator.remove(feLocator$, BaseHandler.HANDLER_METHOD); JConsoleHandler.execute(console, feLocator$); } catch (Exception e) { LOGGER.severe(e.toString()); } }