Package org.odlabs.wiquery.core.javascript

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


  @Test
  public void testInsertBefore()
  {
    String expectedJavascript = "$('div').insertBefore('<div>a<div>');";
    String generatedJavascript =
      new JsStatement().$(null, "div").chain(ManipulatingHelper.insertBefore("<div>a<div>"))
        .render().toString();

    log.info(expectedJavascript);
    log.info(generatedJavascript);
View Full Code Here


   * Test the javascript generation
   */
  @Test
  public void testJavascriptGeneration()
  {
    assertEquals(new JsStatement().$(null, "#aComponent").chain(new SlideDown()).render()
      .toString(), "$('#aComponent').slideDown();");
  }
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

      }
      js.append(");");
      super.setChangeEvent(JsScopeUiEvent.quickScope(js.toString()));
      super.setSelectEvent(JsScopeUiEvent.quickScope(js.append("$(event.target).blur();")
        .toString()));
      JsStatement jsStatement = super.statement();
      return jsStatement;
    }
View Full Code Here

      setContent(model.getObject());
    }
   
    if (options.isEmpty())
    {
      return new JsStatement().$(component).chain("tooltip");
    }
   
    if (options.containsKey("content") && !options.containsKey("items"))
    {
      setItems("#" + component.getMarkupId());
    }

    return new JsStatement().$(component).chain("tooltip", options.getJavaScriptOptions());
  }
View Full Code Here

   
    Label indexLabel = new Label("indexLabel");
    indexLabel.setOutputMarkupId(true);
    add(indexLabel);
   
    JsStatement getActiveStatement = new JsQuery(accordion).$().chain("accordion", "'option'", "'active'");
    CharSequence labelValue = "'Active is: ' + " + getActiveStatement.render(false);
    accordion.setActivateEvent(JsScopeUiEvent.quickScope(new JsQuery(indexLabel).$().chain("text", labelValue)));
  }
View Full Code Here

   * Default constructor
   */
  public WaitDialogStatements()
  {
    super();
    close = new JsStatement();
    open = new JsStatement();
  }
View Full Code Here

   *            Message
   * @return a {@link JsStatement}
   */
  public JsStatement errorDialog(String message)
  {
    JsStatement statement = new JsStatement();
    statement.append("$.ui.dialog.wiquery.errorDialog(");
    statement.append("" + Session.get().nextSequenceValue() + ", ");
    statement.append(DialogUtilsLanguages.getDialogUtilsLiteral(DialogUtilsLanguages
      .getDialogUtilsLanguages(getLocale())) + ", ");
    statement.append(JsUtils.doubleQuotes(message, true) + ", ");
    statement.append(JsUtils.quotes(RequestCycle.get().urlFor(CANCEL_IMG, null)) + ")");

    return statement;
  }
View Full Code Here

   *            Message
   * @return a {@link JsStatement}
   */
  public JsStatement questionDialog(String message)
  {
    JsStatement statement = new JsStatement();
    statement.append("$.ui.dialog.wiquery.questionDialog(");
    statement.append("" + Session.get().nextSequenceValue() + ", ");
    statement.append(DialogUtilsLanguages.getDialogUtilsLiteral(DialogUtilsLanguages
      .getDialogUtilsLanguages(getLocale())) + ", ");
    statement.append(JsUtils.doubleQuotes(message, true) + ", ");
    statement.append(JsUtils.quotes(RequestCycle.get().urlFor(QUESTION_IMG, null)) + ")");

    return statement;
  }
View Full Code Here

   *            Message
   * @return the required {@link JsStatement}
   */
  public JsStatement simpleDialog(String title, String message)
  {
    JsStatement statement = new JsStatement();
    statement.append("$.ui.dialog.wiquery.simpleDialog(");
    statement.append("" + Session.get().nextSequenceValue() + ", ");
    statement.append(DialogUtilsLanguages.getDialogUtilsLiteral(DialogUtilsLanguages
      .getDialogUtilsLanguages(getLocale())) + ", ");
    statement.append(JsUtils.quotes(title, true) + ", ");
    statement.append(JsUtils.doubleQuotes(message, true) + ")");

    return statement;
  }
View Full Code Here

TOP

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

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.