Browse Source

REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(报表)初步修改

master
plough 7 years ago
parent
commit
7d76f7d6f2
  1. 10
      designer/src/com/fr/design/widget/WidgetEventPane.java
  2. 72
      designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java
  3. 11
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

10
designer/src/com/fr/design/widget/WidgetEventPane.java

@ -4,10 +4,10 @@ package com.fr.design.widget;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.fr.design.gui.controlpane.ObjectUIControlPane;
import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane; import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ObjectJControlPane;
import com.fr.design.gui.frpane.ListenerUpdatePane; import com.fr.design.gui.frpane.ListenerUpdatePane;
import com.fr.design.javascript.JavaScriptActionPane; import com.fr.design.javascript.JavaScriptActionPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
@ -19,7 +19,7 @@ import com.fr.general.Inter;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
public class WidgetEventPane extends ObjectJControlPane { public class WidgetEventPane extends ObjectUIControlPane {
public WidgetEventPane() { public WidgetEventPane() {
this(null); this(null);
@ -39,7 +39,11 @@ public class WidgetEventPane extends ObjectJControlPane {
}; };
} }
@Override @Override
public void saveSettings() {
}
@Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("Event"); return Inter.getLocText("Event");
} }

72
designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java

@ -0,0 +1,72 @@
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 (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException 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());
}
}
}

11
designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java

@ -28,6 +28,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
private ToolBarDef toolbarDef; private ToolBarDef toolbarDef;
private UIToolbar toolBar; private UIToolbar toolBar;
private UIToolbar topToolBar;
protected PopupEditDialog popupEditDialog; protected PopupEditDialog popupEditDialog;
// peter:这是整体的一个cardLayout Pane // peter:这是整体的一个cardLayout Pane
protected CardLayout cardLayout; protected CardLayout cardLayout;
@ -146,7 +147,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
// leftContentPane.setBorder(BorderFactory.createLineBorder(new Color(201, 198, 184))); // leftContentPane.setBorder(BorderFactory.createLineBorder(new Color(201, 198, 184)));
// 顶部标签及add按钮 // 顶部标签及add按钮
UIToolbar topToolBar = new UIToolbar(); topToolBar = new UIToolbar();
topToolBar.setLayout(new BorderLayout()); topToolBar.setLayout(new BorderLayout());
ShortCut addItem = addItemShortCut().getShortCut(); ShortCut addItem = addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar); addItem.intoJToolBar(topToolBar);
@ -246,6 +247,14 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
toolbarDef.updateToolBar(toolBar); toolbarDef.updateToolBar(toolBar);
toolBar.validate(); toolBar.validate();
toolBar.repaint(); toolBar.repaint();
// 顶部按钮
topToolBar.removeAll();
ShortCut addItem = addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar);
topToolBar.validate();
this.repaint(); this.repaint();
} }

Loading…
Cancel
Save