package com.vci.client.portal.NewNewUI.actionExport; import java.awt.Color; import java.awt.event.MouseEvent; import java.io.FileInputStream; import java.io.ObjectInputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.Set; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import com.vci.client.LogonApplication; import com.vci.client.portal.NewNewUI.Export.BaseExportNode; import com.vci.client.portal.NewNewUI.Export.ExportTreeCellRenderer; import com.vci.client.portal.NewNewUI.Export.VCIImportTree; import com.vci.client.portal.utility.UITools; import com.vci.client.ui.swing.CheckBoxLabel; import com.vci.client.ui.swing.VCIOptionPane; import com.vci.client.ui.tree.CheckBoxTreeCellRenderer; import com.vci.client.ui.tree.CheckBoxTreeManager; import com.vci.common.utility.ObjectUtility; import com.vci.corba.common.VCIError; import com.vci.corba.portal.*; import com.vci.corba.portal.data.PLAction; import com.vci.corba.portal.data.PLActionCls; import com.vci.corba.portal.data.PLActionParam; public class VCIActionImportTree extends VCIImportTree { /** * */ private static final long serialVersionUID = 1L; private CheckBoxTreeManager treeManager = null; // 导入的对象 private ExportBeans exportBeans = null; // 库中的所有Action分类对象 private PLActionCls[] pLActionClses = null; // 库中的所有action对象 private PLAction[] plActions = null; // log对象 private ExportActionLogBean logBean = null; // 存储库中的action,plCode作为关键字 private HashMap actionsInDB = null; // getPLActionListFromOptionListByPLActionClsId的临时变量,按actionCls属性存储action到list中 private HashMap> temActionListMap = null; // 更换actionId后,可以从此导航中获得原来的id private HashMap actionIdNav = new HashMap(); // 更换actionClsId后,可以从此导航中获得原来的id private HashMap actionClsIdNav = new HashMap(); // 存储符合条件的PLActionCls private ArrayList optionPLActionClsList = null; // 存储符合条件的PLAction private ArrayList optionPLActionList = null; private int pLActionClsesLength = 0; // 接受传来的PrintWriter 向文件中写入日志 private PrintWriter fileLog = null; // 接受传来的PrintWriter 向"下一步"写入日志 private DefaultTableModel tableLog = null; // 保存“action分类”的name 保证每个分类只存入分类一次 降低资源开销 private HashSet saveActionClsLog = null; //保存所有父分类,用id主key private HashMap actionClses = new HashMap(); public VCIActionImportTree(DefaultTreeModel treeModel) { super(treeModel); this.setCellRenderer(new ExportTreeCellRenderer()); } public VCIActionImportTree() { super(new DefaultTreeModel(new DefaultMutableTreeNode("Action分类"))); this.setCellRenderer(new ExportTreeCellRenderer()); } @SuppressWarnings("rawtypes") public void initTree(String filePath) { try { this.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION); actionIdNav.clear(); actionClsIdNav.clear(); actionsInDB = null; temActionListMap = null; this.optionPLActionClsList = new ArrayList(); this.optionPLActionList = new ArrayList(); this.pLActionClses = UITools.getService().getPLActionClsArray(); this.plActions = UITools.getService().getAllPLAction(); this.saveActionClsLog = new HashSet (); this.pLActionClsesLength = pLActionClses.length; } catch (Exception e) { VCIOptionPane.showMessage(LogonApplication.frame, "导入数据时出错"); e.printStackTrace(); } optionPLActionClsList.addAll(Arrays.asList(pLActionClses)); // optionPLActionList.addAll(Arrays.asList(plActions)); // 获得导入对象 HashMap map = null; try { ObjectInputStream obj = new ObjectInputStream(new FileInputStream( filePath)); map = (HashMap) obj.readObject(); } catch (Exception e) { VCIOptionPane.showMessage(LogonApplication.frame, "导入对象未获取成功!!导入对象版本号不同!"); // e.printStackTrace(); } if(map != null){ exportBeans = (ExportBeans) map.get("exportBeans"); // 添加导入的数据 addImportData(this.optionPLActionClsList, this.optionPLActionList); }else{ PLActionCls plac = new PLActionCls("", "", "", "", "", 0, (short)0); ExportPLActionClsBean exportPLActionBean = new ExportPLActionClsBean(plac); exportPLActionBean.setMessage("导入数据失败"); exportPLActionBean.setLeaf(BaseExportNode.IS_A_Message); DefaultMutableTreeNode root = new DefaultMutableTreeNode(exportPLActionBean, true); this.setModel(new DefaultTreeModel(root)); return; } //设置树默认属性 (全部展开、全部勾选、不可编辑) this.setModel(new DefaultTreeModel(new DefaultMutableTreeNode( "Action分类"))); if (treeManager == null) { treeManager = new CheckBoxTreeManager(this) { public void mouseClicked(MouseEvent me) { // 覆盖点击选择事件 } }; } else { TreePath[] paths = treeManager.getSelectionModel() .getSelectionPaths(); if (paths != null) treeManager.getSelectionModel().removeSelectionPaths(paths); } treeManager.getSelectionModel().setSelectionPath( new TreePath(this.getModel().getRoot())); CheckBoxTreeCellRenderer render = (CheckBoxTreeCellRenderer) this .getCellRenderer(); this.updateUI(); for (int i = 0; i < render.getComponentCount(); i++) { if (render.getComponent(i).getClass().getName() .equals("com.vci.base.ui.swing.CheckBoxLabel")) { CheckBoxLabel label = (CheckBoxLabel) render.getComponent(i); label.setEnabled(false); } } // 刷新分类树 refreshImportTree(this.getPathForRow(0)); } private void refreshImportTree(TreePath pathForRow) { DefaultTreeModel dtml = (DefaultTreeModel) this.getModel(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) pathForRow .getLastPathComponent(); // 将PLActionCls 、PLAction 对应的set集合转换成数组(匹配原addExportTreeNode方法) PLActionCls[] newPLActionClsArray = new PLActionCls[optionPLActionClsList.size()]; PLAction[] newPLActionArray = new PLAction[optionPLActionList.size()]; optionPLActionClsList.toArray(newPLActionClsArray); optionPLActionList.toArray(newPLActionArray); //清楚分类id actionClses.clear(); //保存所有分类id for (int i = 0; i < newPLActionClsArray.length; i++) { actionClses.put(newPLActionClsArray[i].id,newPLActionClsArray[i]); } //保存所有存在action的分类(子分类存在action也保存) HashSet pLActionClsList =new HashSet (); for (int i = 0; i < newPLActionArray.length; i++) { //缓存该分类的所有父分类 saveParentCls(newPLActionArray[i].plActionCls,pLActionClsList); } PLActionCls[] actionClses = new PLActionCls[pLActionClsList.size()]; pLActionClsList.toArray(actionClses); addExportTreeNode(dtml, node, actionClses, newPLActionArray); // 展开所有树节点 TreeNode rootNode = (TreeNode) this.getModel().getRoot(); this.expandAllTreeNode(new TreePath(rootNode), true); } private void addExportTreeNode(DefaultTreeModel dtml, DefaultMutableTreeNode node, PLActionCls[] pLActionClses, PLAction[] plActions) { // node.removeAllChildren(); String pid = ""; Object userObject = node.getUserObject(); if (!(userObject instanceof String)) { if (userObject instanceof ExportPLActionClsBean) { PLActionCls pac = ((ExportPLActionClsBean) userObject) .getBean(); pid = pac.id; } } // 添加子节点(源table节点) for (int i = 0; i < plActions.length; i++) { if ((!pid.equals("")) && plActions[i].plActionCls.equals(pid)) { ExportPLActionBean exportPLActionBean = new ExportPLActionBean( plActions[i]); if (plActions[i].plName.endsWith("@#修改$%")) { plActions[i].plName = plActions[i].plName.replace( "@#修改$%", ""); exportPLActionBean.setMessage("【修改】"); }else if (plActions[i].plName.endsWith("@#存在在未分类中$%")) { plActions[i].plName = plActions[i].plName.replace( "@#存在在未分类中$%", ""); exportPLActionBean.setMessage("【action存在在未分类中,修改Action并按导入文件创建action分类】"); } else { exportPLActionBean.setMessage("【新增】"); exportPLActionBean.setFontColor(Color.BLACK); } DefaultMutableTreeNode newChild = new DefaultMutableTreeNode( exportPLActionBean); // TreePath newChildTreePath = new TreePath(newChild); dtml.insertNodeInto(newChild, node, node.getChildCount()); } } // 添加子节点(源树节点) for (int i = 0; i < pLActionClses.length; i++) { if (pLActionClses[i].pid.equals(pid)) { if(pid.equals("") && pLActionClses[i].name.equals("未分类")){ continue; } ExportPLActionClsBean exportPLActionClsBean = new ExportPLActionClsBean( pLActionClses[i]); if (i >= this.pLActionClsesLength) { exportPLActionClsBean.setMessage("【新增】"); exportPLActionClsBean.setFontColor(Color.BLACK); } DefaultMutableTreeNode child = new DefaultMutableTreeNode( exportPLActionClsBean); dtml.insertNodeInto(child, node, node.getChildCount()); addExportTreeNode(dtml, child, pLActionClses, plActions); } } if (pid.equals("")) { PLActionCls plac = new PLActionCls("", "未分类", "", "", "", 0, (short)0); DefaultMutableTreeNode child = new DefaultMutableTreeNode( new ExportPLActionClsBean(plac), true); dtml.insertNodeInto(child, node, node.getChildCount()); for (int i = 0; i < plActions.length; i++) { if (plActions[i].plActionCls.equals("")) { ExportPLActionBean exportPLActionBean = new ExportPLActionBean( plActions[i]); if (plActions[i].plName.endsWith("@#修改$%")) { plActions[i].plName = plActions[i].plName.replace( "@#修改$%", ""); exportPLActionBean.setMessage("【修改】"); }else if (plActions[i].plName.endsWith("@#存在在未分类中$%")) { plActions[i].plName = plActions[i].plName.replace( "@#存在在未分类中$%", ""); exportPLActionBean.setMessage("【修改】"); } else { exportPLActionBean.setMessage("【新增】"); exportPLActionBean.setFontColor(Color.BLACK); } DefaultMutableTreeNode newChild = new DefaultMutableTreeNode( exportPLActionBean, false); dtml.insertNodeInto(newChild, child, child.getChildCount()); } } } dtml.reload(node); } /** * 保存所有父分类 * @param plActionCls * @param pLActionClsList */ private void saveParentCls(String plActionCls, HashSet pLActionClsList) { if(actionClses.containsKey(plActionCls)){ PLActionCls pCls = actionClses.get(plActionCls); pLActionClsList.add(pCls); saveParentCls(pCls.pid,pLActionClsList); } } /** * @Use get all information from 'exportBeans' and put it into reference * list * @param pLActionClsList * @param plActionList */ private void addImportData(ArrayList pLActionClsList, ArrayList plActionList) { HashMap pLActionBeans = this.exportBeans .getPLActions(); if (pLActionBeans == null) { VCIOptionPane.showMessage(LogonApplication.frame, "导入对象未获取成功!!"); return; } Set> pLActions = pLActionBeans.entrySet(); for (Entry entry : pLActions) { PLAction plAction = entry.getValue(); PLAction plActionInDB = getPLActionInDB(plAction); if (plActionInDB != null) { // String newId = ObjectUtility.getNewObjectID36(); // actionIdNav.put(plAction.plOId, plAction.plOId); if( plActionInDB.plActionCls != ""){ plAction.plActionCls = plActionInDB.plActionCls; // plAction.plOId = newId; plAction.plName += "@#修改$%"; plActionList.add(plAction); continue; }else{ plAction.plName += "@#存在在未分类中$%"; } } // 将该实例acion存入到plActionList中 plActionList.add(plAction); // 定义list存储当前action到数据库action的路径上的所有PLActionCls对象 List plActionClsList = new ArrayList(); // 获得库中的最近的PLActionCls对象 String pId = ObjectUtility.getNewObjectID36(); String oId = ObjectUtility.getNewObjectID36(); PLActionCls pLActionCls = getParentPLActionClsInDBById(plAction, pId, plActionClsList); changePLActionOID(plAction, oId, pId); // System.out.println(plActionClsList.size()); if (plActionClsList.size() == 1) { // 删除"未分类"分类对象 PLActionCls plActionCls = plActionClsList.get(plActionClsList .size() - 1); if(pLActionCls != null){ plAction.plActionCls = pLActionCls.id; if(plActionCls.name.equals("未分类")){ plAction.plActionCls = ""; } plActionClsList.remove(plActionClsList.size() - 1); }else{ if(plActionCls.name.equals("未分类")){ plActionClsList.remove(plActionClsList.size() - 1); }else{ plActionCls.pid = ""; } } } if (plActionClsList.size() >= 2) { PLActionCls plActionCls2 = plActionClsList.get(plActionClsList .size() - 2); PLActionCls plActionCls1 = plActionClsList.get(plActionClsList .size() - 1); if (pLActionCls != null) { // 将导入对象与“库中的最近的PLActionCls对 象”name相同的对象 // 的下一个PLActionCls对象父id改为库中“最近”PLActionCls对象id plActionClsList.remove(plActionClsList.size() - 1); plActionCls2.pid = pLActionCls.id; }else{ if(plActionCls1.name.equals("未分类")){ plActionClsList.remove(plActionClsList.size() - 1); plActionCls2.pid = ""; }else{ plActionCls1.pid = ""; } } } // 增加到整体list中用来最终持久化 pLActionClsList.addAll(plActionClsList); } } private void changePLActionOID(PLAction plAction, String oId, String pId) { actionIdNav.put(oId, plAction.plOId); plAction.plOId = oId; plAction.plActionCls = pId; } private PLAction getPLActionInDB(PLAction plAction) { if (actionsInDB == null) { actionsInDB = new HashMap(); for (PLAction action : this.plActions) { actionsInDB.put(action.plCode, action); } } return actionsInDB.get(plAction.plCode); } /*** * 获得库中的PLActionCls对象,用来嫁接导入来的树 * * @param plActionClsId * @param plActionClsList * @return */ private PLActionCls getParentPLActionClsInDBById(Object plActionClsIdObj, String newPLActionClsId, List plActionClsList) { String pId = null; if (plActionClsIdObj instanceof PLAction) { pId = ((PLAction) plActionClsIdObj).plActionCls; if(pId.equals("")){ PLActionCls noneCls = new PLActionCls("", "未分类", "", "", "", 0, (short)0); plActionClsList.add(noneCls); return noneCls; } } if (plActionClsIdObj instanceof PLActionCls) { pId = ((PLActionCls) plActionClsIdObj).pid; pId = actionClsIdNav.get(pId); if(pId.equals("")){ pId = "null"; } } PLActionCls plActionCls = this.exportBeans.getPLActionClsBeanById(pId);// 从导入对象中获得父分类 PLActionCls tempPLActionCls = null; if (plActionCls != null) {// plActionCls为空 证明父节点为根节点 plActionClsList.add(plActionCls); if(this.optionPLActionClsList.contains(plActionCls)){ return plActionCls ; } for (PLActionCls Cls : pLActionClses) { if ((plActionCls.id.equals("") && plActionCls.name.trim() .equals("未分类")) || plActionCls.name.trim().equals(Cls.name.trim())) { tempPLActionCls = Cls; } } plActionCls.id = newPLActionClsId; // 修改父分类id } else { return null; } if (tempPLActionCls == null) { String newClsId = ObjectUtility.getNewObjectID36(); actionClsIdNav.put(newClsId, plActionCls.pid); plActionCls.pid = newClsId; return getParentPLActionClsInDBById(plActionCls, newClsId, plActionClsList); } return tempPLActionCls; } @Override public boolean hasSelectImportContent(){ TreePath path = new TreePath(this.getModel().getRoot()); if(path.getLastPathComponent().toString().equals("导入数据失败")){ return false; }; TreePath[] treePath = treeManager.getSelectionModel() .getSelectionPaths(); if (treePath == null) { return false; } return true; } @Override public void exeImport(PrintWriter log, JTable tblExportLog) { // 只保留导入的符合条件的PLActionCls optionPLActionClsList.removeAll(Arrays.asList(pLActionClses)); // System.out.println(this.optionPLActionClsList.size()); // 符合条件的PLAction // System.out.println(this.optionPLActionList.size()); this.fileLog = log; this.addImportLogHeader(tblExportLog); this.tableLog = (DefaultTableModel) tblExportLog.getModel(); while (this.tableLog.getRowCount() > 0) {// 清除tableLog,准备重新绘制 this.tableLog.removeRow(0); } new ExportActionLogBean(); TreePath[] treePath = treeManager.getSelectionModel() .getSelectionPaths(); if (treePath != null) { try { for (int i = 0; i < treePath.length; i++) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath[i] .getLastPathComponent(); Object obj = node.getUserObject(); if (obj instanceof String) {// 如果是root节点,则保存所有模块 返回 String nodeName = (String) obj; if ("Action分类".equals(nodeName)) { for (PLAction action : this.optionPLActionList) { // 持久化action及其类别 saveAction(action); // this.exportBeans.addPLActionBean(action); // ExportActionLogBean bean = exportBeans // .getLogBean(); // this.fileLog.println(bean.getLogRowContent()); // this.tableLog.addRow(bean.getLogRowObjcets()); } return; } } if (obj instanceof ExportPLActionBean) { PLAction action = ((ExportPLActionBean) obj).getBean(); // 持久化action及其类别 saveAction(action); } else if (obj instanceof ExportPLActionClsBean) { PLActionCls actionCls = ((ExportPLActionClsBean) obj) .getBean(); ArrayList actionClses = getChildPLActionClsListFromOptionList(actionCls); actionClses.add(actionCls); for (PLActionCls plActionCls : actionClses) { ArrayList actions = getPLActionListFromOptionListByPLActionClsId(plActionCls.id); if (actions != null) { for (PLAction plAction : actions) { saveAction(plAction); } } } } } } catch (Exception e) { e.printStackTrace(); } } } private ArrayList getPLActionListFromOptionListByPLActionClsId( String id) { if (temActionListMap == null) { temActionListMap = new HashMap>(); for (PLAction plAction : this.optionPLActionList) { if (temActionListMap.get(plAction.plActionCls) == null) { ArrayList temArray = new ArrayList(); temActionListMap.put(plAction.plActionCls, temArray); } temActionListMap.get(plAction.plActionCls).add(plAction); } } return temActionListMap.get(id); } private ArrayList getChildPLActionClsListFromOptionList( PLActionCls plActionCls) { ArrayList temActionClsList = new ArrayList(); putPLActionCls(plActionCls, temActionClsList); return temActionClsList; } private void putPLActionCls(PLActionCls plActionCls, ArrayList temActionClsList) { ArrayList allPLActionClsList = new ArrayList(); allPLActionClsList.addAll(this.optionPLActionClsList); allPLActionClsList.addAll(Arrays.asList(pLActionClses)); for (PLActionCls actionCls : allPLActionClsList) { if (actionCls.pid.equals(plActionCls.id)) { temActionClsList.add(actionCls); putPLActionCls(actionCls, temActionClsList); } } } private void saveAction(PLAction action) { // 持久化action及其参数(ActionCls had added when initTree) PLAction actionInDB = this.getPLActionInDB(action); if (actionInDB != null) {// in db , update it this.actionIdNav.put(actionInDB.plOId, action.plOId); action.plOId = actionInDB.plOId; try { this.updateActionWithParams(action); logBean = new ExportActionLogBean("更新成功", action.plCode, action.plName, action.plCSClass, action.plBSUrl, action.plTypeType, action.plDesc, ""); } catch (Exception e) { logBean = new ExportActionLogBean("更新失败", action.plCode, action.plName, action.plCSClass, action.plBSUrl, action.plTypeType, action.plDesc, ""); } finally { this.writeLog(logBean); } } else {// not in db ,save it try { this.saveActionWithParams(action); logBean = new ExportActionLogBean("保存成功", action.plCode, action.plName, action.plCSClass, action.plBSUrl, action.plTypeType, action.plDesc, "未知"); } catch (Exception e) { logBean = new ExportActionLogBean("保存失败", action.plCode, action.plName, action.plCSClass, action.plBSUrl, action.plTypeType, action.plDesc, ""); } finally { this.writeLog(logBean); } } PLActionCls actionCls = this .getPLActionClsFromOptionListById(action.plActionCls); if (actionCls != null) { savePLActionCls(actionCls); } } /** * 写出log记录 * * @param logBean */ private void writeLog(ExportActionLogBean logBean) { this.fileLog.println(logBean.getLogRowContent()); this.tableLog.addRow(logBean.getInportLogRowObjcets()); } private void savePLActionCls(PLActionCls actionCls) { if (actionCls != null) { if (!saveActionClsLog.contains(actionCls.name)) { saveActionClsLog.add(actionCls.name); UITools.getService().creaetePLActionCls(actionCls); } PLActionCls aCls = getPLActionClsFromOptionListById(actionCls.pid); savePLActionCls(aCls); } } private void saveActionWithParams(PLAction action) throws VCIError { String oldId = this.actionIdNav.get(action.plOId); PLActionParam[] params = exportBeans .getPLActionParamArrayByActionId(oldId); if (params != null) { for (PLActionParam plActionParam : params) { // 数据库不存该参数在则创建 plActionParam.action = action.plOId; UITools.getService().createPLActionParam(plActionParam); } } UITools.getService().savePLAction(action); } private void updateActionWithParams(PLAction action) throws VCIError { String oldId = this.actionIdNav.get(action.plOId); PLActionParam[] params = exportBeans .getPLActionParamArrayByActionId(oldId); PLActionParam[] paramsInDB = UITools.getService() .getPLActionParamArrayByActionId(action.plOId); if (params != null) { HashMap paramsInDBMap = new HashMap();// 临时存储库中的参数 if (paramsInDB != null) {// 数据库中参数存在,则存储到临时map中 for (PLActionParam plActionParam : paramsInDB) { paramsInDBMap.put(plActionParam.name, plActionParam); } } for (PLActionParam plActionParam : params) { PLActionParam actionParamInDB = paramsInDBMap .get(plActionParam.name); if (actionParamInDB == null) {// 数据库不存该参数在则创建 UITools.getService().createPLActionParam(plActionParam); } else {// 数据库中存在该参数则更新 actionParamInDB.name = plActionParam.name; actionParamInDB.defaultValue = plActionParam.defaultValue; actionParamInDB.description = plActionParam.description; UITools.getService().editPLActionParam(actionParamInDB); } } } UITools.getService().updatePLAction(action); } private PLActionCls getPLActionClsFromOptionListById(String plActionCls) { PLActionCls temActionCls = null; if (optionPLActionClsList != null) { for (PLActionCls actionCls : optionPLActionClsList) { if (actionCls.id.equals(plActionCls)) { temActionCls = actionCls; } } } return temActionCls; } // private PLActionCls getPLActionClsFromDB(PLActionCls plActionCls) { // PLActionCls temActionCls = null; // PLActionCls plActionClsesInDB[] = null; // try { // plActionClsesInDB = Tool.getService().getPLActionClsArray(); // for (PLActionCls actionCls : plActionClsesInDB) { // if (actionCls.name.equals(plActionCls.name)) { // temActionCls = actionCls; // } // } // // } catch (VCIError e) { // e.printStackTrace(); // } // ; // return temActionCls; // } private void addImportLogHeader(JTable tblExportLog) { tblExportLog.setModel(new DefaultTableModel(new Object[][] { { null, null, null, null, null, null, null, null }, }, new String[] { "\u5E8F\u53F7", "导入状态", "\u7F16\u53F7", "\u540D\u79F0", "CS\u6CE8\u518C", "BS\u6CE8\u518C", "\u7C7B\u578B", "\u63CF\u8FF0" }) { /** * serialVersionUID */ private static final long serialVersionUID = 1L; boolean[] columnEditables = new boolean[] { false, false, false, false, false, false, false, false }; public boolean isCellEditable(int row, int column) { return columnEditables[column]; } }); tblExportLog.getColumnModel().getColumn(0).setResizable(false); tblExportLog.getColumnModel().getColumn(0).setPreferredWidth(35); tblExportLog.getColumnModel().getColumn(0).setMinWidth(35); tblExportLog.getColumnModel().getColumn(0).setMaxWidth(35); tblExportLog.getColumnModel().getColumn(1).setMinWidth(60); tblExportLog.getColumnModel().getColumn(1).setMaxWidth(150); tblExportLog.getColumnModel().getColumn(2).setMinWidth(60); tblExportLog.getColumnModel().getColumn(2).setMaxWidth(150); tblExportLog.getColumnModel().getColumn(3).setMinWidth(60); tblExportLog.getColumnModel().getColumn(3).setMaxWidth(150); tblExportLog.getColumnModel().getColumn(4).setPreferredWidth(120); tblExportLog.getColumnModel().getColumn(4).setMinWidth(60); tblExportLog.getColumnModel().getColumn(4).setMaxWidth(150); tblExportLog.getColumnModel().getColumn(5).setPreferredWidth(120); tblExportLog.getColumnModel().getColumn(5).setMinWidth(60); tblExportLog.getColumnModel().getColumn(5).setMaxWidth(150); tblExportLog.getColumnModel().getColumn(6).setMinWidth(50); tblExportLog.getColumnModel().getColumn(6).setMaxWidth(100); tblExportLog.getColumnModel().getColumn(7).setMinWidth(60); tblExportLog.getColumnModel().getColumn(7).setMaxWidth(150); } }