Package org.apache.wicket.ajax.attributes

Examples of org.apache.wicket.ajax.attributes.AjaxCallListener


   *
   * @param attributes
   */
  private void updateAjaxAttributesBackwardCompatibility(final AjaxRequestAttributes attributes)
  {
    AjaxCallListener backwardCompatibleAjaxCallListener = new AjaxCallListener();
    backwardCompatibleAjaxCallListener.onSuccess(getSuccessScript());
    backwardCompatibleAjaxCallListener.onFailure(getFailureScript());
    backwardCompatibleAjaxCallListener.onPrecondition(getPreconditionScript());
    attributes.getAjaxCallListeners().add(backwardCompatibleAjaxCallListener);

    AjaxChannel channel = getChannel();
    if (channel != null)
    {
View Full Code Here


        CharSequence precondition = "var kc=Wicket.Event.keyCode(attrs.event),"
          + "evtType=attrs.event.type,"
          + "ret=false;"
          + "if (evtType==='blur' || (evtType==='keyup' && kc===27) || (evtType==='keydown' && kc===13)) {attrs.event.preventDefault(); ret = true;}"
          + "return ret;";
        AjaxCallListener ajaxCallListener = new AjaxCallListener();
        ajaxCallListener.onPrecondition(precondition);

        CharSequence dynamicExtraParameters = "var result = [],"
          + "evtType=attrs.event.type;"
          + "if (evtType === 'keyup') { result.push( { name: 'save', value: false } ); }"
          + "else { result = Wicket.Form.serializeElement(attrs.c); result.push( { name: 'save', value: true } ); }"
View Full Code Here

                if (reportlets.getModelObject() != null) {

                    super.updateAjaxAttributes(attributes);

                    final AjaxCallListener ajaxCallListener = new AjaxCallListener() {

                        private static final long serialVersionUID = 7160235486520935153L;

                        @Override
                        public CharSequence getPrecondition(final Component component) {
View Full Code Here

    @Override
    protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
        super.updateAjaxAttributes(attributes);

        final AjaxCallListener ajaxCallListener = new AjaxCallListener() {

            private static final long serialVersionUID = 7160235486520935153L;

            @Override
            public CharSequence getPrecondition(final Component component) {
View Full Code Here

            @Override
            protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
                super.updateAjaxAttributes(attributes);

                final AjaxCallListener ajaxCallListener = new AjaxCallListener() {

                    private static final long serialVersionUID = 7160235486520935153L;

                    @Override
                    public CharSequence getPrecondition(final Component component) {
View Full Code Here

   *
   * @param attributes
   */
  private void updateAjaxAttributesBackwardCompatibility(final AjaxRequestAttributes attributes)
  {
    AjaxCallListener backwardCompatibleAjaxCallListener = new AjaxCallListener();
    backwardCompatibleAjaxCallListener.onSuccess(getSuccessScript());
    backwardCompatibleAjaxCallListener.onFailure(getFailureScript());
    backwardCompatibleAjaxCallListener.onPrecondition(getPreconditionScript());
    attributes.getAjaxCallListeners().add(backwardCompatibleAjaxCallListener);

    AjaxChannel channel = getChannel();
    if (channel != null)
    {
View Full Code Here

  @Test
  public void renderAjaxAttributes()
  {
    AjaxRequestAttributes attributes = new AjaxRequestAttributes();

    AjaxCallListener listener = new AjaxCallListener();
    listener.onPrecondition("return somePrecondition();");
    listener.onBefore("alert('Before!');");
    listener.onAfter("alert('After!');");
    listener.onSuccess("alert('Success!');");
    listener.onFailure("alert('Failure!');");
    listener.onComplete("alert('Complete!');");
    attributes.getAjaxCallListeners().add(listener);

    Component component = Mockito.mock(Component.class);
    AbstractDefaultAjaxBehavior behavior = new AbstractDefaultAjaxBehavior()
    {
View Full Code Here

        CharSequence precondition = "var kc=Wicket.Event.keyCode(attrs.event),"
          + "evtType=attrs.event.type,"
          + "ret=false;"
          + "if (evtType==='blur' || (evtType==='keyup' && kc===27) || (evtType==='keydown' && kc===13)) {attrs.event.preventDefault(); ret = true;}"
          + "return ret;";
        AjaxCallListener ajaxCallListener = new AjaxCallListener();
        ajaxCallListener.onPrecondition(precondition);

        CharSequence dynamicExtraParameters = "var result,"
          + "evtType=attrs.event.type;"
          + "if (evtType === 'keyup') { result = { 'save': false }; }"
          + "else { result = { 'save': true }; }"
View Full Code Here

  @Test
  public void renderAjaxAttributes()
  {
    AjaxRequestAttributes attributes = new AjaxRequestAttributes();

    AjaxCallListener listener = new AjaxCallListener();
    listener.onPrecondition("return somePrecondition();");
    listener.onBefore("alert('Before!');");
    listener.onAfter("alert('After!');");
    listener.onSuccess("alert('Success!');");
    listener.onFailure("alert('Failure!');");
    listener.onComplete("alert('Complete!');");
    attributes.getAjaxCallListeners().add(listener);

    Component component = Mockito.mock(Component.class);
    AbstractDefaultAjaxBehavior behavior = new AbstractDefaultAjaxBehavior()
    {
View Full Code Here

  @Override
  protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
  {
    super.updateAjaxAttributes(attributes);

    attributes.getAjaxCallListeners().add(new AjaxCallListener()
    {
      private static final long serialVersionUID = 1L;

      @Override
      public CharSequence getPrecondition(Component component)
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.attributes.AjaxCallListener

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.