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 022d8de06d..29310ca0c3 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 7e37fefc3a..9d4a14d5b5 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 6591b90592..0930a8e699 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; } }