Package com.chap.links.client

Examples of com.chap.links.client.DataTable$Action


  public void onModuleLoad() {
    // Create a callback to be called when the visualization API
    // has been loaded.
    Runnable onLoadCallback = new Runnable() {
      public void run() {
        DataTable dataTable = new DataTable () {
          @Override
          public void onEvent(String event, JavaScriptObject items) {
            JSONArray jsonItems = new JSONArray(items);
            System.out.println("event=" + event +
                ", items=" + jsonItems.toString());
          }
        };

        for (int i = 0; i < 100; i++) {
          dataTable.setField(i, "name", "Truck " + i);
          dataTable.setField(i, "capacity", 100 * Math.round(Math.random() * 20));
          dataTable.setField(i, "store", (Math.random() > 0.1) ? "main" : "spare");

          Action action = new Action("edit");
          dataTable.addAction(i, action);
          action = new Action("delete");
          dataTable.addAction(i, action);

          DataTable childTable = new DataTable();
          for (int j = 0; j < 5; j++) {
            String priority = Math.random() > 0.2 ? "normal" : "high";
            childTable.setField(j, "name", "Item " + j);
            childTable.setField(j, "priority", priority);
          }
          dataTable.setChilds(i, childTable);
        }
       
        // set options (optional)
View Full Code Here


          data.set(i, item);
        }
        //*/
       
        //*
        DataTable data = new DataTable () {
          @Override
          public void onEvent(String event, JavaScriptObject items) {
            JSONArray jsonItems = new JSONArray(items);
            System.out.println("event=" + event +
                ", items=" + jsonItems.toString());
          }
        };

        for (int i = 0; i < 100; i++) {
          data.setField(i, "name", "Truck " + i);
          data.setField(i, "capacity", 100 * Math.round(Math.random() * 20));
          data.setField(i, "store", (Math.random() > 0.1) ? "main" : "spare");

          DataTable.Action action = new DataTable.Action("edit");
          data.addAction(i, action);
          action = new DataTable.Action("delete");
          data.addAction(i, action);

          DataTable childTable = new DataTable();
          for (int j = 0; j < 5; j++) {
            String priority = Math.random() > 0.2 ? "normal" : "high";
            childTable.setField(j, "name", "Item " + j);
            childTable.setField(j, "priority", priority);
          }
          data.setChilds(i, childTable);
        }
        //*/

 
View Full Code Here

    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(sb.toString(), "");
    parameters.put("huuhaa", "");

    Action action = new SimpleAction();
    parametersInterceptor.setParameters(action, stack, parameters);
    assertEquals(1, actual.size());
  }
View Full Code Here

    public void testNoParametersAction() throws Exception {
        ParametersInterceptor interceptor = new ParametersInterceptor();
        interceptor.init();

        MockActionInvocation mai = new MockActionInvocation();
        Action action = new NoParametersAction();
        mai.setAction(action);

        interceptor.doIntercept(mai);
        interceptor.destroy();
    }
View Full Code Here

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("user.address.city", "London");
        parameters.put("user.name", "Superman");

        Action action = new SimpleAction();
        pi.setParameters(action, stack, parameters);

        assertEquals("ordered should be false by default", false, pi.isOrdered());
        assertEquals(2, actual.size());
        assertEquals("London", actual.get("user.address.city"));
View Full Code Here

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("user.address.city", "London");
        parameters.put("user.address['postal']", "QJR387");
        parameters.put("user.name", "Superman");

        Action action = new SimpleAction();
        pi.setParameters(action, stack, parameters);

        assertEquals(true, pi.isOrdered());
        assertEquals(3, actual.size());
        assertEquals("London", actual.get("user.address.city"));
View Full Code Here

        sac.registerSingleton("proxyFactory", BeanNameAutoProxyCreator.class, values);

        sac.refresh();

        ActionConfig actionConfig = new ActionConfig.Builder("", "", SimpleAction.class.getName()).build();
        Action action = (Action) objectFactory.buildBean(actionConfig.getClassName(), null);

        assertNotNull("Bean should not be null", action);
        System.out.println("Action class is: " + action.getClass().getName());
        assertTrue("Action should have been advised", action instanceof Advised);
    }
View Full Code Here

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put(sb.toString(), "");
        parameters.put("huuhaa", "");

        Action action = new SimpleAction();
        parametersInterceptor.setParameters(action, stack, parameters);
        assertEquals(1, actual.size());
    }
View Full Code Here

    public void testNoParametersAction() throws Exception {
        ParametersInterceptor interceptor = new ParametersInterceptor();
        interceptor.init();

        MockActionInvocation mai = new MockActionInvocation();
        Action action = new NoParametersAction();
        mai.setAction(action);

        interceptor.doIntercept(mai);
        interceptor.destroy();
    }
View Full Code Here

        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("user.address.city", "London");
        parameters.put("user.name", "Superman");

        Action action = new SimpleAction();
        pi.setParameters(action, stack, parameters);

        assertEquals("ordered should be false by default", false, pi.isOrdered());
        assertEquals(2, actual.size());
        assertEquals("London", actual.get("user.address.city"));
View Full Code Here

TOP

Related Classes of com.chap.links.client.DataTable$Action

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.