Browse Source

REPORT-3163 合作开发9.0设计器=>控件设置事件编辑(表单)=>bug解决;效率优化

master
plough 7 years ago
parent
commit
4af854aee9
  1. 2
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java
  2. 33
      designer_form/src/com/fr/design/designer/properties/EventPropertyTable.java
  3. 9
      designer_form/src/com/fr/design/mainframe/JForm.java
  4. 16
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

2
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();

33
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);
}

9
designer_form/src/com/fr/design/mainframe/JForm.java

@ -221,14 +221,19 @@ public class JForm extends JTemplate<Form, FormUndoState> 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);
}
}
});

16
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();
}
}

Loading…
Cancel
Save