Package org.apache.wicket.markup.html

Examples of org.apache.wicket.markup.html.IHeaderResponse


   *
   * @return new header response
   */
  protected IHeaderResponse newHeaderResponse()
  {
    IHeaderResponse headerResponse = RequestContext.get().getHeaderResponse();
    if (headerResponse == null)
    {
      // no (portlet) headerResponse override, create a default one
      headerResponse = new HeaderResponse()
      {
View Full Code Here


      if (log.isDebugEnabled())
      {
        log.debug("renderHead: " + toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        // Make sure the markup source strategy contributes to the header first
        // to be backward compatible. WICKET-3761
        getMarkupSourcingStrategy().renderHead(this, container);

        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            response.markRendered(behavior);
          }
        }
      }
    }
  }
View Full Code Here

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: " + toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        // Make sure the markup source strategy contributes to the header first
        // to be backward compatible. WICKET-3761
        getMarkupSourcingStrategy().renderHead(this, container);

        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            response.markRendered(behavior);
          }
        }
      }
    }
  }
View Full Code Here

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: " + toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        // Let the component contribute something to the header
        renderHead(response);

        // Make sure the markup source strategy has been considered as well.
        getMarkupSourcingStrategy().renderHead(this, container);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            response.markRendered(behavior);
          }
        }
      }
    }
  }
View Full Code Here

  @Override
  public void renderHead(HtmlHeaderContainer container) {
    super.renderHead(container);
    JQueryCssResourceReference[] cssResources = getCssResources();
    if (cssResources!= null) {
      IHeaderResponse headerResponse = container.getHeaderResponse();
      for (JQueryCssResourceReference cssResource : cssResources)
        headerResponse.renderCSSReference(cssResource);
    }
  }
View Full Code Here

        this.inputLength = inputLength;
    }

    @Override
    public void renderHead(HtmlHeaderContainer container) {
        IHeaderResponse response = container.getHeaderResponse();

        // shouldn't be using MarkupAttributes as it's an internal method, but
        // have to, no other way to
        // find out if the user put an id attribute on the tag,
        // getMarkupId(false) should tell us, but it doens't
        // at this stage in rendering it seems
        String tmpId = this.getMarkupAttributes().getString("id");
        // if they haven't set the id on the component tag, we'll set one for
        // them
        if (Strings.isEmpty(tmpId)) {
            this.setOutputMarkupId(true);
            tmpId = this.getMarkupId(true);
        }
        final String id = tmpId;

        // add prototype
        response.renderJavascriptReference(PrototypeResourceReference.INSTANCE);
        // add this components javascript
        response.renderJavascriptReference(new ResourceReference(this.getClass(), "res/scripts/tag.js"));
        // add component css
        if (properties.isBrowserInternetExplorer()) {
            response.renderCSSReference(new ResourceReference(this.getClass(), "res/stylesheets/tag-ie.css"));
        } else if (properties.isBrowserSafari()) {
            response.renderCSSReference(new ResourceReference(this.getClass(), "res/stylesheets/tag-webkit.css"));
        } else {
            response.renderCSSReference(new ResourceReference(this.getClass(), "res/stylesheets/tag-moz.css"));
        }

        // render the javascript to setup the component
        IModel variablesModel = new AbstractReadOnlyModel() {
            public Map getObject() {
                Map<String, CharSequence> variables = new HashMap<String, CharSequence>(2);
                variables.put("id", id);
                StringBuffer arr = new StringBuffer();
                // join our collection into a comma delimeted string
                Collection<T> model = (Collection<T>) MultiTextInput.this.getInnermostModel().getObject();
                if (model != null) {
                    Iterator<?> iter = model.iterator();
                    while (iter.hasNext()) {
                        arr.append('\'');
                        // looks like a weird substitution, but regexp in java
                        // ftl.
                        arr.append(iter.next().toString().replaceAll("'", "\\\\'").replaceAll("\"", "\\\\\""));
                        arr.append('\'');
                        if (iter.hasNext()) {
                            arr.append(',');
                        }
                    }
                }
                variables.put("model", arr.toString());
                variables.put("length", String.valueOf(MultiTextInput.this.inputLength));
                return variables;
            }
        };
        // merge the javascript from the properties file with the properties we
        // set above
        String js = new StringBuffer().append(getString("javascript.tagEntry", variablesModel)).toString();
        response.renderOnDomReadyJavascript(js.toString());

        super.renderHead(container);
    }
View Full Code Here

  @Override
  public void renderHead(HtmlHeaderContainer container)
  {
    super.renderHead(container);

    IHeaderResponse headerResponse = container.getHeaderResponse();

    AppendingStringBuffer asb = new AppendingStringBuffer("var tog = document.getElementById('");
    asb.append(label.getMarkupId());
    asb.append("');\n");
    asb.append("var slide = document.getElementById('");
    asb.append(stretchPanel.getMarkupId());
    asb.append("');\n");

    asb.append("slideFunction = function(e, obj) {\n");
    asb.append("var att = {height: { to: " + expandedHeight + " }};\n");
    asb.append("if(this.style.height == '" + expandedHeight + "px') {\n");
    asb.append("att = {height: { to: " + collapsedHeight + " }};\n");
    asb.append("}\n");
    asb.append("var anim = new YAHOO.util.Anim(this, att, " + delay + ", " + easing.constant()
        + ");\n");
    asb.append("anim.animate();\n");
    asb.append("}\n");
    asb.append("YAHOO.util.Event.on(tog, 'click', slideFunction, slide, true);\n");
    int initialHeight = collapsedHeight;
    if (EXPANDED.equals(defaultState))
    {
      initialHeight = expandedHeight;
    }
    asb.append("var att = {height: { to: " + initialHeight + " }};\n");
    asb.append("var anim = new YAHOO.util.Anim(slide, att, " + delay + ", YAHOO.util.Easing."
        + easing + ");\n");
    asb.append("anim.animate();\n");

    headerResponse.renderOnDomReadyJavascript(asb.toString());

  }
View Full Code Here

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: " + toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        // Make sure the markup source strategy contributes to the header first
        // to be backward compatible. WICKET-3761
        getMarkupSourcingStrategy().renderHead(this, container);

        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            List<IClusterable> pair = Arrays.asList(this, behavior);
            response.markRendered(pair);
          }
        }
      }
    }
  }
View Full Code Here

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: " + toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        // Make sure the markup source strategy contributes to the header first
        // to be backward compatible. WICKET-3761
        getMarkupSourcingStrategy().renderHead(this, container);

        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            response.markRendered(behavior);
          }
        }
      }
    }
  }
View Full Code Here

   *
   * @return new header response
   */
  protected IHeaderResponse newHeaderResponse()
  {
    IHeaderResponse headerResponse = RequestContext.get().getHeaderResponse();
    if (headerResponse == null)
    {
      // no (portlet) headerResponse override, create a default one
      headerResponse = new HeaderResponse()
      {
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.IHeaderResponse

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.