Exemplo n.º 1
0
 static void init(Scriptable scope, boolean sealed) {
   NativeMath obj = new NativeMath();
   obj.activatePrototypeMap(MAX_ID);
   obj.setPrototype(Js.getObjectPrototype(scope));
   obj.setParentScope(scope);
   if (sealed) {
     obj.sealObject();
   }
   Js.defineProperty(scope, "Math", obj, ScriptableObject.DONTENUM);
 }
Exemplo n.º 2
0
  // @Override
  public void onReady() {
    Js.alert(Browser.userAgent.var());

    final Button tb = new Button("THE BUTTON", "The Button1");
    tb.addListener(
        Click.class,
        new OnClick() {
          // @Override
          public void onEvent(Click evt) {
            Js.win().alert("Hello The Button1!");
          }
        });

    ClickMenu m1 = new ClickMenu("Menu01");
    m1.add(new ClickMenu("MenuItem11aaa"));
    m1.add(new ClickMenu("MenuItem12b"));
    m1.add(new ClickMenu("MenuItem13ccccc"));
    m1.add(new ClickMenu("MenuItem14"));
    ClickMenu m2 = new ClickMenu("Menu02");
    m2.add(new ClickMenu("MenuItem21"));
    ClickMenu m22 = new ClickMenu("Menu22");
    m22.add(new ClickMenu("MenuItem221"));
    m22.add(new ClickMenu("MenuItem222"));
    m22.add(new ClickMenu("MenuItem223"));
    m2.add(m22);
    m2.add(new ClickMenu("MenuItem23"));
    m2.add(new ClickMenu("MenuItem24"));
    ClickMenu m3 = new ClickMenu("Menu03");
    m3.add(new ClickMenu("MenuItem31"));
    m3.add(new ClickMenu("MenuItem32"));
    m3.add(new ClickMenu("MenuItem33"));
    m3.add(new ClickMenu("MenuItem34"));
    ClickMenu m4 = new ClickMenu("Menu04");
    m4.add(new ClickMenu("MenuItem41"));
    m4.add(new ClickMenu("MenuItem42"));
    m4.add(new ClickMenu("MenuItem43"));
    m4.add(new ClickMenu("MenuItem44"));
    m4.addListener(
        Click.class,
        new OnClick() {
          // @Override
          public void onEvent(Click arg0) {
            Js.alert("A menu clicked!");
          }
        });
    Viewport.get().add(new Vars<Widget>().add(tb).add(m1).add(m2).add(m3).add(m4).var());
  }