田源
2025-01-09 8a166a60cfd1a2e593ffa103d10c0dc224fc8628
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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<String, InnerStruct> map = getActionMap();
        if(map.containsKey(key)){
            boa = map.get(key).getAction();
        }
        return boa;
    }
    
    public static String getActionIcon(String key){
        String icon = "";
        HashMap<String, InnerStruct> map = getActionMap();
        if(map.containsKey(key)){
            icon = map.get(key).getIcon();
        }
        return icon;
    }
    
    private static HashMap<String, InnerStruct> getActionMap(){
        BOAFactory boaf = new BOAFactory();
        HashMap<String, InnerStruct> map = new HashMap<String, BOAFactory.InnerStruct>();
        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;
        }
    }
}