diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index 372377077e..f4af3d79d2 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 f5e8e0126f..47fb692759 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 ef01c7b711..cbcf8f1975 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.*;