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); }
@Override public void orgUpdate(String orgID, int col, D_Organization org) { if (DEBUG) System.out.println("ConstituentsTest:orgUpdate: id=" + orgID + " col=" + col); long _orgID = -1; if (orgID != null) { _orgID = new Integer(orgID).longValue(); if (org == null) org = D_Organization.getOrgByLID_NoKeep(orgID, true); if (org == null) _orgID = -1; } else { if (org != null) _orgID = org.getLID_forced(); } try { this.setOrg(_orgID, org); } catch (P2PDDSQLException e) { e.printStackTrace(); } }
public static void _main(String args[]) throws P2PDDSQLException { net.ddp2p.java.db.Vendor_JDBC_EMAIL_DB.initJDBCEmail(); Application.setDB(new DBInterface(Application.DELIBERATION_FILE)); System.out.println("D_Organization: main: prog pID, verify, sign, store"); long pID = Long.parseLong(args[0]); int verif = Integer.parseInt(args[1]); int sign = Integer.parseInt(args[2]); int store = Integer.parseInt(args[3]); /* HandlingMyself_Peer.loadIdentity(null); D_Organization me = HandlingMyself_Peer.getPeer(Identity.current_peer_ID); System.out.println("D_Organization: main: me= "+me); HandlingMyself_Peer.setMyself(me, false); */ // D_Organization d = D_Organization.getPeerByLID(1, true); // System.out.println("D_Organization: main:read(1) "+d); D_Organization d2 = D_Organization.getOrgByLID_NoKeep(pID, true); // System.out.println("D_Organization: main: cache="+dumpDirCache()); System.out.println("\nD_Organization: main: d[" + pID + "]=" + d2); if (d2 == null) { System.out.println("D_Organization: no d2=: " + d2); return; } // System.out.println("\nD_Organization: main 1: ********\n"); // d2.verifySignature(); // System.out.println("\nD_Organization: main 2: ********\n"); // d2.sign(); System.out.println("\nD_Organization: main 3: ********\n"); if (verif > 0) { boolean r = d2.verifySignature(); System.out.println("\nD_Organization: main 3: verif result=" + r); } if (sign > 0) { d2.sign(); boolean r2 = d2.verifySignature(); System.out.println("\nD_Organization: main 4: verif result=" + r2); } if (store > 0) d2.storeSynchronouslyNoException(); }