Search in sources :

Example 6 with DashboardContext

use of net.sourceforge.processdash.DashboardContext in project processdash by dtuma.

the class QuickSelectTaskAction method selectTask.

private void selectTask() {
    if (taskProvider == null || activeTaskModel == null)
        throw new IllegalStateException("Object not yet initialized");
    TreeTableModel tasks = taskProvider.getTaskSelectionChoices();
    final JFilterableTreeComponent selector = new JFilterableTreeComponent(tasks, resources.getString("Choose_Task.Find"), false);
    final Object nodeToSelect = taskProvider.getTreeNodeForPath(activeTaskModel.getPath());
    loadPrefs(selector);
    selector.setMatchEntirePath(true);
    TaskCompletionRenderer rend = null;
    if (parentComponent instanceof DashboardContext)
        rend = new TaskCompletionRenderer(selector, (DashboardContext) parentComponent);
    new JOptionPaneActionHandler().install(selector);
    Object[] message = new Object[] { resources.getString("Choose_Task.Prompt"), selector, new JOptionPaneTweaker.MakeResizable(), new JOptionPaneTweaker.GrabFocus(selector.getFilterTextField()), new JOptionPaneTweaker(50) {

        public void doTweak(JDialog dialog) {
            if (nodeToSelect != null)
                selector.setAnchorSelectedNode(nodeToSelect);
        }
    } };
    int userChoice = JOptionPane.showConfirmDialog(parentComponent, message, resources.getString("Choose_Task.Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    savePrefs(selector);
    if (rend != null)
        rend.dispose();
    if (userChoice != JOptionPane.OK_OPTION)
        return;
    Object newTask = selector.getSelectedLeaf();
    if (newTask == null)
        return;
    String newPath = taskProvider.getPathForTreeNode(newTask);
    if (StringUtils.hasValue(newPath))
        activeTaskModel.setPath(newPath);
}
Also used : DashboardContext(net.sourceforge.processdash.DashboardContext) JOptionPaneTweaker(net.sourceforge.processdash.ui.lib.JOptionPaneTweaker) JOptionPaneActionHandler(net.sourceforge.processdash.ui.lib.JOptionPaneActionHandler) TreeTableModel(net.sourceforge.processdash.ui.lib.TreeTableModel) JFilterableTreeComponent(net.sourceforge.processdash.ui.lib.JFilterableTreeComponent) JDialog(javax.swing.JDialog)

Example 7 with DashboardContext

use of net.sourceforge.processdash.DashboardContext in project processdash by dtuma.

the class WorkflowReport method getWorkflowsForCurrentProject.

private Map<String, String> getWorkflowsForCurrentProject(HttpServletRequest req) {
    DashboardContext dash = (DashboardContext) PDashServletUtils.buildEnvironment(req).get(TinyCGI.DASHBOARD_CONTEXT);
    DatabasePlugin databasePlugin = dash.getDatabasePlugin();
    QueryUtils.waitForAllProjects(databasePlugin);
    QueryRunner queryRunner = databasePlugin.getObject(QueryRunner.class);
    PDashContext ctx = PDashServletUtils.getContext(req);
    String projectID = ctx.getData().getString("Project_ID");
    String workflowProcessIDPattern = DatabasePluginUtils.getWorkflowPhaseIdentifier(projectID, "%");
    Map<String, String> result = new TreeMap<String, String>();
    String query = Settings.isTeamMode() ? WORKFLOW_LIST_QUERY : WORKFLOW_LIST_QUERY_PERSONAL;
    QueryUtils.mapColumns(result, //
    queryRunner.queryHql(//
    query, workflowProcessIDPattern));
    return result;
}
Also used : DashboardContext(net.sourceforge.processdash.DashboardContext) PDashContext(net.sourceforge.processdash.api.PDashContext) DatabasePlugin(net.sourceforge.processdash.tool.db.DatabasePlugin) TreeMap(java.util.TreeMap) QueryRunner(net.sourceforge.processdash.tool.db.QueryRunner)

Aggregations

DashboardContext (net.sourceforge.processdash.DashboardContext)7 DashboardTimeLog (net.sourceforge.processdash.log.time.DashboardTimeLog)3 TimeLoggingModel (net.sourceforge.processdash.log.time.TimeLoggingModel)3 TreeMap (java.util.TreeMap)2 DatabasePlugin (net.sourceforge.processdash.tool.db.DatabasePlugin)2 QueryRunner (net.sourceforge.processdash.tool.db.QueryRunner)2 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 JDialog (javax.swing.JDialog)1 PDashContext (net.sourceforge.processdash.api.PDashContext)1 EVTaskListRollup (net.sourceforge.processdash.ev.EVTaskListRollup)1 ChartItem (net.sourceforge.processdash.ev.ui.TaskScheduleChartUtil.ChartItem)1 HelpAwareEvChart (net.sourceforge.processdash.ev.ui.chart.HelpAwareEvChart)1 HtmlEvChart (net.sourceforge.processdash.ev.ui.chart.HtmlEvChart)1 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)1 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)1 CachedURLObject (net.sourceforge.processdash.net.cache.CachedURLObject)1