Example usage for org.apache.wicket.util.string StringValue toString

List of usage examples for org.apache.wicket.util.string StringValue toString

Introduction

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

Prototype

@Override
public final String toString() 

Source Link

Usage

From source file:de.dennishoersch.web.wicket.pages.BookmarkablePage.java

License:Apache License

private Component createLabel(String labelId, PageParameters parameters) {
    if (parameters != null) {
        StringValue value = parameters.get("parameter1");
        if (!Strings.isNullOrEmpty(value.toString())) {
            return new Label(labelId, "Ich habe den Parameter '" + value.toString() + "'!!");
        }//from  w ww  .j a  v  a  2  s  . c  o  m
    }
    return Components.invisible(labelId);
}

From source file:de.heartbeat.backend.GraphPage.java

License:Apache License

public GraphPage(final PageParameters parameters) {
    StringValue appview = parameters.get("appview");
    if (!appview.isEmpty()) {
        if (valueOf(appview).equals("true")) {
            isAppview = Boolean.parseBoolean(appview.toString());
        }// w  w  w  .ja va  2 s .c  o  m
    }

    StringValue imageview = parameters.get("imageview");
    if (!imageview.isEmpty()) {
        if (valueOf(imageview).equals("true")) {
            isImage = Boolean.parseBoolean(imageview.toString());
            parameters.remove("imageview", "true");
        }
    }

    WebMarkupContainer imageMenu = new WebMarkupContainer("imageMenu");
    Link liveChart2 = new Link("liveChart2") {
        @Override
        public void onClick() {
            setResponsePage(new SprideChart(parameters));
        }
    };
    Link average2 = new Link("averageChart2") {
        @Override
        public void onClick() {
            setResponsePage(new AverageLineChart(parameters));
        }
    };

    Link year2 = new Link("yearChart2") {
        @Override
        public void onClick() {
            setResponsePage(new YearOverview(parameters));
        }
    };

    imageMenu.add(liveChart2);
    imageMenu.add(average2);
    imageMenu.add(year2);

    WebMarkupContainer menu = new WebMarkupContainer("menu");
    WebMarkupContainer adminMenu = new WebMarkupContainer("adminMenu");
    Link addUser = new Link("addUser") {
        @Override
        public void onClick() {
            setResponsePage(UserForm.class);
        }
    };

    Link user = new Link("userOverview") {
        @Override
        public void onClick() {
            setResponsePage(UserView.class);
        }
    };
    Link overview = new Link("overview") {
        @Override
        public void onClick() {
            setResponsePage(HeartBeatOverview.class);
        }
    };

    adminMenu.add(addUser);
    adminMenu.add(user);
    adminMenu.add(overview);

    WebMarkupContainer graphMenu = new WebMarkupContainer("graphMenu");
    WebMarkupContainer container = new WebMarkupContainer("container");
    Link liveChart = new Link("liveChart") {
        @Override
        public void onClick() {
            setResponsePage(new SprideChart(parameters));
        }
    };
    Link average = new Link("averageChart") {
        @Override
        public void onClick() {
            setResponsePage(new AverageLineChart(parameters));
        }
    };
    Link year = new Link("yearChart") {
        @Override
        public void onClick() {
            setResponsePage(new YearOverview(parameters));
        }
    };

    adminMenu.setVisible(!isAppview);
    graphMenu.add(average);
    graphMenu.add(liveChart);
    graphMenu.add(year);
    menu.add(graphMenu);
    menu.add(adminMenu);
    imageMenu.setVisible(isImage);
    container.add(imageMenu);
    container.add(new FeedbackPanel("feedback"));
    container.add(menu);
    add(container);
}

From source file:de.heartbeat.charts.AverageLineChart.java

License:Apache License

public AverageLineChart(PageParameters parameters) {
    super(parameters);
    StringValue deviceId = parameters.get("deviceId");
    Person person;//  w w  w.  ja  va2 s.  co  m
    Session session = sessionFactory.openSession();
    session.beginTransaction();
    person = (Person) session.createCriteria(Person.class)
            .add(Restrictions.like("deviceID", deviceId.toString())).uniqueResult();
    heartBeatList = person.getHeartbeats();
    session.getTransaction().commit();
    session.close();
    Collections.sort(heartBeatList);
    Options options = new Options();
    options.setTitle(new Title("Overview"));

    ChartOptions chartOptions = new ChartOptions();
    chartOptions.setType(SeriesType.COLUMN);
    chartOptions.setMarginRight(130);
    chartOptions.setMarginBottom(25);
    options.setChartOptions(chartOptions);

    List<PlotBand> plotBands = new ArrayList<>();
    plotBands.add(createPlotBand("HIGH", 120, 10000, true));
    plotBands.add(createPlotBand("NORMAL", 45, 120, false));
    plotBands.add(createPlotBand("LOW", 0, 45, true));

    Title title = new Title("Average Pulse");
    title.setX(-20);
    options.setTitle(title);

    Axis xAxis = new Axis();
    xAxis.setCategories(Arrays.asList(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
            "Sep", "Oct", "Nov", "Dec" }));
    options.setxAxis(xAxis);

    Axis yAxis = new Axis();
    yAxis.setPlotBands(plotBands);
    yAxis.setTitle(new Title("Pulse"));
    options.setyAxis(yAxis);
    options.setLegend(new Legend(Boolean.FALSE));
    options.setTooltip(new Tooltip()
            .setFormatter(new Function().setFunction(" return ''+ this.x +': '+ this.y.toFixed(2) +' bpm';")));

    DataLabels dataLabels = new DataLabels(Boolean.TRUE);

    options.setPlotOptions(new PlotOptionsChoice().setColumn(new PlotOptions()
            .setDataLabels(new DataLabels().setEnabled(Boolean.TRUE).setColor(new HighchartsColor(0))
                    .setFormatter(new Function("return this.y.toFixed(2)  +\" bpm\";")))));

    Series<Number> series = new SimpleSeries();
    List<Number> data = calculatePulse(heartBeatList);
    series.setData(data);
    options.addSeries(series);

    add(new Chart("chart", options));
}

From source file:de.heartbeat.charts.YearOverview.java

License:Apache License

public YearOverview(PageParameters parameters) {
    super(parameters);
    StringValue deviceId = parameters.get("deviceId");
    Person person;/*from  w  w  w. jav a2  s. c  o m*/
    Session session = sessionFactory.openSession();
    session.beginTransaction();
    person = (Person) session.createCriteria(Person.class)
            .add(Restrictions.like("deviceID", deviceId.toString())).uniqueResult();
    heartBeatList = person.getHeartbeats();
    session.getTransaction().commit();
    session.close();

    Collections.sort(heartBeatList);
    Options options = new Options();

    options.setTooltip(
            new Tooltip().setFormatter(new Function().setFunction("return '<b>'+ this.series.name +'</b><br/>'+"
                    + "Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+"
                    + "Highcharts.numberFormat(this.y, 2);")));
    List<PlotBand> plotBands = new ArrayList<>();
    plotBands.add(createPlotBand("HIGH", 120, 10000, true));
    plotBands.add(createPlotBand("NORMAL", 45, 120, false));
    plotBands.add(createPlotBand("LOW", 0, 45, true));
    options.setTitle(new Title("Puls"));
    options.setChartOptions((new ChartOptions().setType(SeriesType.SPLINE).setMarginRight(10)));
    options.setxAxis(new Axis().setType(AxisType.DATETIME));

    Axis yAxis = new Axis();
    yAxis.setTitle(new Title("Puls")).setPlotLines(Collections
            .singletonList(new PlotLine().setValue(1f).setWidth(1).setColor(new HexColor("#808080"))));
    yAxis.setPlotBands(plotBands);

    options.setyAxis(yAxis);

    options.setLegend(new Legend(Boolean.FALSE));
    options.setExporting(new ExportingOptions().setEnabled(Boolean.FALSE));

    series = new LiveDataSeries(options, 6000) {

        @Override
        public Point update(LiveDataUpdateEvent ldue) {
            Session session = sessionFactory.openSession();
            session.beginTransaction();
            heartBeatListNew = session.createCriteria(HeartBeat.class)
                    .add(Restrictions.gt("time", heartBeatList.get(heartBeatList.size() - 1).getTime())).list();
            session.getTransaction().commit();
            session.close();

            if (heartBeatListNew.size() > 0) {
                HeartBeat hb = heartBeatListNew.get(0);
                Date time = new Date(hb.getTime().getTime());
                heartBeatList.addAll(heartBeatListNew);
                return new Point(time.getTime(), Double.parseDouble(hb.getPulse()));
            } else {
                return null;
            }

        }
    };

    series.setData(getPoints(this.heartBeatList)).setName("Puls");
    options.addSeries(series);

    add(new Chart("chart", options));
}

