Search in sources :

Example 61 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class MoveProjectWizard method checkProject.

/**
     * Checks to ensure that the prefix points to a team or master project.
     * If so, sets the projectType and processID fields accordingly.
     * If not, throws a {@link MoveProjectException}.
     * @throws MoveProjectException
     */
private void checkProject() throws MoveProjectException {
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(getPrefix());
    String templateID = hierarchy.getID(key);
    if (templateIs(templateID, MASTER_ROOT)) {
        this.isMaster = true;
        putValue(TEAM_MASTER_FLAG, "t");
        putValue(TEAM_NAME, "Master");
        putValue(TEAM_NAME_LOWER, "master");
    } else if (templateIs(templateID, TEAM_ROOT)) {
        this.isMaster = false;
        putValue(TEAM_MASTER_FLAG, (SimpleData) null);
        putValue(TEAM_NAME, "Team");
        putValue(TEAM_NAME_LOWER, "team");
    } else {
        putValue(TEAM_NAME, "");
        putValue(TEAM_NAME_LOWER, "");
        throw new MoveProjectException("notTeamProject");
    }
    projectID = getStringValue(TeamDataConstants.PROJECT_ID);
    if (!hasValue(projectID))
        throw new MoveProjectException("noProjectID");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 62 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class MigrationToolTeam method convertHierarchy.

private void convertHierarchy() throws HierarchyAlterationException {
    ProcessDashboard dash = (ProcessDashboard) ctx;
    HierarchyAlterer alt = new HierarchyAlterer(dash);
    DashHierarchy hier = ctx.getHierarchy();
    PropertyKey key = hier.findExistingKey(projectPath);
    // delete the children of the team project root node.
    for (int i = hier.getNumChildren(key); i-- > 0; ) {
        PropertyKey child = hier.getChildKey(key, i);
        alt.deleteNode(child.path());
    }
    // change the template ID of the root node.
    alt.setTemplateId(projectPath, newRootTemplateID);
}
Also used : HierarchyAlterer(net.sourceforge.processdash.hier.HierarchyAlterer) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 63 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class HierarchySynchronizer method findHierarchyNodesByID.

private void findHierarchyNodesByID(PropertyKey node, String id, List<PropertyKey> results) {
    if (node == null)
        return;
    String nodeID = getWbsIdForPath(node.path());
    if (id.equals(nodeID))
        results.add(node);
    for (int i = hierarchy.getNumChildren(node); i-- > 0; ) {
        PropertyKey child = hierarchy.getChildKey(node, i);
        findHierarchyNodesByID(child, id, results);
    }
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 64 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class MockActiveTaskModel method setNode.

public boolean setNode(PropertyKey node) {
    if (node != null && hierarchy.containsKey(node)) {
        PropertyKey oldNode = this.node;
        this.node = node;
        propSupport.firePropertyChange("node", oldNode, node);
        return true;
    } else {
        return false;
    }
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 65 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class DashController method alterTemplateID.

public static boolean alterTemplateID(String prefix, String oldID, String newID) {
    if (Settings.isReadOnly())
        return false;
    PropertyKey key = dash.props.findExistingKey(prefix);
    String actualID = dash.props.getID(key);
    if (// handles "null == null" case
    oldID == actualID || (oldID != null && oldID.equals(actualID)))
        try {
            HierarchyAlterer a = new HierarchyAlterer(dash);
            a.addTemplate(prefix, newID);
            return true;
        } catch (Exception e) {
        }
    return false;
}
Also used : HierarchyAlterer(net.sourceforge.processdash.hier.HierarchyAlterer) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) IOException(java.io.IOException)

Aggregations

PropertyKey (net.sourceforge.processdash.hier.PropertyKey)125 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)40 Prop (net.sourceforge.processdash.hier.Prop)16 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)10 SimpleData (net.sourceforge.processdash.data.SimpleData)7 ArrayList (java.util.ArrayList)6 Enumeration (java.util.Enumeration)6 IOException (java.io.IOException)5 Iterator (java.util.Iterator)5 StringTokenizer (java.util.StringTokenizer)5 TreePath (javax.swing.tree.TreePath)5 ListData (net.sourceforge.processdash.data.ListData)5 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)5 List (java.util.List)4 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)4 HierarchyAlterer (net.sourceforge.processdash.hier.HierarchyAlterer)4 HierarchyAlterationException (net.sourceforge.processdash.hier.HierarchyAlterer.HierarchyAlterationException)4 DefectLogID (net.sourceforge.processdash.log.defects.DefectLogID)4 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)4 Point (java.awt.Point)3