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;
}
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);
}
}
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;
}
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;
}
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));
}
Aggregations