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