|
|
@ -39,7 +39,7 @@ public class HeaderSortRulePane extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
HeaderSortRulePane() { |
|
|
|
HeaderSortRulePane() { |
|
|
|
initComponents(); |
|
|
|
initComponents(); |
|
|
|
initState(true, null); |
|
|
|
initState(true); |
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); |
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 15)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -80,24 +80,13 @@ public class HeaderSortRulePane extends JPanel { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void initState(boolean selected, SortHeader.SortItem[] items) { |
|
|
|
void initState(boolean selected) { |
|
|
|
ascUICheckBox.setSelected(selected); |
|
|
|
ascUICheckBox.setSelected(selected); |
|
|
|
desUICheckBox.setSelected(selected); |
|
|
|
desUICheckBox.setSelected(selected); |
|
|
|
nosortUICheckBox.setSelected(selected); |
|
|
|
nosortUICheckBox.setSelected(selected); |
|
|
|
if(items==null){ |
|
|
|
ascIconButton.refreshIconLabelColor(new FineColor(defaultColor)); |
|
|
|
ascIconButton.refreshIconLabelColor(new FineColor(defaultColor)); |
|
|
|
desIconButton.refreshIconLabelColor(new FineColor(defaultColor)); |
|
|
|
desIconButton.refreshIconLabelColor(new FineColor(defaultColor)); |
|
|
|
nosortIconButton.refreshIconLabelColor(new FineColor(defaultColor)); |
|
|
|
nosortIconButton.refreshIconLabelColor(new FineColor(defaultColor)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Map<SortRule, FineColor> colorMap = new HashMap<>(items.length); |
|
|
|
|
|
|
|
for (SortHeader.SortItem item : items) { |
|
|
|
|
|
|
|
colorMap.put(item.getSortRule(), item.getFineColor()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ascIconButton.refreshIconLabelColor(colorMap.getOrDefault(SortRule.ASC, new FineColor(defaultColor))); |
|
|
|
|
|
|
|
desIconButton.refreshIconLabelColor(colorMap.getOrDefault(SortRule.DES, new FineColor(defaultColor))); |
|
|
|
|
|
|
|
nosortIconButton.refreshIconLabelColor(colorMap.getOrDefault(SortRule.NO_SORT, new FineColor(defaultColor))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class IconButton extends JPanel implements UIObserver, PopupHider { |
|
|
|
class IconButton extends JPanel implements UIObserver, PopupHider { |
|
|
@ -230,19 +219,23 @@ public class HeaderSortRulePane extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void populateBean(SortHeader.SortItem[] sortItems) { |
|
|
|
public void populateBean(SortHeader.SortItem[] sortItems) { |
|
|
|
initState(sortItems == null, sortItems); |
|
|
|
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(); |
|
|
|
BufferedImage bufferedImage = sortItem.getBufferedImage(); |
|
|
|
BufferedImage bufferedImage = sortItem.getBufferedImage(); |
|
|
|
|
|
|
|
FineColor fineColor = sortItem.getFineColor(); |
|
|
|
if (sortRule == SortRule.ASC) { |
|
|
|
if (sortRule == SortRule.ASC) { |
|
|
|
ascIconButton.refreshIconLabel(bufferedImage); |
|
|
|
ascIconButton.refreshIconLabel(bufferedImage); |
|
|
|
|
|
|
|
ascIconButton.refreshIconLabelColor(fineColor); |
|
|
|
ascUICheckBox.setSelected(true); |
|
|
|
ascUICheckBox.setSelected(true); |
|
|
|
} else if (sortRule == SortRule.DES) { |
|
|
|
} else if (sortRule == SortRule.DES) { |
|
|
|
desIconButton.refreshIconLabel(bufferedImage); |
|
|
|
desIconButton.refreshIconLabel(bufferedImage); |
|
|
|
|
|
|
|
desIconButton.refreshIconLabelColor(fineColor); |
|
|
|
desUICheckBox.setSelected(true); |
|
|
|
desUICheckBox.setSelected(true); |
|
|
|
} else if (sortRule == SortRule.NO_SORT) { |
|
|
|
} else if (sortRule == SortRule.NO_SORT) { |
|
|
|
nosortIconButton.refreshIconLabel(bufferedImage); |
|
|
|
nosortIconButton.refreshIconLabel(bufferedImage); |
|
|
|
|
|
|
|
nosortIconButton.refreshIconLabelColor(fineColor); |
|
|
|
nosortUICheckBox.setSelected(true); |
|
|
|
nosortUICheckBox.setSelected(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|