use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.
the class ScriptBrowser method applyFilter.
private void applyFilter() {
list.getSelectionModel().clearSelection();
scriptList.clear();
DefaultMutableTreeNode selected = getSelectedNode();
if (selected == null)
return;
PropertyKey key = treeModel.getPropKey(useProps, selected.getPath());
if (key == null)
return;
List<ScriptID> scripts = ScriptEnumerator.getScripts(dashboard, key);
if (scripts == null || scripts.size() == 0)
return;
ScriptID script, defaultScript = scripts.get(0);
String dataPath = defaultScript.getDataPath();
for (int i = 1; i < scripts.size(); i++) {
script = scripts.get(i);
if (dataPath != null && !dataPath.equals(script.getDataPath()))
break;
scriptList.addElement(script);
dataPath = script.getDataPath();
if (defaultScript.scriptEquals(script))
list.getSelectionModel().addSelectionInterval(i - 1, i - 1);
}
}
use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.
the class ScriptBrowser method showSelectedScript.
protected void showSelectedScript() {
int selectedIndex = list.getMinSelectionIndex();
if (selectedIndex == -1)
return;
ScriptID id = (ScriptID) scriptList.elementAt(selectedIndex);
id.display();
if (!keepDialogOpen)
dispose();
}
use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.
the class TeamProjectBrowser method showSelectedScript.
/**
* Display the script that is currently selected
*
* @param clearSelection
* if true, clear the selection after displaying the script
* @param evt
* the mouse click event that triggered this action; can be null
*/
private void showSelectedScript(boolean clearSelection, MouseEvent evt) {
// find out which item is currently selected
int selectedIndex = scriptList.getMinSelectionIndex();
if (selectedIndex == -1)
return;
// somewhere within the empty space of the JList.
if (evt != null && evt.getPoint() != null) {
Rectangle selectedCellBounds = scriptList.getCellBounds(selectedIndex, selectedIndex);
if (selectedCellBounds != null && !selectedCellBounds.contains(evt.getPoint()))
return;
}
ScriptID id = (ScriptID) scripts.elementAt(selectedIndex);
if (id.getScript() == null)
return;
UserFilter f = UserGroupManager.getInstance().getGlobalFilter();
UserGroupManagerDash.getInstance().setLocalFilter(id.getDataPath(), f);
id.display();
if (clearSelection)
scriptList.clearSelection();
}
use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.
the class WorkflowScriptSource method addScriptsFromUrlSpec.
/**
* Parse a URL specification, construct ScriptIDs, and add them to a list.
*
* @param result the list that ScriptID objects should be added to
* @param dataPath the dashboard hierarchy path that should be used when
* creating the ScriptID objects
* @param oneUrlSpec a String of the format
* <code>(http...[ display name])+</code>. That is, a
* whitespace-separated list of HTTP URLs, each one optionally
* followed by whitespace and a free text display name.
*/
private void addScriptsFromUrlSpec(Set<ScriptID> result, String dataPath, String oneUrlSpec) {
while (oneUrlSpec.length() > 0) {
int pos = oneUrlSpec.lastIndexOf("http");
if (pos == -1)
break;
String oneUrl = oneUrlSpec.substring(pos).trim();
String oneDisplayName = null;
Matcher m = WHITESPACE_PAT.matcher(oneUrl);
if (m.find()) {
oneDisplayName = oneUrl.substring(m.end());
oneUrl = oneUrl.substring(0, m.start());
}
result.add(new ScriptID(oneUrl, dataPath, oneDisplayName));
oneUrlSpec = oneUrlSpec.substring(0, pos);
}
}
use of net.sourceforge.processdash.process.ScriptID in project processdash by dtuma.
the class TemplateLoader method generateDefaultScriptMaps.
private static void generateDefaultScriptMaps(Element e) {
NodeList templates = e.getElementsByTagName(TEMPLATE_NODE_NAME);
int len = templates.getLength();
for (int i = 0; i < len; i++) try {
Element template = (Element) templates.item(i);
String ID = template.getAttribute(ID_ATTR);
if (!hasValue(ID))
continue;
if (hasValue(template.getAttribute(HTML_HREF_ATTR)))
continue;
// if there is no script ID for this element, and it
// hasn't specifically requested otherwise, give it a
// default href.
Vector v = (Vector) scriptMaps.get(ID);
if (v == null)
scriptMaps.put(ID, (v = new Vector()));
if (v.size() == 0) {
String planSummaryName = Resources.getDashBundle("Templates").format("Plan_Summary_Name_FMT", ID);
v.addElement(new ScriptID("dash/summary.shtm", null, planSummaryName));
debug("adding default HTML form for " + ID);
}
} catch (ClassCastException cce) {
}
}
Aggregations