From 04a2611500ee126d8a739d0b85a6a5b0c408f39b Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 16:59:24 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/ShareWidgetButton.java | 40 ++++--------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index 955e54822..ffb688578 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.Widget; @@ -20,7 +19,6 @@ import java.awt.dnd.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; -import java.awt.image.BufferedImage; import java.io.IOException; import java.io.Serializable; @@ -36,42 +34,20 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot public ShareWidgetButton(ElCaseBindInfo bindInfo) { this.bindInfo = bindInfo; initUI(); - this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); this.addMouseListener(this); this.addMouseMotionListener(this); new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); } - private void initUI() { - this.setBackground(Color.WHITE); - this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - setPreferredSize(new Dimension(108, 72)); - setLayout(FRGUIPaneFactory.createBorderLayout()); - ImagePanel imagePanel = new ImagePanel((BufferedImage) bindInfo.getCover()); - imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - - this.add(imagePanel, BorderLayout.NORTH); - UILabel label = new UILabel(bindInfo.getName(), SwingConstants.HORIZONTAL); - label.setOpaque(true); - label.setBackground(new Color(184, 220, 242)); - this.add(label, BorderLayout.SOUTH); - } - - private class ImagePanel extends JPanel { - - private BufferedImage image; - - public ImagePanel(BufferedImage image) { - this.image = image; - this.setPreferredSize(new Dimension(108, 52)); - } - - @Override - public void paintComponent(Graphics g) { - g.drawImage(image, 0, 0, null); - } - + JPanel reportPane = new JPanel(new BorderLayout()); + reportPane.add(new UILabel(new ImageIcon(bindInfo.getCover())), BorderLayout.CENTER); + JPanel labelPane = new JPanel(new BorderLayout()); + UILabel label = new UILabel(bindInfo.getName(), UILabel.CENTER); + labelPane.setBackground(new Color(184, 220, 242)); + labelPane.add(label, BorderLayout.CENTER); + reportPane.add(labelPane, BorderLayout.SOUTH); + add(reportPane); } public ElCaseBindInfo getBindInfo() { From 989358cf8b463d17e8644df93c8eff35c0354c37 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:02:03 +0800 Subject: [PATCH 2/8] rt --- .../mainframe/FormWidgetDetailPane.java | 42 ++++++++++--------- .../fr/design/mainframe/ShareWidgetPane.java | 13 +++--- .../mainframe/widget/UITreeComboBox.java | 1 + 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 372377077..f4af3d79d 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -47,7 +47,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; private UIScrollPane downPanel; - private JPanel reuWidgetPanel; + private JPanel esp; private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; private UIButton downloadButton; @@ -95,21 +95,14 @@ public class FormWidgetDetailPane extends FormDockView{ clearDockingView(); return; } - - JPanel esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); + esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); esp.setBorder(null); if (elCaseBindInfoList == null) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } initReuWidgetPanel(); - esp.add(reuWidgetPanel, BorderLayout.CENTER); createDownloadButton(); - JPanel widgetPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); - widgetPane.setBorder(BorderFactory.createEmptyBorder(3, 10, 3, 3)); - widgetPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), - SwingConstants.HORIZONTAL), BorderLayout.WEST); - widgetPane.add(downloadButton, BorderLayout.EAST); - esp.add(widgetPane,BorderLayout.NORTH); + initMenuPanel(); tabbedPane = new UITabbedPane(); tabbedPane.setOpaque(true); tabbedPane.setBorder(null); @@ -124,16 +117,25 @@ public class FormWidgetDetailPane extends FormDockView{ * 初始化组件共享和复用面板 */ private void initReuWidgetPanel() { - int rowCount = (elCaseBindInfoList.length + 1)/2; downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - downPanel.setPreferredSize(new Dimension(236, rowCount * 82)); - reuWidgetPanel = new JPanel(); + esp.add(downPanel); + } + + /** + * 初始化菜单栏面板 + */ + private void initMenuPanel() { + JPanel menutPane = new JPanel(); + menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + menutPane.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 3)); + menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), + SwingConstants.HORIZONTAL), BorderLayout.WEST); + menutPane.add(downloadButton, BorderLayout.EAST); comboBox = new UIComboBox(getFormCategories()); - comboBox.setPreferredSize(new Dimension(236, 30)); + comboBox.setPreferredSize(new Dimension(240, 30)); initComboBoxSelectedListener(); - reuWidgetPanel.add(comboBox, BorderLayout.NORTH); - reuWidgetPanel.add(downPanel, BorderLayout.CENTER); - reuWidgetPanel.setBorder(new LineBorder(Color.gray)); + menutPane.add(comboBox, BorderLayout.SOUTH); + esp.add(menutPane,BorderLayout.NORTH); } private void initComboBoxSelectedListener() { @@ -144,7 +146,7 @@ public class FormWidgetDetailPane extends FormDockView{ if (filterIndex == 0) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } else { - String filterName = (String) e.getItem(); + String filterName = comboBox.getSelectedItem().toString(); elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName); } refreshDownPanel(); @@ -191,10 +193,10 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel() { - reuWidgetPanel.remove(downPanel); + esp.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); //todo:这个地方有问题 - reuWidgetPanel.add(downPanel); + esp.add(downPanel); repaintContainer(); } diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index f5e8e0126..47fb69275 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe; +import com.fr.design.form.layout.FRGridLayout; import com.fr.form.ui.ElCaseBindInfo; @@ -16,17 +17,15 @@ import java.util.List; public class ShareWidgetPane extends JPanel { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) { - this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离 - int rowCount = (elCaseBindInfoList.length + 1)/2; - this.setLayout(new GridLayout(rowCount, 2, 10, 10)); + this.setBorder(BorderFactory.createEmptyBorder(5, 2, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 + int rowCount = (elCaseBindInfoList.length + 1) / 2; + this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); this.add(widgetButton); } - if (elCaseBindInfoList.length == 1) { - this.add(new JPanel()); - } + this.setPreferredSize(new Dimension(240, rowCount * 80)); } -} +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index ef01c7b71..cbcf8f197 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -15,6 +15,7 @@ import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.ComponentTree; import com.sun.java.swing.plaf.motif.*; import com.sun.java.swing.plaf.windows.*; From a9f89dc2680cd65cafc1edd4552ab36f02fcc5c9 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:02:43 +0800 Subject: [PATCH 3/8] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index cbcf8f197..ef01c7b71 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -15,7 +15,6 @@ import com.fr.design.designer.beans.*; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.ComponentTree; import com.sun.java.swing.plaf.motif.*; import com.sun.java.swing.plaf.windows.*; From 45edc1997f0bb1f3aeb9c017466c835940714cba Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:05:31 +0800 Subject: [PATCH 4/8] rt --- .../src/com/fr/design/mainframe/ShareWidgetPane.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index 47fb69275..d9228f7fb 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -1,14 +1,10 @@ package com.fr.design.mainframe; -import com.fr.design.form.layout.FRGridLayout; -import com.fr.form.ui.ElCaseBindInfo; - +import com.fr.form.ui.ElCaseBindInfo; import javax.swing.*; import java.awt.*; -import java.util.*; -import java.util.List; /** From 660024a8e1a14da473dda095b14ca898de5553ac Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:08:34 +0800 Subject: [PATCH 5/8] rt --- designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index d9228f7fb..8d52eb4c8 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -13,7 +13,7 @@ import java.awt.*; public class ShareWidgetPane extends JPanel { public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList) { - this.setBorder(BorderFactory.createEmptyBorder(5, 2, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 + this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 int rowCount = (elCaseBindInfoList.length + 1) / 2; this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { From 583458bede4b79a59645859116e47d4c049ef754 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:10:41 +0800 Subject: [PATCH 6/8] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index f4af3d79d..3eef45c40 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -127,7 +127,7 @@ public class FormWidgetDetailPane extends FormDockView{ private void initMenuPanel() { JPanel menutPane = new JPanel(); menutPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPane.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 3)); + menutPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 3, 3)); menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), SwingConstants.HORIZONTAL), BorderLayout.WEST); menutPane.add(downloadButton, BorderLayout.EAST); From 3ad0e4764a6a00114423ebfe14ee459d4c208168 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 17:18:37 +0800 Subject: [PATCH 7/8] rt --- .../src/com/fr/design/mainframe/FormWidgetDetailPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 3eef45c40..e31187826 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -195,7 +195,6 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel() { esp.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - //todo:这个地方有问题 esp.add(downPanel); repaintContainer(); From f8ffda50923974e7f62daa1d76acf78a075f9f4c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 25 Oct 2016 20:19:29 +0800 Subject: [PATCH 8/8] rt --- .../design/mainframe/FormWidgetDetailPane.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index e31187826..ef3a1e708 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -47,7 +47,7 @@ public class FormWidgetDetailPane extends FormDockView{ private UITabbedPane tabbedPane; private UIScrollPane downPanel; - private JPanel esp; + private JPanel reuWidgetPanel; private UIComboBox comboBox; private ElCaseBindInfo[] elCaseBindInfoList; private UIButton downloadButton; @@ -95,8 +95,8 @@ public class FormWidgetDetailPane extends FormDockView{ clearDockingView(); return; } - esp = FRGUIPaneFactory.createBorderLayout_S_Pane(); - esp.setBorder(null); + reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + reuWidgetPanel.setBorder(null); if (elCaseBindInfoList == null) { elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); } @@ -107,7 +107,7 @@ public class FormWidgetDetailPane extends FormDockView{ tabbedPane.setOpaque(true); tabbedPane.setBorder(null); tabbedPane.setTabPlacement(SwingConstants.BOTTOM); - tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), esp); + tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), reuWidgetPanel); tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel()); add(tabbedPane, BorderLayout.CENTER); @@ -118,7 +118,7 @@ public class FormWidgetDetailPane extends FormDockView{ */ private void initReuWidgetPanel() { downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - esp.add(downPanel); + reuWidgetPanel.add(downPanel); } /** @@ -135,7 +135,7 @@ public class FormWidgetDetailPane extends FormDockView{ comboBox.setPreferredSize(new Dimension(240, 30)); initComboBoxSelectedListener(); menutPane.add(comboBox, BorderLayout.SOUTH); - esp.add(menutPane,BorderLayout.NORTH); + reuWidgetPanel.add(menutPane,BorderLayout.NORTH); } private void initComboBoxSelectedListener() { @@ -193,9 +193,9 @@ public class FormWidgetDetailPane extends FormDockView{ public void refreshDownPanel() { - esp.remove(downPanel); + reuWidgetPanel.remove(downPanel); downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList)); - esp.add(downPanel); + reuWidgetPanel.add(downPanel); repaintContainer(); }