예제 #1
0
    public void updateConnectorHierarchy(List<ServerConnector> children) {
      Set<String> connectorIds = new HashSet<String>();
      for (ServerConnector child : children) {
        if (child instanceof ComponentConnector) {
          connectorIds.add(child.getConnectorId());
          idToDetailsMap.put(child.getConnectorId(), (ComponentConnector) child);
        }
      }

      Set<String> removedDetails = new HashSet<String>();
      for (Entry<String, ComponentConnector> entry : idToDetailsMap.entrySet()) {
        ComponentConnector connector = entry.getValue();
        String id = connector.getConnectorId();
        if (!connectorIds.contains(id)) {
          removedDetails.add(entry.getKey());
          if (idToRowIndex.containsKey(id)) {
            getWidget().setDetailsVisible(idToRowIndex.get(id), false);
          }
        }
      }

      for (String id : removedDetails) {
        idToDetailsMap.remove(id);
        idToRowIndex.remove(id);
      }
    }
예제 #2
0
 @Override
 public Object invoke(Object target, Method method, Object[] params) {
   MethodInvocation invocation =
       new MethodInvocation(
           connector.getConnectorId(), rpcInterface.getName(), method.getName(), params);
   connector
       .getConnection()
       .addMethodInvocationToQueue(invocation, method.isDelayed(), method.isLastOnly());
   // No RPC iface should have a return value
   return null;
 }
예제 #3
0
파일: RpcProxy.java 프로젝트: jmauix/vaadin
 @Override
 public Object invoke(Object target, Method method, Object[] params) {
   MethodInvocation invocation =
       new MethodInvocation(
           connector.getConnectorId(), rpcInterface.getName(), method.getName(), params);
   ServerRpcQueue serverRpcQueue = ServerRpcQueue.get(connector.getConnection());
   serverRpcQueue.add(invocation, method.isLastOnly());
   if (!method.isDelayed()) {
     serverRpcQueue.flush();
   }
   // No RPC iface should have a return value
   return null;
 }
  @Override
  protected void extend(ServerConnector target) {
    target.addStateChangeHandler(
        new StateChangeEvent.StateChangeHandler() {
          private static final long serialVersionUID = -8439729365677484553L;

          @Override
          public void onStateChanged(StateChangeEvent stateChangeEvent) {
            Scheduler.get()
                .scheduleDeferred(
                    new ScheduledCommand() {
                      @Override
                      public void execute() {
                        updateResetButtonVisibility();
                      }
                    });
          }
        });

    textField = (VTextField) ((ComponentConnector) target).getWidget();
    textField.addStyleName(CLASSNAME + "-textfield");

    resetButtonElement = DOM.createDiv();
    resetButtonElement.addClassName(CLASSNAME + "-resetbutton");

    textField.addAttachHandler(this);
    textField.addKeyUpHandler(this);
  }
  /**
   * Invokes the listener method for a state change.
   *
   * @param stateChangeEvent the state change event
   */
  public void invoke(StateChangeEvent stateChangeEvent) {
    ServerConnector connector = (ServerConnector) stateChangeEvent.getSource();

    Class<?> declaringClass = this.declaringClass;
    if (declaringClass == null) {
      declaringClass = connector.getClass();
    }
    Type declaringType = TypeDataStore.getType(declaringClass);

    try {
      declaringType.getMethod(methodName).invoke(connector);
    } catch (NoDataException e) {
      throw new RuntimeException(
          "Couldn't invoke @OnStateChange method "
              + declaringType.getSignature()
              + "."
              + methodName,
          e);
    }
  }