Search in sources :

Example 1 with TreeTableModel

use of net.sourceforge.processdash.ui.lib.TreeTableModel in project processdash by dtuma.

the class EVReport method writeTaskTree.

private static void writeTaskTree(Writer out, EVTaskList taskList, EVTaskFilter filter, EVReportSettings settings, String namespace) throws IOException {
    TreeTableModel tree = taskList.getMergedModel(true, settings.shouldMergePreserveLeaves(), filter);
    HTMLTreeTableWriter writer = new HTMLTreeTableWriter();
    customizeTaskTableWriter(writer, taskList, null, settings, false);
    writer.setTreeName(namespace + "t");
    writer.setExpandAllTooltip(resources.getHTML("Report.Expand_All_Tooltip"));
    writer.setTableAttributes("class='needsTreeSortLinks' id='" + namespace + "task' border='1'");
    writer.setShowDepth(Settings.getInt("ev.showHierarchicalDepth", 3) - 1);
    writer.writeTree(out, tree);
}
Also used : HTMLTreeTableWriter(net.sourceforge.processdash.ui.lib.HTMLTreeTableWriter) TreeTableModel(net.sourceforge.processdash.ui.lib.TreeTableModel)

Example 2 with TreeTableModel

use of net.sourceforge.processdash.ui.lib.TreeTableModel in project processdash by dtuma.

the class EVReport method writeCsv.

/** Generate a file of comma-separated data for use by MS Project.
     */
private void writeCsv() throws IOException {
    if (evModel == null || evModel.isEmpty()) {
        out.print("Status: 404 Not Found\r\n\r\n");
        out.flush();
        return;
    }
    writeContentDispositionHeader(".csv");
    out.print("Content-type: text/plain\r\n\r\n");
    boolean simpleCsv = Settings.getBool("ev.simpleCsvOutput", false);
    List columns = null;
    if (simpleCsv) {
        columns = createSimpleCsvColumns();
    } else {
        columns = createCsvColumns();
        writeCsvColumnHeaders(columns);
    }
    TreeTableModel merged = evModel.getMergedModel(false, false, null);
    EVTask root = (EVTask) merged.getRoot();
    prepCsvColumns(columns, root, root, 1);
    writeCsvRows(columns, root, 1);
}
Also used : EVTask(net.sourceforge.processdash.ev.EVTask) List(java.util.List) ArrayList(java.util.ArrayList) MilestoneList(net.sourceforge.processdash.ev.MilestoneList) LinkedList(java.util.LinkedList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) TreeTableModel(net.sourceforge.processdash.ui.lib.TreeTableModel)

Example 3 with TreeTableModel

use of net.sourceforge.processdash.ui.lib.TreeTableModel 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)

Aggregations

TreeTableModel (net.sourceforge.processdash.ui.lib.TreeTableModel)3 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 JDialog (javax.swing.JDialog)1 DashboardContext (net.sourceforge.processdash.DashboardContext)1 EVTask (net.sourceforge.processdash.ev.EVTask)1 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)1 MilestoneList (net.sourceforge.processdash.ev.MilestoneList)1 HTMLTreeTableWriter (net.sourceforge.processdash.ui.lib.HTMLTreeTableWriter)1 JFilterableTreeComponent (net.sourceforge.processdash.ui.lib.JFilterableTreeComponent)1 JOptionPaneActionHandler (net.sourceforge.processdash.ui.lib.JOptionPaneActionHandler)1 JOptionPaneTweaker (net.sourceforge.processdash.ui.lib.JOptionPaneTweaker)1