diff --git a/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index f4a0ce89a4..ed995d29d2 100644 --- a/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -145,10 +145,6 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); } - public boolean supportSetVisibleOrEnable(){ - return false; - } - /** * data属性改变触发其他操作 * diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index 87f3e532e2..b46d9d2335 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -625,10 +625,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } /** - * 是否支持设置可见和可用 + * 是否支持设置可见 * return boolean */ - public boolean supportSetVisibleOrEnable(){ + public boolean supportSetVisible(){ + return true; + } + + /** + * 是否支持设置可用 + * return boolean + */ + public boolean supportSetEnable(){ return true; } diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index f2f1000db2..75c2bb80d0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -327,4 +327,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme initStyle(); } + /** + * 是否支持设置可用 + * return boolean + */ + public boolean supportSetEnable(){ + return false; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java b/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java index f99aca41aa..28427b9afb 100644 --- a/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java @@ -536,4 +536,20 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme initStyle(); } + /** + * 是否支持设置可见 + * return boolean + */ + public boolean supportSetVisible(){ + return false; + } + + /** + * 是否支持设置可用 + * return boolean + */ + public boolean supportSetEnable(){ + return false; + } + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java b/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java index 97a12e80b8..cddcfac538 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java @@ -158,10 +158,6 @@ public class XWScaleLayout extends DedicateLayoutContainer { } - public boolean supportSetVisibleOrEnable(){ - return true; - } - /** * data属性改变触发其他操作 * diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java new file mode 100644 index 0000000000..e67bfc8bab --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java @@ -0,0 +1,50 @@ +package com.fr.design.mainframe.widget.ui; + +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.ui.Widget; +import com.fr.general.Inter; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by kerry on 2017/9/30. + */ +public class BasicSetVisiblePropertyPane extends FormBasicPropertyPane { + private UICheckBox visibleCheckBox; + + public BasicSetVisiblePropertyPane() { + initComponent(); + } + + protected void initComponent() { + JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); + pane2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + UICheckBox otherOtherConfig = createOtherConfig(); + if(otherOtherConfig != null){ + pane2.add(otherOtherConfig); + } + visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true); + visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + pane2.add(visibleCheckBox); + this.add(pane2, BorderLayout.CENTER); + } + + public UICheckBox createOtherConfig(){ + return null; + } + + public void populate(Widget widget) { + super.populate(widget); + visibleCheckBox.setSelected(widget.isVisible()); + } + + public void update(Widget widget) { + super.update(widget); + widget.setVisible(visibleCheckBox.isSelected()); + } + + +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java index dd2f15af62..d6aa882960 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormBasicWidgetPropertyPane.java @@ -1,34 +1,24 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; import com.fr.form.ui.Widget; import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; /** * Created by ibm on 2017/7/26. */ -public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane { +public class FormBasicWidgetPropertyPane extends BasicSetVisiblePropertyPane { private UICheckBox enableCheckBox; - private UICheckBox visibleCheckBox; - public FormBasicWidgetPropertyPane (){ - initOtherPane(); + public FormBasicWidgetPropertyPane() { + super(); } - protected void initOtherPane() { - JPanel pane2 = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); - pane2.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + public UICheckBox createOtherConfig() { enableCheckBox = new UICheckBox(Inter.getLocText("Enabled"), true); - enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - pane2.add(enableCheckBox); - visibleCheckBox = new UICheckBox(Inter.getLocText("Widget-Visible"), true); - visibleCheckBox.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); - pane2.add(visibleCheckBox); - this.add(pane2, BorderLayout.CENTER); + enableCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); + return enableCheckBox; } @Override @@ -39,13 +29,12 @@ public class FormBasicWidgetPropertyPane extends FormBasicPropertyPane { public void populate(Widget widget) { super.populate(widget); enableCheckBox.setSelected(widget.isEnabled()); - visibleCheckBox.setSelected(widget.isVisible()); + } public void update(Widget widget) { super.update(widget); widget.setEnabled(enableCheckBox.isSelected()); - widget.setVisible(visibleCheckBox.isSelected()); } } diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 166ac74e80..6eefcba6d9 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -109,6 +109,8 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { private void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + XCreator innerCreator = getXCreatorDedicated(); + final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); BasicScrollPane basicScrollPane = new BasicScrollPane() { @Override @@ -127,23 +129,20 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { } }; this.add(basicScrollPane, BorderLayout.CENTER); + attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + jPanel.add(attriCardPane, BorderLayout.CENTER); + jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - if (xCreator.supportSetVisibleOrEnable()) { - widgetPropertyPane = new FormBasicWidgetPropertyPane(); - } else { - widgetPropertyPane = new FormBasicPropertyPane(); + if(FormWidgetDefinePaneFactoryBase.isExtraXWidget(innerCreator.toData())){ + return; } + widgetPropertyPane = WidgetBasicPropertyPaneFactory.createBasicPropertyPane(innerCreator); + UIExpandablePane uiExpandablePane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"), 280, 20, widgetPropertyPane); jPanel.add(uiExpandablePane, BorderLayout.NORTH); - attriCardPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - - jPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - - jPanel.add(attriCardPane, BorderLayout.CENTER); - this.listener = new AttributeChangeListener() { @Override public void attributeChange() { @@ -196,7 +195,9 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { innerWidget = crBoundsWidget.getWidget(); } currentEditorDefinePane.populateBean(innerWidget); - widgetPropertyPane.populate(innerWidget); + if(widgetPropertyPane != null){ + widgetPropertyPane.populate(innerWidget); + } reinitAllListeners(); this.addAttributeChangeListener(listener); } @@ -205,7 +206,7 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { public void updateCreator() { currentEditorDefinePane.setGlobalName(getGlobalName()); Widget widget = currentEditorDefinePane.updateBean(); - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name")) && widgetPropertyPane != null) { widgetPropertyPane.update(widget); xCreator.resetCreatorName(widget.getWidgetName()); designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java b/designer_form/src/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java new file mode 100644 index 0000000000..db98069094 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java @@ -0,0 +1,21 @@ +package com.fr.design.mainframe.widget.ui; + +import com.fr.design.designer.creator.XCreator; + +/** + * Created by kerry on 2017/9/30. + */ +public class WidgetBasicPropertyPaneFactory { + + public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator){ + if(xCreator.supportSetVisible() && xCreator.supportSetEnable()){ + return new FormBasicWidgetPropertyPane(); + } + if(xCreator.supportSetVisible()){ + return new BasicSetVisiblePropertyPane(); + }else{ + return new FormBasicPropertyPane(); + } + + } +} diff --git a/designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java b/designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java index 8fba8220f8..47efd40fe8 100644 --- a/designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java +++ b/designer_form/src/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java @@ -76,11 +76,11 @@ public class FormWidgetDefinePaneFactoryBase { } public static RN createWidgetDefinePane(XCreator creator, FormDesigner designer, Widget widget, Operator operator) { - Appearance dn = defineMap.get(widget.getClass()); - if(dn == null){ + if(isExtraXWidget(widget)){ WidgetDefinePane widgetDefinePane = new WidgetDefinePane(creator, designer); return new RN(widgetDefinePane, widgetDefinePane.title4PopupWindow()); } + Appearance dn = defineMap.get(widget.getClass()); DataModify definePane = null; try { Constructor con = dn.getDefineClass().getConstructor(XCreator.class); @@ -92,6 +92,10 @@ public class FormWidgetDefinePaneFactoryBase { return new RN(definePane, dn.getDisplayName()); } + public static boolean isExtraXWidget(Widget widget){ + return defineMap.get(widget.getClass()) == null; + } + public static class RN { private DataModify definePane; private String cardName; diff --git a/designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java index f582fdd323..5bc9691daf 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/WidgetDefinePane.java @@ -8,7 +8,6 @@ import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.Widget; -import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.JPanel; @@ -31,13 +30,6 @@ public class WidgetDefinePane extends AbstractDataModify { public void initComponent(XCreator source, FormDesigner designer) { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, source); groupPanes = adapter.getXCreatorPropertyPane(); - //todo 留着做兼容,以后删掉 - for (int i = 0; i < groupPanes.size(); i++) { - if (ComparatorUtils.equals(groupPanes.get(i).getGroupName(), "Form-Basic_Properties")) { - groupPanes.remove(i); - } - } - this.add(createCenterPane(START_INDEX), BorderLayout.CENTER); }