Package org.odlabs.wiquery.core.javascript

Examples of org.odlabs.wiquery.core.javascript.JsQuery


   *
   * @return the associated JsStatement
   */
  public JsStatement enable()
  {
    return new JsQuery(getComponent()).$().chain("button", "'enable'");
  }
View Full Code Here


   *
   * @return a non null {@link JsStatement}.
   */
  public JsStatement refresh()
  {
    return new JsQuery(getComponent()).$().chain("button", "'refresh'");
  }
View Full Code Here

   *
   * @return the associated JsStatement
   */
  public JsStatement widget()
  {
    return new JsQuery(getComponent()).$().chain("button", "'widget'");
  }
View Full Code Here

   * @return the JsStatement
   */
  public static JsStatement hover(Component component)
  {
    component.setOutputMarkupId(true);
    return new JsQuery(component).$().chain("hover",
      "function() { $(this).addClass('ui-state-hover'); }",
      "function() { $(this).removeClass('ui-state-hover'); }");
  }
View Full Code Here

  protected static final Logger log = LoggerFactory.getLogger(JSQueryTestCase.class);

  @Test
  public void testJSQuerySyntax()
  {
    JsQuery jsq = new JsQuery();
    JsStatement jst = jsq.$(".sample").chain("css", "'foo'", "'bar'");
    String expected = "$('.sample').css('foo', 'bar');";
    String generated = jst.render().toString();
    log.info(expected);
    log.info(generated);
    assertEquals(generated, expected);

    jsq = new JsQuery();
    expected = "$('.sample').ready(function() {\n\talert('foo');\n\talert('bar');\n});";
    jst = jsq.$(".sample").ready(new JsScope()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void execute(JsScopeContext scopeContext)
      {
        scopeContext.append("alert('foo')");
        scopeContext.append("alert('bar')");
      }

    });
    generated = jst.render().toString();
    log.info(expected);
    log.info(generated);
    assertEquals(generated, expected);

    expected =
      "$('.sample').each(function() {\n" + "\t$(this).css('foo');\n"
        + "\t$(this).css('bar');\n" + "});";

    jsq = new JsQuery();
    jst = jsq.$(".sample").each(new JsScope()
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void execute(JsScopeContext scopeContext)
      {
        scopeContext.self().chain("css", "'foo'");
        scopeContext.self().chain("css", "'bar'");
      }

    });
    generated = jst.render().toString();
    log.info(expected);
    log.info(generated);
    assertEquals(generated, expected);

    // statements chaining
    jsq = new JsQuery();
    jsq.$(".foo").chain("css", "bar");
    JsStatement jss = new JsStatement();
    jss.append(jsq.getStatement().render());
    log.info(jss.render().toString());
  }
View Full Code Here

  @Override
  public CharSequence renderOption(String name, Object value, boolean isLast)
  {
    JsStatement jsStatement =
      new JsQuery(this.component).$().chain(this.statement, "'option'", "'" + name + "'",
        value.toString());
    return jsStatement.render();
  }
View Full Code Here

    return options;
  }
 
  public JsStatement statement()
  {
    return new JsQuery(this).$().chain("dialog", options.getJavaScriptOptions());
  }
View Full Code Here

   *
   * @return the associated JsStatement
   */
  public JsStatement open()
  {
    return new JsQuery(this).$().chain("dialog", "'open'");
  }
View Full Code Here

   *
   * @return the associated JsStatement
   */
  public JsStatement close()
  {
    return new JsQuery(this).$().chain("dialog", "'close'");
  }
View Full Code Here

   *
   * @return the associated JsStatement
   */
  public JsStatement destroy()
  {
    return new JsQuery(this).$().chain("dialog", "'destroy'");
  }
View Full Code Here

TOP

Related Classes of org.odlabs.wiquery.core.javascript.JsQuery

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.