From source file:de.heartbeat.restservice.HeartBeatRest.java

License:Apache License

public HeartBeatRest(final PageParameters parameters) {
    super(parameters);
    boolean isAlert = false;
    int lowerBound = 0;
    int higherBound = 0;

    StringValue alert = parameters.get("alert");
    if (!alert.isEmpty()) {
        if (valueOf(alert).equals("true")) {
            isAlert = Boolean.parseBoolean(alert.toString());
        }/*from w w w . j av  a2s.co  m*/
    }

    Timestamp timestamp = new Timestamp(new Date().getTime());
    StringValue lower = parameters.get("lowerBound");
    StringValue higher = parameters.get("higherBound");
    StringValue pulse = parameters.get("pulse");
    StringValue deviceId = parameters.get("deviceId");
    StringValue time = parameters.get("time");

    if (!isAlert) {
        lowerBound = Integer.parseInt(lower.toString());
    }
    if (!isAlert) {
        higherBound = Integer.parseInt(higher.toString());
    }

    int pulseInt = Integer.parseInt(pulse.toString());

    // restService?pulse=60&lowerBound=45&higherBound=120&deviceId=123456&time=2015-12-21 18:53:11.115
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
    Date parsedDate;
    try {
        parsedDate = dateFormat.parse(time.toString());
        timestamp = new Timestamp(parsedDate.getTime());
    } catch (ParseException ex) {
        Logger.getLogger(HeartBeatRest.class.getName()).log(Level.SEVERE, null, ex);
    }

    HeartBeat heartBeat = new HeartBeat(pulse.toString(), timestamp);
    if (!isAlert) {
        if (pulseInt < lowerBound || pulseInt > higherBound) {
            heartBeat.setAlert(true);
        } else {
            heartBeat.setAlert(false);
        }
    } else {
        heartBeat.setAlert(isAlert);
    }

    Person person;
    PulseLimit limit;
    Session session = sessionFactory.openSession();
    session.beginTransaction();
    person = (Person) session.createCriteria(Person.class)
            .add(Restrictions.like("deviceID", deviceId.toString())).uniqueResult();
    if (person != null) {
        heartBeat.setPerson(person);
        person.getHeartbeats().add(heartBeat);
        session.saveOrUpdate(heartBeat);
        session.saveOrUpdate(person);
        session.getTransaction().commit();
        session.close();
    } else {

        session.getTransaction().commit();
        session.close();
        setResponsePage(ErrorPage.class);
    }

    add(new Label("pulse", pulse));
    add(new Label("deviceId", deviceId));
    add(new Label("time", timestamp));
}

From source file:de.lichtflut.glasnost.is.pages.PerceptionDisplayPage.java

License:Apache License

private IModel<Perception> getPerceptionFromParam(final PageParameters parameters) {
    StringValue id = parameters.get(CommonParams.PARAM_RESOURCE_ID);
    DisplayMode displayMode = DisplayMode.fromParams(parameters);
    IModel<Perception> model;//from   w w w . ja v a 2 s.c o  m
    if (DisplayMode.VIEW.name().equals(displayMode.name())) {
        ResourceNode node = networkService.find(new QualifiedName(id.toString()));
        model = new Model<Perception>(new Perception(node));
    } else {
        model = new Model<Perception>(new Perception());
    }
    return model;
}

From source file:de.lichtflut.glasnost.is.pages.PerceptionEditPage.java

License:Apache License

