package com.vci.client.framework.systemConfig.stafforgmanage;
|
|
import java.awt.BorderLayout;
|
import java.awt.Color;
|
import java.awt.FlowLayout;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.io.File;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
import javax.swing.BorderFactory;
|
import javax.swing.JFileChooser;
|
import javax.swing.JPanel;
|
import javax.swing.JScrollPane;
|
import javax.swing.JTable;
|
import javax.swing.ListSelectionModel;
|
import javax.swing.border.TitledBorder;
|
import javax.swing.event.TreeExpansionEvent;
|
import javax.swing.event.TreeExpansionListener;
|
import javax.swing.tree.TreePath;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.common.VCIBasePanel;
|
import com.vci.client.common.objects.DeptObject;
|
import com.vci.client.common.objects.UserObject;
|
import com.vci.client.framework.delegate.RightManagementClientDelegate;
|
import com.vci.client.framework.rightConfig.object.FunctionObject;
|
import com.vci.client.framework.util.RightControlUtil;
|
import com.vci.client.ui.excel.ExcelFileOperation;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.client.ui.locale.LocaleDisplay;
|
import com.vci.client.ui.process.QANProcessBar;
|
import com.vci.client.ui.process.QANProcessBarFrame;
|
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.treeTable.InterfaceTreeTableModel;
|
import com.vci.client.ui.treeTable.JTreeTable;
|
import com.vci.client.ui.treeTable.TreeTableModel;
|
import com.vci.common.utility.ObjectUtility;
|
/**
|
* <p>Title: DeptTablePanel</p>
|
* <p>Description:部门管理 </p>
|
* <p>Copyright: Copyright (c) 2012</p>
|
* <p>Company: VCI</p>
|
* @author wangxl
|
* @time 2012-5-9
|
* @version 1.0
|
*/
|
public class DeptTablePanel extends VCIBasePanel {
|
|
private static final long serialVersionUID = 1L;
|
private boolean fromManualExpand = false;
|
private String[] columns = {"名称","编号","代号","专业","描述"};
|
DeptObject rootObj;
|
private Class[] colClasses = {InterfaceTreeTableModel.class,String.class,String.class,String.class,String.class} ;
|
private PLDeptInfoDataTreeModel treeTableModel = null;
|
private Object transObject = "";
|
private JTreeTable treeTable = null;
|
private TreeTableModel.TreeTableNode rootNode = null;
|
|
private VCIJButton addButton = VCISwingUtil.createVCIJButton("",LocaleDisplay.getI18nString("rmip.stafforg.operate.add", "RMIPFramework", getLocale()) ,LocaleDisplay.getI18nString("rmip.stafforg.operate.add", "RMIPFramework", getLocale()) , "create.gif",null);
|
private VCIJButton editButton = VCISwingUtil.createVCIJButton("",LocaleDisplay.getI18nString("rmip.stafforg.operate.modify", "RMIPFramework", getLocale()) ,LocaleDisplay.getI18nString("rmip.stafforg.operate.modify", "RMIPFramework", getLocale()) , "modify.gif",null);
|
private VCIJButton deleteButton = VCISwingUtil.createVCIJButton("",LocaleDisplay.getI18nString("rmip.stafforg.operate.delete", "RMIPFramework", getLocale()) ,LocaleDisplay.getI18nString("rmip.stafforg.operate.delete", "RMIPFramework", getLocale()), "delete.gif" ,null);
|
private VCIJButton btnDisplay = VCISwingUtil.createVCIJButton("", "统计","统计","group.gif",null);
|
private VCIJButton rightButton = VCISwingUtil.createVCIJButton("", "分配成员","分配成员", "user.gif" ,null);
|
private VCIJButton importButton = VCISwingUtil.createVCIJButton("import", "导入部门" ,"导入部门" , "import.gif",null);
|
private VCIJButton exportButton = VCISwingUtil.createVCIJButton("export", "导出部门模板", "导出部门模板", "export.gif", null);
|
|
public DeptTablePanel(FunctionObject funcObj){
|
super(funcObj);
|
init();
|
if(funcObj.getId() != null){
|
checkPermission();
|
}
|
}
|
|
public void init(){
|
//LogonApplication.getUserEntityObject().setModules(this.getClass().getName());
|
LogonApplication.getUserEntityObject().setModules("部门管理");
|
initControl();//添加按钮
|
initAction();//初始化按钮点击事件
|
}
|
|
private void checkPermission(){
|
checkRight(RightControlUtil.CREATE, addButton);
|
checkRight(RightControlUtil.UPDATE, editButton);
|
checkRight(RightControlUtil.DELETE, deleteButton);
|
checkRight(RightControlUtil.FREEZE, rightButton);
|
checkRight(RightControlUtil.DISCARD, btnDisplay);
|
checkRight(RightControlUtil.IMPORT, importButton);
|
checkRight(RightControlUtil.EXPORT, exportButton);
|
}
|
|
/**
|
* <p>Description:添加按钮 </p>
|
*
|
* @author wangxl
|
* @time 2012-5-10
|
*/
|
private void initControl(){
|
this.setLayout(new BorderLayout());
|
this.setBorder(new TitledBorder("部门管理"));
|
try{
|
JScrollPane jspTable = reloadTree();
|
this.add(jspTable, BorderLayout.CENTER);
|
}catch (VCIException e) {
|
VCIOptionPane.showError(LogonApplication.frame, "RMIPBom", e);
|
}
|
|
JPanel palSubmit = new JPanel();
|
palSubmit.setLayout(new FlowLayout());
|
|
palSubmit.add(addButton);
|
palSubmit.add(editButton);
|
palSubmit.add(deleteButton);
|
palSubmit.add(rightButton);
|
palSubmit.add(btnDisplay);
|
palSubmit.add(importButton);
|
palSubmit.add(exportButton);
|
palSubmit.setBorder(BorderFactory.createLineBorder(Color.gray));
|
this.add(palSubmit, BorderLayout.SOUTH);
|
}
|
|
public JScrollPane reloadTree() throws VCIException{
|
DeptObject rootDeptObj = new DeptObject();
|
treeTableModel = new PLDeptInfoDataTreeModel(transObject, columns, colClasses);
|
rootNode = treeTableModel.getRootNode();
|
rootObj = new DeptObject();
|
rootObj.setName("部门");
|
rootNode.setObj(rootObj);
|
this.loadTreeTableData(rootNode, rootDeptObj);
|
treeTable = new JTreeTable(treeTableModel);
|
treeTable.setRowHeight(25);
|
treeTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
|
treeTable.getTableHeader().setReorderingAllowed(false);
|
treeTable.getTableHeader().setResizingAllowed(true);
|
treeTable.setColumnSelectionAllowed(false);
|
treeTable.setShowGrid(true);
|
treeTable.getColumnModel().getColumn(0).setMinWidth(200);
|
treeTable.getTree().setCellRenderer(new DeptInfoTreeTableCellRender());
|
treeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
|
|
treeTable.getColumnModel().getColumn(1).setMinWidth(150);
|
treeTable.getColumnModel().getColumn(2).setMinWidth(150);
|
treeTable.getColumnModel().getColumn(3).setMinWidth(250);
|
treeTable.getColumnModel().getColumn(4).setMinWidth(250);
|
|
treeTable.getTree().addTreeExpansionListener(new TreeExpansionListener(){
|
public void treeExpanded(TreeExpansionEvent e) {
|
if(fromManualExpand) return;
|
TreePath path = e.getPath();
|
TreeTableModel.TreeTableNode tableNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
if(!tableNode.isExpand()){
|
loadSelectedTreeNodeChild(tableNode);
|
// 展开过就不再加载数据
|
tableNode.setExpand(true);
|
}
|
}
|
public void treeCollapsed(TreeExpansionEvent e) {}
|
});
|
JScrollPane jspTable = new JScrollPane();
|
jspTable.getViewport().add(treeTable);
|
return jspTable;
|
}
|
|
|
/**
|
* 事件
|
*/
|
private void initAction(){
|
addButton.addActionListener(new java.awt.event.ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
addButton_conform();
|
}
|
});
|
|
editButton.addActionListener(new java.awt.event.ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
editButton_conform();
|
}
|
});
|
|
deleteButton.addActionListener(new java.awt.event.ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
deleteButton_conform();
|
}
|
});
|
rightButton.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
rightButton_conform();
|
}
|
});
|
|
btnDisplay.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
btnDisplay_conform();
|
}
|
});
|
|
importButton.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
importButton_conform();
|
}
|
});
|
|
exportButton.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent arg0) {
|
exportButton_conform();
|
}
|
});
|
}
|
|
/**
|
* 添加事件
|
*/
|
private void addButton_conform(){
|
if (null == this.treeTable.getTree().getSelectionPaths()){
|
VCIOptionPane.showMessage(this, "请选择节点!");
|
return;
|
}
|
TreePath path = this.treeTable.getTree().getSelectionPaths()[0];
|
TreeTableModel.TreeTableNode treeNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
DeptObject parentObj =(DeptObject)treeNode.getObj();
|
DeptDialog dial = new DeptDialog(this,parentObj, "addDept");
|
dial.setDialogCallback(new Runnable() {
|
@Override
|
public void run() {
|
// TODO Auto-generated method stub
|
tableRowSelect();
|
}
|
});
|
}
|
public void tableRowSelect(){
|
treeTable.selectAll();
|
}
|
/**
|
* 修改事件
|
*/
|
private void editButton_conform(){
|
if (null == this.treeTable.getTree().getSelectionPaths()){
|
VCIOptionPane.showMessage(this, "请选择节点!");
|
return;
|
}
|
TreePath path = this.treeTable.getTree().getSelectionPaths()[0];
|
TreeTableModel.TreeTableNode treeNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
DeptObject currentObj =(DeptObject)treeNode.getObj();
|
if (currentObj == rootObj){
|
VCIOptionPane.showMessage(this, "此节点为部门标示,不能修改.请选择其它节点!");
|
return;
|
}
|
TreeTableModel.TreeTableNode parentNode = (TreeTableModel.TreeTableNode)treeNode.getParent();
|
DeptObject parentObj =(DeptObject)parentNode.getObj();
|
new DeptDialog(this, parentObj, currentObj, "editDept");
|
|
}
|
/**
|
* 删除事件
|
*/
|
private void deleteButton_conform(){
|
if (null == this.treeTable.getTree().getSelectionPaths()){
|
VCIOptionPane.showMessage(this, "请选择部门节点!");
|
return;
|
}
|
if (this.treeTable.getTree().getSelectionPaths().length > 1){
|
VCIOptionPane.showMessage(this, "仅支持单个部门节点的删除操作,请重新选择!");
|
return;
|
}
|
TreePath path = this.treeTable.getTree().getSelectionPaths()[0];
|
TreeTableModel.TreeTableNode treeNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
DeptObject currentObj =(DeptObject)treeNode.getObj();
|
if (currentObj == rootObj){
|
VCIOptionPane.showMessage(this, "此节点为部门标示,不能删除.请选择其它节点!");
|
return;
|
}
|
int ask = VCIOptionPane.showQuestion(this,
|
"确定要删除所选择的部门吗?");
|
if(ask == 1) return;
|
try {
|
DeptObject[] deptObjs = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchDepartmentInfosById(currentObj.getId());
|
if(deptObjs == null){
|
return;
|
}
|
for (int i = 0 ; i < deptObjs.length ; i ++){
|
UserObject[] userObj = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).getUserByDeptId(deptObjs[i].getId());
|
if (userObj.length > 0){
|
VCIOptionPane.showMessage(this, "要删除的部门树中,名称为'"+deptObjs[i].getName() +"'的部门中存在人员,不能直接删除!");
|
return;
|
}
|
}
|
|
new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).deleteDepartment(new String[]{currentObj.getId()});
|
|
this.removeSelectedTreeNodeByDelete(treeNode);
|
|
} catch (VCIException e) {
|
VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e);
|
}
|
|
}
|
|
private void rightButton_conform(){
|
if (null == this.treeTable.getTree().getSelectionPaths()){
|
VCIOptionPane.showMessage(this, "请选择部门节点!");
|
return;
|
}
|
if (this.treeTable.getTree().getSelectionPaths().length > 1){
|
VCIOptionPane.showMessage(this, "仅支持单个部门的分配人员操作,请重新选择!");
|
return;
|
}
|
TreePath path = this.treeTable.getTree().getSelectionPaths()[0];
|
TreeTableModel.TreeTableNode treeNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
DeptObject currentObj =(DeptObject)treeNode.getObj();
|
if (currentObj == rootObj){
|
VCIOptionPane.showMessage(this, "此节点为部门标示,不能分配人员操作.请选择其它节点!");
|
return;
|
}
|
RightDeptDialog dialog = new RightDeptDialog(currentObj);
|
dialog.setVisible(true);
|
}
|
private void btnDisplay_conform(){
|
if (null == this.treeTable.getTree().getSelectionPaths()){
|
VCIOptionPane.showMessage(this, "请选择部门节点!");
|
return;
|
}
|
if (this.treeTable.getTree().getSelectionPaths().length > 1){
|
VCIOptionPane.showMessage(this, "仅支持单个部门的统计操作,请重新选择!");
|
return;
|
}
|
TreePath path = this.treeTable.getTree().getSelectionPaths()[0];
|
TreeTableModel.TreeTableNode treeNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
DeptObject currentObj =(DeptObject)treeNode.getObj();
|
DisplayDialog dialog = null;
|
|
dialog = new DisplayDialog(new DeptObject[]{currentObj});
|
dialog.setModal(true);
|
dialog.setVisible(true);
|
}
|
|
private void importButton_conform() {
|
File f = this.getFile();
|
if (f == null) {
|
return;
|
}
|
if (!f.exists()) {
|
VCIOptionPane.showMessageDialog(this, "请选择文件进行导入!");
|
return;
|
}
|
final String filePath = f.getAbsolutePath();
|
final QANProcessBarFrame frame = new QANProcessBarFrame();
|
Thread t = new Thread() {
|
public void run() {
|
boolean b = false;
|
frame.setContent("正在进行处理数据,请稍等......");
|
try {
|
b = importData(frame, filePath);
|
} catch (VCIException e){
|
|
} finally {
|
frame.setProcessBarCancel(true);
|
if (b) {
|
VCIOptionPane.showMessageDialog(LogonApplication.frame,
|
"导入成功!");
|
}else{
|
VCIOptionPane.showMessageDialog(LogonApplication.frame,
|
"导入失败!");
|
}
|
}
|
}
|
};
|
QANProcessBar bar = new QANProcessBar(t, frame, frame,
|
"导入部门数据......", false);
|
bar.setVisible(true);
|
|
}
|
|
private boolean importData(QANProcessBarFrame frame, String filePath) throws VCIException {
|
String[][] datas = new ExcelFileOperation().readExcelFileInfo(filePath);
|
if (datas == null || datas.length < 2) {
|
return true;
|
}
|
Map<String, String> idMap = new HashMap<String, String>();
|
String parentId = "";
|
String id = "";
|
DeptObject[] deptObjs = new DeptObject[datas.length - 1];
|
for(int i = 1; i < datas.length; i++){
|
if (idMap.get(datas[i][0]) != null) {
|
id = idMap.get(datas[i][0]);
|
} else {
|
id = ObjectUtility.getNewObjectID36();
|
idMap.put(datas[i][0], id);
|
}
|
if (datas[i][4] == null || datas[i][4].trim().equals("")) {
|
parentId = "";
|
} else if (idMap.get(datas[i][4]) != null) {
|
parentId = idMap.get(datas[i][4]);
|
} else {
|
parentId = ObjectUtility.getNewObjectID36();
|
idMap.put(datas[i][4], parentId);
|
}
|
deptObjs[i - 1] = constructDeptObj(datas[i], id, parentId);
|
}
|
frame.setContent("正在存储数据,请稍等......");
|
boolean rs = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).batchsaveDepartment(deptObjs);
|
frame.setContent("存储完成!");
|
return rs;
|
}
|
|
private DeptObject constructDeptObj(String[] data, String id, String parentId) {
|
DeptObject departmentInfo = new DeptObject();
|
departmentInfo.setId(id);
|
departmentInfo.setNum(data[1]);
|
departmentInfo.setName(data[2]);
|
departmentInfo.setCode(data[3]);
|
departmentInfo.setSpecialties(data[4]);
|
departmentInfo.setDescription(data[5]);
|
departmentInfo.setParentId(parentId);
|
departmentInfo.setStatus((short)0);
|
departmentInfo.setCreateTime(System.currentTimeMillis());
|
departmentInfo.setCreateUser(LogonApplication.getUserEntityObject().getUserName());
|
departmentInfo.setUpdateTime(System.currentTimeMillis());
|
departmentInfo.setUpdateUser(LogonApplication.getUserEntityObject().getUserName());
|
departmentInfo.setGrantor("");
|
return departmentInfo;
|
}
|
|
|
|
private void exportButton_conform() {
|
String[] columns = new String[] { "ID", "编号", "名称", "代码", "专业", "父ID", "描述"};// 设置表单列名
|
final boolean[] ress = new boolean[1];
|
String[][] datas = new String[1][columns.length];
|
datas[0] = columns;
|
ress[0] = exportExcel(datas, "部门模板");
|
final QANProcessBarFrame frame = new QANProcessBarFrame();
|
final QANProcessBar[] bar = new QANProcessBar[1];
|
bar[0] = new QANProcessBar(new Thread() {
|
public void run() {
|
try {
|
frame.setContent("正在导出Excel文件,请稍等......");
|
} finally {
|
frame.setProcessBarCancel(true);
|
}
|
}
|
}, frame, frame, "人员模板导出", false);
|
bar[0].setVisible(true);
|
if (ress[0]) {
|
VCIOptionPane.showMessageDialog(LogonApplication.frame, "导出成功!");
|
}
|
}
|
|
private boolean exportExcel(String[][] datas, String title){
|
File f = this.getFile();
|
if (f == null) return false;
|
/**判断导出的文件是否被使用的校验,如果文件已经打开,不允许导入**/
|
if(!f.renameTo(f) && f.exists()) {
|
VCIOptionPane.showMessageDialog(this, "文件已经被使用,请重新选择!");
|
if(exportExcel(datas, title)){
|
return true;
|
}
|
}
|
new ExcelFileOperation().writeExcelFileInfo(f.getPath(), title, datas);
|
return true;
|
}
|
|
private File getFile() {
|
File f = null;
|
JFileChooser fileDialog = new JFileChooser("选择文件");
|
@SuppressWarnings("static-access")
|
String fileURL = new VCISwingUtil().getExcelFileURL(fileDialog, true, "");
|
if (fileURL == null) return null;
|
f = new File(fileURL);
|
return f;
|
}
|
|
/**
|
* <p>Description: 获取顶级部门</p>
|
*
|
* @author wangxl
|
* @time 2012-5-14
|
* @param rootNode
|
* @param rootDeptObj
|
*/
|
private void loadTreeTableData(TreeTableModel.TreeTableNode rootNode, DeptObject rootDeptObj){
|
DeptObject[] deptObjs = null;
|
try {
|
deptObjs = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchDepartmentInfoRoot();
|
if (deptObjs != null){
|
if (deptObjs.length > 0){
|
for (int i = 0 ; i < deptObjs.length ; i ++){
|
TreeTableModel.TreeTableNode tableNode = treeTableModel.new TreeTableNode(rootNode, deptObjs[i]);
|
rootNode.addChild(tableNode);
|
setPropertyValue(tableNode);
|
}
|
}
|
}
|
}catch(VCIException e) {
|
VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e);
|
}
|
}
|
/**
|
* <p>Description:获取子部门 </p>
|
*
|
* @author wangxl
|
* @time 2012-5-14
|
* @param parentTableNode
|
*/
|
private void loadSelectedTreeNodeChild(TreeTableModel.TreeTableNode parentTableNode){
|
try{
|
if(parentTableNode.getObj() instanceof DeptObject){
|
DeptObject parentObj = (DeptObject)parentTableNode.getObj();
|
DeptObject[] childStructDatas = null ;
|
if (parentObj.getId() == null ){
|
parentTableNode.removeAll();
|
childStructDatas = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchDepartmentInfoRoot();
|
}else {
|
childStructDatas = new RightManagementClientDelegate(LogonApplication.getUserEntityObject()).fetchDepartmentInfoByParentId(parentObj.getId());
|
}
|
parentTableNode.setExpand(true);
|
if (childStructDatas != null){
|
for (int i = 0 ; i < childStructDatas.length ; i ++){
|
TreeTableModel.TreeTableNode tableNode = treeTableModel.new TreeTableNode(parentTableNode, childStructDatas[i]);
|
parentTableNode.addChild(tableNode);
|
setPropertyValue(tableNode);
|
}
|
}
|
|
// 设置选择节点
|
this.treeTable.getTree().setSelectionPath(new TreePath(parentTableNode));
|
}
|
} catch (VCIException e) {
|
VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", e);
|
}
|
}
|
|
/**
|
* <p>Description:新增加的部门节点插入到树上 </p>
|
*
|
* @author wangxl
|
* @time 2012-5-15
|
* @param newDeptObj
|
*/
|
public void insertNewDeptObjToTree(DeptObject newDeptObj){
|
TreePath path = this.treeTable.getTree().getSelectionPath();
|
TreeTableModel.TreeTableNode parentTreeNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
TreeTableModel.TreeTableNode treeNode = treeTableModel.new TreeTableNode(parentTreeNode, newDeptObj);
|
parentTreeNode.addChild(treeNode);
|
setPropertyValue(treeNode);
|
// 设置选择节点
|
parentTreeNode.setLeaf(false);
|
parentTreeNode.setExpand(true);
|
|
TreePath selectedPath = new TreePath(treeNode);
|
this.fromManualExpand = true;
|
treeTable.getTree().expandPath(selectedPath);
|
this.fromManualExpand = false;
|
treeTable.getTree().setSelectionPath(selectedPath);
|
|
}
|
/**
|
* <p>Description:修改后,更新树节点信息 </p>
|
*
|
* @author wangxl
|
* @time 2012-5-15
|
* @param currentDeptObj
|
*/
|
public void updateCurrentDeptObjForTree(DeptObject currentDeptObj){
|
TreePath path = this.treeTable.getTree().getSelectionPath();
|
TreeTableModel.TreeTableNode tableNode = (TreeTableModel.TreeTableNode)path.getLastPathComponent();
|
tableNode.setObj(currentDeptObj);
|
setPropertyValue(tableNode);
|
treeTable.getTree().updateUI();
|
}
|
/**
|
* <p>Description:删除后,节点移除 </p>
|
*
|
* @author wangxl
|
* @time 2012-5-15
|
* @param isRoot
|
* @throws VCIException
|
*/
|
public void removeSelectedTreeNodeByDelete(TreeTableModel.TreeTableNode treeNode) throws VCIException{
|
|
TreeTableModel.TreeTableNode parentTreeNode = (TreeTableModel.TreeTableNode)treeNode.getParent();
|
parentTreeNode.removeChild(treeNode);
|
this.treeTable.getTree().setSelectionPaths(null);
|
this.treeTable.updateUI();
|
this.treeTable.setShowGrid(true);
|
}
|
|
/**
|
* <p>Description:单元格属性填充 </p>
|
*
|
* @author wangxl
|
* @time 2012-5-14
|
* @param tableNode
|
*/
|
private void setPropertyValue(TreeTableModel.TreeTableNode tableNode){
|
DeptObject deptObj = (DeptObject)tableNode.getObj();
|
tableNode.setPropertyValueByName(columns[1], deptObj.getNum() == null ? "" : deptObj.getNum());
|
tableNode.setPropertyValueByName(columns[2], deptObj.getCode() == null ? "" : deptObj.getCode());
|
tableNode.setPropertyValueByName(columns[3], deptObj.getSpecialties() == null ? "" : deptObj.getSpecialties());
|
tableNode.setPropertyValueByName(columns[4], deptObj.getDescription() == null ? "" : deptObj.getDescription());
|
|
}
|
}
|