Search in sources :

Example 11 with ProcessDashboard

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

the class OpenDefectDialog method getDefectLog.

private DefectLogID getDefectLog(String path) {
    DashHierarchy hier = getPSPProperties();
    PropertyKey key = hier.findExistingKey(path);
    if (key == null)
        return null;
    ProcessDashboard dash = getDash();
    DefectLogID defectLog = hier.defectLog(key, dash.getDirectory());
    if (defectLog == null)
        return null;
    if (Filter.matchesFilter(dash.getBrokenDataPaths(), defectLog.path.path()))
        return null;
    return defectLog;
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) DefectLogID(net.sourceforge.processdash.log.defects.DefectLogID) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 12 with ProcessDashboard

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

the class DefectImportForm method importDefects.

private void importDefects(List defects) {
    DashHierarchy hier = dashboardContext.getHierarchy();
    PropertyKey defectLogKey = hier.findExistingKey(defectLogPath);
    ProcessDashboard dashboard = (ProcessDashboard) dashboardContext;
    String filename = hier.pget(defectLogKey).getDefectLog();
    if (!StringUtils.hasValue(filename)) {
        AbortImport.showError("Hierarchy_Changed", selectedPath);
        return;
    }
    DefectLog defectLog = new DefectLog(dashboard.getDirectory() + filename, defectLogPath, dashboardContext.getData());
    int addedCount = 0;
    int updatedCount = 0;
    int unchangedCount = 0;
    for (Iterator i = defects.iterator(); i.hasNext(); ) {
        Defect newDefect = (Defect) i.next();
        Defect oldDefect = defectLog.getDefect(newDefect.number);
        if (oldDefect == null) {
            addedCount++;
            defectLog.writeDefect(newDefect);
        } else {
            Defect originalDefect = (Defect) oldDefect.clone();
            oldDefect.defect_type = merge(oldDefect.defect_type, newDefect.defect_type);
            oldDefect.injected = merge(oldDefect.injected, newDefect.injected);
            oldDefect.phase_injected = oldDefect.injected.legacyPhase;
            oldDefect.removed = merge(oldDefect.removed, newDefect.removed);
            oldDefect.phase_removed = oldDefect.removed.legacyPhase;
            oldDefect.description = merge(oldDefect.description, newDefect.description);
            oldDefect.fix_time = merge(oldDefect.fix_time, newDefect.fix_time);
            oldDefect.fix_defect = merge(oldDefect.fix_defect, newDefect.fix_defect);
            if (originalDefect.equals(oldDefect)) {
                unchangedCount++;
            } else {
                updatedCount++;
                defectLog.writeDefect(oldDefect);
            }
        }
    }
    if (addedCount == 0 && updatedCount == 0) {
        JOptionPane.showMessageDialog(frame, resources.getStrings("Nothing_To_Do.Message"), resources.getString("Nothing_To_Do.Title"), JOptionPane.INFORMATION_MESSAGE);
    } else if (addedCount < defects.size()) {
        String title = resources.getString("Defects_Updated.Title");
        Object[] message = new Object[4];
        message[0] = resources.getStrings("Defects_Updated.Message");
        message[1] = getUpdatedSegment("Added", addedCount);
        message[2] = getUpdatedSegment("Unchanged", unchangedCount);
        message[3] = getUpdatedSegment("Updated", updatedCount);
        JOptionPane.showMessageDialog(frame, message, title, JOptionPane.INFORMATION_MESSAGE);
    }
}
Also used : DefectLog(net.sourceforge.processdash.log.defects.DefectLog) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) Iterator(java.util.Iterator) Defect(net.sourceforge.processdash.log.defects.Defect) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 13 with ProcessDashboard

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

the class TimeLoggingSimulation method run.

private void run(long seed) throws Exception {
    random = new Random(seed);
    print("Seed is " + seed);
    dataDir = createAndPopulateDataDir();
    harness = new SimulationHarness(dataDir);
    ProcessDashboard dashboard = harness.getDashboard();
    dashboard.removeWindowListener(dashboard);
    dashboard.addWindowListener(this);
    robot = new Robot();
    user = new RandomUserActivityGenerator();
    user.start();
    userMeta = new RandomUserMetaActivityGenerator();
    userMeta.start();
}
Also used : Random(java.util.Random) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) SimulationHarness(net.sourceforge.processdash.SimulationHarness) Robot(java.awt.Robot)

Example 14 with ProcessDashboard

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

the class EditExportMetricsFilePanel method buildMainPanelContents.

protected void buildMainPanelContents() {
    String chooseFilePrompt = getString("Choose_File");
    add(indentedComponent(2, new WrappingText(chooseFilePrompt)));
    add(verticalSpace(1));
    file = new FileChooser();
    file.getDocument().addDocumentListener((DocumentListener) EventHandler.create(DocumentListener.class, this, "updateInstruction"));
    add(indentedComponent(4, file));
    add(verticalSpace(2));
    String choosePathsPrompt = getString("Choose_Paths");
    add(indentedComponent(2, new WrappingText(choosePathsPrompt)));
    add(verticalSpace(1));
    ProcessDashboard dashboard = ExportManager.getInstance().getProcessDashboard();
    paths = new SelectableHierarchyTree(dashboard.getHierarchy(), instr.getPaths());
    paths.addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting())
                updateInstruction();
        }
    });
    JScrollPane scrollPane = new JScrollPane(paths);
    scrollPane.setPreferredSize(new Dimension(999, 300));
    add(indentedComponent(4, scrollPane));
    if (fromManagePanel == false) {
        add(verticalSpace(2));
        String makeAutomaticPrompt = getString("Make_Automatic");
        add(indentedComponent(2, new WrappingText(makeAutomaticPrompt)));
        makeAutomatic = new ButtonGroup();
        Box autoButtonBox = Box.createHorizontalBox();
        autoButtonBox.add(createAutomaticButton("Yes"));
        autoButtonBox.add(createAutomaticButton("No"));
        add(indentedComponent(4, autoButtonBox));
    }
    add(verticalSpace(4));
    error = new WrappingText("X");
    error.setMinimumSize(error.getPreferredSize());
    error.setText("");
    error.setForeground(Color.red);
    add(error);
}
Also used : JScrollPane(javax.swing.JScrollPane) ButtonGroup(javax.swing.ButtonGroup) JFileChooser(javax.swing.JFileChooser) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) ListSelectionEvent(javax.swing.event.ListSelectionEvent) SelectableHierarchyTree(net.sourceforge.processdash.hier.ui.SelectableHierarchyTree) Box(javax.swing.Box) Dimension(java.awt.Dimension) WrappingText(net.sourceforge.processdash.ui.lib.WrappingText) ListSelectionListener(javax.swing.event.ListSelectionListener)

Aggregations

ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)14 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)4 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)3 File (java.io.File)2 DataContext (net.sourceforge.processdash.data.DataContext)2 WorkingDirectory (net.sourceforge.processdash.tool.bridge.client.WorkingDirectory)2 Dimension (java.awt.Dimension)1 Robot (java.awt.Robot)1 Window (java.awt.Window)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 URL (java.net.URL)1 Date (java.util.Date)1 Iterator (java.util.Iterator)1 Random (java.util.Random)1 Box (javax.swing.Box)1 ButtonGroup (javax.swing.ButtonGroup)1 JFileChooser (javax.swing.JFileChooser)1 JMenuBar (javax.swing.JMenuBar)1 JScrollPane (javax.swing.JScrollPane)1