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);
}
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;
}
Aggregations