Browse Source

REPORT-4117 [9.0一轮回归]控件提交入库智能选择单元格后自动复制一个控件

master
kerry 7 years ago
parent
commit
44764ccffa
  1. 40
      designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  2. 11
      designer/src/com/fr/design/widget/WidgetPane.java

40
designer/src/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -102,31 +102,41 @@ public class CellWidgetPropertyPane extends BasicPane {
}
public void update() {
if (cellElement == null) {// 利用默认的CellElement.
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) {
return;
}
final CellSelection finalCS = (CellSelection) ePane.getSelection();
final TemplateElementCase tplEC = ePane.getEditingElementCase();
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
Widget cellWidget = cellEditorDefPane.update();
// p:最后把这个cellEditorDef设置到CellGUIAttr.
TemplateCellElement cellElement = (TemplateCellElement) editCellElement;
if (cellWidget instanceof NoneWidget) {
cellElement.setWidget(null);
} else {
if (cellElement.getWidget() != null) {
cellWidget = upDateWidgetAuthority(cellElement, cellWidget);
}
cellElement.setWidget(cellWidget);
}
if(finalCS.isSelectedOneCell(ePane)){
if(tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow())== null){//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement);
}
});
setCellWidget(cellElement);
}else{
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) {
// p:最后把这个cellEditorDef设置到CellGUIAttr.
TemplateCellElement templateCellElement = (TemplateCellElement) editCellElement;
setCellWidget(templateCellElement);
}
});
}
if(DesignerContext.getDesignerFrame().getSelectedJTemplate() != null){
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
}
private void setCellWidget(TemplateCellElement cellElement){
Widget cellWidget = cellEditorDefPane.update();
if (cellWidget instanceof NoneWidget) {
cellElement.setWidget(null);
} else {
if (cellElement.getWidget() != null) {
cellWidget = upDateWidgetAuthority(cellElement, cellWidget);
}
cellElement.setWidget(cellWidget);
}
}
public void reInitAllListener(){
cellEditorDefPane.registerListener();

11
designer/src/com/fr/design/widget/WidgetPane.java

@ -47,6 +47,12 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
this.initComponents(pane);
}
public boolean isShouldFireSelectedEvent(){
return shouldFireSelectedEvent;
}
protected void initComponents(ElementCasePane pane) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
@ -136,8 +142,8 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
String name = ((NameWidget) widget).getName();
shouldFireSelectedEvent = false;
editorTypeComboBox.setSelectedItem(new Item(name, name));
shouldFireSelectedEvent = true;
cellEditorCardPane.populate(widget);
shouldFireSelectedEvent = true;
}
// 内置组件
else {
@ -145,10 +151,9 @@ public class WidgetPane extends AbstractAttrNoScrollPane implements ItemListener
if (ArrayUtils.contains(ButtonConstants.CLASSES4BUTTON, clazz)) {
clazz = Button.class;
}
cellEditorCardPane.populate(widget);
shouldFireSelectedEvent = false;
editorTypeComboBox.setSelectedItemByWidgetClass(clazz);
cellEditorCardPane.populate(widget);
shouldFireSelectedEvent = true;
}
removeAttributeChangeListener();

Loading…
Cancel
Save