diff --git a/designer_base/src/com/fr/design/constants/UIConstants.java b/designer_base/src/com/fr/design/constants/UIConstants.java index f5ef1ca2cb..e13b124c90 100644 --- a/designer_base/src/com/fr/design/constants/UIConstants.java +++ b/designer_base/src/com/fr/design/constants/UIConstants.java @@ -22,6 +22,8 @@ public interface UIConstants { public static final int SIZE = 17; + public static final int GAP_NORMAL = 10; // 10px + /** * Cell default cursor. */ @@ -93,6 +95,7 @@ public interface UIConstants { public static final Color RULER_LINE_COLOR = new Color(0xababab); public static final Color RULER_SCALE_COLOR = new Color(0x4e504f); public static final Color PROPERTY_PANE_BACKGROUND = new Color(0xdadadd); + public static final Color SPLIT_LINE = new Color(201, 198, 184); public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png"); diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index d4b9833077..34d7d08222 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -162,7 +162,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] columnSize = { p, f, 155}; - double[] rowSize = {20}; + double[] rowSize = {p}; Component[][] components = new Component[][]{ new Component[]{new UILabel(getAddItemText()), null, topToolBar}, }; diff --git a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java index 73ca39f2e7..280a12067d 100644 --- a/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java @@ -113,8 +113,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP EastRegionContainerPane.getInstance().replaceWidgetLibPane( FormWidgetDetailPane.getInstance(this)); if (!BaseUtils.isAuthorityEditing()) { - EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this)); - EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height); + ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(this); + parameterPropertyPane.setAddParaPaneVisible(true); + EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane); + EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height); EastRegionContainerPane.getInstance().replaceWidgetSettingsPane( WidgetPropertyPane.getInstance(this)); } else { diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 771ceef534..c84f572fd3 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -300,8 +300,10 @@ public class JForm extends JTemplate implements BaseJForm { private void setPropertyPaneChange(XComponent comp) { if (comp == null) { + ParameterPropertyPane.getInstance().setAddParaPaneVisible(false); return; } + ParameterPropertyPane.getInstance().setAddParaPaneVisible(comp instanceof XWParameterLayout); editingComponent = comp.createToolPane(this, formDesign); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); if (BaseUtils.isAuthorityEditing()) { @@ -677,10 +679,11 @@ public class JForm extends JTemplate implements BaseJForm { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM); EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign)); - if (formDesign.getParaComponent() != null) { - EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign)); - EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(formDesign).getPreferredSize().height); - } + ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(formDesign); + parameterPropertyPane.setAddParaPaneVisible(false); + EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane); + EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height); + if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) { new Thread() { public void run() { diff --git a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java index 01302299ea..1ed9f9bcbb 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java @@ -1,5 +1,6 @@ package com.fr.design.parameter; +import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicScrollPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.FormDesigner; @@ -14,11 +15,14 @@ import java.awt.event.MouseEvent; public class ParameterPropertyPane extends JPanel{ private ParameterToolBarPane toolbarPane; - private BasicScrollPane basicScrollPane; private ParaDefinitePane paraPane; + private JPanel formHierarchyTreePaneWrapper; // 封装一层,加边框 + private JPanel addParaPane; - public static ParameterPropertyPane THIS; + + private static ParameterPropertyPane THIS; private boolean isEditing = false; + private static final int HIDE_HEIGHT = 40; public static final ParameterPropertyPane getInstance() { if(THIS == null) { @@ -43,7 +47,7 @@ public class ParameterPropertyPane extends JPanel{ public ParameterPropertyPane() { toolbarPane = new ParameterToolBarPane(); - basicScrollPane = new BasicScrollPane() { + BasicScrollPane basicScrollPane = new BasicScrollPane() { @Override protected JPanel createContentPane() { return toolbarPane; @@ -59,15 +63,42 @@ public class ParameterPropertyPane extends JPanel{ return null; } }; - initParameterListener(); + JPanel scrollPaneWrapperInner = new JPanel(new BorderLayout()); + scrollPaneWrapperInner.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 5)); + scrollPaneWrapperInner.add(basicScrollPane, BorderLayout.CENTER); + addParaPane = new JPanel(new BorderLayout()); + addParaPane.add(scrollPaneWrapperInner, BorderLayout.CENTER); + addParaPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.SPLIT_LINE)); + + + initParameterListener(); this.setLayout(new BorderLayout(0, 6)); - this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - this.add(basicScrollPane, BorderLayout.CENTER); + this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + this.add(addParaPane, BorderLayout.CENTER); } + + public void setAddParaPaneVisible(boolean isVisible) { + if (isVisible == addParaPane.isVisible()) { + return; + } + if (isVisible && toolbarPane.hasSelectedLabelItem()) { + addParaPane.setVisible(true); + this.setPreferredSize(null); + } else { + addParaPane.setVisible(false); + this.setPreferredSize(new Dimension(getWidth(), HIDE_HEIGHT)); + } + repaintContainer(); + } private void setEditor(FormDesigner editor) { - this.remove(FormHierarchyTreePane.getInstance()); - this.add(FormHierarchyTreePane.getInstance(editor), BorderLayout.NORTH); + if (formHierarchyTreePaneWrapper == null) { + formHierarchyTreePaneWrapper = new JPanel(new BorderLayout()); + formHierarchyTreePaneWrapper.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + this.add(formHierarchyTreePaneWrapper, BorderLayout.SOUTH); + } + formHierarchyTreePaneWrapper.remove(FormHierarchyTreePane.getInstance()); + formHierarchyTreePaneWrapper.add(FormHierarchyTreePane.getInstance(editor), BorderLayout.CENTER); } private void initParameterListener() { diff --git a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java index cfae55b853..daac4c2db8 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java @@ -57,6 +57,10 @@ public class ParameterToolBarPane extends BasicBeanPane { } + public boolean hasSelectedLabelItem() { + return !parameterSelectedLabellist.isEmpty(); + } + @Override protected String title4PopupWindow() { return null;