Fangjie Hu 8 years ago
parent
commit
e014da33c0
  1. 5
      designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java
  2. 38
      designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java
  3. 51
      designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java
  4. 21
      designer_form/src/com/fr/design/designer/creator/XElementCase.java

5
designer_base/src/com/fr/design/fun/FormElementCaseEditorProcessor.java

@ -6,10 +6,9 @@ import com.fr.stable.fun.mark.Immutable;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
/** /**
* Created by zhouping on 2015/9/10. * Created by Slpire on 2016/10/28.
*/ */
public interface FormElementCaseEditorProcessor extends Immutable { public interface FormElementCaseEditorProcessor extends Immutable {
String MARK_STRING = "PropertyEditor"; String MARK_STRING = "PropertyEditor";
int CURRENT_LEVEL = 1; int CURRENT_LEVEL = 1;
@ -29,6 +28,4 @@ public interface FormElementCaseEditorProcessor extends Immutable {
* @return 返回pc自适应属性值 * @return 返回pc自适应属性值
*/ */
int getFitStateInPC(ReportFitAttrProvider fitAttrProvider); int getFitStateInPC(ReportFitAttrProvider fitAttrProvider);
} }

38
designer_base/src/com/fr/design/fun/FormElementCaseEditorProvider.java

@ -0,0 +1,38 @@
package com.fr.design.fun;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.stable.fun.ReportFitAttrProvider;
import com.fr.form.main.Form;
import com.fr.stable.fun.mark.Mutable;
import java.beans.PropertyDescriptor;
/**
* Created by zhouping on 2015/9/10.
*/
public interface FormElementCaseEditorProvider extends Mutable {
String MARK_STRING = "PropertyEditor";
int CURRENT_LEVEL = 1;
//加个provider返回tab的接口
//design_base依赖了form
PropertyDescriptor[] createPropertyDescriptor (Class<?> temp, Form form, ElementCaseEditor editor);
/**
* 生成属性表
* @param temp 传入当前操作的class
* @param reportFitAttr 传入的自适应属性
* @return 返回属性表
*/
PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, ReportFitAttrProvider reportFitAttr);
/**
* 返回pc自适应属性值
* @param fitAttrProvider 传入的自适应属性
* @return 返回pc自适应属性值
*/
int getFitStateInPC(ReportFitAttrProvider fitAttrProvider);
}

51
designer_base/src/com/fr/design/fun/impl/AbstractFormElementCaseEditorProvider.java

@ -0,0 +1,51 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.FormElementCaseEditorProvider;
import com.fr.form.main.Form;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.stable.fun.ReportFitAttrProvider;
import com.fr.stable.fun.mark.API;
import java.beans.PropertyDescriptor;
/**
* Created by zhouping on 2015/9/10.
*/
@API(level = FormElementCaseEditorProvider.CURRENT_LEVEL)
public abstract class AbstractFormElementCaseEditorProvider implements FormElementCaseEditorProvider {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return this.getClass().getName();
}
@Override
public PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, Form reportAttr, ElementCaseEditor editor) {
return new PropertyDescriptor[0];
}
/**
* 生成属性表
* @param temp 传入当前操作的class
* @param reportFitAttr 传入的自适应属性
* @return 返回属性表
*/
@Override
public PropertyDescriptor[] createPropertyDescriptor(Class<?> temp, ReportFitAttrProvider reportFitAttr) {
return new PropertyDescriptor[0];
}
/**
* 返回pc自适应属性值
* @param fitAttrProvider 传入的自适应属性
* @return 返回pc自适应属性值
*/
@Override
public int getFitStateInPC(ReportFitAttrProvider fitAttrProvider) {
return 0;
}
}

21
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -5,7 +5,9 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; import com.fr.design.designer.properties.mobile.ElementCasePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.FormElementCaseEditorProcessor; import com.fr.design.fun.FormElementCaseEditorProcessor;
import com.fr.design.fun.FormElementCaseEditorProvider;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.CoverReportPane;
import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.EditingMouseListener;
@ -23,6 +25,7 @@ import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.form.main.Form;
import com.fr.stable.fun.FitProvider; import com.fr.stable.fun.FitProvider;
import com.fr.stable.fun.ReportFitAttrProvider; import com.fr.stable.fun.ReportFitAttrProvider;
@ -32,6 +35,7 @@ import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.util.Set;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable; private UILabel imageLable;
@ -97,9 +101,20 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar")) .setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
}; };
//这边有个插件兼容问题,之后还是要改回process才行
Set<FormElementCaseEditorProvider> set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING);
for (FormElementCaseEditorProvider provider : set) {
if (provider == null) {
continue;
}
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Form form = designer.getTarget();
PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), form, this.toData());
propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
}
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING);
if (processor == null) { if (processor == null) {
return propertyTableEditor; return propertyTableEditor;
@ -114,11 +129,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
} }
ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr(); ReportFitAttrProvider reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : editor.getReportFitAttr();
PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr); PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass(), reportFitAttr);
if (editor.getReportFitAttr() == null) { if (editor.getReportFitAttr() == null) {
editor.setReportFitInPc(processor.getFitStateInPC(fitAttr)); editor.setReportFitInPc(processor.getFitStateInPC(fitAttr));
} }
return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
} }
@Override @Override

Loading…
Cancel
Save