Search in sources :

Example 1 with TimeLoggingModel

use of net.sourceforge.processdash.log.time.TimeLoggingModel in project processdash by dtuma.

the class TaskStatusApi method getTargetPath.

/** Retrieve the target path from the incoming HTTP request */
private String getTargetPath() {
    // use the prefix, if one was supplied in the request
    String result = getPrefix();
    // selected task
    if (!StringUtils.hasValue(result)) {
        DashboardContext ctx = getDashboardContext();
        DashboardTimeLog tl = (DashboardTimeLog) ctx.getTimeLog();
        TimeLoggingModel tlm = tl.getTimeLoggingModel();
        result = tlm.getActiveTaskModel().getPath();
    }
    // verify that the named path exists and is a leaf task
    DashHierarchy hier = getPSPProperties();
    PropertyKey key = hier.findExistingKey(result);
    if (key == null)
        throw new WebApiException("no-such-task", 404, "The task '" + result + "' was not found.");
    else if (hier.getNumChildren(key) != 0)
        throw new WebApiException("not-leaf-task", 400, "The item '" + result + "' is not a leaf task.");
    return result;
}
Also used : DashboardContext(net.sourceforge.processdash.DashboardContext) DashboardTimeLog(net.sourceforge.processdash.log.time.DashboardTimeLog) TimeLoggingModel(net.sourceforge.processdash.log.time.TimeLoggingModel) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 2 with TimeLoggingModel

use of net.sourceforge.processdash.log.time.TimeLoggingModel in project processdash by dtuma.

the class MenuHandler method createSharedActions.

private void createSharedActions(ProcessDashboard pdash) {
    showWindowAction = new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            DashController.raiseWindow();
        }
    };
    final TimeLoggingModel timeLoggingModel = pdash.getTimeLoggingModel();
    playPauseAction = new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            timeLoggingModel.setPaused(!timeLoggingModel.isPaused());
        }
    };
    changeTaskAction = pdash.getChangeTaskAction();
}
Also used : TimeLoggingModel(net.sourceforge.processdash.log.time.TimeLoggingModel) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 3 with TimeLoggingModel

use of net.sourceforge.processdash.log.time.TimeLoggingModel in project processdash by dtuma.

the class SizeMetricApiDispatcher method getTargetPath.

/** Retrieve the target path from the incoming HTTP request */
private String getTargetPath() {
    // use the prefix, if one was supplied in the request
    String result = getPrefix();
    // selected task
    if (!StringUtils.hasValue(result)) {
        DashboardContext ctx = getDashboardContext();
        DashboardTimeLog tl = (DashboardTimeLog) ctx.getTimeLog();
        TimeLoggingModel tlm = tl.getTimeLoggingModel();
        result = tlm.getActiveTaskModel().getPath();
    }
    return result;
}
Also used : DashboardContext(net.sourceforge.processdash.DashboardContext) DashboardTimeLog(net.sourceforge.processdash.log.time.DashboardTimeLog) TimeLoggingModel(net.sourceforge.processdash.log.time.TimeLoggingModel)

Example 4 with TimeLoggingModel

use of net.sourceforge.processdash.log.time.TimeLoggingModel in project processdash by dtuma.

the class DisplayState method writeTimingState.

private void writeTimingState() {
    DashboardContext ctx = getDashboardContext();
    DashboardTimeLog tl = (DashboardTimeLog) ctx.getTimeLog();
    TimeLoggingModel tlm = tl.getTimeLoggingModel();
    String path = tlm.getActiveTaskModel().getPath();
    String isTiming = tlm.isPaused() ? "false" : "true";
    out.write("Content-Type: text/plain\r\n\r\n");
    out.write("activeTask=" + path + "\r\n");
    out.write("isTiming=" + isTiming + "\r\n");
    out.flush();
}
Also used : DashboardContext(net.sourceforge.processdash.DashboardContext) DashboardTimeLog(net.sourceforge.processdash.log.time.DashboardTimeLog) TimeLoggingModel(net.sourceforge.processdash.log.time.TimeLoggingModel)

Aggregations

TimeLoggingModel (net.sourceforge.processdash.log.time.TimeLoggingModel)4 DashboardContext (net.sourceforge.processdash.DashboardContext)3 DashboardTimeLog (net.sourceforge.processdash.log.time.DashboardTimeLog)3 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)1 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)1