|
|
|
@ -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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|