Package org.apache.wicket.util.time

Examples of org.apache.wicket.util.time.Duration


    private static final long serialVersionUID = 1L;

    @Override
    protected PageAccessSynchronizer createInstance()
    {
      final Duration timeout;
      if (Application.exists())
      {
        timeout = Application.get().getRequestCycleSettings().getTimeout();
      }
      else
View Full Code Here


      if (attributes.isAllowDefault())
      {
        attributesJson.put("ad", true);
      }

      Duration requestTimeout = attributes.getRequestTimeout();
      if (requestTimeout != null)
      {
        attributesJson.put("rt", requestTimeout.getMilliseconds());
      }

      boolean wicketAjaxResponse = attributes.isWicketAjaxResponse();
      if (wicketAjaxResponse == false)
      {
View Full Code Here

    {
      resource.setContentDisposition(Strings.isEmpty(fileName) ? ContentDisposition.INLINE
          : ContentDisposition.ATTACHMENT);
    }

    final Duration cacheDuration = getCacheDuration();
    if (cacheDuration != null)
    {
      resource.setCacheDuration(cacheDuration);
    }
  }
View Full Code Here

      if (attributes.isAllowDefault())
      {
        attributesJson.put("ad", true);
      }

      Duration requestTimeout = attributes.getRequestTimeout();
      if (requestTimeout != null)
      {
        attributesJson.put("rt", requestTimeout.getMilliseconds());
      }

      boolean wicketAjaxResponse = attributes.isWicketAjaxResponse();
      if (wicketAjaxResponse == false)
      {
View Full Code Here

   * Tests timer behavior in a component added to an AjaxRequestTarget
   */
  @Test
  public void addToAjaxUpdate()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();

    page.add(new WebComponent(MockPageWithLinkAndComponent.COMPONENT_ID).setOutputMarkupId(true));

View Full Code Here

   * tests timer behavior in a WebPage.
   */
  @Test
  public void addToWebPage()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new Link<Void>(MockPageWithLinkAndComponent.LINK_ID)
View Full Code Here

     * @see IResourceSettings#setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
     * @see IResourceSettings#getDefaultCacheDuration()
     */
    public Duration getCacheDuration()
    {
      Duration duration = cacheDuration;
      if (duration == null && Application.exists())
      {
        duration = Application.get().getResourceSettings().getDefaultCacheDuration();
      }

View Full Code Here

  {
    Response response = attributes.getResponse();

    if (response instanceof WebResponse)
    {
      Duration duration = data.getCacheDuration();
      WebResponse webResponse = (WebResponse)response;
      if (duration.compareTo(Duration.NONE) > 0)
      {
        webResponse.enableCaching(duration, data.getCacheScope());
      }
      else
      {
View Full Code Here

    @Override
    public Collection<Event> getEvents(DateTime start, DateTime end) {
      events.clear();
      SecureRandom random = new SecureRandom();

      Duration duration = Duration.valueOf(end.getMillis()
          - start.getMillis());

      for (int j = 0; j < 1; j++) {
        for (int i = 0; i < duration.days() + 1; i++) {
          DateTime calendar = start;
          calendar = calendar.plusDays(i).withHourOfDay(
              6 + random.nextInt(10));

          Event event = new Event();
          int id = (int) (j * duration.days() + i);
          event.setId("" + id);
          event.setTitle(title + (1 + i));
          event.setStart(calendar);
          calendar = calendar.plusHours(random.nextInt(8));
          event.setEnd(calendar);
View Full Code Here

    private static final long serialVersionUID = 1L;

    @Override
    protected PageAccessSynchronizer createInstance()
    {
      final Duration timeout;
      if (Application.exists())
      {
        timeout = Application.get().getRequestCycleSettings().getTimeout();
      }
      else
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.time.Duration

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.