use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class AlfrescoNavigationHandler method getDialogContainer.
/**
* Retrieves the configured dialog container page
*
* @param context FacesContext
* @return The container page
*/
protected String getDialogContainer(FacesContext context) {
String container;
// determine which kind of container we need to return, if the
// external session flag is set then use the plain container
Object obj = context.getExternalContext().getSessionMap().get(EXTERNAL_CONTAINER_SESSION);
if (obj != null && obj instanceof Boolean && ((Boolean) obj).booleanValue()) {
if ((this.plainDialogContainer == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) {
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null) {
this.plainDialogContainer = globalConfig.getConfigElement("plain-dialog-container").getValue();
}
}
container = this.plainDialogContainer;
} else {
if ((this.dialogContainer == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) {
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null) {
this.dialogContainer = globalConfig.getConfigElement("dialog-container").getValue();
}
}
container = this.dialogContainer;
}
if (logger.isDebugEnabled())
logger.debug("Using dialog container: " + container);
return container;
}
use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class CreateCompositeRuleWizard method getWizardContainerViewId.
private String getWizardContainerViewId(FacesContext context) {
String viewId = null;
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null) {
viewId = globalConfig.getConfigElement("wizard-container").getValue();
} else {
logger.error("plain-dialog-container configuraion setting is not found");
}
return viewId;
}
use of org.springframework.extensions.config.ConfigService 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.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class ImagePickerRadioRenderer method encodeChildren.
/**
* @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
@SuppressWarnings("unchecked")
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
if (component.isRendered() == false) {
return;
}
UIImagePicker imagePicker = (UIImagePicker) component;
Map attrs = imagePicker.getAttributes();
Integer cols = (Integer) attrs.get("columns");
if (cols != null && cols instanceof Integer) {
this.columns = cols.intValue();
}
// retrieve the onclick handler, if there is one
String onclick = (String) attrs.get("onclick");
ResponseWriter out = context.getResponseWriter();
// determine whether the options should be pulled from config or
// from the child components
String configSection = (String) attrs.get("configSection");
if (configSection != null && configSection.length() > 0) {
// render all the icons from the list that appear in the given
// config section
ConfigService cfgService = Application.getConfigService(context);
Config cfg = cfgService.getConfig(configSection);
if (cfg != null) {
ConfigElement iconsCfg = cfg.getConfigElement("icons");
if (iconsCfg != null) {
for (ConfigElement icon : iconsCfg.getChildren()) {
String iconName = icon.getAttribute("name");
String iconPath = icon.getAttribute("path");
if (iconName != null && iconPath != null) {
UIListItem item = new UIListItem();
item.setValue(iconName);
item.setImage(iconPath);
renderItem(context, out, imagePicker, item, onclick);
}
}
}
}
} else {
try {
// get the child components
for (Iterator i = imagePicker.getChildren().iterator(); i.hasNext(); ) /**/
{
UIComponent child = (UIComponent) i.next();
if (child instanceof UIListItems) {
// get the value of the list items component and iterate
// through it's collection
Object listItems = ((UIListItems) child).getValue();
if (listItems instanceof Collection) {
Iterator iter = ((Collection) listItems).iterator();
while (iter.hasNext()) {
UIListItem item = (UIListItem) iter.next();
if (item.isRendered()) {
renderItem(context, out, imagePicker, item, onclick);
}
}
}
} else if (child instanceof UIListItem && child.isRendered() == true) {
// found a valid UIListItem child to render
UIListItem item = (UIListItem) child;
renderItem(context, out, imagePicker, item, onclick);
}
}
} catch (PropertyNotFoundException pnfe) {
// method specified in the value binding expression
if (logger.isWarnEnabled())
logger.warn("Failed to retrieve icons: " + pnfe.toString());
out.write(Application.getMessage(context, "no_icons_found"));
}
}
// if we are in the middle of a row, close it
if (open) {
out.write("</tr>\n");
}
}
use of org.springframework.extensions.config.ConfigService in project acs-community-packaging by Alfresco.
the class WebClientConfigBootstrap method init.
/**
* @deprecated
*/
public void init() {
if (this.applicationContext.containsBean("webClientConfigService") == true) {
ConfigService configService = (ConfigService) this.applicationContext.getBean("webClientConfigService");
if (configService != null) {
setConfigService(configService);
register();
}
}
}
Aggregations