use of org.alfresco.web.data.QuickSort in project acs-community-packaging by Alfresco.
the class StartWorkflowWizard method getStartableWorkflows.
/**
* Returns a list of workflows that can be started.
*
* @return List of SelectItem objects representing the workflows
*/
public List<SelectItem> getStartableWorkflows() {
if (availableWorkflows == null) {
initializeWorkflows();
}
// Alphabetical list sorting
// Fix bug reported in https://issues.alfresco.com/browse/ETWOTWO-302
QuickSort sorter = new QuickSort(availableWorkflows, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
// select the first workflow in the list
if (this.availableWorkflows.size() > 0 && previouslySelectedWorkflow == null) {
this.selectedWorkflow = (String) this.availableWorkflows.get(0).getValue();
}
return availableWorkflows;
}
use of org.alfresco.web.data.QuickSort in project acs-community-packaging by Alfresco.
the class CreateRuleWizard method getMimeTypes.
/**
* Returns a list of mime types in the system
*
* @return List of mime types
*/
public List<SelectItem> getMimeTypes() {
if (this.mimeTypes == null) {
this.mimeTypes = new ArrayList<SelectItem>(50);
Map<String, String> mimeTypes = getMimetypeService().getDisplaysByMimetype();
for (String mimeType : mimeTypes.keySet()) {
this.mimeTypes.add(new SelectItem(mimeType, mimeTypes.get(mimeType)));
}
// make sure the list is sorted by the values
QuickSort sorter = new QuickSort(this.mimeTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
}
return this.mimeTypes;
}
use of org.alfresco.web.data.QuickSort in project acs-community-packaging by Alfresco.
the class CreateRuleWizard method getConditions.
/**
* @return Returns the list of selectable conditions
*/
public List<SelectItem> getConditions() {
if (this.conditions == null) {
List<ActionConditionDefinition> ruleConditions = this.getActionService().getActionConditionDefinitions();
this.conditions = new ArrayList<SelectItem>(ruleConditions.size());
for (ActionConditionDefinition ruleConditionDef : ruleConditions) {
// add to SelectItem list
this.conditions.add(new SelectItem(ruleConditionDef.getName(), ruleConditionDef.getTitle()));
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.conditions, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
// add the "Select a condition" entry at the beginning of the list
this.conditions.add(0, new SelectItem("null", Application.getMessage(FacesContext.getCurrentInstance(), "select_a_condition")));
}
return this.conditions;
}
use of org.alfresco.web.data.QuickSort in project acs-community-packaging by Alfresco.
the class CreateRuleWizard method getModelTypes.
/**
* Returns a list of the types available in the repository
*
* @return List of SelectItem objects
*/
public List<SelectItem> getModelTypes() {
if ((this.modelTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) {
FacesContext context = FacesContext.getCurrentInstance();
ConfigService svc = Application.getConfigService(context);
Config wizardCfg = svc.getConfig("Action Wizards");
if (wizardCfg != null) {
ConfigElement typesCfg = wizardCfg.getConfigElement("subtypes");
if (typesCfg != null) {
this.modelTypes = new ArrayList<SelectItem>();
for (ConfigElement child : typesCfg.getChildren()) {
QName idQName = Repository.resolveToQName(child.getAttribute("name"));
// get the display label from config
String label = Utils.getDisplayLabel(context, child);
// if there wasn't a client based label try and get it from the dictionary
if (label == null) {
TypeDefinition typeDef = this.getDictionaryService().getType(idQName);
if (typeDef != null) {
label = typeDef.getTitle(this.getDictionaryService());
} else {
label = idQName.getLocalName();
}
}
this.modelTypes.add(new SelectItem(idQName.toString(), label));
}
// make sure the list is sorted by the label
QuickSort sorter = new QuickSort(this.modelTypes, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
} else {
logger.warn("Could not find 'subtypes' configuration element");
}
} else {
logger.warn("Could not find 'Action Wizards' configuration section");
}
}
return this.modelTypes;
}
use of org.alfresco.web.data.QuickSort in project acs-community-packaging by Alfresco.
the class YahooTreeRenderer method generateNode.
/**
* Generates the JavaScript required to create the branch of a tree from
* the given node.
*
* @param node The node to generate
* @param out Response writer
* @param parentVarName Name of the parent variable, null if the node has no parent
*/
protected void generateNode(TreeNode node, ResponseWriter out, String parentVarName) throws IOException {
String currentVarName = getNextVarName();
// generate the Javascript to create the given node using the
// appropriate parent variable
out.write(" var ");
out.write(currentVarName);
out.write(" = createYahooTreeNode(");
if (node.getParent() == null) {
out.write("root");
} else {
out.write(parentVarName);
}
out.write(", \"");
out.write(node.getNodeRef());
out.write("\", \"");
out.write(node.getName());
out.write("\", \"");
out.write(node.getIcon());
out.write("\", ");
out.write(Boolean.toString(node.isExpanded()));
out.write(", ");
out.write(Boolean.toString(node.isSelected()));
out.write(");\n");
// iterate through the child nodes and generate them
if (node.isExpanded() && node.getChildren().size() > 0) {
// order the children
List<TreeNode> children = node.getChildren();
if (children.size() > 1) {
QuickSort sorter = new QuickSort(children, "name", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
}
for (TreeNode child : children) {
generateNode(child, out, currentVarName);
}
}
}
Aggregations