Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (DEBUG) System.out.println("ConstituentsPanel:action Refresh \n" + e);
   if (e.getSource() == this.refresh_button) {
     if (!this.refresh_button.isEnabled()) return;
     // disableRefresh();
     if (tree == null) return;
     ConstituentsModel model = tree.getModel();
     if (model == null) return;
     try {
       model.doRefreshAll();
       /*
       Object oldRoot = model.getRoot();
       model.init(model.getOrganizationID(), model.getConstituentIDMyself(), model.getConstituentGIDMyself(), model.getOrganization());
       model.fireTreeStructureChanged(new TreeModelEvent(tree,new Object[]{model.root}));
       model.refresh(new JTree[]{tree}, oldRoot);
       model.runCensus();
       	 */
     } catch (P2PDDSQLException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
   }
 }