Examples of DurationFormatter


Examples of com.ibm.icu.impl.duration.DurationFormatter

        {
            PeriodFormatterService pfs = BasicPeriodFormatterService.getInstance();
            PeriodBuilder pb = pfs.newPeriodBuilderFactory()
                .setAllowMilliseconds(false)
                .getSingleUnitBuilder();
            DurationFormatter df = pfs.newDurationFormatterFactory()
                .setPeriodBuilder(pb)
                .getFormatter();
            String result = df.formatDurationFromNow(500);
            assertEquals(
                "english test case",
                "less than 1 second from now",
                result);
          
        }
       
        // if the limit is set on milliseconds, and they are not supported,
        // use an effective limit based on seconds
        {
            PeriodFormatterService pfs = BasicPeriodFormatterService.getInstance();
            PeriodBuilder pb = pfs.newPeriodBuilderFactory()
                .setMinLimit(2500)
                .setAllowMilliseconds(false)
                .getSingleUnitBuilder();
            DurationFormatter df = pfs.newDurationFormatterFactory()
                .setPeriodBuilder(pb)
                .getFormatter();
            String result = df.formatDurationFromNow(500);
            assertEquals(
                "limit test case",
                "less than 2 seconds from now",
                result);
        }
View Full Code Here

Examples of com.iisigroup.cap.formatter.DurationFormatter

    Page<Map<String, Object>> page = batchSrv.findExecutionsPage(search);
    Map<String, IFormatter> fmt = new HashMap<String, IFormatter>();
    fmt.put("startDate", new ADDateFormatter());
    fmt.put("START_TIME", new ADDateTimeFormatter("HH:mm:ss"));
    fmt.put("duration", new DurationFormatter("START_TIME", "END_TIME",
        "HH:mm:ss.SSS"));
    return new MapGridResult(page.getContent(), page.getTotalRow(), fmt);
  }// ;
View Full Code Here

Examples of com.iisigroup.cap.formatter.DurationFormatter

    AjaxFormResult result = new AjaxFormResult();
    result.set("jobParams", jobParams);
    result.set("JOB_NAME", (String) map.get("JOB_NAME"));
    result.set("START_TIME",
        new ADDateTimeFormatter().reformat(map.get("START_TIME")));
    result.set("duration", new DurationFormatter("START_TIME", "END_TIME",
        "HH:mm:ss.SSS").reformat(map));
    result.set("jobStatus", (String) map.get("STATUS"));
    result.set("EXIT_CODE", (String) map.get("EXIT_CODE"));
    result.set("JOB_EXECUTION_ID",
        String.valueOf(map.get("JOB_EXECUTION_ID")));
View Full Code Here

Examples of com.iisigroup.cap.formatter.DurationFormatter

  @HandlerType(HandlerTypeEnum.GRID)
  public MapGridResult stepsQuery(ISearch search, IRequest request) {
    String executionId = request.get("jobExeId");
    List<Map<String, Object>> list = batchSrv.findSteps(executionId);
    Map<String, IFormatter> fmt = new HashMap<String, IFormatter>();
    fmt.put("duration", new DurationFormatter("START_TIME", "END_TIME",
        "HH:mm:ss.SSS"));
    return new MapGridResult(list, list.size(), fmt);
  }// ;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.