Package org.apache.wicket

Examples of org.apache.wicket.Page


    // component's markup in a manner safe for transport inside CDATA block
    encodingBodyResponse.reset();
    RequestCycle.get().setResponse(encodingBodyResponse);

    // Initialize temporary variables
    final Page page = component.findParent(Page.class);
    if (page == null)
    {
      // dont throw an exception but just ignore this component, somehow
      // it got removed from the page.
      LOG.debug("component: " + component + " with markupid: " + markupId +
          " not rendered because it was already removed from page");
      return;
    }

    page.startComponentRender(component);

    try
    {
      component.prepareForRender();

      // render any associated headers of the component
      writeHeaderContribution(response, component);
    }
    catch (RuntimeException e)
    {
      try
      {
        component.afterRender();
      }
      catch (RuntimeException e2)
      {
        // ignore this one could be a result off.
      }
      // Restore original response
      RequestCycle.get().setResponse(response);
      encodingBodyResponse.reset();
      throw e;
    }

    try
    {
      component.render();
    }
    catch (RuntimeException e)
    {
      RequestCycle.get().setResponse(response);
      encodingBodyResponse.reset();
      throw e;
    }

    page.endComponentRender(component);

    // Restore original response
    RequestCycle.get().setResponse(response);

    response.write("<component id=\"");
View Full Code Here


  {
    Iterator<Component> iterator = markupIdToComponent.values().iterator();
    while (iterator.hasNext())
    {
      final Component component = iterator.next();
      final Page parentPage = component.findParent(Page.class);
      if (parentPage != null)
      {
        parentPage.detach();
        break;
      }
    }
  }
View Full Code Here

    // create the htmlheadercontainer if needed
    if (header == null)
    {
      header = new AjaxHtmlHeaderContainer(this);
      final Page parentPage = component.getPage();
      parentPage.addOrReplace(header);
    }

    RequestCycle requestCycle = component.getRequestCycle();

    // save old response, set new
View Full Code Here

      appendAssignment(buffer, "settings.heightUnit", getHeightUnit());
    }

    if (isCustomComponent() == false)
    {
      Page page = createPage();
      if (page == null)
      {
        throw new WicketRuntimeException("Error creating page for modal dialog.");
      }
      CharSequence pageUrl;
      RequestCycle requestCycle = RequestCycle.get();

      if (page.isPageStateless())
      {
        pageUrl = requestCycle.urlFor(page.getClass(), page.getPageParameters());
      }
      else
      {
        IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
        pageUrl = requestCycle.urlFor(handler);
View Full Code Here

  }

  @Override
  public void respond(IRequestCycle requestCycle)
  {
    Page page = (Page)Application.get().getMapperContext().getPageInstance(pageKey.getPageId());
    AjaxRequestTarget target = WebApplication.get().newAjaxRequestTarget(page);
    executeHandlers(target, page);
  }
View Full Code Here

    }

    component.setOutputMarkupId(true);

    // Initialize temporary variables
    final Page page = component.findParent(Page.class);
    if (page == null)
    {
      // dont throw an exception but just ignore this component, somehow
      // it got removed from the page.
      LOG.warn("Component '{}' with markupid: '{}' not rendered because it was already removed from page",
          component, markupId);
      return;
    }

    // substitute our encoding response for the old one so we can capture
    // component's markup in a manner safe for transport inside CDATA block
    Response oldResponse = RequestCycle.get().setResponse(encodingBodyResponse);

    try
    {
      encodingBodyResponse.reset();
     
      page.startComponentRender(component);

      try
      {
        component.prepareForRender();

        // render any associated headers of the component
        writeHeaderContribution(response, component);
      }
      catch (RuntimeException e)
      {
        try
        {
          component.afterRender();
        }
        catch (RuntimeException e2)
        {
          // ignore this one could be a result off.
        }
        encodingBodyResponse.reset();
        throw e;
      }

      try
      {
        component.render();
      }
      catch (RuntimeException e)
      {
        encodingBodyResponse.reset();
        throw e;
      }

      page.endComponentRender(component);
    }
    finally
    {
      // Restore original response
      RequestCycle.get().setResponse(oldResponse);
View Full Code Here

    @Override
    public IRequestHandler onException(final RequestCycle cycle, final Exception e) {

        LOG.error("Exception found", e);

        final Page errorPage;
        PageParameters errorParameters = new PageParameters();
        errorParameters.add("errorTitle", new StringResourceModel("alert", null).getString());

        if (e instanceof UnauthorizedInstantiationException) {
            errorParameters.add("errorMessage", new StringResourceModel("unauthorizedInstantiationException", null)
View Full Code Here

  {
    Iterator<Component> iterator = markupIdToComponent.values().iterator();
    while (iterator.hasNext())
    {
      final Component component = iterator.next();
      final Page parentPage = component.findParent(Page.class);
      if (parentPage != null)
      {
        parentPage.detach();
        break;
      }
    }
  }
View Full Code Here

    // create the htmlheadercontainer if needed
    if (header == null)
    {
      header = new AjaxHtmlHeaderContainer(this);
      final Page parentPage = component.getPage();
      parentPage.addOrReplace(header);
    }

    RequestCycle requestCycle = component.getRequestCycle();

    // save old response, set new
View Full Code Here

    IMarkupFragment pageMarkup)
  {
    Args.notNull(component, "component");

    // Create a page object and assign the markup
    Page page = createPage();
    if (page == null)
    {
      fail("The automatically created page should not be null.");
    }

    // Automatically create the page markup if not provided
    if (pageMarkup == null)
    {
      String markup = createPageMarkup(component.getId());
      if (markup == null)
      {
        fail("The markup for the automatically created page should not be null.");
      }

      try
      {
        // set a ContainerInfo to be able to use HtmlHeaderContainer so header contribution
        // still work. WICKET-3700
        ContainerInfo containerInfo = new ContainerInfo(page);
        MarkupResourceStream markupResourceStream = new MarkupResourceStream(
          new StringResourceStream(markup), containerInfo, page.getClass());

        MarkupParser markupParser = getApplication().getMarkupSettings()
          .getMarkupFactory()
          .newMarkupParser(markupResourceStream);
        pageMarkup = markupParser.parse();
      }
      catch (Exception e)
      {
        fail("Error while parsing the markup for the autogenerated page: " + e.getMessage());
      }
    }
    page.setMarkup(pageMarkup);

    // Add the child component
    page.add(component);

    // Preserve 'componentInPage' because #startPage() needs to null-fy it
    ComponentInPage oldComponentInPage = componentInPage;

    // Process the page
View Full Code Here

TOP

Related Classes of org.apache.wicket.Page

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.