From 50fb8f23ebe3baac7a07949fdb59bdb3943954f5 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 21 Dec 2021 23:32:17 +0800 Subject: [PATCH] REPORT-64527 && REPORT-64525 && REPORT-64489 && REPORT-64485 && REPORT-64466 && REPORT-64463 && REPORT-64462 && REPORT-64460 --- .../images/buttonicon/select_disabled.svg | 5 ++ .../images/buttonicon/select_normal.svg | 5 ++ .../com/fr/design/images/sort/sequence.png | Bin 0 -> 301 bytes .../fr/design/mainframe/ElementCasePane.java | 19 ++++++- .../design/sort/common/SortColumnRowPane.java | 47 ++++++++++------ .../CustomSequenceEditPane.java | 52 ++++++++++++++---- .../expressionpane/CustomSequencePane.java | 18 +++--- .../fr/design/sort/header/HeaderAreaPane.java | 30 +++++++++- .../sort/header/HeaderSortRulePane.java | 43 ++++++++------- .../fr/design/sort/header/SortHeaderPane.java | 6 +- 10 files changed, 162 insertions(+), 63 deletions(-) create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg create mode 100644 designer-base/src/main/resources/com/fr/design/images/sort/sequence.png diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg new file mode 100644 index 0000000000..b21c206a3a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/select_disabled.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg b/designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg new file mode 100644 index 0000000000..60a2855aa5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/buttonicon/select_normal.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/designer-base/src/main/resources/com/fr/design/images/sort/sequence.png b/designer-base/src/main/resources/com/fr/design/images/sort/sequence.png new file mode 100644 index 0000000000000000000000000000000000000000..ac321ae1749c385bda6374d526d7016aaac9a52a GIT binary patch literal 301 zcmV+|0n+}7P)Px#=Sf6CR5(wik}+z-P!L3CtRe>pxJhGh6Bh=-{@%VyZjr`Sn%p8+v3so%xNsVS z8#e|YAcZpF2V_3v3nXRR-FfWnEb-4`)SCtM;kZ}7^J(1yxn>_|C&0{>(qsnUk<`Y$ zn&*I7fSEl5+)8|nqCo&Nn@iY{e3JOm1&DWxw*PDpLfA?80t1YW1siUTIefG=k6(t5x1Hj#xcSX*! extends Tar private CellSelection formatReferencedCell = null; private CellSelection cellNeedTOFormat = null; private FormatBrushAction formatBrushAction; + private boolean repeatSelection = false; private ActionListener keyListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -526,11 +527,17 @@ public abstract class ElementCasePane extends Tar return this.selection.getQuickEditor(this); } + public boolean isRepeatSelection() { + return repeatSelection; + } + + public void setRepeatSelection(boolean repeatSelection) { + this.repeatSelection = repeatSelection; + } + @Override public void setSelection(Selection selection) { - if (!ComparatorUtils.equals(this.selection, selection) - || !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance()) - || DesignModeContext.isAuthorityEditing()) { + if (isEffectiveSelection(selection)) { try { //旧选中内容编辑器释放模板对象 QuickEditor editor = this.selection.getQuickEditorWithoutPopulate(this); @@ -545,6 +552,12 @@ public abstract class ElementCasePane extends Tar } } + private boolean isEffectiveSelection(Selection selection) { + return (isRepeatSelection() || !ComparatorUtils.equals(this.selection, selection)) + || !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance()) + || DesignModeContext.isAuthorityEditing(); + } + public void setOldSelecton(Selection selection) { this.selection = selection; diff --git a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java index cc276711a3..851b35a8d2 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/common/SortColumnRowPane.java @@ -12,8 +12,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; -import com.fr.design.ui.util.UIUtil; -import com.fr.general.Background; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; import com.fr.log.FineLoggerFactory; @@ -30,8 +28,6 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -50,6 +46,9 @@ public class SortColumnRowPane extends JPanel implements UIObserver { private CellSelection oldSelection; private SelectionListener gridSelectionChangeListener; UIObserverListener uiObserverListener; + private final static Icon DISABLED_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_disabled.svg"); + private final static Icon ENABLE_ICON = IconUtils.readIcon("/com/fr/design/images/buttonicon/select_normal.svg"); + private boolean enabled; public SortColumnRowPane(int paneWidth, int paneHeight) { this.paneWidth = paneWidth; @@ -91,12 +90,17 @@ public class SortColumnRowPane extends JPanel implements UIObserver { } void initSelectButton() { - selectButton = new UIButton(IconUtils.readIcon("/com/fr/design/images/buttonicon/select.png")); + selectButton = new UIButton(ENABLE_ICON); selectButton.addMouseListener(new SelectActionListener(this)); this.add(selectButton); } public void populateBean(ColumnRow columnRow) { + populateBean(columnRow, true); + } + + public void populateBean(ColumnRow columnRow, boolean enabled) { + this.enabled = enabled; if (SortColumnRowPane.isAvailableColumnRow(columnRow)) { colJTextField.setText(EssentialUtils.convertIntToABC(columnRow.column + 1)); rowJTextField.setText(String.valueOf(columnRow.row + 1)); @@ -104,6 +108,11 @@ public class SortColumnRowPane extends JPanel implements UIObserver { colJTextField.setText(StringUtils.EMPTY); rowJTextField.setText(StringUtils.EMPTY); } + if (enabled) { + selectButton.setIcon(ENABLE_ICON); + } else { + selectButton.setIcon(DISABLED_ICON); + } refresh(); } @@ -141,25 +150,28 @@ public class SortColumnRowPane extends JPanel implements UIObserver { @Override public void mouseClicked(MouseEvent e) { - ElementCasePane elementCasePane = getCurrentElementCase(); - if (elementCasePane == null || isAlreadyAddListener) { - return; - } - prepareSelectHeader(elementCasePane); - gridSelectionChangeListener = new SelectionListener() { - @Override - public void selectionChanged(SelectionEvent e) { - completeSelectHeader(elementCasePane); + if (enabled) { + ElementCasePane elementCasePane = getCurrentElementCase(); + if (elementCasePane == null || isAlreadyAddListener) { + return; } - }; - elementCasePane.addSelectionChangeListener(gridSelectionChangeListener); - isAlreadyAddListener = true; + prepareSelectHeader(elementCasePane); + gridSelectionChangeListener = new SelectionListener() { + @Override + public void selectionChanged(SelectionEvent e) { + completeSelectHeader(elementCasePane); + } + }; + elementCasePane.addSelectionChangeListener(gridSelectionChangeListener); + isAlreadyAddListener = true; + } } private void prepareSelectHeader(ElementCasePane elementCasePane) { ashDisableHeaderCellsStyle(elementCasePane.getEditingElementCase()); oldSelection = (CellSelection) elementCasePane.getSelection(); elementCasePane.getGrid().setNotShowingTableSelectPane(false); + elementCasePane.setRepeatSelection(true); elementCasePane.setEditable(false); elementCasePane.repaint(10); } @@ -179,6 +191,7 @@ public class SortColumnRowPane extends JPanel implements UIObserver { elementCasePane.removeSelectionChangeListener(gridSelectionChangeListener); isAlreadyAddListener = false; elementCasePane.getGrid().setNotShowingTableSelectPane(true); + elementCasePane.setRepeatSelection(false); elementCasePane.setEditable(true); elementCasePane.repaint(); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java index a62acc4131..c65657836b 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequenceEditPane.java @@ -5,12 +5,15 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.UIList; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.dnd.SerializableTransferable; import com.fr.design.mainframe.share.ui.base.PlaceholderTextArea; import com.fr.locale.InterProviderFactory; import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; +import com.fr.stable.StringUtils; import javax.swing.*; +import javax.swing.event.DocumentEvent; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; @@ -27,6 +30,7 @@ import java.util.List; public class CustomSequenceEditPane extends BasicPane { java.util.List customSequence; + JSplitPane jSplitPane; JPanel referenceSequencePanel; JPanel editSequencePanel; JTextArea jTextArea; @@ -40,17 +44,32 @@ public class CustomSequenceEditPane extends BasicPane { this.setLayout(new BorderLayout()); initReferenceSequencePanel(); initEditSequencePanel(); + initSplitPane(); + } + + void initSplitPane() { + jSplitPane = new JSplitPane(); + this.add(jSplitPane); + jSplitPane.setOneTouchExpandable(true); + jSplitPane.setContinuousLayout(true); + jSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); + jSplitPane.setLeftComponent(referenceSequencePanel); + jSplitPane.setRightComponent(editSequencePanel); + jSplitPane.setDividerSize(10); + jSplitPane.setDividerLocation(200); } void initReferenceSequencePanel() { - referenceSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + referenceSequencePanel = new JPanel(); + referenceSequencePanel.setLayout(new BoxLayout(referenceSequencePanel, BoxLayout.Y_AXIS)); + JPanel titlePane = new JPanel(new FlowLayout(FlowLayout.LEFT)); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Reference_Sequence")); - referenceSequencePanel.add(uiLabel); + titlePane.add(uiLabel); + referenceSequencePanel.add(titlePane); UIScrollPane uiScrollPane = new UIScrollPane(getReferenceSequenceList()); uiScrollPane.setPreferredSize(new Dimension(200, 300)); referenceSequencePanel.add(uiScrollPane); - referenceSequencePanel.setPreferredSize(new Dimension(200, 400)); - this.add(referenceSequencePanel, BorderLayout.WEST); + referenceSequencePanel.setSize(new Dimension(200, 400)); } private UIList getReferenceSequenceList() { @@ -69,18 +88,20 @@ public class CustomSequenceEditPane extends BasicPane { } void initEditSequencePanel() { - editSequencePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + editSequencePanel = new JPanel(); + editSequencePanel.setLayout(new BoxLayout(editSequencePanel, BoxLayout.Y_AXIS)); + JPanel titlePane = new JPanel(new FlowLayout(FlowLayout.LEFT)); UILabel uiLabel = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Input_Sequence")); - editSequencePanel.add(uiLabel); + titlePane.add(uiLabel); UILabel uiLabel2 = new UILabel(Toolkit.i18nText("Fine-Design_Sort_Please_Interlace_Sequence_Elements")); uiLabel2.setForeground(Color.lightGray); - editSequencePanel.add(uiLabel2); + titlePane.add(uiLabel2); + editSequencePanel.add(titlePane); jTextArea = getTextArea(); UIScrollPane uiScrollPane = new UIScrollPane(jTextArea); uiScrollPane.setPreferredSize(new Dimension(475, 300)); editSequencePanel.add(uiScrollPane); - this.add(editSequencePanel, BorderLayout.CENTER); - + editSequencePanel.setSize(new Dimension(475, 300)); } @@ -88,6 +109,12 @@ public class CustomSequenceEditPane extends BasicPane { PlaceholderTextArea placeholderTextArea = new PlaceholderTextArea(10, 10, getPlaceholderText()); new CustomSequenceEditDropTarget(placeholderTextArea, CustomSequenceSortExpression.getReferenceCustomSequences()); placeholderTextArea.setText(CustomSequenceSortExpression.customSequenceToString(customSequence, "\n")); + placeholderTextArea.getDocument().addDocumentListener(new DocumentAdapter() { + @Override + protected void textChanged(DocumentEvent e) { + placeholderTextArea.repaint(); + } + }); return placeholderTextArea; } @@ -139,12 +166,15 @@ public class CustomSequenceEditPane extends BasicPane { DataFlavor[] dataFlavors = transferable.getTransferDataFlavors(); if (dataFlavors.length == 1) { Integer index = (Integer) transferable.getTransferData(dataFlavors[0]); - String text = ""; + JTextArea jTextArea = (JTextArea) dtde.getDropTargetContext().getComponent(); + String text = jTextArea.getText(); + if (StringUtils.isNotEmpty(text) && !text.endsWith("\n")) { + text += "\n"; + } java.util.List customSequence = customSequences.get(index); for (int i = 0; i < customSequence.size(); i++) { text += customSequence.get(i) + "\n"; } - JTextArea jTextArea = (JTextArea) dtde.getDropTargetContext().getComponent(); jTextArea.setText(text); } } catch (Exception e) { diff --git a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java index 50344f1b64..34fca093b2 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/expressionpane/CustomSequencePane.java @@ -10,8 +10,8 @@ import com.fr.report.core.sort.sortexpression.CustomSequenceSortExpression; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.List; @@ -29,13 +29,15 @@ public class CustomSequencePane extends JPanel { textField = new UITextField(); textField.setEditable(false); textField.setPreferredSize(new Dimension(width - 20, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - Icon icon = IconUtils.readIcon("/com/fr/design/images/control/refresh.png"); + Icon icon = IconUtils.readIcon("/com/fr/design/images/sort/sequence.png"); button = new UIButton(icon); button.setBackground(Color.RED); button.setOpaque(false); button.setCursor(new Cursor(Cursor.HAND_CURSOR)); - button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + button.setPreferredSize(new Dimension(20, AbstractSortPane.PANE_COMPONENT_HEIGHT)); + MouseAdapter mouseAdapter = new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { CustomSequenceEditPane customSequenceEditPane = new CustomSequenceEditPane(customSequence); customSequenceEditPane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override @@ -45,9 +47,9 @@ public class CustomSequencePane extends JPanel { } }, new Dimension(700, 400)).setVisible(true); } - }); - button.setPreferredSize(new Dimension(20, AbstractSortPane.PANE_COMPONENT_HEIGHT)); - + }; + button.addMouseListener(mouseAdapter); + textField.addMouseListener(mouseAdapter); this.add(textField); this.add(button); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java index 31057c724b..3e1adbe48c 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/HeaderAreaPane.java @@ -1,10 +1,14 @@ package com.fr.design.sort.header; +import com.fr.design.designer.TargetComponent; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.ElementCasePane; import com.fr.design.sort.common.AbstractSortPane; import com.fr.design.sort.common.SortColumnRowPane; +import com.fr.log.FineLoggerFactory; import com.fr.stable.ColumnRow; import javax.swing.*; @@ -43,13 +47,31 @@ public class HeaderAreaPane extends JPanel { } public void populateBean(ColumnRow columnRow, boolean showHeaderArea) { - areaJLayeredPane.populateBean(columnRow, showHeaderArea); + boolean enabled = true; + ElementCasePane elementCasePane = getCurrentElementCase(); + if (elementCasePane != null) { + enabled = elementCasePane.isSelectedOneCell(); + } + areaJLayeredPane.populateBean(columnRow, showHeaderArea, enabled); } public ColumnRow updateBean() { return areaJLayeredPane.updateBean(); } + private ElementCasePane getCurrentElementCase() { + try { + TargetComponent targetComponent + = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); + if (targetComponent instanceof ElementCasePane) { + return (ElementCasePane) targetComponent; + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e, e.getMessage()); + } + return null; + } + class AreaJLayeredPane extends JPanel { SortColumnRowPane columnRowPane; JLayeredPane jLayeredPane; @@ -75,6 +97,7 @@ public class HeaderAreaPane extends JPanel { setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1); } }); + uiComboBox.setEnabled(false); } void setSortColumnRowPaneShow(boolean show) { @@ -97,14 +120,15 @@ public class HeaderAreaPane extends JPanel { this.add(jLayeredPane); } - public void populateBean(ColumnRow columnRow, boolean showHeaderArea) { + public void populateBean(ColumnRow columnRow, boolean showHeaderArea, boolean enabled) { if (showHeaderArea) { uiComboBox.setSelectedIndex(1); } else { uiComboBox.setSelectedIndex(0); } - columnRowPane.populateBean(columnRow); + columnRowPane.populateBean(columnRow, enabled); setSortColumnRowPaneShow(uiComboBox.getSelectedIndex() == 1); + uiComboBox.setEnabled(enabled); } public ColumnRow updateBean() { 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 9b1de94772..79f939639e 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 @@ -31,6 +31,8 @@ public class HeaderSortRulePane extends JPanel { private static final String ASC_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/asc.svg"; private static final String DES_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/des.svg"; private static final String NOSORT_ICON_TEMPLATE_PATH = "/com/fr/design/images/sort/nosort.svg"; + private static final double ICON_SCALE = SVGIcon.SYSTEM_SCALE * 1.25; + private static final int ICON_LENGTH = (int) Math.ceil(16 * ICON_SCALE); IconButton ascIconButton; IconButton desIconButton; IconButton nosortIconButton; @@ -63,8 +65,8 @@ public class HeaderSortRulePane extends JPanel { new Component[]{desUICheckBox = new UICheckBox(SortRule.DES.getDescription()), desIconButton = new IconButton(DES_ICON_TEMPLATE_PATH)}, new Component[]{nosortUICheckBox = new UICheckBox(SortRule.NO_SORT.getDescription()), nosortIconButton = new IconButton(NOSORT_ICON_TEMPLATE_PATH)}, }; - double[] rowSize = {24, 24, 24}; - double[] columnSize = {80, 30}; + double[] rowSize = {ICON_LENGTH + 10, ICON_LENGTH + 10, ICON_LENGTH + 10}; + double[] columnSize = {80, ICON_LENGTH + 10}; JPanel sortRuleItem = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 0); this.add(sortRuleItem, BorderLayout.CENTER); initUICheckBoxChange(ascUICheckBox, ascIconButton); @@ -125,12 +127,12 @@ public class HeaderSortRulePane extends JPanel { jLayeredPane = new JLayeredPane(); iconLabel = getIconLabel(iconTemplatePath); borderUiLabel = new UILabel(); - borderUiLabel.setSize(16, 16); + borderUiLabel.setSize(ICON_LENGTH, ICON_LENGTH); borderUiLabel.setOpaque(true); borderUiLabel.setBackground(Color.WHITE); - iconLabel.setSize(16, 16); + iconLabel.setSize(ICON_LENGTH, ICON_LENGTH); colorButton = new ColorListPane.ColorButton(Color.CYAN); - colorButton.setSize(16, 16); + colorButton.setSize(ICON_LENGTH, ICON_LENGTH); colorButton.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { @@ -139,7 +141,7 @@ public class HeaderSortRulePane extends JPanel { uiObserverListener.doChange(); } }); - jLayeredPane.setPreferredSize(new Dimension(16, 16)); + jLayeredPane.setPreferredSize(new Dimension(ICON_LENGTH, ICON_LENGTH)); jLayeredPane.add(iconLabel, JLayeredPane.POPUP_LAYER); jLayeredPane.add(borderUiLabel, JLayeredPane.MODAL_LAYER); @@ -152,6 +154,14 @@ public class HeaderSortRulePane extends JPanel { refreshIconLabel(icon); } + void refreshIconLabel(BufferedImage bufferedImage) { + if (bufferedImage != null) { + this.bufferedImage = bufferedImage; + Icon icon = new SVGIcon(bufferedImage); + refreshIconLabel(icon); + } + } + void refreshIconLabel(Icon icon) { if (icon != null) { iconLabel.removeAll(); @@ -175,7 +185,7 @@ public class HeaderSortRulePane extends JPanel { String svgText = originalSvgText.replaceAll("\\{fillColor\\}", shiftColor(color)); InputStream svgInputStream = new ByteArrayInputStream(svgText.getBytes(StandardCharsets.UTF_8)); TranscoderInput input = new TranscoderInput(svgInputStream); - bufferedImage = SVGTranscoder.createImage(SVGIcon.SYSTEM_SCALE, input).getImage(); + bufferedImage = SVGTranscoder.createImage(ICON_SCALE, input).getImage(); SVGIcon svgIcon = new SVGIcon(bufferedImage); return svgIcon; } catch (Exception e) { @@ -203,12 +213,11 @@ public class HeaderSortRulePane extends JPanel { } String shiftValue(int value) { - int resultValue = (int) ((((float) value) / 255) * 99); - if (resultValue < 10) { - return "0" + resultValue; - } else { - return "" + resultValue; + String resultValue = Integer.toHexString(value); + if (resultValue.length() == 1) { + resultValue = "0" + resultValue; } + return resultValue; } private String getSvgText(InputStream inputStream) throws Exception { @@ -237,18 +246,14 @@ public class HeaderSortRulePane extends JPanel { for (SortHeader.SortItem sortItem : sortItems) { SortRule sortRule = sortItem.getSortRule(); BufferedImage bufferedImage = sortItem.getBufferedImage(); - Icon icon = null; - if (bufferedImage != null) { - icon = new SVGIcon(bufferedImage); - } if (sortRule == SortRule.ASC) { - ascIconButton.refreshIconLabel(icon); + ascIconButton.refreshIconLabel(bufferedImage); ascUICheckBox.setSelected(true); } else if (sortRule == SortRule.DES) { - desIconButton.refreshIconLabel(icon); + desIconButton.refreshIconLabel(bufferedImage); desUICheckBox.setSelected(true); } else if (sortRule == SortRule.NO_SORT) { - nosortIconButton.refreshIconLabel(icon); + nosortIconButton.refreshIconLabel(bufferedImage); nosortUICheckBox.setSelected(true); } diff --git a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java index 0235a10fb9..b79065e331 100644 --- a/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java +++ b/designer-realize/src/main/java/com/fr/design/sort/header/SortHeaderPane.java @@ -35,15 +35,17 @@ public class SortHeaderPane extends JPanel { public void populateBean(SortHeader sortHeader, String defaultHeaderArea) { this.sortHeader = sortHeader; boolean showHeaderArea = false; - ColumnRow columnRow = null; SortHeader.SortItem[] sortItems = null; String headerArea = defaultHeaderArea; + ColumnRow columnRow = ColumnRow.valueOf(headerArea); if (sortHeader != null) { headerArea = sortHeader.getHeaderArea(); sortItems = sortHeader.getSortItems(); showHeaderArea = SortColumnRowPane.isAvailableColumnRow(ColumnRow.valueOf(headerArea)); + if (showHeaderArea) { + columnRow = ColumnRow.valueOf(headerArea); + } } - columnRow = ColumnRow.valueOf(headerArea); headerAreaPane.populateBean(columnRow, showHeaderArea); headerSettingPane.populateBean(sortItems); }