From 7d76f7d6f23ff4a1a150a5964b8f01b1e39d5819 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 1 Aug 2017 11:23:13 +0800 Subject: [PATCH 01/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=EF=BC=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=89=E5=88=9D=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/WidgetEventPane.java | 12 ++-- .../gui/controlpane/ObjectUIControlPane.java | 72 +++++++++++++++++++ .../design/gui/controlpane/UIControlPane.java | 11 ++- 3 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java diff --git a/designer/src/com/fr/design/widget/WidgetEventPane.java b/designer/src/com/fr/design/widget/WidgetEventPane.java index 2665057b3f..5d9845c3c8 100644 --- a/designer/src/com/fr/design/widget/WidgetEventPane.java +++ b/designer/src/com/fr/design/widget/WidgetEventPane.java @@ -4,10 +4,10 @@ package com.fr.design.widget; import java.util.ArrayList; import java.util.List; +import com.fr.design.gui.controlpane.ObjectUIControlPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane; 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.javascript.JavaScriptActionPane; import com.fr.design.mainframe.DesignerContext; @@ -19,7 +19,7 @@ import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.stable.Nameable; -public class WidgetEventPane extends ObjectJControlPane { +public class WidgetEventPane extends ObjectUIControlPane { public WidgetEventPane() { this(null); @@ -38,8 +38,12 @@ public class WidgetEventPane extends ObjectJControlPane { EventCreator.STATECHANGE }; } - - @Override + + @Override + public void saveSettings() { + } + + @Override protected String title4PopupWindow() { return Inter.getLocText("Event"); } diff --git a/designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java new file mode 100644 index 0000000000..46b41d020a --- /dev/null +++ b/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 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 getConstructor(Class clazz, Class cls) { + Constructor 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()); + } + } + +} \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index 42d7e97bd2..02273477bb 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/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 UIToolbar toolBar; + private UIToolbar topToolBar; protected PopupEditDialog popupEditDialog; // peter:这是整体的一个cardLayout Pane protected CardLayout cardLayout; @@ -146,7 +147,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH // leftContentPane.setBorder(BorderFactory.createLineBorder(new Color(201, 198, 184))); // 顶部标签及add按钮 - UIToolbar topToolBar = new UIToolbar(); + topToolBar = new UIToolbar(); topToolBar.setLayout(new BorderLayout()); ShortCut addItem = addItemShortCut().getShortCut(); addItem.intoJToolBar(topToolBar); @@ -246,6 +247,14 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH toolbarDef.updateToolBar(toolBar); toolBar.validate(); toolBar.repaint(); + + + // 顶部按钮 + topToolBar.removeAll(); + ShortCut addItem = addItemShortCut().getShortCut(); + addItem.intoJToolBar(topToolBar); + topToolBar.validate(); + this.repaint(); } From dd1bfadd21d82ace400e84677c315735b78ef614 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 1 Aug 2017 21:28:12 +0800 Subject: [PATCH 02/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=EF=BC=88?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=EF=BC=89=3D>=E5=88=9D=E6=AD=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/WidgetEventPane.java | 4 +- .../com/fr/design/widget/EventCreator.java | 151 ++++++------- .../properties/EventPropertyTable.java | 208 +++++------------- 3 files changed, 128 insertions(+), 235 deletions(-) rename {designer => designer_base}/src/com/fr/design/widget/EventCreator.java (57%) diff --git a/designer/src/com/fr/design/widget/WidgetEventPane.java b/designer/src/com/fr/design/widget/WidgetEventPane.java index 5d9845c3c8..20fd5cc4e2 100644 --- a/designer/src/com/fr/design/widget/WidgetEventPane.java +++ b/designer/src/com/fr/design/widget/WidgetEventPane.java @@ -35,7 +35,7 @@ public class WidgetEventPane extends ObjectUIControlPane { */ public NameableCreator[] createNameableCreators() { return new NameableCreator[]{ - EventCreator.STATECHANGE + new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class) }; } @@ -108,7 +108,7 @@ public class WidgetEventPane extends ObjectUIControlPane { return; } - this.refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents())); + this.refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); List list = new ArrayList(); Listener listener; diff --git a/designer/src/com/fr/design/widget/EventCreator.java b/designer_base/src/com/fr/design/widget/EventCreator.java similarity index 57% rename from designer/src/com/fr/design/widget/EventCreator.java rename to designer_base/src/com/fr/design/widget/EventCreator.java index 3826d7b6fb..530bd34aa2 100644 --- a/designer/src/com/fr/design/widget/EventCreator.java +++ b/designer_base/src/com/fr/design/widget/EventCreator.java @@ -1,76 +1,77 @@ -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 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 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); + } + + +// 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; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java index bec1b44f84..4fd1a8fabe 100644 --- a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java @@ -3,6 +3,9 @@ package com.fr.design.designer.properties; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.controlpane.ShortCut4JControlPane; +import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.frpane.ListenerUpdatePane; import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.itoolbar.UIToolbar; @@ -12,6 +15,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import com.fr.design.widget.EventCreator; import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; @@ -39,11 +43,11 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.IOException; -public class EventPropertyTable extends BasicPane { +public class EventPropertyTable extends UIListControlPane { private ShortCut[] shorts; private XCreator creator; - private JNameEdList nameableList; +// private JNameEdList nameableList; private ToolBarDef toolbarDef; private AddItemMenuDef itemMenu; private ShortCut editItemAction; @@ -59,27 +63,22 @@ public class EventPropertyTable extends BasicPane { this.initComponents(); } - protected void initComponents() { - this.setLayout(new BorderLayout()); - nameableList = new JNameEdList(new DefaultListModel()); - this.add(new JScrollPane(nameableList), BorderLayout.CENTER); - - nameableList.setCellRenderer(new NameableListCellRenderer()); - nameableList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); - nameableList.addMouseListener(listMouseListener); - nameableList.setTransferHandler(new DnDTransferHandler()); - nameableList.setDropMode(DropMode.INSERT); - nameableList.setDragEnabled(true); - + @Override + protected void initComponentPane() { toolbarDef = new ToolBarDef(); - shorts = new ShortCut[] { itemMenu = new AddItemMenuDef(), editItemAction = new EditItemMenuDef(), - copyItemAction = new CopyItemAction(), removeItemAction = new RemoveItemAction() }; +// shorts = new ShortCut[] { itemMenu = new AddItemMenuDef(), editItemAction = new EditItemMenuDef(), +// copyItemAction = new CopyItemAction(), removeItemAction = new RemoveItemAction() }; + shorts = new ShortCut[] { itemMenu = new AddItemMenuDef()}; for (ShortCut sj : shorts) { toolbarDef.addShortCut(sj); } toolbar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolbar); - this.add(toolbar, BorderLayout.NORTH); + + super.initComponentPane(); + } + + protected void initComponents() { } /** @@ -110,74 +109,41 @@ public class EventPropertyTable extends BasicPane { this.repaint(); } - private void checkButtonEnabled() { - boolean enable = nameableList.getSelectedValue() instanceof NameObject; - itemMenu.setEnabled(this.creator != null && itemMenu.getShortCutCount() > 0); - editItemAction.setEnabled(enable); - copyItemAction.setEnabled(enable); - removeItemAction.setEnabled(enable); - } + public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { - private MouseListener listMouseListener = new MouseAdapter() { @Override - public void mouseReleased(MouseEvent evt) { - checkButtonEnabled(); - if (evt.getClickCount() >= 2 && SwingUtilities.isLeftMouseButton(evt)) { - NameObject object = (NameObject) nameableList.getSelectedValue(); - showEventPane(object); - } - } - }; + protected JavaScriptActionPane createJavaScriptActionPane() { + return new JavaScriptActionPane() { - private void showEventPane(final NameObject object) { - if (listenerPane == null) { - listenerPane = new ListenerUpdatePane() { + @Override + protected DBManipulationPane createDBManipulationPane() { + return new DBManipulationPane(ValueEditorPaneFactory.formEditors()); + } @Override - protected JavaScriptActionPane createJavaScriptActionPane() { - return new JavaScriptActionPane() { - - @Override - protected DBManipulationPane createDBManipulationPane() { - return new DBManipulationPane(ValueEditorPaneFactory.formEditors()); - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("Set_Callback_Function"); - } - @Override - protected EmailPane initEmaiPane() { - return new FormEmailPane(); - } - @Override - public boolean isForm() { - return true; - } - - protected String[] getDefaultArgs() { - return new String[0]; - } - - }; + protected String title4PopupWindow() { + return Inter.getLocText("Set_Callback_Function"); + } + @Override + protected EmailPane initEmaiPane() { + return new FormEmailPane(); } @Override - protected boolean supportCellAction() { - return false; + public boolean isForm() { + return true; + } + + protected String[] getDefaultArgs() { + return new String[0]; } - + }; } - listenerPane.populateBean((Listener) object.getObject()); - BasicDialog dialog = listenerPane.showWindow(SwingUtilities.getWindowAncestor(this)); - dialog.addDialogActionListener(new DialogActionAdapter() { - @Override - public void doOk() { - object.setObject(listenerPane.updateBean()); - updateWidgetListener(creator); - } - }); - dialog.setVisible(true); + + @Override + protected boolean supportCellAction() { + return false; + } } private class NameableListCellRenderer extends DefaultListCellRenderer { @@ -226,20 +192,6 @@ public class EventPropertyTable extends BasicPane { } } } - - protected class EditItemMenuDef extends UpdateAction { - public EditItemMenuDef() { - this.setName(Inter.getLocText("Edit")); - this.setMnemonic('E'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/edit.png")); - } - - public void actionPerformed(ActionEvent evt) { - if (nameableList.getSelectedValue() instanceof NameObject) { - showEventPane((NameObject) nameableList.getSelectedValue()); - } - } - } private String switchLang(String eventName) { return Inter.getLocText("Event-" + eventName); @@ -261,7 +213,7 @@ public class EventPropertyTable extends BasicPane { } Widget widget = creator.toData(); - refreshNameableCreator(widget.supportedEvents()); + refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); ((DefaultListModel) nameableList.getModel()).removeAllElements(); for (int i = 0, size = widget.getListenerSize(); i < size; i++) { @@ -288,81 +240,21 @@ public class EventPropertyTable extends BasicPane { checkButtonEnabled(); } - private class RemoveItemAction extends UpdateAction { - public RemoveItemAction() { - this.setName(Inter.getLocText("Remove")); - this.setMnemonic('R'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); - } - - public void actionPerformed(ActionEvent evt) { - GUICoreUtils.removeJListSelectedNodes(SwingUtilities.getWindowAncestor(EventPropertyTable.this), - nameableList); - updateWidgetListener(creator); - } - - } - - /* - * CopyItem - */ - private class CopyItemAction extends UpdateAction { - public CopyItemAction() { - this.setName(Inter.getLocText("Copy")); - this.setMnemonic('C'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/copy.png")); - } - - public void actionPerformed(ActionEvent evt) { - NameObject selectedNameObject = (NameObject) nameableList.getSelectedValue(); - - // p: 用反射机制实现 - try { - NameObject newNameObject = (NameObject) BaseUtils.cloneObject(selectedNameObject); - newNameObject.setName("CopyOf" + selectedNameObject.getName()); - - EventPropertyTable.this.addNameObject(newNameObject, nameableList.getSelectedIndex() + 1); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - updateWidgetListener(creator); - } - } - @Override protected String title4PopupWindow() { return "Event"; } - /** - * 生成不重复名字 - * @param prefix 字符 - * @return 返回 - */ - public String createUnrepeatedName(String prefix) { - DefaultListModel model = (DefaultListModel) nameableList.getModel(); - Nameable[] all = new Nameable[model.getSize()]; - for (int i = 0; i < model.size(); i++) { - all[i] = (Nameable) model.get(i); - } - int count = 1; - while (true) { - String name_test = prefix + count; - boolean repeated = false; - for (int i = 0, len = model.size(); i < len; i++) { - Nameable nameable = all[i]; - if (ComparatorUtils.equals(nameable.getName(), name_test)) { - repeated = true; - break; - } - } + @Override + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class) + }; + } - if (!repeated) { - return name_test; - } + @Override + public void saveSettings() { - count++; - } } private class DnDTransferHandler extends TransferHandler { From 957bf499887d6e6a5d022debeaf6233a6c929b85 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 11:48:08 +0800 Subject: [PATCH 03/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=EF=BC=88?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=EF=BC=89=3D>=E5=8F=AF=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E4=BD=86=E6=9C=89bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/WidgetEventPane.java | 73 +++++++++++++++++++ .../properties/EventPropertyTable.java | 30 ++++++-- 2 files changed, 95 insertions(+), 8 deletions(-) diff --git a/designer/src/com/fr/design/widget/WidgetEventPane.java b/designer/src/com/fr/design/widget/WidgetEventPane.java index 20fd5cc4e2..176422ff49 100644 --- a/designer/src/com/fr/design/widget/WidgetEventPane.java +++ b/designer/src/com/fr/design/widget/WidgetEventPane.java @@ -4,7 +4,9 @@ package com.fr.design.widget; import java.util.ArrayList; import java.util.List; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.controlpane.ObjectUIControlPane; +import com.fr.design.present.CellWriteAttrPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -15,17 +17,27 @@ import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JTemplate; import com.fr.form.event.Listener; import com.fr.form.ui.Widget; +import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.NameObject; +import com.fr.grid.GridUtils; +import com.fr.grid.selection.CellSelection; +import com.fr.privilege.finegrain.WidgetPrivilegeControl; +import com.fr.report.cell.DefaultTemplateCellElement; +import com.fr.report.cell.TemplateCellElement; +import com.fr.report.elementcase.TemplateElementCase; +import com.fr.report.stable.ReportConstants; import com.fr.stable.Nameable; public class WidgetEventPane extends ObjectUIControlPane { + private ElementCasePane ePane; public WidgetEventPane() { this(null); } public WidgetEventPane(ElementCasePane pane) { super(pane); + ePane = pane; this.setNameListEditable(false); } @@ -41,8 +53,69 @@ public class WidgetEventPane extends ObjectUIControlPane { @Override public void saveSettings() { + + final TemplateElementCase tplEC = ePane.getEditingElementCase(); + final CellSelection finalCS = (CellSelection) ePane.getSelection(); + TemplateCellElement editCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); + if (editCellElement == null) { + editCellElement = new DefaultTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); + tplEC.addCellElement(editCellElement); + } + final BasicPane bp = populateBasicPane(editCellElement); + + // 需要先行后列地增加新元素。 + for (int j = 0; j < finalCS.getRowSpan(); j++) { + for (int i = 0; i < finalCS.getColumnSpan(); i++) { + int column = i + finalCS.getColumn(); + int row = j + finalCS.getRow(); + editCellElement = tplEC.getTemplateCellElement(column, row); + if (editCellElement == null) { + editCellElement = new DefaultTemplateCellElement(column, row); + tplEC.addCellElement(editCellElement); + } + // alex:不加这一句话会导致跨行跨列的格子被多次update + if (editCellElement.getColumn() != column || editCellElement.getRow() != row) { + continue; + } + updateBasicPane(bp, editCellElement); + + Object editElementValue = editCellElement.getValue(); + if (editElementValue != null && (editElementValue instanceof String || editElementValue instanceof Number)) { + // TODO ALEX_SEP 暂时用FIT_DEFAULT替代,不取reportsetting里面的设置,因为也不知道是应该放在report里面还是elementcase里面 + GridUtils.shrinkToFit(ReportConstants.AUTO_SHRINK_TO_FIT_DEFAULT, tplEC, editCellElement); + } + } + } + ePane.fireTargetModified(); } + private BasicPane populateBasicPane(TemplateCellElement cellElement) { + CellWriteAttrPane pane = new CellWriteAttrPane(ePane); + //got simple cell element from column and row. + pane.populate(cellElement); + + return pane; + } + + private void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { + CellWriteAttrPane pane = (CellWriteAttrPane) bp; + if (cellElement.getWidget() == null) { + pane.update(cellElement); + return; + } + try { + Widget oldWidget = (Widget) cellElement.getWidget().clone(); + pane.update(cellElement); + //这边需要重新设置权限细粒度的hashset是因为Update是直接生成一个新的来update的,所以以前里面的hashset都没有了 + Widget newWidget = cellElement.getWidget(); + if (newWidget.getClass() == oldWidget.getClass()) { + newWidget.setWidgetPrivilegeControl((WidgetPrivilegeControl) oldWidget.getWidgetPrivilegeControl().clone()); + } + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + @Override protected String title4PopupWindow() { return Inter.getLocText("Event"); diff --git a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java index 4fd1a8fabe..97320585b3 100644 --- a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java @@ -8,6 +8,7 @@ import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.frpane.ListenerUpdatePane; import com.fr.design.gui.ilist.JNameEdList; +import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.javascript.EmailPane; import com.fr.design.javascript.JavaScriptActionPane; @@ -42,6 +43,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.IOException; +import java.util.ArrayList; public class EventPropertyTable extends UIListControlPane { @@ -89,7 +91,8 @@ public class EventPropertyTable extends UIListControlPane { public void addNameObject(NameObject nameObject, int index) { DefaultListModel model = (DefaultListModel) nameableList.getModel(); - model.add(index, nameObject); +// model.add(index, nameObject); + model.add(index, new ListModelElement(nameObject)); nameableList.setSelectedIndex(index); nameableList.ensureIndexIsVisible(index); @@ -201,6 +204,7 @@ public class EventPropertyTable extends UIListControlPane { * 刷新 */ public void refresh() { + isPopulating = true; int selectionSize = designer.getSelectionModel().getSelection().size(); if (selectionSize == 0 || selectionSize == 1) { this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel() @@ -215,31 +219,41 @@ public class EventPropertyTable extends UIListControlPane { refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); - ((DefaultListModel) nameableList.getModel()).removeAllElements(); +// ((DefaultListModel) nameableList.getModel()).removeAllElements(); + ArrayList nameObjectList = new ArrayList<>(); for (int i = 0, size = widget.getListenerSize(); i < size; i++) { Listener listener = widget.getListener(i); if (!listener.isDefault()) { - addNameObject(new NameObject(switchLang(listener.getEventName()) + (i + 1), listener), i); - } +// addNameObject(new NameObject(switchLang(listener.getEventName()) + (i + 1), listener), i); + nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); + + } } + populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); checkButtonEnabled(); this.repaint(); + isPopulating = false; } /** * 更新控件事件 * @param creator 控件 */ - public void updateWidgetListener(XCreator creator) { + public void updateWidgetListener(XCreator creator, boolean isSaving) { DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); (creator.toData()).clearListeners(); for (int i = 0, len = listModel.getSize(); i < len; i++) { - (creator.toData()).addListener((Listener) ((NameObject) listModel.getElementAt(i)).getObject()); + NameObject nameObject = isSaving ? (NameObject)((ListModelElement) listModel.getElementAt(i)).wrapper : (NameObject)(listModel.getElementAt(i)); + (creator.toData()).addListener((Listener) nameObject.getObject()); } designer.fireTargetModified(); checkButtonEnabled(); } + public void updateWidgetListener(XCreator creator) { + updateWidgetListener(creator, true); + } + @Override protected String title4PopupWindow() { return "Event"; @@ -254,8 +268,8 @@ public class EventPropertyTable extends UIListControlPane { @Override public void saveSettings() { - - } + updateWidgetListener(creator, true); + } private class DnDTransferHandler extends TransferHandler { private int action; From 9d402867265bad1de94da30fe3a22db0fb7233f1 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 11:49:01 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E6=94=B6=E9=9B=86=E6=A8=A1=E7=89=88=E4=BF=A1=E6=81=AF=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=BA=94=E8=AF=A5=E5=BD=B1=E5=93=8D=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/mainframe/JTemplate.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index 1df95805b1..b5d1f4cabb 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -126,7 +126,10 @@ public abstract class JTemplate> ex return; } long saveTime = System.currentTimeMillis(); // 保存模板的时间点 - tic.collectInfo(template, this, openTime, saveTime); + try { + tic.collectInfo(template, this, openTime, saveTime); + } catch (Exception ex) { // 不管收集过程中出现任何异常,都不应该影响模版保存 + } openTime = saveTime; // 更新 openTime,准备下一次计算 } From fd3e790bb4cbfe743b7d3c1c20f7e1ea9ec0d4a3 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 14:16:35 +0800 Subject: [PATCH 05/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=96=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=9D=A2=E6=9D=BF=3D=E3=80=8B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=A1=86=E7=9A=84=E5=B0=BA=E5=AF=B8=E5=92=8C?= =?UTF-8?q?=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/gui/controlpane/UIControlPane.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index 02273477bb..af47f1de8a 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -261,13 +261,13 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH // 点击"编辑"按钮,弹出面板 protected class PopupEditDialog extends JDialog { private JComponent editPane; - private static final int WIDTH = 490; - private static final int HEIGHT = 570; + private static final int WIDTH = 570; + private static final int HEIGHT = 490; PopupEditDialog(JComponent pane) { super(DesignerContext.getDesignerFrame()); setUndecorated(true); - pane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + pane.setBorder(BorderFactory.createEmptyBorder(20, 10, 10, 10)); this.editPane = pane; this.getContentPane().add(editPane, BorderLayout.CENTER); setSize(WIDTH, HEIGHT); From 4af854aee97766c37a697adcfc3d0d71ad801bbe Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 16:44:18 +0800 Subject: [PATCH 06/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=EF=BC=88?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=EF=BC=89=3D>bug=E8=A7=A3=E5=86=B3=EF=BC=9B?= =?UTF-8?q?=E6=95=88=E7=8E=87=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/controlpane/UIListControlPane.java | 2 +- .../properties/EventPropertyTable.java | 33 +++++++++++++------ .../src/com/fr/design/mainframe/JForm.java | 9 +++-- .../design/mainframe/WidgetPropertyPane.java | 16 +++++---- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java index 1968dc6356..25369a550c 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -210,7 +210,7 @@ public abstract class UIListControlPane extends UIControlPane { listModel.addElement(new ListModelElement(aNameableArray)); } - if (listModel.size() > 0) { + if (listModel.size() > 0 || this.nameableList.getSelectedIndex() != 0) { this.nameableList.setSelectedIndex(0); } this.checkButtonEnabled(); diff --git a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java index 97320585b3..a0a29fc4cb 100644 --- a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java @@ -204,7 +204,8 @@ public class EventPropertyTable extends UIListControlPane { * 刷新 */ public void refresh() { - isPopulating = true; +// isPopulating = true; + System.out.println("in refresh..."); int selectionSize = designer.getSelectionModel().getSelection().size(); if (selectionSize == 0 || selectionSize == 1) { this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel() @@ -232,21 +233,30 @@ public class EventPropertyTable extends UIListControlPane { populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); checkButtonEnabled(); this.repaint(); - isPopulating = false; - } +// isPopulating = false; + System.out.println("out refresh..."); + } /** * 更新控件事件 * @param creator 控件 */ public void updateWidgetListener(XCreator creator, boolean isSaving) { - DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); - (creator.toData()).clearListeners(); - for (int i = 0, len = listModel.getSize(); i < len; i++) { - NameObject nameObject = isSaving ? (NameObject)((ListModelElement) listModel.getElementAt(i)).wrapper : (NameObject)(listModel.getElementAt(i)); - (creator.toData()).addListener((Listener) nameObject.getObject()); - } - designer.fireTargetModified(); +// DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); +// (creator.toData()).clearListeners(); +// for (int i = 0, len = listModel.getSize(); i < len; i++) { +// NameObject nameObject = isSaving ? (NameObject)((ListModelElement) listModel.getElementAt(i)).wrapper : (NameObject)(listModel.getElementAt(i)); +// (creator.toData()).addListener((Listener) nameObject.getObject()); +// } + + (creator.toData()).clearListeners(); + Nameable[] res = this.update(); + for (int i = 0; i < res.length; i++) { + NameObject nameObject = (NameObject)res[i]; + (creator.toData()).addListener((Listener) nameObject.getObject()); + } + + designer.fireTargetModified(); checkButtonEnabled(); } @@ -268,6 +278,9 @@ public class EventPropertyTable extends UIListControlPane { @Override public void saveSettings() { + if (isPopulating) { + return; + } updateWidgetListener(creator, true); } diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 23299f30b1..439ebe9a66 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -221,14 +221,19 @@ public class JForm extends JTemplate implements BaseJForm { } }); formDesign.addDesignerEditListener(new DesignerEditListener() { - + private XComponent lastAffectedCreator; @Override public void fireCreatorModified(DesignerEvent evt) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) { setPropertyPaneChange(formDesign.getRootComponent()); } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { - setPropertyPaneChange(evt.getAffectedCreator()); + // 防止多次触发 + if (lastAffectedCreator != null && lastAffectedCreator == evt.getAffectedCreator()) { + return; + } + lastAffectedCreator = evt.getAffectedCreator(); + setPropertyPaneChange(lastAffectedCreator); } } }); diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index 201ab203e4..40bdff39c5 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -4,10 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.WidgetPropertyTable; import com.fr.design.fun.WidgetPropertyUIProvider; @@ -314,6 +311,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper */ private class EventPropertyDesignerAdapter implements DesignerEditListener { EventPropertyTable propertyTable; + private XComponent lastAffectedCreator; EventPropertyDesignerAdapter(EventPropertyTable eventTable) { this.propertyTable = eventTable; @@ -321,8 +319,14 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper @Override public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED - || evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED) { + propertyTable.refresh(); + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { + // 防止多次触发 + if (lastAffectedCreator != null && lastAffectedCreator == evt.getAffectedCreator()) { + return; + } + lastAffectedCreator = evt.getAffectedCreator(); propertyTable.refresh(); } } From 1281a70691fa1a370169abda2cad9a911c7a3ff5 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 17:20:06 +0800 Subject: [PATCH 07/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=3D>?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=EF=BC=9B=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/WidgetEventPane.java | 5 + .../com/fr/design/locale/designer.properties | 1 + .../design/locale/designer_en_US.properties | 1 + .../design/locale/designer_ja_JP.properties | 1 + .../design/locale/designer_ko_KR.properties | 1 + .../design/locale/designer_zh_CN.properties | 1 + .../design/locale/designer_zh_TW.properties | 1 + .../properties/EventPropertyTable.java | 201 +----------------- 8 files changed, 19 insertions(+), 193 deletions(-) diff --git a/designer/src/com/fr/design/widget/WidgetEventPane.java b/designer/src/com/fr/design/widget/WidgetEventPane.java index 176422ff49..449e599e83 100644 --- a/designer/src/com/fr/design/widget/WidgetEventPane.java +++ b/designer/src/com/fr/design/widget/WidgetEventPane.java @@ -41,6 +41,11 @@ public class WidgetEventPane extends ObjectUIControlPane { this.setNameListEditable(false); } + @Override + public String getAddItemText() { + return Inter.getLocText("FR-Designer_Add_Event"); + } + /** * 生成添加按钮的NameableCreator * @return 按钮的NameableCreator diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 9bee11543a..c5fc60a42b 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2105,3 +2105,4 @@ FR-Designer_Insert_Formula=Insert_Formula FR-Designer_Insert_Chart= FR-Designer_Insert_Text= FR-Designer_Double= +FR-Designer_Add_Event=Add Event diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 6a96057ed9..5813cbb324 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -2106,3 +2106,4 @@ FR-Designer_Insert_Formula=Insert_Formula FR-Designer_Insert-Chart= FR-Designer_Insert-Text= FR-Designer_Double= +FR-Designer_Add_Event=Add Event diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index 991092322c..c5ca8622e7 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -2107,3 +2107,4 @@ FR-Designer_Label_Name= FR-Designer_Insert-Chart= FR-Designer_Insert-Text= FR-Designer_Insert_Formula= +FR-Designer_Add_Event= diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 521e8e4015..e1745cef3b 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -2107,3 +2107,4 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Insert-Chart= FR-Designer_Insert-Text= +FR-Designer_Add_Event= diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 10506bc897..fcdb415a27 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -2101,3 +2101,4 @@ FR-Designer_Insert_Image=\u63D2\u5165\u56FE\u7247 FR-Designer_Insert_Chart=\u63D2\u5165\u56FE\u8868 FR-Designer_Insert_Text=\u63D2\u5165\u666E\u901A\u6587\u672C FR-Designer_Insert_Formula=\u63D2\u5165\u516C\u5F0F +FR-Designer_Add_Event=\u6DFB\u52A0\u4E8B\u4EF6 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index bfd296c08d..bf4e166330 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -2107,3 +2107,4 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Insert-Chart= FR-Designer_Insert-Text= +FR-Designer_Add_Event= \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java index a0a29fc4cb..41057748fc 100644 --- a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java @@ -1,13 +1,9 @@ package com.fr.design.designer.properties; -import com.fr.base.BaseUtils; -import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.frpane.ListenerUpdatePane; -import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.javascript.EmailPane; @@ -18,59 +14,42 @@ import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.design.widget.EventCreator; import com.fr.design.write.submit.DBManipulationPane; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.designer.creator.XCreator; import com.fr.form.event.Listener; import com.fr.design.form.javascript.FormEmailPane; import com.fr.form.ui.Widget; -import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.general.NameObject; import com.fr.js.JavaScriptImpl; import com.fr.stable.Nameable; -import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; -import java.awt.*; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.io.IOException; import java.util.ArrayList; public class EventPropertyTable extends UIListControlPane { private ShortCut[] shorts; private XCreator creator; -// private JNameEdList nameableList; private ToolBarDef toolbarDef; - private AddItemMenuDef itemMenu; - private ShortCut editItemAction; - private ShortCut copyItemAction; - private ShortCut removeItemAction; private UIToolbar toolbar; - private ListenerUpdatePane listenerPane; private FormDesigner designer; public EventPropertyTable(FormDesigner designer) { super(); this.designer = designer; - this.initComponents(); } + @Override + public String getAddItemText() { + return Inter.getLocText("FR-Designer_Add_Event"); + } + @Override protected void initComponentPane() { toolbarDef = new ToolBarDef(); -// shorts = new ShortCut[] { itemMenu = new AddItemMenuDef(), editItemAction = new EditItemMenuDef(), -// copyItemAction = new CopyItemAction(), removeItemAction = new RemoveItemAction() }; - shorts = new ShortCut[] { itemMenu = new AddItemMenuDef()}; + shorts = new ShortCut[] {new AddItemMenuDef()}; for (ShortCut sj : shorts) { toolbarDef.addShortCut(sj); } @@ -80,9 +59,6 @@ public class EventPropertyTable extends UIListControlPane { super.initComponentPane(); } - protected void initComponents() { - } - /** * 指定索引添加对象 * @param nameObject 对象名 @@ -91,7 +67,6 @@ public class EventPropertyTable extends UIListControlPane { public void addNameObject(NameObject nameObject, int index) { DefaultListModel model = (DefaultListModel) nameableList.getModel(); -// model.add(index, nameObject); model.add(index, new ListModelElement(nameObject)); nameableList.setSelectedIndex(index); nameableList.ensureIndexIsVisible(index); @@ -99,19 +74,6 @@ public class EventPropertyTable extends UIListControlPane { nameableList.repaint(); } - /** - * 刷新控件 - * @param strings 字符数组 - */ - public void refreshNameableCreator(String[] strings) { - itemMenu.populate(strings); - - toolbarDef.updateToolBar(toolbar); - toolbar.validate(); - toolbar.repaint(); - this.repaint(); - } - public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { @Override @@ -149,20 +111,6 @@ public class EventPropertyTable extends UIListControlPane { } } - private class NameableListCellRenderer extends DefaultListCellRenderer { - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, - boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - if (value instanceof NameObject) { - Nameable wrappee = (NameObject) value; - this.setText(wrappee.getName()); - } - return this; - } - } - /* * 增加项的MenuDef */ @@ -204,8 +152,6 @@ public class EventPropertyTable extends UIListControlPane { * 刷新 */ public void refresh() { -// isPopulating = true; - System.out.println("in refresh..."); int selectionSize = designer.getSelectionModel().getSelection().size(); if (selectionSize == 0 || selectionSize == 1) { this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel() @@ -220,35 +166,23 @@ public class EventPropertyTable extends UIListControlPane { refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); -// ((DefaultListModel) nameableList.getModel()).removeAllElements(); ArrayList nameObjectList = new ArrayList<>(); for (int i = 0, size = widget.getListenerSize(); i < size; i++) { Listener listener = widget.getListener(i); if (!listener.isDefault()) { -// addNameObject(new NameObject(switchLang(listener.getEventName()) + (i + 1), listener), i); nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); - } } populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); checkButtonEnabled(); this.repaint(); -// isPopulating = false; - System.out.println("out refresh..."); } /** * 更新控件事件 * @param creator 控件 */ - public void updateWidgetListener(XCreator creator, boolean isSaving) { -// DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel(); -// (creator.toData()).clearListeners(); -// for (int i = 0, len = listModel.getSize(); i < len; i++) { -// NameObject nameObject = isSaving ? (NameObject)((ListModelElement) listModel.getElementAt(i)).wrapper : (NameObject)(listModel.getElementAt(i)); -// (creator.toData()).addListener((Listener) nameObject.getObject()); -// } - + public void updateWidgetListener(XCreator creator) { (creator.toData()).clearListeners(); Nameable[] res = this.update(); for (int i = 0; i < res.length; i++) { @@ -260,10 +194,6 @@ public class EventPropertyTable extends UIListControlPane { checkButtonEnabled(); } - public void updateWidgetListener(XCreator creator) { - updateWidgetListener(creator, true); - } - @Override protected String title4PopupWindow() { return "Event"; @@ -281,121 +211,6 @@ public class EventPropertyTable extends UIListControlPane { if (isPopulating) { return; } - updateWidgetListener(creator, true); + updateWidgetListener(creator); } - - private class DnDTransferHandler extends TransferHandler { - private int action; - - public DnDTransferHandler() { - this(TransferHandler.MOVE); - } - - public DnDTransferHandler(int action) { - this.action = action; - } - - @Override - public int getSourceActions(JComponent comp) { - return action; - } - - @Override - public Transferable createTransferable(JComponent comp) { - - int index = nameableList.getSelectedIndex(); - if (index < 0 || index >= nameableList.getModel().getSize()) { - return null; - } - - return new DnDListItem((NameObject) nameableList.getSelectedValue()); - } - - @Override - public boolean canImport(TransferSupport support) { - if (!support.isDrop()) { - return false; - } - - if (!support.isDataFlavorSupported(DnDListItem.FLAVOR)) { - return false; - } - - boolean actionSupported = (action & support.getSourceDropActions()) == action; - if (actionSupported) { - support.setDropAction(action); - return true; - } - - return false; - } - - @Override - public boolean importData(TransferHandler.TransferSupport support) { - if (!canImport(support)) { - return false; - } - JList.DropLocation dl = (JList.DropLocation) support.getDropLocation(); - - int importIndex = dl.getIndex(); - - try { - NameObject item = (NameObject) support.getTransferable().getTransferData(DnDListItem.FLAVOR); - JList list = (JList) support.getComponent(); - DefaultListModel model = (DefaultListModel) list.getModel(); - for (int i = 0; i <= importIndex; i++) { - if (ComparatorUtils.equals(item,model.getElementAt(i))) { - importIndex--; - break; - } - } - model.removeElement(item); - model.insertElementAt(item, importIndex); - updateWidgetListener(creator); - } catch (UnsupportedFlavorException e) { - return false; - } catch (java.io.IOException e) { - return false; - } - - return true; - } - } - - public static class DnDListItem implements Transferable { - private NameObject no; - public static final DataFlavor FLAVOR = new DataFlavor(DnDListItem.class, "DnDListItem.class"); - - public DnDListItem(NameObject no) { - this.no = no; - } - - @Override - public DataFlavor[] getTransferDataFlavors() { - return new DataFlavor[] { FLAVOR }; - } - - @Override - /** - *是否支持 dataFlavor - *@param DataFlavor类 - *@return 支持返回true - */ - public boolean isDataFlavorSupported(DataFlavor flavor) { - if (ComparatorUtils.equals(flavor,FLAVOR)) { - return true; - } - - return false; - } - - @Override - public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - if (ComparatorUtils.equals(flavor,FLAVOR)) { - return no; - } - - return null; - } - } } \ No newline at end of file From 25b278e3c01633fbcc56ab299450d258d717a769 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 17:35:56 +0800 Subject: [PATCH 08/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=EF=BC=88?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=EF=BC=89=3D>=E5=8E=BB=E6=8E=89=E5=86=97?= =?UTF-8?q?=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/EventPropertyTable.java | 73 ------------------- 1 file changed, 73 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java index 41057748fc..435f42cfe6 100644 --- a/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java @@ -1,17 +1,11 @@ package com.fr.design.designer.properties; -import com.fr.design.actions.UpdateAction; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.frpane.ListenerUpdatePane; -import com.fr.design.gui.ilist.ListModelElement; -import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.javascript.EmailPane; import com.fr.design.javascript.JavaScriptActionPane; import com.fr.design.mainframe.FormDesigner; -import com.fr.design.menu.MenuDef; -import com.fr.design.menu.ShortCut; -import com.fr.design.menu.ToolBarDef; import com.fr.design.widget.EventCreator; import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.editor.ValueEditorPaneFactory; @@ -21,19 +15,14 @@ import com.fr.design.form.javascript.FormEmailPane; import com.fr.form.ui.Widget; import com.fr.general.Inter; import com.fr.general.NameObject; -import com.fr.js.JavaScriptImpl; import com.fr.stable.Nameable; import javax.swing.*; -import java.awt.event.ActionEvent; import java.util.ArrayList; public class EventPropertyTable extends UIListControlPane { - private ShortCut[] shorts; private XCreator creator; - private ToolBarDef toolbarDef; - private UIToolbar toolbar; private FormDesigner designer; public EventPropertyTable(FormDesigner designer) { @@ -46,40 +35,11 @@ public class EventPropertyTable extends UIListControlPane { return Inter.getLocText("FR-Designer_Add_Event"); } - @Override - protected void initComponentPane() { - toolbarDef = new ToolBarDef(); - shorts = new ShortCut[] {new AddItemMenuDef()}; - for (ShortCut sj : shorts) { - toolbarDef.addShortCut(sj); - } - toolbar = ToolBarDef.createJToolBar(); - toolbarDef.updateToolBar(toolbar); - - super.initComponentPane(); - } - - /** - * 指定索引添加对象 - * @param nameObject 对象名 - * @param index 索引 - */ - public void addNameObject(NameObject nameObject, int index) { - DefaultListModel model = (DefaultListModel) nameableList.getModel(); - - model.add(index, new ListModelElement(nameObject)); - nameableList.setSelectedIndex(index); - nameableList.ensureIndexIsVisible(index); - - nameableList.repaint(); - } - public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { @Override protected JavaScriptActionPane createJavaScriptActionPane() { return new JavaScriptActionPane() { - @Override protected DBManipulationPane createDBManipulationPane() { return new DBManipulationPane(ValueEditorPaneFactory.formEditors()); @@ -110,39 +70,6 @@ public class EventPropertyTable extends UIListControlPane { return false; } } - - /* - * 增加项的MenuDef - */ - protected class AddItemMenuDef extends MenuDef { - public AddItemMenuDef() { - this.setName(Inter.getLocText("Add")); - this.setMnemonic('A'); - this.setIconPath("/com/fr/design/images/control/addPopup.png"); - } - - public void populate(String[] eventNames) { - this.clearShortCuts(); - for (int i = 0; i < eventNames.length; i++) { - final String eventname = eventNames[i]; - - this.addShortCut(new UpdateAction() { - { - this.setName(switchLang(eventname)); - } - - public void actionPerformed(ActionEvent e) { - NameObject nameable = new NameObject(createUnrepeatedName(switchLang(eventname)), new Listener( - eventname,new JavaScriptImpl())); - - EventPropertyTable.this.addNameObject(nameable, EventPropertyTable.this.nameableList.getModel() - .getSize()); - updateWidgetListener(creator); - } - }); - } - } - } private String switchLang(String eventName) { return Inter.getLocText("Event-" + eventName); From f5a98631691448389440f52289d58742d30174b4 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 17:57:04 +0800 Subject: [PATCH 09/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=EF=BC=88?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=EF=BC=89=3D>=E8=BE=B9=E6=A1=86=E6=A0=A1?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/WidgetPropertyPane.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index 40bdff39c5..8b959deec9 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -127,9 +127,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper private void createEventTable() { eventTable = new EventPropertyTable(designer); designer.addDesignerEditListener(new EventPropertyDesignerAdapter(eventTable)); - eventTable.setBorder(null); - esp = new UIScrollPane(eventTable); //用来装载事件table - esp.setBorder(null); } /** @@ -239,7 +236,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper tabbedPane.setBorder(null); tabbedPane.setTabPlacement(SwingConstants.BOTTOM); tabbedPane.addTab(Inter.getLocText("FR-Designer_Properties"), psp); - tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), esp); + tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), eventTable); tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp); } From 601fab68d132601fb6c5763e703f9fd20fbf9491 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 2 Aug 2017 20:06:12 +0800 Subject: [PATCH 10/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=8B=E4=BB=B6=E7=BC=96=E8=BE=91=EF=BC=88?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=89=3D=E3=80=8B=E6=95=B4=E5=90=88?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=AE=9E=E7=8E=B0=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/WidgetEventPane.java | 75 +------------------ 1 file changed, 4 insertions(+), 71 deletions(-) diff --git a/designer/src/com/fr/design/widget/WidgetEventPane.java b/designer/src/com/fr/design/widget/WidgetEventPane.java index 449e599e83..3d37770b06 100644 --- a/designer/src/com/fr/design/widget/WidgetEventPane.java +++ b/designer/src/com/fr/design/widget/WidgetEventPane.java @@ -6,6 +6,7 @@ import java.util.List; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.controlpane.ObjectUIControlPane; +import com.fr.design.mainframe.CellWidgetPropertyPane; import com.fr.design.present.CellWriteAttrPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane; @@ -30,14 +31,9 @@ import com.fr.report.stable.ReportConstants; import com.fr.stable.Nameable; public class WidgetEventPane extends ObjectUIControlPane { - private ElementCasePane ePane; - - public WidgetEventPane() { - this(null); - } + public WidgetEventPane(ElementCasePane pane) { super(pane); - ePane = pane; this.setNameListEditable(false); } @@ -58,67 +54,7 @@ public class WidgetEventPane extends ObjectUIControlPane { @Override public void saveSettings() { - - final TemplateElementCase tplEC = ePane.getEditingElementCase(); - final CellSelection finalCS = (CellSelection) ePane.getSelection(); - TemplateCellElement editCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); - if (editCellElement == null) { - editCellElement = new DefaultTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); - tplEC.addCellElement(editCellElement); - } - final BasicPane bp = populateBasicPane(editCellElement); - - // 需要先行后列地增加新元素。 - for (int j = 0; j < finalCS.getRowSpan(); j++) { - for (int i = 0; i < finalCS.getColumnSpan(); i++) { - int column = i + finalCS.getColumn(); - int row = j + finalCS.getRow(); - editCellElement = tplEC.getTemplateCellElement(column, row); - if (editCellElement == null) { - editCellElement = new DefaultTemplateCellElement(column, row); - tplEC.addCellElement(editCellElement); - } - // alex:不加这一句话会导致跨行跨列的格子被多次update - if (editCellElement.getColumn() != column || editCellElement.getRow() != row) { - continue; - } - updateBasicPane(bp, editCellElement); - - Object editElementValue = editCellElement.getValue(); - if (editElementValue != null && (editElementValue instanceof String || editElementValue instanceof Number)) { - // TODO ALEX_SEP 暂时用FIT_DEFAULT替代,不取reportsetting里面的设置,因为也不知道是应该放在report里面还是elementcase里面 - GridUtils.shrinkToFit(ReportConstants.AUTO_SHRINK_TO_FIT_DEFAULT, tplEC, editCellElement); - } - } - } - ePane.fireTargetModified(); - } - - private BasicPane populateBasicPane(TemplateCellElement cellElement) { - CellWriteAttrPane pane = new CellWriteAttrPane(ePane); - //got simple cell element from column and row. - pane.populate(cellElement); - - return pane; - } - - private void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { - CellWriteAttrPane pane = (CellWriteAttrPane) bp; - if (cellElement.getWidget() == null) { - pane.update(cellElement); - return; - } - try { - Widget oldWidget = (Widget) cellElement.getWidget().clone(); - pane.update(cellElement); - //这边需要重新设置权限细粒度的hashset是因为Update是直接生成一个新的来update的,所以以前里面的hashset都没有了 - Widget newWidget = cellElement.getWidget(); - if (newWidget.getClass() == oldWidget.getClass()) { - newWidget.setWidgetPrivilegeControl((WidgetPrivilegeControl) oldWidget.getWidgetPrivilegeControl().clone()); - } - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } + CellWidgetPropertyPane.getInstance().update(); } @Override @@ -127,10 +63,7 @@ public class WidgetEventPane extends ObjectUIControlPane { } public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { - private ElementCasePane epane; - public WidgetEventListenerUpdatePane() { - this(null); - } + private ElementCasePane epane; public WidgetEventListenerUpdatePane(ElementCasePane epane){ this.epane = epane; super.initComponents(); From be2ab9031440ee29f7f66aa4badeafe9aa7aafdd Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 3 Aug 2017 10:43:10 +0800 Subject: [PATCH 11/11] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/controlpane/ObjectUIControlPane.java | 12 +----------- .../com/fr/design/mainframe/JTemplate.java | 2 +- .../com/fr/design/widget/EventCreator.java | 19 ------------------- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java index 46b41d020a..3b2a1b0711 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/ObjectUIControlPane.java @@ -30,17 +30,7 @@ public abstract class ObjectUIControlPane extends UIListControlPane { Constructor 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) { + } catch (Exception e) { throw new RuntimeException(e); } } diff --git a/designer_base/src/com/fr/design/mainframe/JTemplate.java b/designer_base/src/com/fr/design/mainframe/JTemplate.java index b5d1f4cabb..aa42804dbb 100644 --- a/designer_base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer_base/src/com/fr/design/mainframe/JTemplate.java @@ -128,7 +128,7 @@ public abstract class JTemplate> ex long saveTime = System.currentTimeMillis(); // 保存模板的时间点 try { tic.collectInfo(template, this, openTime, saveTime); - } catch (Exception ex) { // 不管收集过程中出现任何异常,都不应该影响模版保存 + } catch (Throwable th) { // 不管收集过程中出现任何异常,都不应该影响模版保存 } openTime = saveTime; // 更新 openTime,准备下一次计算 } diff --git a/designer_base/src/com/fr/design/widget/EventCreator.java b/designer_base/src/com/fr/design/widget/EventCreator.java index 530bd34aa2..84f6120a75 100644 --- a/designer_base/src/com/fr/design/widget/EventCreator.java +++ b/designer_base/src/com/fr/design/widget/EventCreator.java @@ -50,25 +50,6 @@ public class EventCreator extends NameableSelfCreator { 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() {