private IModel<Perception> getPerceptionFromParam(final PageParameters parameters,
        final IModel<DisplayMode> displayMode) {
    IModel<Perception> model;/*from w  w  w  . ja  v  a 2  s. c  o  m*/
    if (areEqual(this.displayMode, DisplayMode.CREATE).isFulfilled()) {
        model = new Model<Perception>(new Perception());
    } else {
        StringValue id = parameters.get(CommonParams.PARAM_RESOURCE_ID);
        ResourceNode node = networkService.find(new QualifiedName(id.toString()));
        model = new Model<Perception>(new Perception(node));
    }

    return model;
}

From source file:de.tudarmstadt.ukp.clarin.webanno.brat.curation.component.SuggestionViewPanel.java

License:Apache License

public SuggestionViewPanel(String id, IModel<LinkedList<CurationUserSegmentForAnnotationDocument>> aModel) {
    super(id, aModel);
    // update list of brat embeddings
    sentenceListView = new ListView<CurationUserSegmentForAnnotationDocument>("sentenceListView", aModel) {
        private static final long serialVersionUID = -5389636445364196097L;

        @Override/* w  w w  .  ja v a 2  s  .c om*/
        protected void populateItem(ListItem<CurationUserSegmentForAnnotationDocument> item2) {
            final CurationUserSegmentForAnnotationDocument curationUserSegment = item2.getModelObject();
            BratSuggestionVisualizer curationVisualizer = new BratSuggestionVisualizer("sentence",
                    new Model<CurationUserSegmentForAnnotationDocument>(curationUserSegment)) {
                private static final long serialVersionUID = -1205541428144070566L;

                /**
                 * Method is called, if user has clicked on a span or an arc in the sentence
                 * panel. The span or arc respectively is identified and copied to the merge
                 * cas.
                 * @throws IOException 
                 * @throws ClassNotFoundException 
                 * @throws UIMAException 
                 * @throws BratAnnotationException 
                 */
                @Override
                protected void onSelectAnnotationForMerge(AjaxRequestTarget aTarget)
                        throws UIMAException, ClassNotFoundException, IOException, BratAnnotationException {
                    // TODO: chain the error from this component up in the
                    // CurationPage
                    // or CorrectionPage
                    if (BratAnnotatorUtility.isDocumentFinished(repository,
                            curationUserSegment.getBratAnnotatorModel())) {
                        aTarget.appendJavaScript(
                                "alert('This document is already closed." + " Please ask admin to re-open')");
                        return;
                    }
                    final IRequestParameters request = getRequest().getPostParameters();
                    String username = SecurityContextHolder.getContext().getAuthentication().getName();

                    User user = userRepository.get(username);

                    SourceDocument sourceDocument = curationUserSegment.getBratAnnotatorModel().getDocument();
                    JCas annotationJCas = null;

                    annotationJCas = (curationUserSegment.getBratAnnotatorModel().getMode()
                            .equals(Mode.AUTOMATION)
                            || curationUserSegment.getBratAnnotatorModel().getMode().equals(Mode.CORRECTION))
                                    ? repository.readAnnotationCas(
                                            repository.getAnnotationDocument(sourceDocument, user))
                                    : repository.readCurationCas(sourceDocument);
                    StringValue action = request.getParameterValue("action");
                    // check if clicked on a span
                    if (!action.isEmpty() && action.toString().equals("selectSpanForMerge")) {
                        mergeSpan(request, curationUserSegment, annotationJCas, repository, annotationService);
                    }
                    // check if clicked on an arc
                    else if (!action.isEmpty() && action.toString().equals("selectArcForMerge")) {
                        // add span for merge
                        // get information of the span clicked
                        mergeArc(request, curationUserSegment, annotationJCas);
                    }
                    onChange(aTarget);
                }
            };
            curationVisualizer.setOutputMarkupId(true);
            item2.add(curationVisualizer);
        }
    };
    sentenceListView.setOutputMarkupId(true);
    add(sentenceListView);
}

From source file:dk.netdesign.common.osgi.config.wicket.ConfigurationPage.java

License:Apache License

public ConfigurationPage(PageParameters parameters) {
    super(parameters);
    StringValue configurationIDValue = parameters.get(CONFIGID);

    controllerModel = new ManagedPropertiesControllerModel(configurationIDValue.toString());
    attributeModel = new AttributeModel(controllerModel);
    setUpPage();/*w w  w . jav  a  2  s.com*/
}

