From 05c3e3b86ea4c41185e4f610bcb54e88967291af Mon Sep 17 00:00:00 2001 From: Lee Date: Mon, 16 May 2016 23:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD=E5=B7=B2=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=EF=BC=8C=E6=89=8B=E6=9C=BA=E6=8A=A5=E8=A1=A8=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E9=AB=98=E5=BA=A6=E7=9A=84=E9=99=90=E5=88=B6=EF=BC=8C?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=8F=AF=E8=A1=8C=E3=80=82=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E6=AF=94=EF=BC=9A0.75=EF=BC=8875%=EF=BC=89?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XElementCase.java | 103 ++++++++++++------ 1 file changed, 69 insertions(+), 34 deletions(-) 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 32af5487a..c0c859f1f 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -7,9 +7,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.widget.editors.BooleanEditor; -import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; -import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; +import com.fr.design.mainframe.widget.editors.*; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; import com.fr.form.FormElementCaseContainerProvider; @@ -53,37 +51,74 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme * @return 返回组件属性值 * @throws IntrospectionException 异常 */ - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - - CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("widgetName", this.data.getClass()) - .setI18NName(Inter.getLocText("Form-Widget_Name")), - new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( - WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( - Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - initStyle(); - } - }), - new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) - .setRendererClass(PaddingMarginCellRenderer.class).setI18NName(Inter.getLocText("FR-Layout_Padding")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), - new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) - .setI18NName(Inter.getLocText("Form-EC_toolbar")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), - - }; - - FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor(); - if (processor == null){ - return propertyTableEditor; - } - PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass()); - return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); - } + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] crp = ((ElementCaseEditor) data).isHeightRestrict() ? revealHeightLimit() : getDefault(); + FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor(); + if (processor == null) { + return crp; + } + PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, extraEditor); + } + + protected CRPropertyDescriptor createNonListenerProperties(int i) throws IntrospectionException { + CRPropertyDescriptor[] propertyTableEditor = { + new CRPropertyDescriptor("widgetName", this.data.getClass()) + .setI18NName(Inter.getLocText("Form-Widget_Name")), + new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( + WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( + Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) + .setRendererClass(PaddingMarginCellRenderer.class).setI18NName(Inter.getLocText("FR-Layout_Padding")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) + .setI18NName(Inter.getLocText("Form-EC_toolbar")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("heightRestrict", this.data.getClass()).setEditorClass(InChangeBooleanEditor.class) + .setI18NName(Inter.getLocText("Form-EC_heightrestrict")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), + new CRPropertyDescriptor("heightPercent", this.data.getClass()).setEditorClass(DoubleEditor.class) + .setI18NName(Inter.getLocText("Form-EC_heightpercent")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + }; + return propertyTableEditor[i]; + } + + protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { + return new CRPropertyDescriptor[] { + createNonListenerProperties(0), + createNonListenerProperties(1). + setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + initStyle(); + } + }), + createNonListenerProperties(2), + createNonListenerProperties(3), + createNonListenerProperties(4), + createNonListenerProperties(5) + }; + } + + protected CRPropertyDescriptor[] getDefault() throws IntrospectionException { + return new CRPropertyDescriptor[] { + createNonListenerProperties(0), + createNonListenerProperties(1). + setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + initStyle(); + } + }), + createNonListenerProperties(2), + createNonListenerProperties(3), + createNonListenerProperties(4) + }; + } + @Override protected String getIconName() {