01: package org.osbl.orga.gui;
02:
03: import javax.swing.*;
04:
05: import org.osbl.orga.logic.OrgaStructureLogic;
06: import org.osbl.orga.model.*;
07: import org.osbl.ServiceProvider;
08: import org.osbl.persistence.Persistence;
09: import org.osbl.client.wings.form.GenericObjectTreeModel;
10:
11: /**
12: * @author hengels
13: * @version $Revision$
14: */
15: public class OrgaTreeModel extends GenericObjectTreeModel {
16: Persistence persistence = (Persistence) ServiceProvider
17: .getInstance().getService("OrgaPersistence");
18: OrgaStructureLogic orgaStructureLogic = (OrgaStructureLogic) ServiceProvider
19: .getInstance().getService("OrgaStructureLogic");
20:
21: {
22: map.put(Organisation.class, OrganisationTreeNode.class);
23: map.put(Group.class, GroupTreeNode.class);
24: map.put(Membership.class, MembershipTreeNode.class);
25: }
26:
27: public OrgaTreeModel() {
28: super (new OrganisationsTreeNode("Root"));
29: getRoot().setModel(this );
30: }
31:
32: public OrgaStructureLogic getTreeLogic() {
33: return orgaStructureLogic;
34: }
35:
36: public Persistence getPersistence() {
37: return persistence;
38: }
39:
40: private ComboBoxModel orgaListModel;
41:
42: public ComboBoxModel getOrgaListModel() {
43: if (orgaListModel == null) {
44: orgaListModel = new OrgaListModel(
45: (OrganisationsTreeNode) getRoot());
46: }
47: return orgaListModel;
48: }
49: }
|