Search in sources :

Example 1 with ParseException

use of teamdash.wbs.CsvNodeDataImporter.ParseException in project processdash by dtuma.

the class CsvNodeDataImporterUI method run.

public void run(WBSJTable table, DataTableModel data, TeamMemberList team) {
    File f = selectFile(table);
    if (f == null)
        return;
    List newNodes = null;
    try {
        CsvNodeDataImporter importer = new CsvNodeDataImporter();
        newNodes = importer.getNodesFromCsvFile(f, team);
    } catch (IOException e) {
        showError("Could not open and read from the file '" + f + "'");
    } catch (ParseException e) {
        showError(e.getMessage());
    }
    if (newNodes == null)
        return;
    WBSModel model = (WBSModel) table.getModel();
    newNodes = WBSNode.cloneNodeList(newNodes, model);
    int[] newRows = model.insertNodes(newNodes, model.getRowCount());
    if (newRows == null || newRows.length == 0)
        return;
    storeExtraNodeAttributes(model, data, newRows);
    table.selectRows(newRows);
    table.scrollRectToVisible(table.getCellRect(newRows[0], 0, true));
    UndoList.madeChange(table, "Import from CSV File");
}
Also used : List(java.util.List) TeamMemberList(teamdash.team.TeamMemberList) IOException(java.io.IOException) ParseException(teamdash.wbs.CsvNodeDataImporter.ParseException) File(java.io.File)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 List (java.util.List)1 TeamMemberList (teamdash.team.TeamMemberList)1 ParseException (teamdash.wbs.CsvNodeDataImporter.ParseException)1