From 351c240c60ff3dde80034269fb2a065f638bdfdd Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Thu, 14 Sep 2017 23:35:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8alphafine=E4=B8=8A=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=B8=80=E4=B8=8B=E9=AB=98=E6=B8=85=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/AlphaFineConstants.java | 2 +- .../alphafine/cell/render/ContentCellRender.java | 12 ++++++++---- .../alphafine/component/AlphaFineDialog.java | 9 +++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index b10a61e36f..6993a43e42 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -66,7 +66,7 @@ public class AlphaFineConstants { public static final Font GREATER_FONT = new Font("Song_TypeFace", 0, 20); - + public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/"; public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); public static final String PLUGIN_URL = "http://shop.finereport.com/plugin/"; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index 563e26f46b..a99aecf3a2 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.cell.render; +import com.bulenkov.iconloader.IconLoader; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; @@ -15,6 +16,9 @@ import java.awt.*; */ public class ContentCellRender implements ListCellRenderer { private static final int OFFSET = 45; + private static final String SELECTED_PATH = AlphaFineConstants.IMAGE_URL + "selected"; + private static final String CELL_PATH = AlphaFineConstants.IMAGE_URL + "alphafine"; + private static final String SUFFIX = ".png"; @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -30,13 +34,13 @@ public class ContentCellRender implements ListCellRenderer { titleLabel.setText(" " + model.getName()); if (model.hasAction()) { if (isSelected) { - String iconUrl = "/com/fr/design/mainframe/alphafine/images/selected" + model.getType().getTypeValue() + ".png"; + String iconUrl = SELECTED_PATH + model.getType().getTypeValue() + SUFFIX; panel.setBackground(AlphaFineConstants.BLUE); titleLabel.setForeground(Color.WHITE); - titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl))); + titleLabel.setIcon(IconLoader.getIcon(iconUrl)); } else { - String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; - titleLabel.setIcon(new ImageIcon(IOUtils.readImage(iconUrl))); + String iconUrl = CELL_PATH + model.getType().getTypeValue() + SUFFIX; + titleLabel.setIcon(IconLoader.getIcon(iconUrl)); titleLabel.setForeground(AlphaFineConstants.BLACK); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 67b179e188..a47bdfc802 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.component; +import com.bulenkov.iconloader.IconLoader; import com.fr.base.ConfigManager; import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; @@ -134,7 +135,7 @@ public class AlphaFineDialog extends UIDialog { private void initComponents() { initSearchTextField(); JPanel topPane = new JPanel(new BorderLayout()); - UILabel iconLabel = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png"))); + UILabel iconLabel = new UILabel(IconLoader.getIcon(AlphaFineConstants.IMAGE_URL + "bigsearch.png")); iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); iconLabel.setOpaque(true); iconLabel.setBackground(Color.WHITE); @@ -149,7 +150,7 @@ public class AlphaFineDialog extends UIDialog { } }; closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); - closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png"))); + closeButton.setIcon(IOUtils.readIcon(AlphaFineConstants.IMAGE_URL + "alphafine_close.png")); closeButton.set4ToolbarButton(); closeButton.setBorderPainted(false); closeButton.setRolloverEnabled(false); @@ -345,7 +346,7 @@ public class AlphaFineDialog extends UIDialog { */ private void removeLeftPane() { if (searchListModel.isEmpty() && defaultPane == null) { - defaultPane = new NoResultPane(Inter.getLocText("FR-Designer-AlphaFine_NO_Result"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/no_result.png")); + defaultPane = new NoResultPane(Inter.getLocText("FR-Designer-AlphaFine_NO_Result"), AlphaFineConstants.IMAGE_URL + "no_result.png"); searchResultPane.remove(leftSearchResultPane); searchResultPane.add(defaultPane, BorderLayout.WEST); refreshContainer(); @@ -556,7 +557,7 @@ public class AlphaFineDialog extends UIDialog { break; case ACTION: rightSearchResultPane.removeAll(); - rightSearchResultPane.add(new NoResultPane(Inter.getLocText("FR-Designer_NoResult"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png"))); + rightSearchResultPane.add(new NoResultPane(Inter.getLocText("FR-Designer_NoResult"), AlphaFineConstants.IMAGE_URL + "noresult.png")); validate(); repaint(); break;