Browse Source
* commit 'be2ab9031440ee29f7f66aa4badeafe9aa7aafdd': REPORT-3163 合作开发9.0设计器=>代码规范 REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(报表)=》整合代码,实现保存设置 REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(表单)=>边框校正 REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(表单)=>去掉冗余代码 REPORT-3163 合作开发9.0设计器=>控件设置事件编辑=>国际化;整理代码 REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(表单)=>bug解决;效率优化 REPORT-3163 合作开发9.0设计器=>新列表面板=》修改弹出框的尺寸和边框 无JIRA任务,收集模版信息时,不应该影响保存 REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(表单)=>可保存设置,但有bug REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(表单)=>初步修改 REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(报表)初步修改master
superman
7 years ago
15 changed files with 247 additions and 503 deletions
@ -0,0 +1,62 @@
|
||||
package com.fr.design.gui.controlpane; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
|
||||
/** |
||||
* Created by plough on 2017/8/1. |
||||
*/ |
||||
public abstract class ObjectUIControlPane extends UIListControlPane { |
||||
private Object object; |
||||
|
||||
public ObjectUIControlPane() { |
||||
this(null); |
||||
} |
||||
|
||||
public ObjectUIControlPane(Object object) { |
||||
super(); |
||||
this.object = object; |
||||
} |
||||
|
||||
@Override |
||||
protected BasicBeanPane createPaneByCreators(NameableCreator creator) { |
||||
try { |
||||
if (object == null) { |
||||
return super.createPaneByCreators(creator); |
||||
} else if (object.getClass().isArray()) { |
||||
return creator.getUpdatePane().getConstructor(object.getClass()).newInstance(object); |
||||
} else { |
||||
Constructor<? extends BasicBeanPane> constructor = getConstructor(creator.getUpdatePane(), object.getClass()); |
||||
return constructor == null ? super.createPaneByCreators(creator) : constructor.newInstance(object); |
||||
} |
||||
} catch (Exception e) { |
||||
throw new RuntimeException(e); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 传进BasicBeanPane的构造函数的参数,可能是 |
||||
* |
||||
* @param clazz |
||||
* @param cls |
||||
* @return |
||||
*/ |
||||
private Constructor<? extends BasicBeanPane> getConstructor(Class<? extends BasicBeanPane> clazz, Class<?> cls) { |
||||
Constructor<? extends BasicBeanPane> constructor = null; |
||||
try { |
||||
constructor = clazz.getConstructor(cls); |
||||
} catch (SecurityException e) { |
||||
} catch (NoSuchMethodException e) { |
||||
} |
||||
if (constructor != null) { |
||||
return constructor; |
||||
} else { |
||||
if (cls.getName() == Object.class.getName()) { |
||||
return null; |
||||
} |
||||
return getConstructor(clazz, cls.getSuperclass()); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,76 +1,58 @@
|
||||
package com.fr.design.widget; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.gui.controlpane.NameableSelfCreator; |
||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||
import com.fr.design.gui.ilist.ListModelElement; |
||||
import com.fr.form.event.Listener; |
||||
import com.fr.form.ui.FileEditor; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
public class EventCreator extends NameableSelfCreator { |
||||
private String eventName; |
||||
|
||||
public EventCreator(String eventName) { |
||||
super(switchLang(eventName), Listener.class, WidgetEventPane.WidgetEventListenerUpdatePane.class); |
||||
this.eventName = eventName; |
||||
} |
||||
|
||||
@Override |
||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||
return new NameObject(helper.createUnrepeatedName(this.menuName()),new Listener(this.eventName)) ; |
||||
} |
||||
|
||||
public static EventCreator[] createEventCreator(String[] supportedEvents) { |
||||
EventCreator[] creators = new EventCreator[supportedEvents.length]; |
||||
|
||||
for (int i = 0; i < supportedEvents.length; i++) { |
||||
creators[i] = new EventCreator(supportedEvents[i]); |
||||
} |
||||
|
||||
return creators; |
||||
} |
||||
|
||||
/* |
||||
* richer:国际化事件名称,所有需要国际化的事件都应按格式Event-eventName来进行国际化 |
||||
*/ |
||||
public static final String switchLang(String eventName) { |
||||
try { |
||||
return Inter.getLocText("Event-" + eventName); |
||||
} catch (Exception e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
return eventName; |
||||
} |
||||
} |
||||
@Override |
||||
public void saveUpdatedBean(ListModelElement wrapper, Object bean) { |
||||
((NameObject)wrapper.wrapper).setObject(bean); |
||||
} |
||||
|
||||
|
||||
public static final EventCreator BEFOREEDIT = new EventCreator(Widget.BEFOREEDIT); |
||||
|
||||
public static final EventCreator AFTEREDIT = new EventCreator(Widget.AFTEREDIT); |
||||
|
||||
public static final EventCreator CHANGE = new EventCreator(Widget.CHANGE); |
||||
|
||||
public static final EventCreator CLICK = new EventCreator(Widget.EVENT_CLICK); |
||||
|
||||
public static final EventCreator SUCCESS = new EventCreator("success"); |
||||
|
||||
public static final EventCreator AFTERINIT = new EventCreator(Widget.AFTERINIT); |
||||
|
||||
public static final EventCreator STOPEDIT = new EventCreator(Widget.STOPEDIT); |
||||
|
||||
public static final EventCreator STATECHANGE = new EventCreator(Widget.EVENT_STATECHANGE); |
||||
|
||||
public static final EventCreator CALLBACK = new EventCreator(FileEditor.EVENT_UPLOAD_CALLBACK); |
||||
|
||||
@Override |
||||
public String createTooltip() { |
||||
return null; |
||||
} |
||||
package com.fr.design.widget; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameableSelfCreator; |
||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||
import com.fr.design.gui.ilist.ListModelElement; |
||||
import com.fr.form.event.Listener; |
||||
import com.fr.form.ui.FileEditor; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.general.Inter; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.stable.Nameable; |
||||
|
||||
public class EventCreator extends NameableSelfCreator { |
||||
private String eventName; |
||||
|
||||
public EventCreator(String eventName, Class<? extends BasicBeanPane> updatePane) { |
||||
super(switchLang(eventName), Listener.class, updatePane); |
||||
this.eventName = eventName; |
||||
} |
||||
|
||||
@Override |
||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||
return new NameObject(helper.createUnrepeatedName(this.menuName()),new Listener(this.eventName)) ; |
||||
} |
||||
|
||||
public static EventCreator[] createEventCreator(String[] supportedEvents, Class<? extends BasicBeanPane> updatePane) { |
||||
EventCreator[] creators = new EventCreator[supportedEvents.length]; |
||||
|
||||
for (int i = 0; i < supportedEvents.length; i++) { |
||||
creators[i] = new EventCreator(supportedEvents[i], updatePane); |
||||
} |
||||
|
||||
return creators; |
||||
} |
||||
|
||||
/* |
||||
* richer:国际化事件名称,所有需要国际化的事件都应按格式Event-eventName来进行国际化 |
||||
*/ |
||||
public static final String switchLang(String eventName) { |
||||
try { |
||||
return Inter.getLocText("Event-" + eventName); |
||||
} catch (Exception e) { |
||||
FRContext.getLogger().error(e.getMessage(), e); |
||||
return eventName; |
||||
} |
||||
} |
||||
@Override |
||||
public void saveUpdatedBean(ListModelElement wrapper, Object bean) { |
||||
((NameObject)wrapper.wrapper).setObject(bean); |
||||
} |
||||
|
||||
@Override |
||||
public String createTooltip() { |
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue