|
|
@ -24,9 +24,11 @@ import java.awt.BorderLayout; |
|
|
|
public class CellWidgetPropertyPane extends BasicPane { |
|
|
|
public class CellWidgetPropertyPane extends BasicPane { |
|
|
|
|
|
|
|
|
|
|
|
private static CellWidgetPropertyPane singleton; |
|
|
|
private static CellWidgetPropertyPane singleton; |
|
|
|
|
|
|
|
//当前控件板对应的单元格
|
|
|
|
private TemplateCellElement cellElement; |
|
|
|
private TemplateCellElement cellElement; |
|
|
|
|
|
|
|
//右侧控件板
|
|
|
|
private WidgetPane cellEditorDefPane; |
|
|
|
private WidgetPane cellEditorDefPane; |
|
|
|
|
|
|
|
//左侧单元格板
|
|
|
|
private ElementCasePane ePane; |
|
|
|
private ElementCasePane ePane; |
|
|
|
|
|
|
|
|
|
|
|
public static CellWidgetPropertyPane getInstance() { |
|
|
|
public static CellWidgetPropertyPane getInstance() { |
|
|
@ -101,49 +103,40 @@ public class CellWidgetPropertyPane extends BasicPane { |
|
|
|
editingSelection.populateWidgetPropertyPane(ePane); |
|
|
|
editingSelection.populateWidgetPropertyPane(ePane); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 将控件板中的内容更新到当前选择的单元格项中 |
|
|
|
|
|
|
|
*/ |
|
|
|
public void update() { |
|
|
|
public void update() { |
|
|
|
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) { |
|
|
|
if (ePane == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
final CellSelection finalCS = (CellSelection) ePane.getSelection(); |
|
|
|
//当前单元格板选中的单元格
|
|
|
|
final TemplateElementCase tplEC = ePane.getEditingElementCase(); |
|
|
|
CellSelection finalCS = (CellSelection) ePane.getSelection(); |
|
|
|
final Widget cellWidget = cellEditorDefPane.update(); |
|
|
|
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) { |
|
|
|
if(cellWidget == null){ |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (finalCS.isSelectedOneCell(ePane)) { |
|
|
|
doUpdate(finalCS); |
|
|
|
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(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 将控件板中的内容更新到指定单元格项中 |
|
|
|
|
|
|
|
* (js事件的提交入库事件选择单元格时,ePane.getSelection()是左侧选择的单元格,不是右侧控件板对应的单元格。这时候假如走无参的方法就有问题) |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param selection 当前选中项 |
|
|
|
|
|
|
|
*/ |
|
|
|
public void update(Selection selection) { |
|
|
|
public void update(Selection selection) { |
|
|
|
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) { |
|
|
|
if (cellElement == null || !cellEditorDefPane.isShouldFireSelectedEvent()) { |
|
|
|
return; |
|
|
|
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 TemplateElementCase tplEC = ePane.getEditingElementCase(); |
|
|
|
final Widget cellWidget = cellEditorDefPane.update(); |
|
|
|
final Widget cellWidget = cellEditorDefPane.update(); |
|
|
|
if (cellWidget == null) { |
|
|
|
if (cellWidget == null) { |
|
|
@ -153,7 +146,10 @@ public class CellWidgetPropertyPane extends BasicPane { |
|
|
|
if (tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()) == null) {//cellElement未加入到report中时要添加进去
|
|
|
|
if (tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()) == null) {//cellElement未加入到report中时要添加进去
|
|
|
|
tplEC.addCellElement(cellElement); |
|
|
|
tplEC.addCellElement(cellElement); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
cellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); |
|
|
|
TemplateCellElement newCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); |
|
|
|
|
|
|
|
if (newCellElement != null) { |
|
|
|
|
|
|
|
cellElement = newCellElement; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
setCellWidget(cellWidget, cellElement); |
|
|
|
setCellWidget(cellWidget, cellElement); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -169,6 +165,7 @@ public class CellWidgetPropertyPane extends BasicPane { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) { |
|
|
|
if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) { |
|
|
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
|
|
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
|
|
|
} |
|
|
|
} |
|
|
|