Browse Source

REPORT-51678 事件配置项支持重命名

feature/10.0
kuangshuai 4 years ago
parent
commit
61c6ac4fb1
  1. 3
      designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java
  2. 11
      designer-realize/src/main/java/com/fr/design/share/effect/ListenerEffectItem.java
  3. 3
      designer-realize/src/main/java/com/fr/design/share/ui/config/table/ConfigTableModel.java
  4. 3
      designer-realize/src/main/java/com/fr/design/share/ui/generate/table/EffectTableModel.java

3
designer-realize/src/main/java/com/fr/design/share/effect/EffectItemGroup.java

@ -68,8 +68,7 @@ public class EffectItemGroup {
for (int index = 0; index < listenerSize; index ++) { for (int index = 0; index < listenerSize; index ++) {
Listener listener = widget.getListener(index); Listener listener = widget.getListener(index);
SourceNode sourceNode = SourceNodeUtils.createSourceNode(widget, null); SourceNode sourceNode = SourceNodeUtils.createSourceNode(widget, null);
String eventName = switchLang(listener.getEventName()) + (index + 1); this.add(new ListenerEffectItem(listener, sourceNode));
this.add(new ListenerEffectItem(listener, sourceNode, eventName));
} }
} }

11
designer-realize/src/main/java/com/fr/design/share/effect/ListenerEffectItem.java

@ -9,10 +9,9 @@ import com.fr.form.ui.Widget;
public class ListenerEffectItem extends BaseEffectItem<Listener> { public class ListenerEffectItem extends BaseEffectItem<Listener> {
private Listener listener; private Listener listener;
public ListenerEffectItem(Listener listener, SourceNode sourceNode, String name) { public ListenerEffectItem(Listener listener, SourceNode sourceNode) {
this.listener = listener; this.listener = listener;
this.setSourceNode(sourceNode); this.setSourceNode(sourceNode);
this.setName(name);
init(); init();
} }
@ -24,6 +23,8 @@ public class ListenerEffectItem extends BaseEffectItem<Listener> {
object = new Listener(listener.getTargetWidget(), listener.getEventName(), listener.getAction(), listener.isInvokeOnce()); object = new Listener(listener.getTargetWidget(), listener.getEventName(), listener.getAction(), listener.isInvokeOnce());
} }
setObject(object); setObject(object);
setName(listener.getName());
this.setNameableCreator(new EventCreator(Widget.EVENT_STATECHANGE, EventPropertyTable.WidgetEventListenerUpdatePane.class)); this.setNameableCreator(new EventCreator(Widget.EVENT_STATECHANGE, EventPropertyTable.WidgetEventListenerUpdatePane.class));
} }
@ -32,7 +33,13 @@ public class ListenerEffectItem extends BaseEffectItem<Listener> {
setObject((Listener) bean); setObject((Listener) bean);
} }
public void setName(String name) {
super.setName(name);
getObject().setName(name);
}
public void save() { public void save() {
listener.setName(getObject().getName());
listener.setEventName(getObject().getEventName()); listener.setEventName(getObject().getEventName());
listener.setAction(getObject().getAction()); listener.setAction(getObject().getAction());
listener.setInvokeOnce(getObject().isInvokeOnce()); listener.setInvokeOnce(getObject().isInvokeOnce());

3
designer-realize/src/main/java/com/fr/design/share/ui/config/table/ConfigTableModel.java

@ -39,8 +39,7 @@ public class ConfigTableModel extends AbstractTableModel {
@Override @Override
public boolean isCellEditable(int rowIndex, int columnIndex) { public boolean isCellEditable(int rowIndex, int columnIndex) {
EffectItem effectItem = effectItems.get(rowIndex); return columnIndex == 1;
return columnIndex == 1 && !(effectItem instanceof ListenerEffectItem);
} }
@Override @Override

3
designer-realize/src/main/java/com/fr/design/share/ui/generate/table/EffectTableModel.java

@ -44,8 +44,7 @@ public class EffectTableModel extends AbstractTableModel {
@Override @Override
public boolean isCellEditable(int rowIndex, int columnIndex) { public boolean isCellEditable(int rowIndex, int columnIndex) {
EffectItem effectItem = effectItems.get(rowIndex); return columnIndex == 1;
return columnIndex == 1 && !(effectItem instanceof ListenerEffectItem);
} }
@Override @Override

Loading…
Cancel
Save