Example usage for org.apache.wicket.util.time Duration toString

List of usage examples for org.apache.wicket.util.time Duration toString

Introduction

In this page you can find the example usage for org.apache.wicket.util.time Duration toString.

Prototype

@Override
public String toString() 

Source Link

Document

Retrieves the String representation of this Duration in days, hours, minutes, seconds or milliseconds, as appropriate.

Usage

From source file:org.artifactory.webapp.wicket.page.build.tabs.BuildGeneralInfoTabPanel.java

License:Open Source License

/**
 * Adds the general information border/*w  w w.jav  a2 s.c om*/
 *
 * @param build Build object to display
 */
private void addInfoBorder(Build build) {
    FieldSetBorder infoBorder = new FieldSetBorder("infoBorder");
    add(infoBorder);

    addLabeledValue(infoBorder, "name", "Name", build.getName(), true);
    addLabeledValue(infoBorder, "number", "Number", build.getNumber(), true);

    Agent agent = build.getAgent();
    String agentName = null;
    if (agent != null) {
        agentName = agent.toString();
    }
    addLabeledValue(infoBorder, "agent", "Agent", agentName, true);
    BuildAgent buildAgent = build.getBuildAgent();
    String buildAgentName = (buildAgent != null) ? buildAgent.toString() : null;
    addLabeledValue(infoBorder, "buildAgent", "Build Agent", buildAgentName, true);
    addLabeledValue(infoBorder, "started", "Started", build.getStarted(), true);

    Duration duration = Duration.milliseconds(build.getDurationMillis());
    addLabeledValue(infoBorder, "duration", "Duration", duration.toString(), true);
    addLabeledValue(infoBorder, "principal", "Principal", build.getPrincipal(), true);
    addLabeledValue(infoBorder, "artifactoryPrincipal", "Artifactory Principal",
            build.getArtifactoryPrincipal(), true);
    infoBorder.add(new Label("urlLabel", "URL:"));

    String url = build.getUrl();
    if (url == null) {
        url = "";
    }
    infoBorder.add(new ExternalLink("url", url, url));
    addLabeledValue(infoBorder, "parentBuildId", "Parent Build ID", build.getParentBuildId(),
            StringUtils.isNotBlank(build.getParentBuildId()));
    addLabeledValue(infoBorder, "parentBuildName", "Parent Build Name", build.getParentName(),
            StringUtils.isNotBlank(build.getParentName()));
    addLabeledValue(infoBorder, "parentBuildNumber", "Parent Build Number", build.getParentNumber(),
            StringUtils.isNotBlank(build.getParentNumber()));

    addIssueTrackerInformation(infoBorder, build.getIssues());

    addBintrayButton(infoBorder, build);
}