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