| | |
| | | import java.awt.BorderLayout; |
| | | import java.awt.Dimension; |
| | | import java.awt.FlowLayout; |
| | | import java.awt.Frame; |
| | | import java.awt.Toolkit; |
| | | import java.awt.event.MouseAdapter; |
| | | import java.awt.event.MouseEvent; |
| | | import javax.swing.JPanel; |
| | | import com.vci.base.ui.exception.VCIException; |
| | | import javax.swing.event.TreeSelectionEvent; |
| | | |
| | | import com.alibaba.cloud.commons.lang.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vci.base.ui.swing.VCISwingUtil; |
| | | import com.vci.base.ui.swing.components.VCIJButton; |
| | | import com.vci.base.ui.swing.components.VCIJDialog; |
| | | import com.vci.base.ui.swing.components.VCIJPanel; |
| | | import com.vci.base.ui.swing.components.VCIJTable; |
| | | import com.vci.base.ui.swing.components.*; |
| | | import com.vci.base.ui.swing.components.table.VCIJTablePanel; |
| | | import com.vci.base.ui.tree.VCIBaseTree; |
| | | import com.vci.base.ui.tree.VCIBaseTreeModel; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import com.vci.ubcs.codeapply.enums.CodeReferConfigTypeEnum; |
| | | import com.vci.ubcs.codeapply.object.UIFormRefer; |
| | | import com.vci.ubcs.codeapply.object.UIFormRefers; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | |
| | | public class RMDataReferTempDialog extends VCIJDialog { |
| | | private VCIJDialog rmDataAddDialog; |
| | | private String templateId = ""; |
| | | private CodeApplyFor410MainPanel owner; |
| | | private CodeClassifyTemplateAttrVO codeClassifyTemplateAttr; |
| | | private RMDataReferTempDialogActionListener actionListener = new RMDataReferTempDialogActionListener(this); |
| | | private VCIJButton btnOk = VCISwingUtil.createVCIJButton("ok", "确定", "确定", "accept.png", actionListener); |
| | | private VCIJButton btnCancel = VCISwingUtil.createVCIJButton("cancel", "取消", "取消", "cancel.png", actionListener); |
| | | private static final long serialVersionUID = 1L; |
| | | public RMDataReferTempDialog(VCIJDialog rmDataAddDialog,String templateId) { |
| | | private VCIJScrollPane scrollLeftTreePane = new VCIJScrollPane(); |
| | | CodeReferTreePanel typeTreePanel; |
| | | private VCIBaseTree leftTree = null; |
| | | private VCIBaseTreeModel leftTreeModel = null; |
| | | public RMDataReferTempDialog(CodeApplyFor410MainPanel owner, CodeClassifyTemplateAttrVO codeClassifyTemplateAttr) { |
| | | //super(true); |
| | | this.rmDataAddDialog = rmDataAddDialog; |
| | | this.templateId = templateId; |
| | | this.owner = owner; |
| | | this.codeClassifyTemplateAttr = codeClassifyTemplateAttr; |
| | | init(); |
| | | setTitle("引用模板-属性选择"); |
| | | //initDialogSize(rmDataAddDialog.getWidth(), rmDataAddDialog.getHeight()); |
| | |
| | | JPanel panel = new JPanel(new FlowLayout()); |
| | | panel.add(btnOk); |
| | | panel.add(btnCancel); |
| | | |
| | | this.add(createRMDataMainPanel(), BorderLayout.CENTER); |
| | | this.add(panel,BorderLayout.SOUTH); |
| | | |
| | | Dimension dime = Toolkit.getDefaultToolkit().getScreenSize().getSize(); |
| | | int x = dime.width/6; |
| | | int y = dime.height/6 + 50; |
| | |
| | | public void setFromTableDoubleClick(boolean fromTableDoubleClick) { |
| | | this.fromTableDoubleClick = fromTableDoubleClick; |
| | | } |
| | | |
| | | private UIFormRefer uiFormRefer; |
| | | private VCIJPanel createRMDataMainPanel(){ |
| | | VCIJPanel rmDataTablePanel = new VCIJPanel(); |
| | | if(!templateId.equals("")){ |
| | | //rmDataTablePanel = getRMDataMainPanel("", "", templateId); |
| | | VCIJPanel rmDataTablePanel = new VCIJPanel(new BorderLayout()); |
| | | uiFormRefer=new UIFormRefer(); |
| | | if(StringUtils.isNotBlank(codeClassifyTemplateAttr.getReferConfig())){ |
| | | uiFormRefer = JSONObject.toJavaObject(JSONObject.parseObject(codeClassifyTemplateAttr.getReferConfig().toString()), UIFormRefer.class); |
| | | } |
| | | rmDataTablePanel.setPreferredSize(new Dimension(880,300)); |
| | | if(uiFormRefer !=null&&(uiFormRefer.getType().equals(CodeReferConfigTypeEnum.TREE.getValue()) |
| | | ||uiFormRefer.getType().equals(CodeReferConfigTypeEnum.ORGDEPARTMENTREFER.getValue()))){ |
| | | rmDataTablePanel.add(createTreePanel(),BorderLayout.CENTER); |
| | | }else if(uiFormRefer !=null&&(uiFormRefer.getType().equals(CodeReferConfigTypeEnum.GRID.getValue()))){ |
| | | //树表 |
| | | }else{ |
| | | rmDataTablePanel.add(getRMDataMainPanel(),BorderLayout.CENTER); |
| | | } |
| | | //rmDataTablePanel.setPreferredSize(new Dimension(880,300)); |
| | | return rmDataTablePanel; |
| | | } |
| | | private VCIJTablePanel<T> tablePanel = null; |
| | | |
| | | /** |
| | | * 根据类型显示table |
| | | */ |
| | | private CodeDataMainPanel codeDataMainPanel = null; |
| | | private CodeDataMainPanelDataProvider dataProvider; |
| | | public VCIJTablePanel getRMDataMainPanel(String libId, String classifyId, String templateId) { |
| | | dataProvider = new CodeDataMainPanelDataProvider(); |
| | | tablePanel = new VCIJTablePanel<T>(dataProvider); |
| | | //tablePanel.setCustomButtons(getCombinedButtons()); |
| | | tablePanel.setShowExport(true); |
| | | tablePanel.setShowPaging(true); |
| | | tablePanel.setPageButtonFlowAlign(FlowLayout.CENTER); |
| | | tablePanel.setCustomButtonFlowAlign(FlowLayout.CENTER); |
| | | tablePanel.buildTablePanel(); |
| | | int columnCount = tablePanel.getTable().getColumnCount(); |
| | | tablePanel.getTable().getColumnModel().getColumn(columnCount - 2).setPreferredWidth(150); |
| | | tablePanel.getTable().getColumnModel().getColumn(columnCount - 4).setPreferredWidth(150); |
| | | /** |
| | | * 禁止table表头拖动,防止第一列的复选框和第二列的序号拖动出问题: |
| | | * 点击某行,表格中的复选框看不到,且选中表头上的复选框系统会报错;数据信息显示不正确。 |
| | | * 2012-12-4 wangxl |
| | | */ |
| | | tablePanel.getTable().getTableHeader().setReorderingAllowed(false); |
| | | tablePanel.refreshTableData(); |
| | | VCIJTable table = tablePanel.getTable(); |
| | | public CodeDataMainPanel getRMDataMainPanel() { |
| | | codeDataMainPanel=new CodeDataMainPanel(uiFormRefer); |
| | | CodeDataMainPanelDataProvider dataProvider=new CodeDataMainPanelDataProvider(codeDataMainPanel); |
| | | codeDataMainPanel.setDataProvider(dataProvider); |
| | | codeDataMainPanel.setCustomTopPanel(new attarSearchPanel(uiFormRefer)); |
| | | codeDataMainPanel.buildPanel(); |
| | | VCIJTable table = codeDataMainPanel.getTablePanel().getTable(); |
| | | table.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | if (e.getButton() == 1 && e.getClickCount() == 2) { |
| | |
| | | } |
| | | } |
| | | }); |
| | | return tablePanel; |
| | | return codeDataMainPanel; |
| | | } |
| | | /*** |
| | | * 根据类型展示树 |
| | | * @return |
| | | */ |
| | | private VCIJScrollPane createTreePanel(){ |
| | | final RMDataReferTempDialog self = this; |
| | | |
| | | typeTreePanel = new CodeReferTreePanel(uiFormRefer) { |
| | | private static final long serialVersionUID = 8121108576137012228L; |
| | | @Override |
| | | public void tree_valueChanged(TreeSelectionEvent e) { |
| | | self.leftTree_valueChanged(e); |
| | | } |
| | | }; |
| | | typeTreePanel.buildTreePanel(); |
| | | leftTree = typeTreePanel.getTree(); |
| | | leftTreeModel = typeTreePanel.getTreeModel(); |
| | | scrollLeftTreePane.setViewportView(leftTree); |
| | | |
| | | return scrollLeftTreePane; |
| | | } |
| | | |
| | | /*** |
| | | * 树切换事件 |
| | | * @param e |
| | | */ |
| | | private void leftTree_valueChanged(TreeSelectionEvent e) { |
| | | |
| | | } |
| | | /***获取资源数据的主面板**/ |
| | | /* |
| | | public RMDataMainPanel getRMDataMainPanel() { |