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 32de9a078f..8fb2118d96 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -22,6 +22,7 @@ import com.fr.form.main.Form; import com.fr.form.main.FormIO; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; +import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.general.http.HttpClient; import com.fr.io.TemplateWorkBookIO; @@ -297,15 +298,10 @@ public class AlphaFineDialog extends UIDialog { leftSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane = new JPanel(); rightSearchResultPane.setBackground(Color.WHITE); - UILabel splitLine = new UILabel(); - splitLine.setBackground(AlphaFineConstants.GRAY); - splitLine.setPreferredSize(new Dimension(1, AlphaFineConstants.CONTENT_HEIGHT)); rightSearchResultPane.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH - 1, AlphaFineConstants.CONTENT_HEIGHT)); searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); - searchResultPane.add(splitLine, BorderLayout.CENTER); searchResultPane.add(rightSearchResultPane, BorderLayout.EAST); UILabel splitLabel = new UILabel(); - splitLabel.setBackground(AlphaFineConstants.GRAY); splitLabel.setPreferredSize(new Dimension(AlphaFineConstants.HEIGHT, 1)); searchResultPane.add(splitLabel, BorderLayout.NORTH); add(searchResultPane, BorderLayout.SOUTH); @@ -345,6 +341,9 @@ public class AlphaFineDialog extends UIDialog { replaceLeftPane(); } + /** + * 刷新容器 + */ private void refreshContainer() { validate(); repaint(); @@ -355,18 +354,17 @@ public class AlphaFineDialog extends UIDialog { * 重置结果面板 */ private void replaceLeftPane() { - if (searchListModel.getSize() > 0 && defaultPane != null) { + if (searchListModel.getSize() == 0 && defaultPane == null) { + defaultPane = new NoResultPane(Inter.getLocText("FR-Designer-AlphaFine_NO_Result"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/no_result.png")); + searchResultPane.remove(leftSearchResultPane); + searchResultPane.add(defaultPane, BorderLayout.WEST); + refreshContainer(); + } else if (searchListModel.getSize() > 0 && defaultPane != null) { searchResultPane.remove(defaultPane); defaultPane = null; searchResultPane.add(leftSearchResultPane, BorderLayout.WEST); refreshContainer(); - } else if (searchListModel.getSize() == 0 && defaultPane == null){ - defaultPane = new DefaulPane(); - searchResultPane.remove(leftSearchResultPane); - searchResultPane.add(defaultPane, BorderLayout.WEST); - refreshContainer(); } - } /** @@ -557,7 +555,7 @@ public class AlphaFineDialog extends UIDialog { break; case ACTION: rightSearchResultPane.removeAll(); - rightSearchResultPane.add(new ActionPreviewPane()); + rightSearchResultPane.add(new NoResultPane(Inter.getLocText("FR-Designer_NoResult"), IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png"))); validate(); repaint(); break; diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java deleted file mode 100644 index c7286850f8..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/preview/ActionPreviewPane.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.mainframe.alphafine.preview; - - -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.general.IOUtils; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; - - -/** - * Created by XiaXiang on 2017/5/5. - */ -public class ActionPreviewPane extends JPanel { - private static final Font NAME = new Font("Song_TypeFace", 0, 14); - - public ActionPreviewPane() { - setLayout(new BorderLayout()); - setBackground(null); - setBorder(BorderFactory.createEmptyBorder(135, 0, 0, 0)); - UILabel image = new UILabel(); - image.setPreferredSize(new Dimension(150, 111)); - image.setHorizontalAlignment(SwingConstants.CENTER); - image.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - image.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/noresult.png")); - UILabel description = new UILabel(Inter.getLocText("FR-Designer_NoResult")); - description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(NAME); - description.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - description.setHorizontalAlignment(SwingConstants.CENTER); - this.add(image, BorderLayout.CENTER); - this.add(description, BorderLayout.SOUTH); - } - -} diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/DefaulPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/DefaulPane.java deleted file mode 100644 index 88572a0027..0000000000 --- a/designer/src/com/fr/design/mainframe/alphafine/preview/DefaulPane.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.fr.design.mainframe.alphafine.preview; - -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.general.IOUtils; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; - -/** - * Created by XiaXiang on 2017/8/14. - */ -public class DefaulPane extends JPanel { - private static final Font NAME = new Font("Song_TypeFace", 0, 14); - public DefaulPane() { - setLayout(new BorderLayout()); - setBackground(Color.WHITE); - setBorder(BorderFactory.createEmptyBorder(135, 80, 135, 80)); - UILabel image = new UILabel(); - image.setPreferredSize(new Dimension(150, 111)); - image.setHorizontalAlignment(SwingConstants.CENTER); - image.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); - image.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/no_result.png")); - UILabel description = new UILabel(Inter.getLocText("FR-Designer-AlphaFine_NO_Result")); - description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(NAME); - description.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); - description.setHorizontalAlignment(SwingConstants.CENTER); - this.add(image, BorderLayout.CENTER); - this.add(description, BorderLayout.SOUTH); - UILabel splitLine = new UILabel(); - splitLine.setBackground(AlphaFineConstants.GRAY); - splitLine.setPreferredSize(new Dimension(10, AlphaFineConstants.CONTENT_HEIGHT)); - this.add(splitLine, BorderLayout.EAST); - } -} diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java new file mode 100644 index 0000000000..5ed9004f23 --- /dev/null +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -0,0 +1,31 @@ +package com.fr.design.mainframe.alphafine.preview; + +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.alphafine.AlphaFineConstants; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by XiaXiang on 2017/8/14. + */ +public class NoResultPane extends JPanel { + private static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 14); + public NoResultPane(String title, Icon icon) { + setLayout(new BorderLayout()); + setBackground(Color.white); + setPreferredSize(new Dimension(AlphaFineConstants.LEFT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + UILabel image = new UILabel(); + image.setPreferredSize(new Dimension(150, 111)); + image.setHorizontalAlignment(SwingConstants.CENTER); + image.setIcon(icon); + image.setBorder(BorderFactory.createEmptyBorder(100,0,0,0)); + UILabel description = new UILabel(title); + description.setForeground(AlphaFineConstants.MEDIUM_GRAY); + description.setFont(MEDIUM_FONT); + description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0)); + description.setHorizontalAlignment(SwingConstants.CENTER); + add(image, BorderLayout.CENTER); + add(description, BorderLayout.SOUTH); + } +}