package com.vci.client.framework.appConfig;
|
|
import java.awt.BorderLayout;
|
import java.awt.Dimension;
|
import java.awt.FlowLayout;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.util.LinkedHashMap;
|
import java.util.LinkedList;
|
import java.util.Locale;
|
|
import javax.swing.JComboBox;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import javax.swing.JScrollPane;
|
import javax.swing.border.TitledBorder;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.framework.appConfig.object.AppConfigCategoryObject;
|
import com.vci.client.framework.appConfig.object.AppConfigDetailObject;
|
import com.vci.client.framework.delegate.AppConfigCategoryClientDelegate;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.client.ui.locale.LocaleDisplay;
|
import com.vci.client.ui.swing.VCIOptionPane;
|
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 AppConfigDetailPanel extends VCIJPanel implements IConfigDetailPanel{
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 538726303706205608L;
|
|
private VCIJTablePanel<AppConfigDetailObject> tablePanel = null;
|
private AppConfigDetailDataProvider dataProvider = null;
|
private JComboBox clsfCombo;
|
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 AppConfigDetailPanel() {
|
init();
|
}
|
|
private void init(){
|
this.setLayout(new BorderLayout());
|
this.setBorder(new TitledBorder("配置项管理"));
|
|
JPanel topPanel = new JPanel();//上面的PANEL
|
topPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
|
JLabel ruleLabel = new JLabel("请选择分类:");
|
ruleLabel.setPreferredSize(new Dimension(80,25));
|
clsfCombo = new JComboBox();//选择系统下拉框
|
initClsfCombo();
|
clsfCombo.addActionListener(new ActionListener(){
|
|
@Override
|
public void actionPerformed(ActionEvent arg0) {
|
tablePanel.refreshTableData();
|
}});
|
|
clsfCombo.setPreferredSize(new Dimension(150,25));
|
topPanel.add(ruleLabel);
|
topPanel.add(clsfCombo);
|
|
initSelfButton();
|
VCIJPanel mainPannel = initMainPanl();
|
jsp.getViewport().add(mainPannel);
|
|
this.add(topPanel,BorderLayout.NORTH);
|
this.add(jsp, BorderLayout.CENTER);
|
}
|
|
private void initSelfButton() {
|
addButton = VCISwingUtil.createVCIJButton("create",
|
LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.addButton",
|
"RMIPFramework", getLocale()), LocaleDisplay.getI18nString(
|
"rmip.framework.systemFunctionTree.modelManagment.addButton", "RMIPFramework", getLocale()),
|
"create.gif", null);
|
editButton = VCISwingUtil.createVCIJButton("edit",
|
LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.modifyButton",
|
"RMIPFramework", getLocale()), LocaleDisplay.getI18nString(
|
"rmip.framework.systemFunctionTree.modelManagment.modifyButton", "RMIPFramework", getLocale()),
|
"modify.gif", null);
|
deleteButton = VCISwingUtil.createVCIJButton("delete",
|
LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.modelManagment.deleteButton",
|
"RMIPFramework", getLocale()), LocaleDisplay.getI18nString(
|
"rmip.framework.systemFunctionTree.modelManagment.deleteButton", "RMIPFramework", getLocale()),
|
"delete.gif", null);
|
AppConfigDetailPanelActionListener listener = new AppConfigDetailPanelActionListener(this);
|
addButton.addActionListener(listener);
|
editButton.addActionListener(listener);
|
deleteButton.addActionListener(listener);
|
|
selfCustomButtons.add(addButton);
|
selfCustomButtons.add(editButton);
|
selfCustomButtons.add(deleteButton);
|
}
|
|
public VCIJPanel initMainPanl() {
|
dataProvider = new AppConfigDetailDataProvider(this);
|
tablePanel = new VCIJTablePanel<AppConfigDetailObject>(dataProvider);
|
int startIndex = dataProvider.getDataColumnStartIndex();
|
LinkedHashMap<Integer, Integer> widthMaps = new LinkedHashMap<Integer, Integer>();
|
widthMaps.put(startIndex++, 200);
|
widthMaps.put(startIndex++, 200);
|
widthMaps.put(startIndex++, 600);
|
widthMaps.put(startIndex++, 300);
|
tablePanel.setColumnWidthMaps(widthMaps);
|
tablePanel.setShowPaging(true);
|
tablePanel.setCustomButtons(selfCustomButtons);
|
tablePanel.setCustomButtonFlowAlign(FlowLayout.CENTER);
|
tablePanel.setPageButtonFlowAlign(FlowLayout.CENTER);
|
tablePanel.buildTablePanel();
|
tablePanel.refreshTableData();
|
return tablePanel;
|
}
|
|
@Override
|
public String getConfigCategory() {
|
Object selObj = clsfCombo.getSelectedItem();
|
if (selObj == null) {
|
return "root";
|
} else {
|
return ((AppConfigCategoryObject)selObj).getId();
|
}
|
}
|
|
private void initClsfCombo() {
|
AppConfigCategoryObject[] objects = null;
|
try {
|
AppConfigCategoryClientDelegate delegate = new AppConfigCategoryClientDelegate(LogonApplication.getUserEntityObject());
|
objects = delegate.getAppConfigCategorys();
|
for (int i = 0; i < objects.length; i++) {
|
clsfCombo.addItem(objects[i]);
|
}
|
} catch (VCIException e) {
|
VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
|
}
|
}
|
|
@Override
|
public VCIJTablePanel<AppConfigDetailObject> getTablePanel() {
|
return this.tablePanel;
|
}
|
}
|