/** *
Title:
*Description:
*Copyright: Copyright (C) 2011
*Company: VCI
* @author Bear * @time 2011-7-29 * @version 1.0 */ package com.vci.client.framework.systemConfig.stafforgmanage; import java.awt.BorderLayout; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import com.vci.client.LogonApplication; import com.vci.client.common.objects.DeptObject; import com.vci.client.common.objects.RoleObject; import com.vci.client.common.objects.UserObject; import com.vci.client.framework.delegate.RightManagementClientDelegate; import com.vci.client.framework.systemConfig.object.UserCompInfoObject; import com.vci.client.framework.util.ClientHelper; import com.vci.client.framework.util.RightControlUtil; import com.vci.client.ui.exception.VCIException; import com.vci.client.ui.swing.VCIOptionPane; import com.vci.client.ui.table.ChoiceColumnTable; import com.vci.client.ui.table.VCIBaseTableModel; import com.vci.client.ui.table.VCIBaseTableNode; public class DisplayTablePanel extends JPanel { /** * */ private static final long serialVersionUID = -2763155025351308165L; private String[] columns = {}; private Class[] classes = {}; private VCIBaseTableModel tableModel = null; private ChoiceColumnTable choiseTable = null; private JTable table = null; public DisplayTablePanel(){ init(); } private void init(){ initControl(); } private void initControl(){ initTable(); } private void initTable(){ columns = new String[5]; classes = new Class[5]; columns[0] = ""; classes[0] = String.class; columns[1] = "部门"; classes[1] = String.class; columns[2] = "用户名"; classes[2] = String.class; columns[3] = "真实姓名"; classes[3] = String.class; columns[4] = "角色"; classes[4] = String.class; tableModel = new VCIBaseTableModel(columns, classes); choiseTable = new ChoiceColumnTable(tableModel); JScrollPane jspTable = choiseTable.createChoiceColumnTable(); this.setLayout(new BorderLayout()); this.add(jspTable, BorderLayout.CENTER); table = choiseTable.getPropertyTable(); } private void fillTable(UserCompInfoObject[] objs){ tableModel.list.clear(); for(UserCompInfoObject obj:objs){ VCIBaseTableNode tableNode = new VCIBaseTableNode(obj); String deptName = obj.getDeptObj()== null ? "" : obj.getDeptObj().getName(); tableNode.setPropertyValueByName(columns[1], deptName); tableNode.setPropertyValueByName(columns[2], obj.getUserObj().getUserName()); tableNode.setPropertyValueByName(columns[3], obj.getUserObj().getTrueName()); tableNode.setPropertyValueByName(columns[4], obj.getRoleObj()); tableModel.addRow(tableModel.getRowCount(), tableNode); } tableModel.fireTableDataChanged(); } public String getI18nString(String spCode){ return ClientHelper.getI18nStringForFramework(this.getClass().getName() + "." + spCode, this.getLocale()); } /** * 返回数据的 JTable 对象 * @return */ public JTable getJTable(){ return table; } /** * 返回数据的 TableModel 对象 * @return */ public VCIBaseTableModel getTableModel(){ return tableModel; } /** * 返回表格选择的数据行的索引 * @return */ public int[] getSelectedRowIndexs(){ return choiseTable.getPropertyTableSelectedRows(); } /** * 加载用户信息 * @param exportTempId */ public int reloadUserCompList(String id,String type,String name){ List