|
|
|
@ -8,6 +8,7 @@ import com.fr.design.i18n.Toolkit;
|
|
|
|
|
import com.fr.design.mainframe.ElementCasePane; |
|
|
|
|
import com.fr.design.sort.common.AbstractSortPane; |
|
|
|
|
import com.fr.design.sort.common.SortColumnRowPane; |
|
|
|
|
import com.fr.design.sort.common.SortUtils; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.report.cell.TemplateCellElement; |
|
|
|
|
import com.fr.report.cell.cellattr.CellExpandAttr; |
|
|
|
@ -35,6 +36,7 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
protected int headerAreaPaneWidth; |
|
|
|
|
protected int headerAreaPaneRightWidth; |
|
|
|
|
private CellSelectionManager cellSelectionManager = new CellSelectionManager(); |
|
|
|
|
TemplateCellElement cellElement; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AreaJLayeredPane areaJLayeredPane; |
|
|
|
@ -62,9 +64,10 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
this.add(areaJLayeredPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populateBean(ColumnRow columnRow, boolean showHeaderArea) { |
|
|
|
|
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, TemplateCellElement cellElement) { |
|
|
|
|
this.cellElement = cellElement; |
|
|
|
|
boolean enabled = true; |
|
|
|
|
ElementCasePane elementCasePane = getCurrentElementCase(); |
|
|
|
|
ElementCasePane elementCasePane = SortUtils.getCurrentElementCase(); |
|
|
|
|
if (elementCasePane != null) { |
|
|
|
|
enabled = elementCasePane.isSelectedOneCell(); |
|
|
|
|
} |
|
|
|
@ -72,7 +75,7 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ColumnRow updateBean(TemplateCellElement cellElement) { |
|
|
|
|
ElementCasePane elementCasePane = getCurrentElementCase(); |
|
|
|
|
ElementCasePane elementCasePane = SortUtils.getCurrentElementCase(); |
|
|
|
|
if (elementCasePane != null) { |
|
|
|
|
if (!elementCasePane.isSelectedOneCell()) { |
|
|
|
|
return getOldColumnRow(cellElement); |
|
|
|
@ -96,19 +99,6 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private ElementCasePane getCurrentElementCase() { |
|
|
|
|
try { |
|
|
|
|
TargetComponent targetComponent |
|
|
|
|
= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); |
|
|
|
|
if (targetComponent instanceof ElementCasePane) { |
|
|
|
|
return (ElementCasePane) targetComponent; |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e, e.getMessage()); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class AreaJLayeredPane extends JPanel { |
|
|
|
|
SortColumnRowPane columnRowPane; |
|
|
|
|
JLayeredPane jLayeredPane; |
|
|
|
@ -151,6 +141,7 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
cellSelectionManager.removeNotSelectables(columnRowPane.updateBean()); |
|
|
|
|
columnRowPane.cancelSelectState(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -176,7 +167,8 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { |
|
|
|
|
cellSelectionManager.build(); |
|
|
|
|
cellSelectionManager.build(cellElement, columnRow); |
|
|
|
|
columnRow = cellSelectionManager.buildCurrentCell(cellElement, columnRow); |
|
|
|
|
columnRowPane.populateBean(columnRow, enabled, cellSelectionManager); |
|
|
|
|
setSortColumnRowPaneShow(showHeaderArea); |
|
|
|
|
uiComboBox.setSelectedIndex(showHeaderArea ? 1 : 0); |
|
|
|
@ -203,15 +195,26 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
ElementCasePane elementCase; |
|
|
|
|
java.util.List<ColumnRow> notSelectables = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
void build() { |
|
|
|
|
ElementCasePane elementCase = SortColumnRowPane.getCurrentElementCase(); |
|
|
|
|
void build(TemplateCellElement templateCellElement, ColumnRow headerColumnRow) { |
|
|
|
|
ElementCasePane elementCase = SortUtils.getCurrentElementCase(); |
|
|
|
|
if (elementCase != null) { |
|
|
|
|
this.elementCase = elementCase; |
|
|
|
|
notSelectables = new ArrayList<>(); |
|
|
|
|
buildNotSelectables(elementCase.getEditingElementCase()); |
|
|
|
|
buildNotSelectables(elementCase.getEditingElementCase(), templateCellElement); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private ColumnRow buildCurrentCell(TemplateCellElement templateCellElement, ColumnRow headerColumnRow) { |
|
|
|
|
if (isNotSelectables(headerColumnRow)) { |
|
|
|
|
SortHeader sortHeader = templateCellElement.getCellExpandAttr().getCellSortAttr().getSortHeader(); |
|
|
|
|
headerColumnRow = ColumnRow.ERROR; |
|
|
|
|
sortHeader.setHeaderArea(headerColumnRow.toString()); |
|
|
|
|
} else { |
|
|
|
|
handleDisableHeaderCell(templateCellElement); |
|
|
|
|
} |
|
|
|
|
return headerColumnRow; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public java.util.List<ColumnRow> getNotSelectables() { |
|
|
|
|
return this.notSelectables; |
|
|
|
|
} |
|
|
|
@ -232,24 +235,20 @@ public class HeaderAreaPane extends JPanel {
|
|
|
|
|
notSelectables.remove(columnRow); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void buildNotSelectables(TemplateElementCase elementCase) { |
|
|
|
|
private void buildNotSelectables(TemplateElementCase elementCase, TemplateCellElement excludeTemplateCellElement) { |
|
|
|
|
Iterator iterator = elementCase.cellIterator(); |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
TemplateCellElement templateCellElement = (TemplateCellElement) iterator.next(); |
|
|
|
|
CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr(); |
|
|
|
|
if (cellExpandAttr != null) { |
|
|
|
|
handleDisableHeaderCell(cellExpandAttr); |
|
|
|
|
} |
|
|
|
|
Object value = templateCellElement.getValue(); |
|
|
|
|
if (value instanceof DSColumn) { |
|
|
|
|
handleDisableHeaderCell((DSColumn) value); |
|
|
|
|
if (templateCellElement != excludeTemplateCellElement) { |
|
|
|
|
handleDisableHeaderCell(templateCellElement); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleDisableHeaderCell(CellSortable cellSortable) { |
|
|
|
|
if (cellSortable.getCellSortAttr() != null) { |
|
|
|
|
SortHeader sortHeader = cellSortable.getCellSortAttr().getSortHeader(); |
|
|
|
|
private void handleDisableHeaderCell(TemplateCellElement templateCellElement) { |
|
|
|
|
CellExpandAttr cellExpandAttr = templateCellElement.getCellExpandAttr(); |
|
|
|
|
if (cellExpandAttr != null && cellExpandAttr.getCellSortAttr() != null) { |
|
|
|
|
SortHeader sortHeader = cellExpandAttr.getCellSortAttr().getSortHeader(); |
|
|
|
|
if (sortHeader != null) { |
|
|
|
|
String headerArea = sortHeader.getHeaderArea(); |
|
|
|
|
if (headerArea != null) { |
|
|
|
|