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