Component component = components[i];
if (\ controlPanel = (KDPanel) component; } }
// 获取btn
if (controlPanel != null) {
components = controlPanel.getComponents(); for (int j = 0; j KDWorkButtonworkButton = (KDWorkButton) component; workButton.setEnabled(false); } } } } } 显示EAS标准单据自带 kdtable(kdtEntry) 右键导出 excel菜单 框架在CoreUI中,把“导出到Excel”和“导出选择部分到Excel”2个右键菜单给隐藏掉了,可以通过覆盖下面的方法使这两个菜单显示。 /** * 显示被框架隐藏的导出Excel的右键菜单 * @author syj */ public KDTMenuManagergetMenuManager(KDTable table) { KDTMenuManagermenuManager = super.getMenuManager(table); if (menuManager != null) { Component menus[] = menuManager.getMenu().getComponents(); for (inti = 0; i return menuManager; } 列表界面根据情况设置单行背景色高亮 列表的填充是在afterTableFillData之前进行的,所以判断的代码可以加在这个方法里面。 protected void afterTableFillData(KDTDataRequestEvent e) { super.afterTableFillData(e); int count = this.tblMain.getRowCount(); if(count>0){ for(inti=0; i IRow row = tblMain.getRow(i); if(row.getCell(\&& \ row.getStyleAttributes().setBackground(new Color(255,80,30)); if(row.getCell(\ }else && \ row.getStyleAttributes().setBackground(Color.ORANGE); } } } 另外有一个execQuery方法,如果加在这个方法里,那么只有当有过滤条件和点刷新按钮时,才会起作用。 修改ListUI的表体列的显示文字 this.tblMain.getHeadRow(0).getCell(27).setValue(\所属管家\ KDTable显示枚举覆盖方法 Java代码 1. 2. 3. 4. 5. protected IQueryExecutor getQueryExecutor(IMetaDataPK queryPK, EntityViewInfo viewInfo) { IQueryExecutor executor = super.getQueryExecutor(queryPK, viewInfo); executor.option().isAutoTranslateEnum = true; return executor; } 枚举在KDTable中显示数字解决 在KDTable中,如果该列是枚举,则显示的value,不会显示别名,要显示别名有两个方法: 1、在Query中用case 语句,这个办法比较笨,如果枚举添加,或者比较多,需要重新修改Query。不建议使用。 2、覆盖父类方法getQueryExecutor Java代码 1. 2. 3. 4. 5. 6. 7. protected IQueryExecutor getQueryExecutor(IMetaDataPK queryPK, EntityViewInfo viewInfo) { IQueryExecutor iec = super.getQueryExecutor(queryPK, viewInfo); iec.option().isAutoTranslateEnum = true;//显示枚举 iec.option().isAutoTranslateBoolean=true;//显示checkbox return iec; } 3、在KDTable的列中设置Editor。这样该列也会显示成下拉框: Java代码 1. 2. private void addCtrl() { tblMain.checkParsed(); 3. 4. 5. 6. 7. 8. 9. KDComboBox tblMain_useToGuarUnit = new KDComboBox(); tblMain_useToGuarUnit.setName(\); tblMain_useToGuarUnit.setVisible(true); tblMain_useToGuarUnit.addItems(EnumUtils.getEnumList(\s.huar.common.YesOrNoEnum\).toArray()); KDTDefaultCellEditor tblMain_useToGuarUnit_CellEditor = new KDTDefaultCellEditor(tblMain_useToGuarUnit); this.tblMain.getColumn(\).setEditor(tblMain_useToGuarUnit_CellEditor); } 添加统计行 1、分录中添加统计行 protected void setTableToSumField() { super.setTableToSumField(); setTableToSumField(kdtDeviceReg, new String[] { \\ } 2、叙事薄上添加 统计行 在query中字段有是否是统计字段(isSumField)扩展属性,设为true,主键定义上添加id,叙事薄中就自动汇总了 序时簿上的排序设置 EAS单据序时簿的排序,通过修改相应Query上的排序是不生效的,这时需要重写序时簿的getQueryExecutor方法。以下是重写的例子: protected IQueryExecutorgetQueryExecutor(IMetaDataPK arg0, EntityViewInfo arg1) { SorterItemCollection sic = new SorterItemCollection(); SorterItemInfosiInfo = new SorterItemInfo(\ siInfo.setSortType(SortType.ASCEND); sic.add(siInfo); arg1.setSorter(sic); return super.getQueryExecutor(arg0, arg1); } KDTable单元格如何格式化显示。 开发过程中需要对KDTable表格单元格中的数值型显示为后面加年,比如输入的是“3”,但要求显示为“3年”,代码如下即可: this.tblMain.getColumn(0).getStyleAttributes().setNumberFormat(\年\ EAS单据分录的一些初始化设置 // 设定单据分录选择模式为单元格选择模式 kdtEntrys.getSelectManager().setSelectMode(KDTSelectManager.CELL_SELECT); // 设定支持鼠标拖动表头移动表列 kdtEntrys.setColumnMoveable(true); EAS设定分录按钮快捷键// 设定分录按钮快捷键 kdtEntrys_detailPanel.getAddNewLineButton().setMnemonic(KeyEvent.VK_DOWN); kdtEntrys_detailPanel.getRemoveLinesButton().setMnemonic(KeyEvent.VK_UP);