From d54982191796796accf56f822a00a99d6ac309b9 Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 29 Jun 2023 17:02:36 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-97591=20=E6=8E=92=E5=BA=8F=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E8=AE=BE=E7=BD=AE=E9=A2=9C=E8=89=B2=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=B9=B6=E5=85=B3=E9=97=AD=E6=A8=A1=E6=9D=BF=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E6=AC=A1=E6=89=93=E5=BC=80=E6=8E=92=E5=BA=8F=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E9=A2=9C=E8=89=B2=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sort/header/HeaderSortRulePane.java | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java index 0c05d75608..a85238acbd 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderSortRulePane.java @@ -39,7 +39,7 @@ public class HeaderSortRulePane extends JPanel { HeaderSortRulePane() { initComponents(); - initState(true, null); + initState(true); 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); desUICheckBox.setSelected(selected); nosortUICheckBox.setSelected(selected); - if(items==null){ - ascIconButton.refreshIconLabelColor(new FineColor(defaultColor)); - desIconButton.refreshIconLabelColor(new FineColor(defaultColor)); - nosortIconButton.refreshIconLabelColor(new FineColor(defaultColor)); - } else { - Map 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))); - } - + ascIconButton.refreshIconLabelColor(new FineColor(defaultColor)); + desIconButton.refreshIconLabelColor(new FineColor(defaultColor)); + nosortIconButton.refreshIconLabelColor(new FineColor(defaultColor)); } class IconButton extends JPanel implements UIObserver, PopupHider { @@ -230,19 +219,23 @@ public class HeaderSortRulePane extends JPanel { } public void populateBean(SortHeader.SortItem[] sortItems) { - initState(sortItems == null, sortItems); + initState(sortItems == null); if (sortItems != null) { for (SortHeader.SortItem sortItem : sortItems) { SortRule sortRule = sortItem.getSortRule(); BufferedImage bufferedImage = sortItem.getBufferedImage(); + FineColor fineColor = sortItem.getFineColor(); if (sortRule == SortRule.ASC) { ascIconButton.refreshIconLabel(bufferedImage); + ascIconButton.refreshIconLabelColor(fineColor); ascUICheckBox.setSelected(true); } else if (sortRule == SortRule.DES) { desIconButton.refreshIconLabel(bufferedImage); + desIconButton.refreshIconLabelColor(fineColor); desUICheckBox.setSelected(true); } else if (sortRule == SortRule.NO_SORT) { nosortIconButton.refreshIconLabel(bufferedImage); + nosortIconButton.refreshIconLabelColor(fineColor); nosortUICheckBox.setSelected(true); } }