Exemplo n.º 1
0
  public void registerEvent(IObservableValueListener manager, IProperty property) {
    Object host = manager.getHost();
    IEventController controller = UserData.findEventController(host);
    if (controller == null) {
      controller = UserData.updateEventController(host);
    }
    IMetaclass metaclass = XWT.getMetaclass(host);

    EventProperty reaisedEventProperty = (EventProperty) property;
    String raisedName = reaisedEventProperty.getEvent().getName();
    for (String name : getEventNames()) {
      if (name.equalsIgnoreCase(raisedName)) {
        continue;
      }
      String eventPropertyName = IEventConstants.getEventPropertyName(name);
      String eventName = IEventConstants.getEventName(name);
      IEvent event = metaclass.findEvent(eventName);
      IProperty eventProperty = metaclass.findProperty(eventPropertyName);

      try {
        controller.setEvent(
            event,
            UserData.getWidget(host),
            manager,
            eventProperty,
            IObservableValueListener.class.getDeclaredMethod(
                "changeValueHandle", Object.class, org.eclipse.swt.widgets.Event.class));
      } catch (Exception e) {
        LoggerManager.log(e);
        return;
      }
    }
  }
Exemplo n.º 2
0
  public void fireEvent(IObservableValueListener manager, IProperty property) {
    Object host = manager.getHost();
    IMetaclass metaclass = XWT.getMetaclass(host);

    EventProperty reaisedEventProperty = (EventProperty) property;
    String raisedName = reaisedEventProperty.getEvent().getName();
    for (String name : getEventNames()) {
      if (name.equalsIgnoreCase(raisedName)) {
        continue;
      }
      String eventPropertyName = IEventConstants.getEventPropertyName(name);
      IProperty eventProperty = metaclass.findProperty(eventPropertyName);

      IObservableValue value = manager.getValue(eventProperty);
      if (value != null) {
        value.setValue(false);
      }
    }
  }