@ -3,13 +3,14 @@ package com.fr.design.sort.common;
import com.fr.base.Style ;
import com.fr.base.Style ;
import com.fr.base.background.ColorBackground ;
import com.fr.base.background.ColorBackground ;
import com.fr.base.svg.IconUtils ;
import com.fr.base.svg.IconUtils ;
import com.fr.design.designer.TargetComponent ;
import com.fr.design.event.UIObserver ;
import com.fr.design.event.UIObserver ;
import com.fr.design.event.UIObserverListener ;
import com.fr.design.event.UIObserverListener ;
import com.fr.design.file.HistoryTemplateListCache ;
import com.fr.design.file.HistoryTemplateListCache ;
import com.fr.design.gui.ibutton.UIButton ;
import com.fr.design.gui.ibutton.UIButton ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.mainframe.ElementCasePane ;
import com.fr.design.mainframe.ElementCasePane ;
import com.fr.design.mainframe.JTemplate ;
import com.fr.design.mainframe.JTemplateActionListener ;
import com.fr.design.selection.SelectionEvent ;
import com.fr.design.selection.SelectionEvent ;
import com.fr.design.selection.SelectionListener ;
import com.fr.design.selection.SelectionListener ;
import com.fr.design.sort.header.HeaderAreaPane ;
import com.fr.design.sort.header.HeaderAreaPane ;
@ -18,10 +19,6 @@ import com.fr.grid.selection.Selection;
import com.fr.log.FineLoggerFactory ;
import com.fr.log.FineLoggerFactory ;
import com.fr.report.cell.DefaultTemplateCellElement ;
import com.fr.report.cell.DefaultTemplateCellElement ;
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.core.group.DSColumn ;
import com.fr.report.core.sort.common.CellSortable ;
import com.fr.report.core.sort.header.SortHeader ;
import com.fr.report.elementcase.TemplateElementCase ;
import com.fr.report.elementcase.TemplateElementCase ;
import com.fr.stable.ColumnRow ;
import com.fr.stable.ColumnRow ;
import com.fr.stable.EssentialUtils ;
import com.fr.stable.EssentialUtils ;
@ -157,6 +154,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
class SelectActionListener extends MouseAdapter {
class SelectActionListener extends MouseAdapter {
SortColumnRowPane columnRowPane ;
SortColumnRowPane columnRowPane ;
ColumnRow oldColumnRow ;
ColumnRow oldColumnRow ;
JTemplateActionListener jTemplateActionListener ;
Map < ColumnRow , Style > disableHeaderCellsStyleMap = new HashMap < > ( ) ;
Map < ColumnRow , Style > disableHeaderCellsStyleMap = new HashMap < > ( ) ;
java . util . List < TemplateCellElement > tempHeaderCells = new ArrayList < > ( ) ;
java . util . List < TemplateCellElement > tempHeaderCells = new ArrayList < > ( ) ;
@ -178,13 +176,44 @@ public class SortColumnRowPane extends JPanel implements UIObserver {
@Override
@Override
public void selectionChanged ( SelectionEvent e ) {
public void selectionChanged ( SelectionEvent e ) {
completeSelectHeader ( elementCasePane ) ;
completeSelectHeader ( elementCasePane ) ;
removeJTemplateActionListener ( ) ;
}
}
} ;
} ;
elementCasePane . addSelectionChangeListener ( gridSelectionChangeListener ) ;
elementCasePane . addSelectionChangeListener ( gridSelectionChangeListener ) ;
this . addJTemplateActionListener ( ) ;
isAlreadyAddListener = true ;
isAlreadyAddListener = true ;
}
}
}
}
private void addJTemplateActionListener ( ) {
JTemplate jTemplate = HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) ;
if ( jTemplate ! = null ) {
removeJTemplateActionListener ( ) ;
jTemplateActionListener = new JTemplateActionListener ( ) {
@Override
public void templateSaveBefore ( JTemplate < ? , ? > jt ) {
ElementCasePane elementCasePane = SortUtils . getCurrentElementCase ( ) ;
if ( elementCasePane ! = null ) {
recoverSelectHeader ( elementCasePane ) ;
}
removeJTemplateActionListener ( ) ;
}
} ;
jTemplate . addJTemplateActionListener ( jTemplateActionListener ) ;
}
}
private void removeJTemplateActionListener ( ) {
JTemplate jTemplate = HistoryTemplateListCache . getInstance ( ) . getCurrentEditingTemplate ( ) ;
if ( jTemplate ! = null ) {
if ( jTemplateActionListener ! = null ) {
jTemplate . removeJTemplateActionListener ( jTemplateActionListener ) ;
}
}
}
private void prepareSelectHeader ( ElementCasePane elementCasePane ) {
private void prepareSelectHeader ( ElementCasePane elementCasePane ) {
ashDisableHeaderCellsStyle ( elementCasePane . getEditingElementCase ( ) ) ;
ashDisableHeaderCellsStyle ( elementCasePane . getEditingElementCase ( ) ) ;
oldSelection = ( CellSelection ) elementCasePane . getSelection ( ) ;
oldSelection = ( CellSelection ) elementCasePane . getSelection ( ) ;