예제 #1
0
    @Override
    void run() {
      if (_object.listeners() != null) {
        _object.listeners().remove(_listener);

        if (_object.listeners().isEmpty()) _object.listeners(null);
      }
    }
예제 #2
0
  @Override
  final Action onVisitingTObject(TObject object) {
    Action action = super.onVisitingTObject(object);

    if (action == Action.VISIT) if (object.listeners() == null) return Action.SKIP;

    return action;
  }
예제 #3
0
  @Override
  protected final void onResourceDelete(final TObject object) {
    if (object.listeners() != null) {
      invoke(
          object,
          new Invocation() {

            @Override
            void run(Object listener) {
              ((ResourceListener) listener).onDelete();
            }
          });
    }
  }
예제 #4
0
  @Override
  protected final void onKeyedClear(TObject object) {
    if (object.listeners() != null) {
      invoke(
          object,
          new Invocation() {

            @Override
            void run(Object listener) {
              ((KeyListener) listener).onClear();
            }
          });
    }
  }
예제 #5
0
  @Override
  protected final void onIndexedWrite(TObject object, final int index) {
    if (object.listeners() != null) {
      invoke(
          object,
          new Invocation() {

            @Override
            void run(Object listener) {
              ((IndexListener) listener).onSet(index);
            }
          });
    }
  }
예제 #6
0
  @SuppressWarnings("unchecked")
  @Override
  protected final void onKeyedRemoval(TObject object, final Object key) {
    if (object.listeners() != null) {
      invoke(
          object,
          new Invocation() {

            @Override
            void run(Object listener) {
              ((KeyListener) listener).onRemove(key);
            }
          });
    }
  }
예제 #7
0
    @Override
    void run() {
      if (_object instanceof TIndexed) {
        if (_object.listeners() != null) {
          invoke(
              _object,
              new Invocation() {

                @Override
                void run(Object listener) {
                  if (listener instanceof IndexListener) ((IndexListener) listener).onSet(_index);
                }
              });
        }
      }
    }
예제 #8
0
    @Override
    void run() {
      if (_object instanceof TIndexed) {
        if (_object.listeners() != null) {
          invoke(
              _object,
              new Invocation() {

                @Override
                void run(Object listener) {
                  if (listener instanceof PropertyListener)
                    ((PropertyListener) listener).onPropertyChanged(_propertyName);
                }
              });
        }
      }
    }
예제 #9
0
  private static void invoke(TObject object, final Invocation invocation) {
    for (Object listener : object.listeners()) {
      if (listener instanceof CustomExecutorListener) {
        final CustomExecutorListener cel = (CustomExecutorListener) listener;

        cel.Executor.execute(
            new Runnable() {

              @Override
              public void run() {
                invocation.run(cel.Listener);
              }
            });
      } else {
        try {
          invocation.run(listener);
        } catch (Exception e) {
          Log.userCodeException(e);
        }
      }
    }
  }
예제 #10
0
    @Override
    void run() {
      if (_object.listeners() == null) _object.listeners(new PlatformSet<Object>());

      _object.listeners().add(_listener);
    }