diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index cd3c3a5ba4..27ab268dc9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -249,7 +249,8 @@ abstract class UIControlPane extends JControlPane { checkValid(); } catch (Exception exp) { // 存在非法输入 拒绝隐藏 - JOptionPane.showMessageDialog(UIControlPane.this.controlUpdatePane, exp.getMessage()); + this.setAlwaysOnTop(true); + JOptionPane.showMessageDialog(this, exp.getMessage()); this.requestFocus(); return; } diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java b/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java index 77cb10734b..1592b0fd01 100644 --- a/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java +++ b/designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java @@ -23,124 +23,131 @@ import java.util.ArrayList; public class EventPropertyTable extends UIListControlPane { - private XCreator creator; - private FormDesigner designer; - - public EventPropertyTable(FormDesigner designer) { - super(); - this.designer = designer; - } - - @Override - public String getAddItemText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Event"); - } - - public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { - - @Override - protected JavaScriptActionPane createJavaScriptActionPane() { - return new JavaScriptActionPane() { - @Override - protected DBManipulationPane createDBManipulationPane() { - return new DBManipulationPane(ValueEditorPaneFactory.formEditors()); - } - - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Callback_Function"); - } - @Override - protected EmailPane initEmaiPane() { - return new FormEmailPane(); - } - @Override - public boolean isForm() { - return true; - } - - protected String[] getDefaultArgs() { - return new String[0]; - } - - }; - } - - @Override - protected boolean supportCellAction() { - return false; - } - } - - private String switchLang(String eventName) { - // 在 properties 文件中找到相应的 key 值 + private XCreator creator; + private FormDesigner designer; + + public EventPropertyTable(FormDesigner designer) { + super(); + this.designer = designer; + } + + @Override + public String getAddItemText() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Event"); + } + + public static class WidgetEventListenerUpdatePane extends ListenerUpdatePane { + + @Override + protected JavaScriptActionPane createJavaScriptActionPane() { + return new JavaScriptActionPane() { + @Override + protected DBManipulationPane createDBManipulationPane() { + return new DBManipulationPane(ValueEditorPaneFactory.formEditors()); + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Callback_Function"); + } + + @Override + protected EmailPane initEmaiPane() { + return new FormEmailPane(); + } + + @Override + public boolean isForm() { + return true; + } + + protected String[] getDefaultArgs() { + return new String[0]; + } + + }; + } + + @Override + protected boolean supportCellAction() { + return false; + } + } + + private String switchLang(String eventName) { + // 在 properties 文件中找到相应的 key 值 String localeKey = ReportEngineEventMapping.getLocaleName(eventName); return com.fr.design.i18n.Toolkit.i18nText(localeKey); - } - - /** - * 刷新 - */ - public void refresh() { - int selectionSize = designer.getSelectionModel().getSelection().size(); - if (selectionSize == 0 || selectionSize == 1) { - this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel() - .getSelection().getSelectedCreator(); - } else { - this.creator = null; - ((DefaultListModel) nameableList.getModel()).removeAllElements(); - checkButtonEnabled(); - return; - } - Widget widget = creator.toData(); - - refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); - - ArrayList nameObjectList = new ArrayList<>(); - for (int i = 0, size = widget.getListenerSize(); i < size; i++) { - Listener listener = widget.getListener(i); - if (!listener.isDefault()) { - nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); - } - } - populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); - checkButtonEnabled(); - this.repaint(); - } - - /** - * 更新控件事件 - * @param creator 控件 - */ - public void updateWidgetListener(XCreator creator) { - (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(); - } - - @Override - protected String title4PopupWindow() { - return "Event"; - } - - @Override - public NameableCreator[] createNameableCreators() { - return new NameableCreator[]{ - new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class) - }; - } - - @Override - public void saveSettings() { - if (isPopulating) { - return; - } - updateWidgetListener(creator); - } + } + + /** + * 刷新 + */ + public void refresh() { + int selectionSize = designer.getSelectionModel().getSelection().size(); + if (selectionSize == 0 || selectionSize == 1) { + this.creator = selectionSize == 0 ? designer.getRootComponent() : designer.getSelectionModel() + .getSelection().getSelectedCreator(); + } else { + this.creator = null; + ((DefaultListModel) nameableList.getModel()).removeAllElements(); + checkButtonEnabled(); + return; + } + Widget widget = creator.toData(); + + refreshNameableCreator(EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class)); + } + + public void populateNameObjects() { + Widget widget = creator.toData(); + + ArrayList nameObjectList = new ArrayList<>(); + for (int i = 0, size = widget.getListenerSize(); i < size; i++) { + Listener listener = widget.getListener(i); + if (!listener.isDefault()) { + nameObjectList.add(i, new NameObject(switchLang(listener.getEventName()) + (i + 1), listener)); + } + } + populate(nameObjectList.toArray(new NameObject[widget.getListenerSize()])); + checkButtonEnabled(); + this.repaint(); + } + + /** + * 更新控件事件 + * + * @param creator 控件 + */ + public void updateWidgetListener(XCreator creator) { + (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(); + } + + @Override + protected String title4PopupWindow() { + return "Event"; + } + + @Override + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new EventCreator(Widget.EVENT_STATECHANGE, WidgetEventListenerUpdatePane.class) + }; + } + + @Override + public void saveSettings() { + if (isPopulating) { + return; + } + updateWidgetListener(creator); + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index 0cf740dbe5..af17389be0 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -108,6 +108,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper */ private void initTables() { formWidgetCardPane.populate(); + eventTable.refresh(); if (mobileExtraPropertyPanes != null) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { @@ -233,7 +234,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper public void tabChanged(int index) { //切换的时候再populate if (index == 1) { - eventTable.refresh(); + eventTable.populateNameObjects(); } else if (index == 2) { if (mobileExtraPropertyPanes != null) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {