Browse Source

Pull request #15334: REPORT-136606【控件】按钮复制事件名称到另一个按钮后发生控件属性名称覆盖的情况

Merge in DESIGN/design from ~LIDONGY/design:release/11.0 to release/11.0

* commit 'e3fc26523120f7cc0c255bf82ba1eb22cbe0c993':
  REPORT-136606【控件】按钮复制事件名称到另一个按钮后发生控件属性名称覆盖的情况
  REPORT-136606【控件】按钮复制事件名称到另一个按钮后发生控件属性名称覆盖的情况
  REPORT-136606【控件】按钮复制事件名称到另一个按钮后发生控件属性名称覆盖的情况
release/11.0
lidongy-李东原 3 weeks ago
parent
commit
25f8fdabfa
  1. 76
      designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java

76
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() {
@ -79,6 +81,11 @@ public class CellWidgetPropertyPane extends BasicPane {
}
/**
* 重初始化选中单元格会走到这
*
* @param ePane 单元格板
*/
public void reInit(ElementCasePane ePane) {
this.ePane = ePane;
cellEditorDefPane = new WidgetPane(ePane);
@ -101,49 +108,40 @@ public class CellWidgetPropertyPane extends BasicPane {
editingSelection.populateWidgetPropertyPane(ePane);
}
/**
* 将控件板中的内容更新到当前选择的单元格项中
*/
public void update() {
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) {
if (ePane == null) {
return;
}
final CellSelection finalCS = (CellSelection) ePane.getSelection();
final TemplateElementCase tplEC = ePane.getEditingElementCase();
final Widget cellWidget = cellEditorDefPane.update();
if(cellWidget == null){
//当前单元格板选中的单元格
CellSelection finalCS = (CellSelection) ePane.getSelection();
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) {
return;
}
if (finalCS.isSelectedOneCell(ePane)) {
if (tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()) == null) {//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement);
} else {
TemplateCellElement newCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow());
if (newCellElement != null) {
cellElement = newCellElement;
}
}
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) {
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
doUpdate(finalCS);
}
/**
* 将控件板中的内容更新到指定单元格项中
* (js事件的提交入库事件选择单元格时ePane.getSelection()是左侧选择的单元格不是右侧控件板对应的单元格这时候假如走无参的方法就有问题)
*
* @param selection 当前选中项
*/
public void update(Selection selection) {
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) {
return;
}
final CellSelection finalCS = (CellSelection) selection;
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) {
@ -153,12 +151,14 @@ public class CellWidgetPropertyPane extends BasicPane {
if (tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()) == null) {//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement);
} else {
cellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow());
TemplateCellElement newCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow());
if (newCellElement != null) {
cellElement = newCellElement;
}
}
setCellWidget(cellWidget, cellElement);
} else {
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, editCellElement -> {
// p:最后把这个cellEditorDef设置到CellGUIAttr.
TemplateCellElement templateCellElement = (TemplateCellElement) editCellElement;
try {
@ -166,7 +166,6 @@ public class CellWidgetPropertyPane extends BasicPane {
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("InternalError: " + e.getMessage());
}
}
});
}
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) {
@ -185,6 +184,9 @@ public class CellWidgetPropertyPane extends BasicPane {
}
}
/**
* 刷新所有监听器
*/
public void reInitAllListener() {
cellEditorDefPane.registerListener();
}

Loading…
Cancel
Save