From source file:edu.uci.ics.hyracks.control.cc.adminconsole.pages.JobDetailsPage.java

License:Apache License

public JobDetailsPage(PageParameters params) throws Exception {
    ClusterControllerService ccs = getAdminConsoleApplication().getClusterControllerService();

    StringValue jobIdStr = params.get("job-id");

    JobId jobId = JobId.parse(jobIdStr.toString());

    GetActivityClusterGraphJSONWork gacgw = new GetActivityClusterGraphJSONWork(ccs, jobId);
    ccs.getWorkQueue().scheduleAndSync(gacgw);
    Label jag = new Label("activity-cluster-graph", gacgw.getJSON().toString());
    jag.setEscapeModelStrings(false);//from   w  ww  .  j  a  v a 2 s.c om
    add(jag);

    JSONObject jagO = gacgw.getJSON();

    Map<ActivityId, String> activityMap = new HashMap<ActivityId, String>();
    if (jagO.has("activities")) {
        JSONArray aArray = jagO.getJSONArray("activities");
        for (int i = 0; i < aArray.length(); ++i) {
            JSONObject aO = aArray.getJSONObject(i);
            ActivityId aid = ActivityId.parse(aO.getString("id"));
            String className = aO.getString("java-class");

            activityMap.put(aid, className);
        }
    }

    GetJobRunJSONWork gjrw = new GetJobRunJSONWork(ccs, jobId);
    ccs.getWorkQueue().scheduleAndSync(gjrw);
    Label jobrun = new Label("job-run", gjrw.getJSON().toString());
    jobrun.setEscapeModelStrings(false);
    add(jobrun);

    JSONObject jrO = gjrw.getJSON();

    List<TaskClusterAttempt[]> tcList = new ArrayList<TaskClusterAttempt[]>();
    long minTime = Long.MAX_VALUE;
    long maxTime = Long.MIN_VALUE;
    if (jrO.has("activity-clusters")) {
        JSONArray acA = jrO.getJSONArray("activity-clusters");
        for (int i = 0; i < acA.length(); ++i) {
            JSONObject acO = acA.getJSONObject(i);
            if (acO.has("plan")) {
                JSONObject planO = acO.getJSONObject("plan");
                if (planO.has("task-clusters")) {
                    JSONArray tcA = planO.getJSONArray("task-clusters");
                    for (int j = 0; j < tcA.length(); ++j) {
                        JSONObject tcO = tcA.getJSONObject(j);
                        String tcId = tcO.getString("task-cluster-id");
                        if (tcO.has("attempts")) {
                            JSONArray tcaA = tcO.getJSONArray("attempts");
                            TaskClusterAttempt[] tcAttempts = new TaskClusterAttempt[tcaA.length()];
                            for (int k = 0; k < tcaA.length(); ++k) {
                                JSONObject tcaO = tcaA.getJSONObject(k);
                                int attempt = tcaO.getInt("attempt");
                                long startTime = tcaO.getLong("start-time");
                                long endTime = tcaO.getLong("end-time");

                                tcAttempts[k] = new TaskClusterAttempt(tcId, attempt, startTime, endTime);
                                if (startTime < minTime) {
                                    minTime = startTime;
                                }
                                if (endTime > maxTime) {
                                    maxTime = endTime;
                                }
                                if (tcaO.has("task-attempts")) {
                                    JSONArray taArray = tcaO.getJSONArray("task-attempts");
                                    tcAttempts[k].tasks = new TaskAttempt[taArray.length()];
                                    for (int l = 0; l < taArray.length(); ++l) {
                                        JSONObject taO = taArray.getJSONObject(l);
                                        TaskAttemptId taId = TaskAttemptId
                                                .parse(taO.getString("task-attempt-id"));
                                        TaskAttempt ta = new TaskAttempt(taId, taO.getLong("start-time"),
                                                taO.getLong("end-time"));
                                        tcAttempts[k].tasks[l] = ta;
                                        TaskId tid = taId.getTaskId();
                                        ta.name = activityMap.get(tid.getActivityId());
                                        ta.partition = tid.getPartition();
                                    }
                                    Arrays.sort(tcAttempts[k].tasks, new Comparator<TaskAttempt>() {
                                        @Override
                                        public int compare(TaskAttempt o1, TaskAttempt o2) {
                                            return o1.startTime < o2.startTime ? -1
                                                    : (o1.startTime > o2.startTime ? 1 : 0);
                                        }
                                    });
                                }
                            }
                            Arrays.sort(tcAttempts, new Comparator<TaskClusterAttempt>() {
                                @Override
                                public int compare(TaskClusterAttempt o1, TaskClusterAttempt o2) {
                                    return o1.startTime < o2.startTime ? -1
                                            : (o1.startTime > o2.startTime ? 1 : 0);
                                }
                            });
                            tcList.add(tcAttempts);
                        }
                    }
                }
            }
        }
    }

    Map<TaskAttemptId, TaskProfile> tpMap = new HashMap<TaskAttemptId, TaskProfile>();
    if (jrO.has("profile")) {
        JSONObject pO = jrO.getJSONObject("profile");
        if (pO.has("joblets")) {
            JSONArray jobletsA = pO.getJSONArray("joblets");
            for (int i = 0; i < jobletsA.length(); ++i) {
                JSONObject jobletO = jobletsA.getJSONObject(i);
                if (jobletO.has("tasks")) {
                    JSONArray tasksA = jobletO.getJSONArray("tasks");
                    for (int j = 0; j < tasksA.length(); ++j) {
                        JSONObject taskO = tasksA.getJSONObject(j);
                        ActivityId activityId = ActivityId.parse(taskO.getString("activity-id"));
                        int partition = taskO.getInt("partition");
                        int attempt = taskO.getInt("attempt");
                        TaskAttemptId taId = new TaskAttemptId(new TaskId(activityId, partition), attempt);
                        if (taskO.has("partition-send-profile")) {
                            JSONArray taskProfilesA = taskO.getJSONArray("partition-send-profile");
                            for (int k = 0; k < taskProfilesA.length(); ++k) {
                                JSONObject ppO = taskProfilesA.getJSONObject(k);
                                long openTime = ppO.getLong("open-time");
                                long closeTime = ppO.getLong("close-time");
                                int resolution = ppO.getInt("resolution");
                                long offset = ppO.getLong("offset");
                                JSONArray frameTimesA = ppO.getJSONArray("frame-times");
                                long[] frameTimes = new long[frameTimesA.length()];
                                for (int l = 0; l < frameTimes.length; ++l) {
                                    frameTimes[l] = frameTimesA.getInt(l) + offset;
                                }
                                TaskProfile tp = new TaskProfile(taId, openTime, closeTime, frameTimes,
                                        resolution);
                                if (!tpMap.containsKey(tp.taId)) {
                                    tpMap.put(tp.taId, tp);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    if (!tcList.isEmpty()) {
        Collections.sort(tcList, new Comparator<TaskClusterAttempt[]>() {
            @Override
            public int compare(TaskClusterAttempt[] o1, TaskClusterAttempt[] o2) {
                if (o1.length == 0) {
                    return o2.length == 0 ? 0 : -1;
                } else if (o2.length == 0) {
                    return 1;
                }
                return o1[0].startTime < o2[0].startTime ? -1 : (o1[0].startTime > o2[0].startTime ? 1 : 0);
            }
        });
        long range = maxTime - minTime;

        double leftOffset = 20;

        int xWidth = 1024;
        double width = ((double) xWidth) / range;
        StringBuilder buffer = new StringBuilder();
        int y = 0;
        for (TaskClusterAttempt[] tcAttempts : tcList) {
            for (int i = 0; i < tcAttempts.length; ++i) {
                TaskClusterAttempt tca = tcAttempts[i];
                long startTime = tca.startTime - minTime;
                long endTime = tca.endTime - minTime;
                buffer.append("<rect x=\"").append(startTime * width + leftOffset).append("\" y=\"")
                        .append(y * (HEIGHT + 1)).append("\" width=\"").append(width * (endTime - startTime))
                        .append("\" height=\"").append(HEIGHT).append("\"/>\n");
                buffer.append("<text x=\"").append(endTime * width + leftOffset + 20).append("\" y=\"")
                        .append(y * (HEIGHT + 1) + HEIGHT * 3 / 4).append("\">")
                        .append((endTime - startTime) + " ms").append("</text>\n");
                ++y;
                for (int j = 0; j < tca.tasks.length; ++j) {
                    TaskAttempt ta = tca.tasks[j];
                    long tStartTime = ta.startTime - minTime;
                    long tEndTime = ta.endTime - minTime;
                    buffer.append("<rect x=\"").append(tStartTime * width + leftOffset).append("\" y=\"")
                            .append(y * (HEIGHT + 1) + HEIGHT / 4).append("\" width=\"")
                            .append(width * (tEndTime - tStartTime)).append("\" height=\"").append(HEIGHT / 2)
                            .append("\" style=\"fill:rgb(255,255,255);stroke-width:1;stroke:rgb(0,0,0)\"/>\n");
                    buffer.append("<text x=\"").append(tEndTime * width + leftOffset + 20).append("\" y=\"")
                            .append(y * (HEIGHT + 1) + HEIGHT * 3 / 4).append("\">")
                            .append((tEndTime - tStartTime) + " ms (" + ta.name + ":" + ta.partition + ")")
                            .append("</text>\n");
                    TaskProfile tp = tpMap.get(ta.taId);
                    if (tp != null) {
                        for (int k = 0; k < tp.frameTimes.length; ++k) {
                            long taOpenTime = tp.openTime - minTime;
                            buffer.append("<rect x=\"").append(taOpenTime * width + leftOffset)
                                    .append("\" y=\"").append(y * (HEIGHT + 1) + HEIGHT / 4)
                                    .append("\" width=\"1\" height=\"").append(HEIGHT / 2)
                                    .append("\" style=\"fill:rgb(255,0,0);stroke-width:1;stroke:rgb(255,0,0)\"/>\n");
                            for (int l = 0; l < tp.frameTimes.length; ++l) {
                                long ft = tp.frameTimes[l];
                                long ftn = l < tp.frameTimes.length - 1 ? tp.frameTimes[l + 1] : ft;
                                long taNextTime = ft - minTime;
                                long barWidth = ftn - ft;
                                buffer.append("<rect x=\"").append(taNextTime * width + leftOffset)
                                        .append("\" y=\"").append(y * (HEIGHT + 1) + HEIGHT / 4)
                                        .append("\" width=\"").append(barWidth == 0 ? 1 : (barWidth * width))
                                        .append("\" height=\"").append(HEIGHT / 2)
                                        .append("\" style=\"fill:rgb(0,255,0);stroke-width:1;stroke:rgb(0,255,0)\"/>\n");
                            }
                            long taCloseTime = tp.closeTime - minTime;
                            buffer.append("<rect x=\"").append(taCloseTime * width + leftOffset)
                                    .append("\" y=\"").append(y * (HEIGHT + 1) + HEIGHT / 4)
                                    .append("\" width=\"1\" height=\"").append(HEIGHT / 2)
                                    .append("\" style=\"fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,255)\"/>\n");
                        }
                    }
                    ++y;
                }
            }
        }
        buffer.append("<rect x=\"").append(leftOffset).append("\" y=\"").append(0).append("\" width=\"")
                .append(1).append("\" height=\"").append((y + 2) * (HEIGHT + 1)).append("\"/>\n");
        buffer.append("<rect x=\"").append(0).append("\" y=\"").append((y + 1) * (HEIGHT + 1))
                .append("\" width=\"").append(xWidth + 2 * leftOffset).append("\" height=\"").append(1)
                .append("\"/>\n");
        buffer.append("</svg>");
        Label markup = new Label("job-timeline",
                "<svg version=\"1.1\"\nxmlns=\"http://www.w3.org/2000/svg\" width=\"" + (xWidth * 1.5)
                        + "\" height=\"" + ((y + 2) * (HEIGHT + 1)) + "\">\n" + buffer.toString());
        markup.setEscapeModelStrings(false);
        add(markup);
    } else {
        Label markup = new Label("job-timeline", "No information available yet");
        add(markup);
    }
}