示例#1
0
    @Override
    public void handleEvent(BaseEvent event) {
      if (event.getKey().equals(RELEASED) && counterSupport instanceof AggregatedCounterSupport)
        ((AggregatedCounterSupport) counterSupport).removeChild((CounterHolder) event.getSource());

      if (event.getKey().equals(DELETED)) {
        final ComponentItem component = (ComponentItem) event.getSource();
        componentList.removeItem(
            component,
            new Runnable() {
              @Override
              public void run() {
                for (int i = 0; i < getConfig().sizeOfComponentArray(); i++) {
                  if (component.getId().equals(getConfig().getComponentArray(i).getId())) {
                    getConfig().removeComponent(i);
                    break;
                  }
                }
              }
            });
      }
    }
示例#2
0
    @Override
    public void handleEvent(BaseEvent event) {
      if (event instanceof ActionEvent) {
        if (CounterHolder.COUNTER_RESET_ACTION.equals(event.getKey())) {
          reset();
        }
      } else if (LoadUI.isController() && event instanceof CounterEvent && isRunning()) {
        CounterEvent cEvent = (CounterEvent) event;
        long limit = getLimit(cEvent.getKey());
        if (limit > 0 && limit <= cEvent.getSource().getCounter(cEvent.getKey()).get()) {
          List<TestExecution> executions = testRunner.getExecutionQueue();

          triggerAction(STOP_ACTION);
          triggerAction(COMPLETE_ACTION);
          if (!executions.isEmpty() && executions.get(0).getCanvas() == CanvasItemImpl.this) {
            executions.get(0).complete();
          }
        }
      }
    }