From 1750d2473f4f2cfad73382b1ea273307861c12fa Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Mon, 4 Nov 2024 15:39:33 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-136606=E3=80=90=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E3=80=91=E6=8C=89=E9=92=AE=E5=A4=8D=E5=88=B6=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=88=B0=E5=8F=A6=E4=B8=80=E4=B8=AA=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=90=8E=E5=8F=91=E7=94=9F=E6=8E=A7=E4=BB=B6=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=90=8D=E7=A7=B0=E8=A6=86=E7=9B=96=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/CellWidgetPropertyPane.java | 77 +++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java index f0ff751f17..f9ac0a67e6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java @@ -24,9 +24,11 @@ import java.awt.BorderLayout; public class CellWidgetPropertyPane extends BasicPane { private static CellWidgetPropertyPane singleton; - + //当前控件板对应的单元格 private TemplateCellElement cellElement; + //右侧控件板 private WidgetPane cellEditorDefPane; + //左侧单元格板 private ElementCasePane ePane; public static CellWidgetPropertyPane getInstance() { @@ -101,14 +103,43 @@ public class CellWidgetPropertyPane extends BasicPane { editingSelection.populateWidgetPropertyPane(ePane); } + /** + * 将控件板中的内容更新到当前选择的单元格项中 + */ public void update() { + if (ePane == null) { + return; + } + //当前单元格板选中的单元格 + CellSelection finalCS = (CellSelection) ePane.getSelection(); if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) { return; } - final CellSelection finalCS = (CellSelection) ePane.getSelection(); + doUpdate(finalCS); + } + + /** + * 将控件板中的内容更新到指定单元格项中 + * (js事件的提交入库事件选择单元格时,ePane.getSelection()是左侧选择的单元格,不是右侧控件板对应的单元格。这时候假如走无参的方法就有问题) + * + * @param selection 当前选中项 + */ + public void update(Selection selection) { + if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) { + return; + } + CellSelection finalCS = (CellSelection) selection; + //假如指定单元格项和当前控件板对应的单元格不同,则跳过 + if (finalCS.getColumn() != cellElement.getColumn() || finalCS.getRow() != cellElement.getRow()) { + return; + } + doUpdate(finalCS); + } + + private void doUpdate(CellSelection finalCS) { final TemplateElementCase tplEC = ePane.getEditingElementCase(); final Widget cellWidget = cellEditorDefPane.update(); - if(cellWidget == null){ + if (cellWidget == null) { return; } if (finalCS.isSelectedOneCell(ePane)) { @@ -134,47 +165,13 @@ public class CellWidgetPropertyPane extends BasicPane { } }); } - if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) { - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } - } - public void update(Selection selection) { - if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) { - return; - } - final CellSelection finalCS = (CellSelection) selection; - final TemplateElementCase tplEC = ePane.getEditingElementCase(); - final Widget cellWidget = cellEditorDefPane.update(); - if(cellWidget == null){ - return; - } - if(finalCS.isSelectedOneCell(ePane)){ - if(tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow())== null){//cellElement未加入到report中时要添加进去 - tplEC.addCellElement(cellElement); - } else { - cellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); - } - setCellWidget(cellWidget, cellElement); - }else{ - ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() { - public void dealWith(CellElement editCellElement) { - // p:最后把这个cellEditorDef设置到CellGUIAttr. - TemplateCellElement templateCellElement = (TemplateCellElement) editCellElement; - try { - setCellWidget((Widget)cellWidget.clone(), templateCellElement); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error("InternalError: " + e.getMessage()); - } - } - }); - } - if(DesignerContext.getDesignerFrame().getSelectedJTemplate() != null){ + if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) { DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } } - private void setCellWidget(Widget cellWidget, TemplateCellElement cellElement){ + private void setCellWidget(Widget cellWidget, TemplateCellElement cellElement) { if (cellWidget instanceof NoneWidget) { cellElement.setWidget(null); } else { @@ -185,7 +182,7 @@ public class CellWidgetPropertyPane extends BasicPane { } } - public void reInitAllListener(){ + public void reInitAllListener() { cellEditorDefPane.registerListener(); }