dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.vci.client.framework.appConfig;
 
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.util.LinkedHashMap;
import java.util.LinkedList;
 
import javax.swing.JScrollPane;
import javax.swing.border.TitledBorder;
 
import com.vci.client.framework.appConfig.object.AppConfigCategoryObject;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.swing.VCISwingUtil;
import com.vci.client.ui.swing.components.VCIJButton;
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.swing.components.table.VCIJTablePanel;
 
public class AppConfigCategoryPanel extends VCIJPanel{
 
    /**
     * 
     */
    private static final long serialVersionUID = 8718243318609088441L;
 
    private AppConfigModulePanel ownerPanel = null;
    
    private VCIJTablePanel<AppConfigCategoryObject> tablePanel = null;
    private AppConfigCategoryDataProvider dataProvider = null;
    private VCIJButton addButton = null;
    private VCIJButton editButton = null;
    private VCIJButton deleteButton = null;
    private LinkedList<VCIJButton> selfCustomButtons = new LinkedList<VCIJButton>();
    private JScrollPane jsp = new JScrollPane();
    
    public AppConfigCategoryPanel(AppConfigModulePanel ownerPanel) {
        this.ownerPanel = ownerPanel;
        init();
    }
    
    private void init(){
        this.setLayout(new BorderLayout());
        this.setBorder(new TitledBorder("配置项分类管理"));
        
        initSelfButton();
        VCIJPanel mainPannel = initMainPanl();
        jsp.getViewport().add(mainPannel);
 
        this.add(jsp, BorderLayout.CENTER);
    }
    
    private void initSelfButton() {
        AppConfigCategoryPanelActionListener listener = new AppConfigCategoryPanelActionListener(this);
        addButton = VCISwingUtil.createVCIJButton("create",
                LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.addButton",
                        "RMIPFramework", getLocale()), LocaleDisplay.getI18nString(
                        "rmip.framework.systemFunctionTree.modelManagment.addButton", "RMIPFramework", getLocale()),
                "create.gif", listener);
        editButton = VCISwingUtil.createVCIJButton("edit",
                LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.modifyButton",
                        "RMIPFramework", getLocale()), LocaleDisplay.getI18nString(
                        "rmip.framework.systemFunctionTree.modelManagment.modifyButton", "RMIPFramework", getLocale()),
                "modify.gif", listener);
        deleteButton = VCISwingUtil.createVCIJButton("delete",
                LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.deleteButton",
                        "RMIPFramework", getLocale()), LocaleDisplay.getI18nString(
                        "rmip.framework.systemFunctionTree.modelManagment.deleteButton", "RMIPFramework", getLocale()),
                "delete.gif", listener);
        
        selfCustomButtons.add(addButton);
        selfCustomButtons.add(editButton);
        selfCustomButtons.add(deleteButton);
    }
    
    public VCIJPanel initMainPanl() {
        dataProvider = new AppConfigCategoryDataProvider(this);
        tablePanel = new VCIJTablePanel<AppConfigCategoryObject>(dataProvider);
        int startIndex = dataProvider.getDataColumnStartIndex();
        LinkedHashMap<Integer, Integer> widthMaps = new LinkedHashMap<Integer, Integer>();
        widthMaps.put(startIndex++, 400);
        widthMaps.put(startIndex++, 400);
        
        tablePanel.setShowProgressBar(false);
        tablePanel.setColumnWidthMaps(widthMaps);
        tablePanel.setShowPaging(false);
        tablePanel.setCustomButtons(selfCustomButtons);
        tablePanel.setCustomButtonFlowAlign(FlowLayout.CENTER);
        tablePanel.setPageButtonFlowAlign(FlowLayout.CENTER);
        tablePanel.buildTablePanel();
        tablePanel.refreshTableData();
        return tablePanel;
    }
    
    public VCIJTablePanel<AppConfigCategoryObject> getTablePanel() {
        return tablePanel;
    }
    
    public AppConfigModulePanel getOwnerPanel() {
        return this.ownerPanel;
    }
}