|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
|
import com.fr.design.gui.controlpane.ObjectUIControlPane; |
|
|
|
|
import com.fr.design.mainframe.CellWidgetPropertyPane; |
|
|
|
|
import com.fr.design.present.CellWriteAttrPane; |
|
|
|
|
import com.fr.design.write.submit.DBManipulationPane; |
|
|
|
|
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane; |
|
|
|
@ -30,14 +31,9 @@ import com.fr.report.stable.ReportConstants;
|
|
|
|
|
import com.fr.stable.Nameable; |
|
|
|
|
|
|
|
|
|
public class WidgetEventPane extends ObjectUIControlPane { |
|
|
|
|
private ElementCasePane ePane; |
|
|
|
|
|
|
|
|
|
public WidgetEventPane() { |
|
|
|
|
this(null); |
|
|
|
|
} |
|
|
|
|
public WidgetEventPane(ElementCasePane pane) { |
|
|
|
|
super(pane); |
|
|
|
|
ePane = pane; |
|
|
|
|
this.setNameListEditable(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -58,67 +54,7 @@ public class WidgetEventPane extends ObjectUIControlPane {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void saveSettings() { |
|
|
|
|
|
|
|
|
|
final TemplateElementCase tplEC = ePane.getEditingElementCase(); |
|
|
|
|
final CellSelection finalCS = (CellSelection) ePane.getSelection(); |
|
|
|
|
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); |
|
|
|
|
if (editCellElement == null) { |
|
|
|
|
editCellElement = new DefaultTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); |
|
|
|
|
tplEC.addCellElement(editCellElement); |
|
|
|
|
} |
|
|
|
|
final BasicPane bp = populateBasicPane(editCellElement); |
|
|
|
|
|
|
|
|
|
// 需要先行后列地增加新元素。
|
|
|
|
|
for (int j = 0; j < finalCS.getRowSpan(); j++) { |
|
|
|
|
for (int i = 0; i < finalCS.getColumnSpan(); i++) { |
|
|
|
|
int column = i + finalCS.getColumn(); |
|
|
|
|
int row = j + finalCS.getRow(); |
|
|
|
|
editCellElement = tplEC.getTemplateCellElement(column, row); |
|
|
|
|
if (editCellElement == null) { |
|
|
|
|
editCellElement = new DefaultTemplateCellElement(column, row); |
|
|
|
|
tplEC.addCellElement(editCellElement); |
|
|
|
|
} |
|
|
|
|
// alex:不加这一句话会导致跨行跨列的格子被多次update
|
|
|
|
|
if (editCellElement.getColumn() != column || editCellElement.getRow() != row) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
updateBasicPane(bp, editCellElement); |
|
|
|
|
|
|
|
|
|
Object editElementValue = editCellElement.getValue(); |
|
|
|
|
if (editElementValue != null && (editElementValue instanceof String || editElementValue instanceof Number)) { |
|
|
|
|
// TODO ALEX_SEP 暂时用FIT_DEFAULT替代,不取reportsetting里面的设置,因为也不知道是应该放在report里面还是elementcase里面
|
|
|
|
|
GridUtils.shrinkToFit(ReportConstants.AUTO_SHRINK_TO_FIT_DEFAULT, tplEC, editCellElement); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ePane.fireTargetModified(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private BasicPane populateBasicPane(TemplateCellElement cellElement) { |
|
|
|
|
CellWriteAttrPane pane = new CellWriteAttrPane(ePane); |
|
|
|
|
//got simple cell element from column and row.
|
|
|
|
|
pane.populate(cellElement); |
|
|
|
|
|
|
|
|
|
return pane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
|
|
|
|
CellWriteAttrPane pane = (CellWriteAttrPane) bp; |
|
|
|
|
if (cellElement.getWidget() == null) { |
|
|
|
|
pane.update(cellElement); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
Widget oldWidget = (Widget) cellElement.getWidget().clone(); |
|
|
|
|
pane.update(cellElement); |
|
|
|
|
//这边需要重新设置权限细粒度的hashset是因为Update是直接生成一个新的来update的,所以以前里面的hashset都没有了
|
|
|
|
|
Widget newWidget = cellElement.getWidget(); |
|
|
|
|
if (newWidget.getClass() == oldWidget.getClass()) { |
|
|
|
|
newWidget.setWidgetPrivilegeControl((WidgetPrivilegeControl) oldWidget.getWidgetPrivilegeControl().clone()); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
CellWidgetPropertyPane.getInstance().update(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -127,10 +63,7 @@ public class WidgetEventPane extends ObjectUIControlPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { |
|
|
|
|
private ElementCasePane epane; |
|
|
|
|
public WidgetEventListenerUpdatePane() { |
|
|
|
|
this(null); |
|
|
|
|
} |
|
|
|
|
private ElementCasePane epane; |
|
|
|
|
public WidgetEventListenerUpdatePane(ElementCasePane epane){ |
|
|
|
|
this.epane = epane; |
|
|
|
|
super.initComponents(); |
|
|
|
|