001: package org.osbl.inventory.gui;
002:
003: import org.osbl.ItemRegistry;
004: import org.osbl.plugin.PluginManager;
005: import org.osbl.plugin.Extension;
006: import org.osbl.client.wings.action.*;
007: import org.osbl.client.wings.navigation.NavigationStructure;
008: import org.osbl.client.wings.form.Editors;
009: import org.osbl.client.action.ActionRegistry;
010: import org.osbl.client.web.spring.SpringWebModule;
011: import org.osbl.inventory.model.*;
012: import org.osbl.item.BeanAuthorizationCollector;
013: import org.osbl.item.BeanLocalizationCollector;
014:
015: public class InventoryWebModule extends SpringWebModule {
016: PluginManager pluginManager;
017: ItemRegistry authorizationItems;
018: ItemRegistry localizationItems;
019:
020: public void setPluginManager(PluginManager pluginManager) {
021: this .pluginManager = pluginManager;
022: }
023:
024: public void setAuthorizationItems(ItemRegistry authorizationItems) {
025: this .authorizationItems = authorizationItems;
026: }
027:
028: public void setLocalizationItems(ItemRegistry localizationItems) {
029: this .localizationItems = localizationItems;
030: }
031:
032: public void initialize() {
033: authorizationItems.addItems(new BeanAuthorizationCollector(
034: Employee.class));
035: authorizationItems.addItems(new BeanAuthorizationCollector(
036: Location.class));
037: authorizationItems.addItems(new BeanAuthorizationCollector(
038: Supplier.class));
039: authorizationItems.addItems(new BeanAuthorizationCollector(
040: CostCenter.class));
041: authorizationItems.addItems(new BeanAuthorizationCollector(
042: CostType.class));
043: authorizationItems.addItems(new BeanAuthorizationCollector(
044: CostTypeHierarchy.class));
045: authorizationItems.addItems(new BeanAuthorizationCollector(
046: Inventory.class));
047: authorizationItems.addItems(new BeanAuthorizationCollector(
048: Allocation.class));
049:
050: localizationItems.addItems(new BeanLocalizationCollector(
051: Employee.class));
052: localizationItems.addItems(new BeanLocalizationCollector(
053: Location.class));
054: localizationItems.addItems(new BeanLocalizationCollector(
055: Supplier.class));
056: localizationItems.addItems(new BeanLocalizationCollector(
057: CostCenter.class));
058: localizationItems.addItems(new BeanLocalizationCollector(
059: CostType.class));
060: localizationItems.addItems(new BeanLocalizationCollector(
061: CostTypeHierarchy.class));
062: localizationItems.addItems(new BeanLocalizationCollector(
063: Inventory.class));
064: localizationItems.addItems(new BeanLocalizationCollector(
065: Allocation.class));
066:
067: pluginManager.registerExtension(new Extension(
068: "EmployeeSubForm", "org.osbl.identity.subForm",
069: EmployeeSubForm.class));
070: pluginManager.registerExtension(new Extension(
071: "SupplierSubForm", "org.osbl.identity.subForm",
072: SupplierSubForm.class));
073: pluginManager.registerExtension(new Extension(
074: "CostCenterSubForm", "org.osbl.identity.subForm",
075: CostCenterSubForm.class));
076:
077: Editors.registerEditor(CostTypeHierarchy.class,
078: CostTypeEditor.class);
079: Editors.registerEditor(CostType.class, CostTypeEditor.class);
080: Editors.registerEditor(Location.class, LocationEditor.class);
081: Editors.registerEditor(Inventory.class, InventoryEditor.class);
082:
083: ActionRegistry.registerAction(new ShowEditorAction(
084: CostType.class,
085: "org.osbl.inventory.actions.manageCostTypes"));
086: ActionRegistry.registerAction(new ShowEditorAction(
087: Location.class,
088: "org.osbl.inventory.actions.manageLocations"));
089: ActionRegistry.registerAction(new ShowEditorAction(
090: Inventory.class,
091: "org.osbl.inventory.actions.manageInventories"));
092:
093: NavigationStructure navigationStructure = NavigationStructure
094: .getInstance();
095: navigationStructure.addAction("inventory",
096: "org.osbl.inventory.actions.manageCostTypes");
097: navigationStructure.addAction("inventory",
098: "org.osbl.inventory.actions.manageLocations");
099: navigationStructure.addAction("inventory",
100: "org.osbl.inventory.actions.manageInventories");
101: }
102: }
|