|
|
|
@ -36,7 +36,7 @@ public class HeaderSortRulePane extends JPanel {
|
|
|
|
|
|
|
|
|
|
HeaderSortRulePane() { |
|
|
|
|
initComponents(); |
|
|
|
|
initState(); |
|
|
|
|
initState(true); |
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -62,12 +62,24 @@ public class HeaderSortRulePane extends JPanel {
|
|
|
|
|
double[] columnSize = {80, 30}; |
|
|
|
|
JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0); |
|
|
|
|
this.add(sortRuleItem, BorderLayout.CENTER); |
|
|
|
|
initUICheckBoxChange(ascUICheckBox, ascIconButton); |
|
|
|
|
initUICheckBoxChange(desUICheckBox, desIconButton); |
|
|
|
|
initUICheckBoxChange(nosortUICheckBox, nosortIconButton); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void initState() { |
|
|
|
|
ascUICheckBox.setSelected(false); |
|
|
|
|
desUICheckBox.setSelected(false); |
|
|
|
|
nosortUICheckBox.setSelected(false); |
|
|
|
|
void initUICheckBoxChange(UICheckBox uiCheckBox, IconButton iconButton) { |
|
|
|
|
uiCheckBox.addChangeListener(new ChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
iconButton.setActiveState(uiCheckBox.isSelected()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void initState(boolean selected) { |
|
|
|
|
ascUICheckBox.setSelected(selected); |
|
|
|
|
desUICheckBox.setSelected(selected); |
|
|
|
|
nosortUICheckBox.setSelected(selected); |
|
|
|
|
ascIconButton.refreshIconLabelColor(new Color(33, 33, 34)); |
|
|
|
|
desIconButton.refreshIconLabelColor(new Color(33, 33, 34)); |
|
|
|
|
nosortIconButton.refreshIconLabelColor(new Color(33, 33, 34)); |
|
|
|
@ -81,21 +93,36 @@ public class HeaderSortRulePane extends JPanel {
|
|
|
|
|
Color color; |
|
|
|
|
BufferedImage bufferedImage; |
|
|
|
|
UIObserverListener uiObserverListener; |
|
|
|
|
boolean activeState; |
|
|
|
|
UILabel borderUiLabel; |
|
|
|
|
|
|
|
|
|
IconButton(String iconTemplatePath) { |
|
|
|
|
this.iconTemplatePath = iconTemplatePath; |
|
|
|
|
initComponents(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean isActiveState() { |
|
|
|
|
return activeState; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setActiveState(boolean activeState) { |
|
|
|
|
if (activeState) { |
|
|
|
|
borderUiLabel.setBorder(BorderFactory.createLineBorder(Color.gray, 1)); |
|
|
|
|
colorButton.setVisible(true); |
|
|
|
|
} else { |
|
|
|
|
borderUiLabel.setBorder(null); |
|
|
|
|
colorButton.setVisible(false); |
|
|
|
|
} |
|
|
|
|
this.activeState = activeState; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void initComponents() { |
|
|
|
|
jLayeredPane = new JLayeredPane(); |
|
|
|
|
iconLabel = getIconLabel(iconTemplatePath); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UILabel emptyUiLabel = new UILabel(); |
|
|
|
|
emptyUiLabel.setSize(16, 16); |
|
|
|
|
emptyUiLabel.setOpaque(true); |
|
|
|
|
emptyUiLabel.setBackground(Color.WHITE); |
|
|
|
|
borderUiLabel = new UILabel(); |
|
|
|
|
borderUiLabel.setSize(16, 16); |
|
|
|
|
borderUiLabel.setOpaque(true); |
|
|
|
|
borderUiLabel.setBackground(Color.WHITE); |
|
|
|
|
iconLabel.setSize(16, 16); |
|
|
|
|
colorButton = new ColorListPane.ColorButton(Color.CYAN); |
|
|
|
|
colorButton.setSize(16, 16); |
|
|
|
@ -110,7 +137,7 @@ public class HeaderSortRulePane extends JPanel {
|
|
|
|
|
jLayeredPane.setPreferredSize(new Dimension(16, 16)); |
|
|
|
|
|
|
|
|
|
jLayeredPane.add(iconLabel, JLayeredPane.POPUP_LAYER); |
|
|
|
|
jLayeredPane.add(emptyUiLabel, JLayeredPane.MODAL_LAYER); |
|
|
|
|
jLayeredPane.add(borderUiLabel, JLayeredPane.MODAL_LAYER); |
|
|
|
|
jLayeredPane.add(colorButton, JLayeredPane.PALETTE_LAYER); |
|
|
|
|
this.add(jLayeredPane); |
|
|
|
|
} |
|
|
|
@ -192,7 +219,7 @@ public class HeaderSortRulePane extends JPanel {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void populateBean(SortHeader.SortItem[] sortItems) { |
|
|
|
|
initState(); |
|
|
|
|
initState(sortItems == null); |
|
|
|
|
if (sortItems != null) { |
|
|
|
|
for (SortHeader.SortItem sortItem : sortItems) { |
|
|
|
|
SortRule sortRule = sortItem.getSortRule(); |
|
|
|
|