public void initPlugin(PluginNode pNode, PluginConfig pConfig) throws Exception { con = (DMConnection) pNode.getSingleApi(DMConnection.class); timer = ((ApiSystem) pNode.getSingleApi(ApiSystem.class)).getTimer(); node = pNode; initUI(); node.addApi(ApiObjectChanged.class, this); try { ((ApiLayout) pNode.getSingleApi(ApiLayout.class)).setComponent(this, pConfig.getNode()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (pConfig.getNode().getAttribute("listen").indexOf("_obj.hotselect_") >= 0) { initHotSelectMenu(pNode, pConfig, this); pNode.addApi(ApiObjectHotSelect.class, this); } if (pConfig.getNode().getAttribute("listen").indexOf("_obj.last_") >= 0) { IDfPersistentObject obj = con.getPersistentObject(pConfig.getProperty("objid")); show(con, (IDfSysObject) obj); } findCabinets(); }
public void selectionCanceled() { final ApiObjectHotSelect[] list = (ApiObjectHotSelect[]) node.getApi(ApiObjectHotSelect.class); if (list == null) return; for (int i = 0; i < list.length; i++) try { if (!list[i].equals(TreePlugin.this)) list[i].apiObjectDepricated(); } catch (Throwable t) { t.printStackTrace(); } timer.schedule( new TimerTask() { public void run() { for (int i = 0; i < list.length; i++) try { if (!list[i].equals(TreePlugin.this)) list[i].apiObjectHotSelected(con, null, null); } catch (Throwable t) { t.printStackTrace(); } } }, 1); }
private void actionHotSelect() { // combo.setEnabled( false ); try { treepanel.removeAll(); treepanel.add(new JLabel("Loading...", LUF.DOT_RED, JLabel.CENTER)); addWorkInProgress(); treepanel.revalidate(); treepanel.repaint(); // String folderName = (String)combo.getSelectedItem(); IDfId folderId = null; /* * if ( !"[All]".equals( folderName ) ) { IDfFolder folder = * con.getSession().getFolderByPath( folderName ); if( folder == * null ) { * System.out.println("Folder or cabinet does not exist in the Docbase!" * ); return; } folderId = folder.getObjectId(); } */ tree = new ContentTree(con, folderId, timer, (ApiTypes) node.getSingleApi(ApiTypes.class), this); tree.setShowDocuments(showDocuments); treepanel.removeAll(); removeWorkInProgress(); treepanel.add(tree, BorderLayout.CENTER); } catch (Exception ex) { ex.printStackTrace(); } // combo.setEnabled( true ); treepanel.revalidate(); treepanel.repaint(); }
public void initPlugin(PluginNode pNode, PluginConfig pConfig) throws Exception { node = pNode; con = (DMConnection) pNode.getSingleApi(DMConnection.class); config = pConfig; initUI(); ((ApiLayout) pNode.getSingleApi(ApiLayout.class)).setComponent(this, pConfig.getNode()); if (pConfig.getNode().getAttribute("listen").indexOf("_obj.hotselect_") >= 0) { pNode.addApi(ApiObjectHotSelect.class, this); } if (pConfig.getNode().getAttribute("listen").indexOf("_obj.last_") >= 0) { IDfPersistentObject obj = con.getPersistentObject(pConfig.getProperty("objid")); actionShow(obj); } }
public void show(DMConnection pCon, IDfSysObject obj) { con = pCon; try { findCabinets(); treepanel.removeAll(); ContentTree tree = new ContentTree( con, obj.getObjectId(), timer, (ApiTypes) node.getSingleApi(ApiTypes.class), this); treepanel.add(tree, BorderLayout.CENTER); } catch (Exception ex) { ex.printStackTrace(); } treepanel.revalidate(); treepanel.repaint(); }
public void destroyPlugin() throws Exception { node.removeApi(this); destroyHotSelectMenu(); }
public void selectedEvent(NodeValue[] value, int mode, JComponent src, int x, int y) { try { if (value == null) { if (mode == Listener.MODE_HOT_SELECT) { ApiObjectHotSelect[] list = (ApiObjectHotSelect[]) node.getApi(ApiObjectHotSelect.class); if (list == null) return; for (int i = 0; i < list.length; i++) try { list[i].apiObjectHotSelected(con, null, null); } catch (Throwable t) { t.printStackTrace(); } } return; } final IDfPersistentObject[] obj = new IDfPersistentObject[value.length]; final IDfPersistentObject[] parents = new IDfPersistentObject[value.length]; for (int i = 0; i < value.length; i++) { obj[i] = con.getPersistentObject(value[i].getId()); if (value[i].getParentId() != null) parents[i] = con.getPersistentObject(value[i].getParentId()); } if (mode == Listener.MODE_HOT_SELECT) { final ApiObjectHotSelect[] list = (ApiObjectHotSelect[]) node.getApi(ApiObjectHotSelect.class); if (list == null) return; for (int i = 0; i < list.length; i++) try { if (!list[i].equals(TreePlugin.this)) list[i].apiObjectDepricated(); } catch (Throwable t) { t.printStackTrace(); } timer.schedule( new TimerTask() { public void run() { for (int i = 0; i < list.length; i++) try { if (!list[i].equals(TreePlugin.this)) list[i].apiObjectHotSelected(con, parents, obj); } catch (Throwable t) { t.printStackTrace(); } } }, 1); } else if (mode == Listener.MODE_SELECT) { /* * final ApiObjectSelect[] list = * (ApiObjectSelect[])node.getApi( ApiObjectSelect.class ); if ( * list == null ) return; * * timer.schedule( new TimerTask() { * * public void run() { for ( int i = 0; i < list.length; i++ ) * try { list[i].apiObjectSelected( con, obj ); } catch ( * Throwable t ) { t.printStackTrace(); } } * * },1); */ } else if (mode == Listener.MODE_MENU) { ObjectWorkerTool.showMenu(node, con, obj, src, x, y); } } catch (DfException e) { e.printStackTrace(); } }