package com.vci.client.uif.actions.client; import java.util.HashMap; public final class BOAFactory { private BOAFactory(){ } public static BusinessOperationAction getAction(String key){ BusinessOperationAction boa = null; HashMap map = getActionMap(); if(map.containsKey(key)){ boa = map.get(key).getAction(); } return boa; } public static String getActionIcon(String key){ String icon = ""; HashMap map = getActionMap(); if(map.containsKey(key)){ icon = map.get(key).getIcon(); } return icon; } private static HashMap getActionMap(){ BOAFactory boaf = new BOAFactory(); HashMap map = new HashMap(); boaf.new InnerStruct(null, ""); map.put(BusinessOperationAction.ADD, boaf.new InnerStruct(new AddAction(), "add.png")); map.put(BusinessOperationAction.EDIT, boaf.new InnerStruct(new EditAction(), "edit.png")); map.put(BusinessOperationAction.DEL, boaf.new InnerStruct(new DeleteAction(), "delete.png")); map.put(BusinessOperationAction.REMOVE, boaf.new InnerStruct(new RemoveAction(), "remove.gif")); map.put(BusinessOperationAction.COPY, boaf.new InnerStruct(new CopyAction(), "copy.gif")); map.put(BusinessOperationAction.PASTE, boaf.new InnerStruct(new PasteAction(), "paste.gif")); map.put(BusinessOperationAction.CUT, boaf.new InnerStruct(new CutAction(), "cut.png")); map.put(BusinessOperationAction.DOWNLOAD, boaf.new InnerStruct(new DownloadAction(), "download.png")); map.put(BusinessOperationAction.REVISION, boaf.new InnerStruct(new RevisionAction(), "arrow_divide.png")); map.put(BusinessOperationAction.TRANSFER, boaf.new InnerStruct(new TransferAction(), "arrow_switch.png")); map.put(BusinessOperationAction.BROWSER, boaf.new InnerStruct(new BrowserAction(), "pause.png")); map.put(BusinessOperationAction.CHOOSE, boaf.new InnerStruct(new ChooseAction(), "add.png")); map.put(BusinessOperationAction.CHOOSE_DOC, boaf.new InnerStruct(new ChooseDocAction(), "plugin.png")); map.put(BusinessOperationAction.ADD_SAVE, boaf.new InnerStruct(new AddAction(), "save.png")); map.put(BusinessOperationAction.EDIT_SAVE, boaf.new InnerStruct(new EditAction(), "save.png")); map.put(BusinessOperationAction.CLOSE_ADD_OR_EDIT_DIALOG, boaf.new InnerStruct(new EditAction(), "cancel.png")); map.put("close", boaf.new InnerStruct(new EditAction(), "cancel.png")); map.put("statistic", boaf.new InnerStruct(new ChooseDocAction(), "chart_bar.png")); map.put("import", boaf.new InnerStruct(new ChooseDocAction(), "import.png")); map.put("export", boaf.new InnerStruct(new ChooseDocAction(), "export.png")); return map; } class InnerStruct{ BusinessOperationAction action = null; String icon = ""; public InnerStruct(BusinessOperationAction action, String icon) { super(); this.action = action; this.icon = icon; } public BusinessOperationAction getAction() { return action; } public void setAction(BusinessOperationAction action) { this.action = action; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } } }