Search in sources :

Example 6 with ScriptID

use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.

the class TemplateLoader method getScriptIDs.

public static Vector<ScriptID> getScriptIDs(String templateID, String path) {
    Vector scriptMap = (Vector) scriptMaps.get(templateID);
    if (scriptMap == null)
        return null;
    Vector<ScriptID> result = new Vector<ScriptID>();
    for (int i = 0; i < scriptMap.size(); i++) result.addElement(new ScriptID((ScriptID) scriptMap.elementAt(i), path));
    return result;
}
Also used : ScriptID(net.sourceforge.processdash.process.ScriptID) Vector(java.util.Vector)

Example 7 with ScriptID

use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.

the class DisplayState method writeScripts.

private void writeScripts(String path, boolean includeAncestors, boolean includeTriggers) throws IOException {
    List<ScriptID> scripts = ScriptEnumerator.getScripts(getDashboardContext(), path);
    if (scripts == null || scripts.isEmpty())
        return;
    String defaultHref = scripts.get(0).getHref();
    for (int i = 1; i < scripts.size(); i++) {
        ScriptID oneScript = scripts.get(i);
        String oneHref = oneScript.getHref();
        // were requested not to include ancestor entries
        if (!includeAncestors && !path.equals(oneScript.getDataPath()))
            continue;
        // not to include trigger entries.
        if (!includeTriggers && TriggerURI.isMandatoryTrigger(oneHref))
            continue;
        // set a flag if this is the default script
        boolean isDefault = false;
        if (defaultHref != null && defaultHref.equals(oneHref)) {
            isDefault = true;
            defaultHref = null;
        }
        // write an XML entry for this script.
        writeScript(xml, oneScript, isDefault, includeAncestors);
    }
}
Also used : ScriptID(net.sourceforge.processdash.process.ScriptID)

Example 8 with ScriptID

use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.

the class WebAppScriptSource method getScripts.

public List<ScriptID> getScripts(String path) {
    List<ScriptID> result = new ArrayList<ScriptID>();
    while (path != null) {
        DataContext ctx = data.getSubcontext(path);
        for (ItemDefinition item : SCRIPT_ITEMS) if (item.test(ctx))
            result.add(item.getScriptID(path));
        path = DataRepository.chopPath(path);
    }
    return result;
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) ArrayList(java.util.ArrayList) ScriptID(net.sourceforge.processdash.process.ScriptID)

Example 9 with ScriptID

use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.

the class DashHierarchy method getScriptIDs.

// gets all the applicable script IDs for the script button
// based on the current phase.
public Vector<ScriptID> getScriptIDs(PropertyKey key) {
    Vector<ScriptID> v = new Vector<ScriptID>();
    Prop val;
    String scriptFile, templateID;
    PropertyKey tempKey = key;
    ScriptID defaultScript = null;
    // Find and add all applicable scripts.
    while (tempKey != null) {
        val = pget(tempKey);
        if (defaultScript == null) {
            scriptFile = val.getScriptFile();
            if (scriptFile != null && scriptFile.length() != 0)
                defaultScript = new ScriptID(scriptFile, datapath(tempKey), null);
        }
        if (Prop.hasValue(templateID = val.getID())) {
            Vector<ScriptID> scriptIDs = TemplateLoader.getScriptIDs(templateID, datapath(tempKey));
            if (scriptIDs != null)
                v.addAll(scriptIDs);
        }
        tempKey = tempKey.getParent();
    }
    if (defaultScript == null && v.size() > 0)
        defaultScript = (ScriptID) v.elementAt(0);
    if (defaultScript != null)
        v.insertElementAt(defaultScript, 0);
    return v;
}
Also used : ScriptID(net.sourceforge.processdash.process.ScriptID) Vector(java.util.Vector)

Example 10 with ScriptID

use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.

the class TemplateLoader method maybeAddScriptID.

private static void maybeAddScriptID(Vector v, String scriptFile) {
    if (v == null || !Prop.hasValue(scriptFile) || "none".equals(scriptFile))
        return;
    int hashPos = scriptFile.indexOf('#');
    if (hashPos != -1)
        scriptFile = scriptFile.substring(0, hashPos);
    for (int i = v.size(); i-- > 0; ) if (scriptFile.equals(((ScriptID) v.elementAt(i)).getScript()))
        return;
    v.addElement(new ScriptID(scriptFile, null, null));
}
Also used : ScriptID(net.sourceforge.processdash.process.ScriptID)

Aggregations

ScriptID (net.sourceforge.processdash.process.ScriptID)19 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Vector (java.util.Vector)3 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)3 Matcher (java.util.regex.Matcher)2 Menu (java.awt.Menu)1 PopupMenu (java.awt.PopupMenu)1 Rectangle (java.awt.Rectangle)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 JMenu (javax.swing.JMenu)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 DataContext (net.sourceforge.processdash.data.DataContext)1 ListData (net.sourceforge.processdash.data.ListData)1 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)1 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)1 ScriptMenuBuilder (net.sourceforge.processdash.process.ui.ScriptMenuBuilder)1 UserFilter (net.sourceforge.processdash.team.group.UserFilter)1 Element (org.w3c.dom.Element)1