Package org.apache.wicket.util.time

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


  /**
   * Tests timer behavior in a component added to an AjaxRequestTarget
   */
  public void testAddToAjaxUpdate()
  {
    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.
   */
  public void testAddToWebPage()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithOneComponent page = new MockPageWithOneComponent();
    Label label = new Label(MockPageWithOneComponent.COMPONENT_ID, "Hello");
    page.add(label);
    label.setOutputMarkupId(true);
View Full Code Here

   */
  public ModificationWatcher getResourceWatcher(boolean start)
  {
    if (resourceWatcher == null && start)
    {
      final Duration pollFrequency = getResourcePollFrequency();
      if (pollFrequency != null)
      {
        resourceWatcher = new ModificationWatcher(pollFrequency);
      }
    }
View Full Code Here

   */
  public ModificationWatcher getResourceWatcher(boolean start)
  {
    if (resourceWatcher == null && start)
    {
      final Duration pollFrequency = getResourcePollFrequency();
      if (pollFrequency != null)
      {
        resourceWatcher = new ModificationWatcher(pollFrequency);
      }
    }
View Full Code Here

        Boolean booleanValue = true;
        Integer integerValue = 42;
        Long longValue = integerValue * 1L;
        Double doubleValue = integerValue * 1.0D;
        Time timeValue = Time.milliseconds(System.currentTimeMillis());
        Duration durationValue = Duration.hours(1);

        boolean defBoolean = !booleanValue;
        int defInteger = 10101;
        long defLong = defInteger * 1L;
        double defDouble = defInteger * 1.0D;
        Time defTime = Time.milliseconds(System.currentTimeMillis());
        Duration defDuration = Duration.hours(42);

        vm.put("num", integerValue.toString());
        vm.put("num.bad", "xxx");
        vm.put("time", timeValue.toString());
        vm.put("time.bad", "xxx");
View Full Code Here

        long startTime = System.currentTimeMillis();

        // TODO For now only use the setting. Might be extended with
        // something overridable on request/ page/ request target level
        // later
        Duration timeout = Application.get().getRequestCycleSettings().getTimeout();

        PageMapsUsedInRequestEntry entry = pageMapsUsedInRequest.get(pageMap);

        // Get page entry for id and version
        Thread t = entry != null ? entry.thread : null;
        while (t != null && t != Thread.currentThread())
        {
          if (isCurrentRequestValid(entry.requestCycle) == false)
          {
            // we need to ignore this request. That's because it is
            // an ajax request
            // while regular page request is being processed
            throw new IgnoreAjaxRequestException();
          }

          try
          {
            pageMapsUsedInRequest.wait(timeout.getMilliseconds());
          }
          catch (InterruptedException ex)
          {
            throw new WicketRuntimeException(ex);
          }

          entry = pageMapsUsedInRequest.get(pageMap);
          t = entry != null ? entry.thread : null;

          if (t != null && t != Thread.currentThread() &&
            (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
          {
            AppendingStringBuffer asb = new AppendingStringBuffer(100);
            asb.append("After " + timeout + " the Pagemap " + pageMapName +
              " is still locked by: " + t +
              ", giving up trying to get the page for path: " + componentPath);
View Full Code Here

  /**
   * @see org.apache.wicket.jmx.ResourceSettingsMBean#getResourcePollFrequency()
   */
  public String getResourcePollFrequency()
  {
    Duration duration = application.getResourceSettings().getResourcePollFrequency();
    return (duration != null) ? duration.toString() : null;
  }
View Full Code Here

        long startTime = System.currentTimeMillis();

        // TODO For now only use the setting. Might be extended with
        // something overridable on request/ page/ request target level
        // later
        Duration timeout = Application.get().getRequestCycleSettings().getTimeout();

        PageMapsUsedInRequestEntry entry = pageMapsUsedInRequest.get(pageMap);

        // Get page entry for id and version
        Thread t = entry != null ? entry.thread : null;
        while (t != null && t != Thread.currentThread())
        {
          if (isCurrentRequestValid(entry.requestCycle) == false)
          {
            // we need to ignore this request. That's because it is
            // an ajax request
            // while regular page request is being processed
            throw new IgnoreAjaxRequestException();
          }

          try
          {
            pageMapsUsedInRequest.wait(timeout.getMilliseconds());
          }
          catch (InterruptedException ex)
          {
            throw new WicketRuntimeException(ex);
          }

          entry = pageMapsUsedInRequest.get(pageMap);
          t = entry != null ? entry.thread : null;

          if (t != null && t != Thread.currentThread() &&
            (startTime + timeout.getMilliseconds()) < System.currentTimeMillis())
          {
            AppendingStringBuffer asb = new AppendingStringBuffer(100);
            asb.append("After " + timeout + " the Pagemap " + pageMapName +
              " is still locked by: " + t +
              ", giving up trying to get the page for path: " + componentPath);
View Full Code Here

    Boolean booleanValue = true;
    Integer integerValue = 42;
    Long longValue = integerValue * 1L;
    Double doubleValue = integerValue * 1.0D;
    Time timeValue = Time.milliseconds(System.currentTimeMillis());
    Duration durationValue = Duration.hours(1);

    boolean defBoolean = !booleanValue;
    int defInteger = 10101;
    long defLong = defInteger * 1L;
    double defDouble = defInteger * 1.0D;
    Time defTime = Time.milliseconds(System.currentTimeMillis());
    Duration defDuration = Duration.hours(42);

    vm.put("num", integerValue.toString());
    vm.put("num.bad", "xxx");
    vm.put("time", timeValue.toString());
    vm.put("time.bad", "xxx");
View Full Code Here

  /**
   * Tests timer behavior in a component added to an AjaxRequestTarget
   */
  public void testAddToAjaxUpdate()
  {
    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

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.