Package com.google.gwt.dev.shell.BrowserChannel

Examples of com.google.gwt.dev.shell.BrowserChannel.Value


  }

  public void testInvokeOnClientMessage() throws IOException,
      BrowserChannelException {
    String methodName = "fooMethod";
    Value thisRef = new Value();
    thisRef.setJavaObject(new JavaObjectRef(42));
    Value[] args = new Value[] {
      new Value(), new Value(),
    };
    args[0].setInt(0);
    args[1].setInt(1);
    new InvokeOnClientMessage(channel, methodName, thisRef, args).send();
    MessageType type = channel.readMessageType();
    assertEquals(MessageType.INVOKE, type);
    InvokeOnClientMessage message = InvokeOnClientMessage.receive(channel);
    assertEquals(methodName, message.getMethodName());
    Value thisRefRecv = message.getThis();
    assertEquals(ValueType.JAVA_OBJECT, thisRefRecv.getType());
    assertEquals(42, thisRefRecv.getJavaObject().getRefid());
    Value[] argsRecv = message.getArgs();
    assertEquals(2, argsRecv.length);
    for (int i = 0; i < 2; ++i) {
      assertEquals(ValueType.INT, argsRecv[i].getType());
      assertEquals(i, argsRecv[i].getInt());
View Full Code Here


  }

  public void testInvokeOnServerMessage() throws IOException,
      BrowserChannelException {
    int methodId = -1;
    Value thisRef = new Value();
    thisRef.setJavaObject(new JavaObjectRef(42));
    Value[] args = new Value[] {
      new Value(), new Value(),
    };
    args[0].setInt(0);
    args[1].setInt(1);
    new InvokeOnServerMessage(channel, methodId, thisRef, args).send();
    MessageType type = channel.readMessageType();
    assertEquals(MessageType.INVOKE, type);
    InvokeOnServerMessage message = InvokeOnServerMessage.receive(channel);
    assertEquals(methodId, message.getMethodDispatchId());
    Value thisRefRecv = message.getThis();
    assertEquals(ValueType.JAVA_OBJECT, thisRefRecv.getType());
    assertEquals(42, thisRefRecv.getJavaObject().getRefid());
    Value[] argsRecv = message.getArgs();
    assertEquals(2, argsRecv.length);
    for (int i = 0; i < 2; ++i) {
      assertEquals(ValueType.INT, argsRecv[i].getType());
      assertEquals(i, argsRecv[i].getInt());
View Full Code Here

  }

  public void testInvokeSpecialMessage() throws IOException,
      BrowserChannelException {
    Value[] args = new Value[] {
      new Value(), new Value(),
    };
    args[0].setInt(0);
    args[1].setInt(1);
    new InvokeSpecialMessage(channel, SpecialDispatchId.HasMethod, args).send();
    MessageType type = channel.readMessageType();
View Full Code Here

    assertFalse(message.isAsynchronous());
  }

  public void testReturnMessage() throws IOException,
      BrowserChannelException {
    Value val = new Value();
    val.setInt(42);
    new ReturnMessage(channel, false, val).send();
    MessageType type = channel.readMessageType();
    assertEquals(MessageType.RETURN, type);
    ReturnMessage message = ReturnMessage.receive(channel);
    assertFalse(message.isException());
    Value valRecv = message.getReturnValue();
    assertEquals(ValueType.INT, valRecv.getType());
    assertEquals(42, valRecv.getInt());
  }
View Full Code Here

    }

    @Override
    public ExceptionOrReturnValue getProperty(BrowserChannelServer channel,
        int refId, int dispId) {
      return new ExceptionOrReturnValue(false, new Value());
    }
View Full Code Here

    }

    @Override
    public ExceptionOrReturnValue invoke(BrowserChannelServer channel, Value thisObj,
        int dispId, Value[] args) {
      return new ExceptionOrReturnValue(false, new Value());
    }
View Full Code Here

    }

    @Override
    public ExceptionOrReturnValue setProperty(BrowserChannelServer channel,
        int refId, int dispId, Value newValue) {
      return new ExceptionOrReturnValue(false, new Value());
    }
View Full Code Here

      TreeLogger branch = logger.branch(TreeLogger.SPAM,
          "Client special invoke of getProperty(" + dispId + " ["
              + ccl.getClassInfoByDispId(dispId).getMember(dispId) + "]) on "
              + obj.toString(), null);
      JsValueOOPHM jsval = (JsValueOOPHM) dispObj.getField(dispId);
      Value retVal = channel.convertFromJsValue(localObjects, jsval);
      if (logger.isLoggable(TreeLogger.SPAM)) {
        branch.log(TreeLogger.SPAM, "result is " + retVal, null);
      }
      return new ExceptionOrReturnValue(false, retVal);
    } catch (Throwable t) {
      JsValueOOPHM jsval = new JsValueOOPHM();
      JsValueGlue.set(jsval, moduleSpace.getIsolatedClassLoader(),
          t.getClass(), t);
      Value retVal = channel.convertFromJsValue(localObjects, jsval);
      return new ExceptionOrReturnValue(true, retVal);
    }
  }
View Full Code Here

    } catch (Throwable t) {
      exception = true;
      JsValueGlue.set(jsRetVal, moduleSpace.getIsolatedClassLoader(),
          t.getClass(), t);
    }
    Value retVal = channel.convertFromJsValue(localObjects, jsRetVal);
    jsToJavaCallEvent.end();
    return new ExceptionOrReturnValue(exception, retVal);
  }
View Full Code Here

      return new ExceptionOrReturnValue(false, newValue);
    } catch (Throwable t) {
      JsValueOOPHM jsval = new JsValueOOPHM();
      JsValueGlue.set(jsval, moduleSpace.getIsolatedClassLoader(),
          t.getClass(), t);
      Value retVal = channel.convertFromJsValue(localObjects, jsval);
      return new ExceptionOrReturnValue(true, retVal);
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.shell.BrowserChannel.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.