public ConstituentsPanel( DBInterface db, int _organizationID, int _constituentID, String _global_constituentID) { super(new BorderLayout()); MainFrame.status.addOrgStatusListener(this); // Application.orgs.addListener(this); if (_organizationID < 0) return; org_label.setText(getLabelText()); refresh_button.addActionListener(this); // refresh_button.setEnabled(false); disableRefresh(); add(getNorthComponent(), BorderLayout.NORTH); // _organizationID = 100; // _constituentID = 100; // String _global_constituentID = "global_ID_Test"; constituentID = _constituentID; organizationID = _organizationID; global_constituentID = _global_constituentID; D_Organization org = null; if (organizationID > 0) try { org = D_Organization.getOrgByLID_NoKeep(organizationID, true); } catch (Exception e) { e.printStackTrace(); return; } ConstituentsModel cm = new ConstituentsModel( db, _organizationID, _constituentID, _global_constituentID, org, this); tree = new ConstituentsTree(cm); long cID = cm.getConstituentIDMyself(); cm.expandConstituentID(tree, ((cID <= 0) ? null : ("" + cID)), true); JScrollPane scrollPane = new JScrollPane(tree); scrollPane.setPreferredSize(new Dimension(200, 200)); add(scrollPane, BorderLayout.CENTER); }
public void setOrg(long _orgID, D_Organization org) throws P2PDDSQLException { if (DEBUG) System.out.println("ConstituentsTest:setOrg: id=" + _orgID); organization = org; if (tree != null) { tree.clean(); } organizationID = _orgID; constituentID = net.ddp2p.common.config.Identity.getDefaultConstituentIDForOrg(organizationID); global_constituentID = D_Constituent.getGIDFromLID(constituentID); if (global_constituentID == null) { constituentID = -1; MainFrame.status.setMeConstituent(null); } else { MainFrame.status.setMeConstituent(D_Constituent.getConstByLID(constituentID, true, false)); } ConstituentsModel cm = new ConstituentsModel( Application.db, organizationID, constituentID, global_constituentID, org, this); tree = new ConstituentsTree(cm); long cID = cm.getConstituentIDMyself(); cm.expandConstituentID(tree, ((cID <= 0) ? null : ("" + cID)), true); JScrollPane scrollPane = new JScrollPane(tree); scrollPane.setPreferredSize(new Dimension(200, 200)); this.removeAll(); if (org_label != null) { org_label.setText(getLabelText()); add(getNorthComponent(), BorderLayout.NORTH); disableRefresh(); this.refresh_button.addActionListener(this); // add(org_label, BorderLayout.NORTH); } add(scrollPane, BorderLayout.CENTER); }