From 809dccafaa0753dcadb8d9ad36f4f6abab8567e8 Mon Sep 17 00:00:00 2001 From: Lee Date: Sat, 4 Jun 2016 17:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=20=E7=A7=BB=E5=8A=A8=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=96=B0=E9=9C=80=E6=B1=82=E6=94=B9=E5=8A=A8=EF=BC=9A=201.=20?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E6=9C=80=E5=A4=A7=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=B1=9E=E6=80=A7=E8=BF=81=E7=A7=BB=E5=88=B0?= =?UTF-8?q?=E2=80=9C=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E2=80=9D?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E4=B8=AD=EF=BC=8C=E5=B9=B6=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E7=9A=84=E6=9B=B4=E6=94=B9=EF=BC=9B=202.=20?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=AB=96=E5=B1=8F=E4=B8=BA=E2=80=9C=E7=BA=B5?= =?UTF-8?q?=E5=90=91=E8=87=AA=E9=80=82=E5=BA=94=E2=80=9D=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E6=89=8B=E6=9C=BA=E6=98=BE=E7=A4=BA=E9=99=90?= =?UTF-8?q?=E5=88=B6=E9=AB=98=E5=BA=A6=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=8B=BE=E9=80=89=EF=BC=8C=E5=88=99=E8=87=AA=E5=8A=A8=E5=8B=BE?= =?UTF-8?q?=E9=80=89=E4=B8=8A=E2=98=91=EF=B8=8F=EF=BC=8C=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E4=BB=A5=E7=BC=96=E8=BE=91=EF=BC=88=E7=81=B0?= =?UTF-8?q?=E5=8C=96=E6=95=88=E6=9E=9C=E6=9A=82=E6=97=B6=E8=BF=98=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=81=9A=E5=87=BA=E6=9D=A5=EF=BC=8C=E6=99=9A=E7=82=B9?= =?UTF-8?q?=E7=A0=94=E7=A9=B6=E4=B8=80=E4=B8=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XElementCase.java | 48 +++----------- .../mobile/ElementCasePropertyTable.java | 64 +++++++++++++++---- .../properties/mobile/MobileFitEditor.java | 2 +- 3 files changed, 63 insertions(+), 51 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 022d8de06..29310ca0c 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -25,8 +25,6 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; -import java.util.ArrayList; -import java.util.List; public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ private UILabel imageLable; @@ -56,23 +54,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme * @throws IntrospectionException 异常 */ 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 List createNonListenerProperties() throws IntrospectionException { - CRPropertyDescriptor[] propertyTableEditor = { + 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() { + Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { @Override public void propertyChange() { @@ -85,34 +74,15 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme 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") - }; - List defaultList = new ArrayList<>(); + }; - for (CRPropertyDescriptor propertyDescriptor : propertyTableEditor) { - defaultList.add(propertyDescriptor); + FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor(); + if (processor == null){ + return propertyTableEditor; } - return defaultList; - } - - protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { - CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.data.getClass()) - .setEditorClass(DoubleEditor.class) - .setI18NName(Inter.getLocText("Form-EC_heightpercent")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); - - ArrayList defaultList = (ArrayList) createNonListenerProperties(); - defaultList.add(heightLimitProperty); - - return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); - } - - protected CRPropertyDescriptor[] getDefault() throws IntrospectionException { - ArrayList defaultList = (ArrayList) createNonListenerProperties(); - return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); + PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index 7e37fefc3..9d4a14d5b 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java @@ -1,6 +1,7 @@ package com.fr.design.designer.properties.mobile; import com.fr.base.FRContext; +import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; import com.fr.design.form.util.XCreatorConstants; @@ -9,11 +10,15 @@ import com.fr.design.gui.itable.PropertyGroup; import com.fr.design.gui.xtable.PropertyGroupModel; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.widget.editors.DoubleEditor; +import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; +import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; import javax.swing.table.TableModel; import java.beans.IntrospectionException; import java.util.ArrayList; +import java.util.List; /** * Created by Administrator on 2016/5/16/0016. @@ -27,6 +32,52 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ this.xCreator = xCreator; } + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + if (((ElementCaseEditor ) xCreator.toData()).getVerticalAttr().getState() == 2 && !((ElementCaseEditor ) xCreator.toData()).isHeightRestrict()) { + ((ElementCaseEditor ) xCreator.toData()).setHeightRestrict(true); + return revealHeightLimit(); + } + CRPropertyDescriptor[] crp = ((ElementCaseEditor) xCreator.toData()).isHeightRestrict() ? revealHeightLimit() : getDefault(); + return crp; + } + + protected List createNonListenerProperties() throws IntrospectionException { + CRPropertyDescriptor[] propertyTableEditor = { + new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) + .setRendererClass(MobileFitRender.class) + .setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), + new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) + .setRendererClass(MobileFitRender.class) + .setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), + new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class) + .setI18NName(Inter.getLocText("Form-EC_heightrestrict")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")) + }; + List defaultList = new ArrayList<>(); + + for (CRPropertyDescriptor propertyDescriptor: propertyTableEditor) { + defaultList.add(propertyDescriptor); + } + return defaultList; + } + + protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { + CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.xCreator.toData().getClass()) + .setEditorClass(DoubleEditor.class) + .setI18NName(Inter.getLocText("Form-EC_heightpercent")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + ArrayList defaultList = (ArrayList) createNonListenerProperties(); + defaultList.add(heightLimitProperty); + return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); + } + + protected CRPropertyDescriptor[] getDefault() throws IntrospectionException { + ArrayList defaultList = (ArrayList) createNonListenerProperties(); + return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); + } + @Override public void initPropertyGroups(Object source) { this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); @@ -34,17 +85,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ groups = new ArrayList(); CRPropertyDescriptor[] propertyTableEditor = null; try { - propertyTableEditor = new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) - .setRendererClass(MobileFitRender.class) - .setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), - new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) - .setRendererClass(MobileFitRender.class) - .setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")) - - }; + propertyTableEditor = supportedDescriptor(); } catch (IntrospectionException e) { FRContext.getLogger().error(e.getMessage()); } @@ -59,6 +100,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ @Override public void firePropertyEdit() { + designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); } public void populate(FormDesigner designer) { diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java b/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java index 6591b9059..0930a8e69 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java @@ -45,6 +45,6 @@ public class MobileFitEditor extends ComboEditor{ */ @Override public boolean refreshInTime() { - return false; + return true; } }