diff --git a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java index 0d9bd24435..e615a38ad9 100644 --- a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java +++ b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java @@ -1131,6 +1131,11 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MODIFY_CATEGORIES_OF) + " '" + getDocument().getName() + "'"; } + + public String getContainerSubTitle() + { + return baseDialogBean.getContainerSubTitle(); + } public boolean getFinishButtonDisabled() { diff --git a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java index ed3f3143e5..c5a421223f 100644 --- a/source/java/org/alfresco/web/bean/SpaceDetailsBean.java +++ b/source/java/org/alfresco/web/bean/SpaceDetailsBean.java @@ -632,6 +632,11 @@ public class SpaceDetailsBean extends BaseDetailsBean implements IDialogBean return Application.getMessage(FacesContext.getCurrentInstance(), MSG_MODIFY_CATEGORIES_OF) + " '" + getSpace().getName() + "'"; } + + public String getContainerSubTitle() + { + return baseDialogBean.getContainerSubTitle(); + } public boolean getFinishButtonDisabled() { diff --git a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java index cb7204d2ef..1fa3f9fa8e 100644 --- a/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java +++ b/source/java/org/alfresco/web/bean/dialog/BaseDialogBean.java @@ -169,6 +169,11 @@ public abstract class BaseDialogBean implements IDialogBean return null; } + public String getContainerSubTitle() + { + return null; + } + public String getContainerDescription() { return null; diff --git a/source/java/org/alfresco/web/bean/dialog/ChangeViewSupport.java b/source/java/org/alfresco/web/bean/dialog/ChangeViewSupport.java new file mode 100644 index 0000000000..0463e689dd --- /dev/null +++ b/source/java/org/alfresco/web/bean/dialog/ChangeViewSupport.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.dialog; + +import java.util.List; +import javax.faces.event.ActionEvent; +import org.alfresco.web.ui.common.component.UIListItem; + +/** + * Interface definition for dialog beans that wish to use the view + * drop down to change the layout of the dialog. + * + * @author gavinc + */ +public interface ChangeViewSupport +{ + public List getViewItems(); + + public String getViewMode(); + + public void setViewMode(String viewMode); + + public void viewModeChanged(ActionEvent event); +} diff --git a/source/java/org/alfresco/web/bean/dialog/DialogManager.java b/source/java/org/alfresco/web/bean/dialog/DialogManager.java index 17ae35deb3..dc20f8c831 100644 --- a/source/java/org/alfresco/web/bean/dialog/DialogManager.java +++ b/source/java/org/alfresco/web/bean/dialog/DialogManager.java @@ -212,6 +212,35 @@ public final class DialogManager return title; } + /** + * Returns the resolved subtitle to use for the dialog + * + * @return The subtitle + */ + public String getSubTitle() + { + // try and get the subtitle directly from the dialog + String subTitle = this.currentDialogState.getDialog().getContainerSubTitle(); + + if (subTitle == null) + { + // try and get the title via a message bundle key + subTitle = this.currentDialogState.getConfig().getSubTitleId(); + + if (subTitle != null) + { + subTitle = Application.getMessage(FacesContext.getCurrentInstance(), subTitle); + } + else + { + // try and get the title from the configuration + subTitle = this.currentDialogState.getConfig().getSubTitle(); + } + } + + return subTitle; + } + /** * Returns the resolved description to use for the dialog * @@ -272,6 +301,39 @@ public final class DialogManager return this.currentDialogState.getConfig().isOKButtonVisible(); } + /** + * Determines whether the current dialog should display the next + * and previous buttons in the header area. + * + * @return true if navigation support is enabled + */ + public boolean isNavigationVisible() + { + return (getBean() instanceof NavigationSupport); + } + + /** + * Determines whether the current dialog should display the list + * of views in the header area. + * + * @return true if change view support is enabled + */ + public boolean isViewListVisible() + { + return (getBean() instanceof ChangeViewSupport); + } + + /** + * Determines whether the current dialog should display the list + * of filters in the header area. + * + * @return true if filter support is enabled + */ + public boolean isFilterListVisible() + { + return (getBean() instanceof FilterViewSupport); + } + /** * Returns a list of additional buttons to display in the dialog * diff --git a/source/java/org/alfresco/web/bean/dialog/FilterViewSupport.java b/source/java/org/alfresco/web/bean/dialog/FilterViewSupport.java new file mode 100644 index 0000000000..5328eaf1c2 --- /dev/null +++ b/source/java/org/alfresco/web/bean/dialog/FilterViewSupport.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.dialog; + +import java.util.List; +import javax.faces.event.ActionEvent; +import org.alfresco.web.ui.common.component.UIListItem; + +/** + * Interface definition for dialog beans that wish to use the filter + * drop down to change the contents of the dialog. + * + * @author gavinc + */ +public interface FilterViewSupport +{ + public List getFilterItems(); + + public String getFilterMode(); + + public void setFilterMode(String filterMode); + + public void filterModeChanged(ActionEvent event); +} diff --git a/source/java/org/alfresco/web/bean/dialog/IDialogBean.java b/source/java/org/alfresco/web/bean/dialog/IDialogBean.java index 2d5a26190b..fc9180f1a8 100644 --- a/source/java/org/alfresco/web/bean/dialog/IDialogBean.java +++ b/source/java/org/alfresco/web/bean/dialog/IDialogBean.java @@ -99,6 +99,15 @@ public interface IDialogBean */ public String getContainerTitle(); + /** + * Returns the subtitle to be used for the dialog + *

If this returns null the DialogManager will + * lookup the subtitle via the dialog configuration

+ * + * @return The subtitle or null if the subtitle is to be acquired via configuration + */ + public String getContainerSubTitle(); + /** * Returns the description to be used for the dialog *

If this returns null the DialogManager will diff --git a/source/java/org/alfresco/web/bean/dialog/NavigationSupport.java b/source/java/org/alfresco/web/bean/dialog/NavigationSupport.java new file mode 100644 index 0000000000..e95b524a4f --- /dev/null +++ b/source/java/org/alfresco/web/bean/dialog/NavigationSupport.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.dialog; + +import javax.faces.event.ActionEvent; + +/** + * Interface definition for dialog beans that wish to use the next + * previous buttons for quick navigation. + * + * @author gavinc + */ +public interface NavigationSupport +{ + public String getCurrentItemId(); + + public void nextItem(ActionEvent event); + + public void previousItem(ActionEvent event); +} diff --git a/source/java/org/alfresco/web/bean/wizard/WizardManager.java b/source/java/org/alfresco/web/bean/wizard/WizardManager.java index 97abc96d04..152c32c02b 100644 --- a/source/java/org/alfresco/web/bean/wizard/WizardManager.java +++ b/source/java/org/alfresco/web/bean/wizard/WizardManager.java @@ -224,6 +224,35 @@ public final class WizardManager return title; } + /** + * Returns the resolved subtitle to use for the wizard + * + * @return The subtitle + */ + public String getSubTitle() + { + // try and get the title directly from the wizard + String subTitle = this.currentWizardState.getWizard().getContainerSubTitle(); + + if (subTitle == null) + { + // try and get the title via a message bundle key + subTitle = this.currentWizardState.getConfig().getSubTitleId(); + + if (subTitle != null) + { + subTitle = Application.getMessage(FacesContext.getCurrentInstance(), subTitle); + } + else + { + // try and get the title from the configuration + subTitle = this.currentWizardState.getConfig().getSubTitle(); + } + } + + return subTitle; + } + /** * Returns the resolved description to use for the wizard * diff --git a/source/java/org/alfresco/web/config/DialogsConfigElement.java b/source/java/org/alfresco/web/config/DialogsConfigElement.java index 1666caa298..cc4f401b57 100644 --- a/source/java/org/alfresco/web/config/DialogsConfigElement.java +++ b/source/java/org/alfresco/web/config/DialogsConfigElement.java @@ -123,113 +123,120 @@ public class DialogsConfigElement extends ConfigElementAdapter } /** - * Inner class representing the configuration of a single dialog + * Immutable inner class representing the configuration of a single dialog. * * @author gavinc */ public static class DialogConfig { - protected String name; - protected String page; - protected String managedBean; - protected String actionsConfigId; - protected String icon; - protected String title; - protected String titleId; - protected String description; - protected String descriptionId; - protected String errorMsgId = "error_dialog"; - protected boolean isOKButtonVisible = true; - protected List buttons; + protected DialogAttributes attributes; - public DialogConfig(String name, String page, String bean, - String actionsConfigId, String icon, - String title, String titleId, - String description, String descriptionId, - String errorMsgId, boolean isOKButtonVisible, - List buttons) + public DialogConfig(DialogAttributes attrs) { - // check the mandatory parameters are present - ParameterCheck.mandatoryString("name", name); - ParameterCheck.mandatoryString("page", page); - ParameterCheck.mandatoryString("managedBean", bean); + // check the attributes object has been supplied + ParameterCheck.mandatory("attrs", attrs); - this.name = name; - this.page = page; - this.managedBean = bean; - this.actionsConfigId = actionsConfigId; - this.icon = icon; - this.title = title; - this.titleId = titleId; - this.description = description; - this.descriptionId = descriptionId; - this.isOKButtonVisible = isOKButtonVisible; - this.buttons = buttons; - - if (errorMsgId != null && errorMsgId.length() > 0) - { - this.errorMsgId = errorMsgId; - } - } - - public String getDescription() - { - return this.description; - } - - public String getDescriptionId() - { - return this.descriptionId; - } - - public String getManagedBean() - { - return this.managedBean; - } - - public String getActionsConfigId() - { - return this.actionsConfigId; + this.attributes = attrs; } public String getName() { - return this.name; + return this.attributes.getName(); } public String getPage() { - return this.page; + return this.attributes.getPage(); } - public String getIcon() + public String getManagedBean() { - return this.icon; + return this.attributes.getManagedBean(); } public String getTitle() { - return this.title; + return this.attributes.getTitle(); } public String getTitleId() { - return this.titleId; + return this.attributes.getTitleId(); + } + + public String getSubTitle() + { + return this.attributes.getSubTitle(); + } + + public String getSubTitleId() + { + return this.attributes.getSubTitleId(); + } + + public String getDescription() + { + return this.attributes.getDescription(); + } + + public String getDescriptionId() + { + return this.attributes.getDescriptionId(); + } + + public String getIcon() + { + return this.attributes.getIcon(); } public String getErrorMessageId() { - return this.errorMsgId; + return this.attributes.getErrorMessageId(); } public boolean isOKButtonVisible() { - return this.isOKButtonVisible; + return this.attributes.isOKButtonVisible(); } public List getButtons() { - return this.buttons; + return this.attributes.getButtons(); + } + + public String getActionsConfigId() + { + return this.attributes.getActionsConfigId(); + } + + public boolean getActionsAsMenu() + { + return this.attributes.getActionsAsMenu(); + } + + public String getActionsMenuLabel() + { + return this.attributes.getActionsMenuLabel(); + } + + public String getActionsMenuLabelId() + { + return this.attributes.getActionsMenuLabelId(); + } + + public String getMoreActionsConfigId() + { + return this.attributes.getMoreActionsConfigId(); + } + + public String getMoreActionsMenuLabel() + { + return this.attributes.getMoreActionsMenuLabel(); + } + + public String getMoreActionsMenuLabelId() + { + return this.attributes.getMoreActionsMenuLabelId(); } /** @@ -239,24 +246,13 @@ public class DialogsConfigElement extends ConfigElementAdapter public String toString() { StringBuilder buffer = new StringBuilder(super.toString()); - buffer.append(" (name=").append(this.name); - buffer.append(" page=").append(this.page); - buffer.append(" managed-bean=").append(this.managedBean); - buffer.append(" actions-config-id=").append(this.actionsConfigId); - buffer.append(" icon=").append(this.icon); - buffer.append(" title=").append(this.title); - buffer.append(" titleId=").append(this.titleId); - buffer.append(" description=").append(this.description); - buffer.append(" descriptionId=").append(this.descriptionId); - buffer.append(" errorMsgId=").append(this.errorMsgId); - buffer.append(" isOKButtonVisible=").append(this.isOKButtonVisible); - buffer.append(" buttons=").append(this.buttons).append(")"); + buffer.append(" (").append(this.attributes.toString()).append(")"); return buffer.toString(); } } /** - * Inner class representing the configuration for an additional + * Immutable inner class representing the configuration for an additional * dialog button. * * @author gavinc @@ -343,4 +339,272 @@ public class DialogsConfigElement extends ConfigElementAdapter return buffer.toString(); } } + + /** + * Object holding all the dialog attributes collected from config. + * + * @author gavinc + */ + public static class DialogAttributes + { + protected String name; + protected String page; + protected String managedBean; + protected String icon; + protected String title; + protected String titleId; + protected String subTitle; + protected String subTitleId; + protected String description; + protected String descriptionId; + protected String errorMsgId = "error_dialog"; + protected boolean isOKButtonVisible = true; + protected List buttons; + protected String actionsConfigId; + protected boolean actionsAsMenu = false; + protected String actionsMenuLabel; + protected String actionsMenuLabelId; + protected String moreActionsConfigId; + protected String moreActionsMenuLabel; + protected String moreActionsMenuLabelId; + + // ---------------------------------------------------- + // Construction + + public DialogAttributes(String name, String page, String bean) + { + // check the mandatory parameters are present + ParameterCheck.mandatoryString("name", name); + ParameterCheck.mandatoryString("page", page); + ParameterCheck.mandatoryString("managedBean", bean); + + this.name = name; + this.page = page; + this.managedBean = bean; + } + + // ---------------------------------------------------- + // Setters + + public void setIcon(String icon) + { + this.icon = icon; + } + + public void setTitle(String title) + { + this.title = title; + } + + public void setTitleId(String titleId) + { + this.titleId = titleId; + } + + public void setSubTitle(String subTitle) + { + this.subTitle = subTitle; + } + + public void setSubTitleId(String subTitleId) + { + this.subTitleId = subTitleId; + } + + public void setDescription(String description) + { + this.description = description; + } + + public void setDescriptionId(String descriptionId) + { + this.descriptionId = descriptionId; + } + + public void setErrorMessageId(String errorMsgId) + { + if (errorMsgId != null && errorMsgId.length() > 0) + { + this.errorMsgId = errorMsgId; + } + } + + public void setOKButtonVisible(boolean isOKButtonVisible) + { + this.isOKButtonVisible = isOKButtonVisible; + } + + public void setButtons(List buttons) + { + this.buttons = buttons; + } + + public void setActionsConfigId(String actionsConfigId) + { + this.actionsConfigId = actionsConfigId; + } + + public void setActionsAsMenu(boolean actionsAsMenu) + { + this.actionsAsMenu = actionsAsMenu; + } + + public void setActionsMenuLabel(String actionsMenuLabel) + { + this.actionsMenuLabel = actionsMenuLabel; + } + + public void setActionsMenuLabelId(String actionsMenuLabelId) + { + this.actionsMenuLabelId = actionsMenuLabelId; + } + + public void setMoreActionsConfigId(String moreActionsConfigId) + { + this.moreActionsConfigId = moreActionsConfigId; + } + + public void setMoreActionsMenuLabel(String moreActionsMenuLabel) + { + this.moreActionsMenuLabel = moreActionsMenuLabel; + } + + public void setMoreActionsMenuLabelId(String moreActionsMenuLabelId) + { + this.moreActionsMenuLabelId = moreActionsMenuLabelId; + } + + // ---------------------------------------------------- + // Getters + + public String getName() + { + return this.name; + } + + public String getPage() + { + return this.page; + } + + public String getManagedBean() + { + return this.managedBean; + } + + public String getDescription() + { + return this.description; + } + + public String getDescriptionId() + { + return this.descriptionId; + } + + public String getIcon() + { + return this.icon; + } + + public String getTitle() + { + return this.title; + } + + public String getTitleId() + { + return this.titleId; + } + + public String getSubTitle() + { + return this.subTitle; + } + + public String getSubTitleId() + { + return this.subTitleId; + } + + public String getErrorMessageId() + { + return this.errorMsgId; + } + + public boolean isOKButtonVisible() + { + return this.isOKButtonVisible; + } + + public List getButtons() + { + return this.buttons; + } + + public String getActionsConfigId() + { + return this.actionsConfigId; + } + + public boolean getActionsAsMenu() + { + return this.actionsAsMenu; + } + + public String getActionsMenuLabel() + { + return this.actionsMenuLabel; + } + + public String getActionsMenuLabelId() + { + return this.actionsMenuLabelId; + } + + public String getMoreActionsConfigId() + { + return this.moreActionsConfigId; + } + + public String getMoreActionsMenuLabel() + { + return this.moreActionsMenuLabel; + } + + public String getMoreActionsMenuLabelId() + { + return this.moreActionsMenuLabelId; + } + + /** + * @see java.lang.Object#toString() + */ + @Override + public String toString() + { + StringBuilder buffer = new StringBuilder(); + buffer.append("name=").append(this.name); + buffer.append(" page=").append(this.page); + buffer.append(" managedBean=").append(this.managedBean); + buffer.append(" icon=").append(this.icon); + buffer.append(" title=").append(this.title); + buffer.append(" titleId=").append(this.titleId); + buffer.append(" subTitle=").append(this.subTitle); + buffer.append(" subTitleId=").append(this.subTitleId); + buffer.append(" description=").append(this.description); + buffer.append(" descriptionId=").append(this.descriptionId); + buffer.append(" errorMsgId=").append(this.errorMsgId); + buffer.append(" isOKButtonVisible=").append(this.isOKButtonVisible); + buffer.append(" actionsConfigId=").append(this.actionsConfigId); + buffer.append(" actionsAsMenu=").append(this.actionsAsMenu); + buffer.append(" actionsMenuLabel=").append(this.actionsMenuLabel); + buffer.append(" actionsMenuLabelId=").append(this.actionsMenuLabelId); + buffer.append(" moreActionsConfigId=").append(this.moreActionsConfigId); + buffer.append(" moreActionsMenuLabel=").append(this.moreActionsMenuLabel); + buffer.append(" moreActionsMenuLabelId=").append(this.moreActionsMenuLabelId); + buffer.append(" buttons=").append(this.buttons); + return buffer.toString(); + } + } } diff --git a/source/java/org/alfresco/web/config/DialogsElementReader.java b/source/java/org/alfresco/web/config/DialogsElementReader.java index 5633ccea3e..87760643b4 100644 --- a/source/java/org/alfresco/web/config/DialogsElementReader.java +++ b/source/java/org/alfresco/web/config/DialogsElementReader.java @@ -48,14 +48,26 @@ public class DialogsElementReader implements ConfigElementReader public static final String ATTR_NAME = "name"; public static final String ATTR_PAGE = "page"; public static final String ATTR_MANAGED_BEAN = "managed-bean"; - public static final String ATTR_ACTIONS_CONFIG_ID = "actions-config-id"; public static final String ATTR_ICON = "icon"; public static final String ATTR_TITLE = "title"; public static final String ATTR_TITLE_ID = "title-id"; + public static final String ATTR_SUBTITLE = "subtitle"; + public static final String ATTR_SUBTITLE_ID = "subtitle-id"; public static final String ATTR_DESCRIPTION = "description"; public static final String ATTR_DESCRIPTION_ID = "description-id"; public static final String ATTR_ERROR_MSG_ID = "error-message-id"; public static final String ATTR_SHOW_OK_BUTTON = "show-ok-button"; + + // action related attributes + public static final String ATTR_ACTIONS_CONFIG_ID = "actions-config-id"; + public static final String ATTR_ACTIONS_AS_MENU = "actions-as-menu"; + public static final String ATTR_ACTIONS_MENU_LABEL = "actions-menu-label"; + public static final String ATTR_ACTIONS_MENU_LABEL_ID = "actions-menu-label-id"; + public static final String ATTR_MORE_ACTIONS_CONFIG_ID = "more-actions-config-id"; + public static final String ATTR_MORE_ACTIONS_MENU_LABEL = "more-actions-menu-label"; + public static final String ATTR_MORE_ACTIONS_MENU_LABEL_ID = "more-actions-menu-label-id"; + + // button related attributes public static final String ATTR_ID = "id"; public static final String ATTR_LABEL = "label"; public static final String ATTR_LABEL_ID = "label-id"; @@ -92,10 +104,11 @@ public class DialogsElementReader implements ConfigElementReader String name = item.attributeValue(ATTR_NAME); String page = item.attributeValue(ATTR_PAGE); String bean = item.attributeValue(ATTR_MANAGED_BEAN); - String actions = item.attributeValue(ATTR_ACTIONS_CONFIG_ID); String icon = item.attributeValue(ATTR_ICON); String title = item.attributeValue(ATTR_TITLE); String titleId = item.attributeValue(ATTR_TITLE_ID); + String subTitle = item.attributeValue(ATTR_SUBTITLE); + String subTitleId = item.attributeValue(ATTR_SUBTITLE_ID); String description = item.attributeValue(ATTR_DESCRIPTION); String descriptionId = item.attributeValue(ATTR_DESCRIPTION_ID); String errorMsgId = item.attributeValue(ATTR_ERROR_MSG_ID); @@ -107,13 +120,46 @@ public class DialogsElementReader implements ConfigElementReader isOKButtonVisible = Boolean.parseBoolean(showOK); } + // action related config + String actionsConfigId = item.attributeValue(ATTR_ACTIONS_CONFIG_ID); + boolean useMenuForActions = false; + String asMenu = item.attributeValue(ATTR_ACTIONS_AS_MENU); + if (asMenu != null) + { + useMenuForActions = Boolean.parseBoolean(asMenu); + } + String actionsMenuLabel = item.attributeValue(ATTR_ACTIONS_MENU_LABEL); + String actionsMenuLabelId = item.attributeValue(ATTR_ACTIONS_MENU_LABEL_ID); + String moreActionsConfigId = item.attributeValue(ATTR_MORE_ACTIONS_CONFIG_ID); + String moreActionsMenuLabel = item.attributeValue(ATTR_MORE_ACTIONS_MENU_LABEL); + String moreActionsMenuLabelId = item.attributeValue(ATTR_MORE_ACTIONS_MENU_LABEL_ID); + // parse any buttons that may be present List buttons = parseButtons(item); - DialogsConfigElement.DialogConfig cfg = new DialogsConfigElement.DialogConfig( - name, page, bean, actions, icon, title, titleId, description, - descriptionId, errorMsgId, isOKButtonVisible, buttons); + // setup the attrbiutes object + DialogsConfigElement.DialogAttributes attrs = + new DialogsConfigElement.DialogAttributes(name, page, bean); + attrs.setIcon(icon); + attrs.setTitle(title); + attrs.setTitleId(titleId); + attrs.setSubTitle(subTitle); + attrs.setSubTitleId(subTitleId); + attrs.setDescription(description); + attrs.setDescriptionId(descriptionId); + attrs.setErrorMessageId(errorMsgId); + attrs.setOKButtonVisible(isOKButtonVisible); + attrs.setButtons(buttons); + attrs.setActionsConfigId(actionsConfigId); + attrs.setActionsAsMenu(useMenuForActions); + attrs.setActionsMenuLabel(actionsMenuLabel); + attrs.setActionsMenuLabelId(actionsMenuLabelId); + attrs.setMoreActionsConfigId(moreActionsConfigId); + attrs.setMoreActionsMenuLabel(moreActionsMenuLabel); + attrs.setMoreActionsMenuLabelId(moreActionsMenuLabelId); + // create and add the dialog config object + DialogsConfigElement.DialogConfig cfg = new DialogsConfigElement.DialogConfig(attrs); configElement.addDialog(cfg); } } @@ -123,7 +169,7 @@ public class DialogsElementReader implements ConfigElementReader /** * Retrieve the configuration for additional buttons. - * + * * @param dialog The dialog XML element * @return List of configured buttons */ diff --git a/source/java/org/alfresco/web/config/WebClientConfigTest.java b/source/java/org/alfresco/web/config/WebClientConfigTest.java index c15646d07b..6ff6814219 100644 --- a/source/java/org/alfresco/web/config/WebClientConfigTest.java +++ b/source/java/org/alfresco/web/config/WebClientConfigTest.java @@ -662,13 +662,21 @@ public class WebClientConfigTest extends BaseTest assertEquals("name", "createSpace", dialog.getName()); assertEquals("page", "/jsp/dialog/create-space.jsp", dialog.getPage()); assertEquals("managed-bean", "NewSpaceDialog", dialog.getManagedBean()); - assertEquals("actions-config-id", "space-actions", dialog.getActionsConfigId()); assertEquals("icon", "/images/icons/create_space_large.gif", dialog.getIcon()); assertEquals("title-id", "create_space_title", dialog.getTitleId()); + assertEquals("subtitle-id", "create_space_subtitle", dialog.getSubTitleId()); assertEquals("description-id", "create_space_description", dialog.getDescriptionId()); assertEquals("error-message-id", "error_create_space_dialog", dialog.getErrorMessageId()); + assertEquals("actions-config-id", "space-actions", dialog.getActionsConfigId()); + assertEquals("more-actions-config-id", "more-actions", dialog.getMoreActionsConfigId()); + assertTrue("actions-as-menu should be true", dialog.getActionsAsMenu()); + assertEquals("actions-menu-label-id", "actions_menu_label", dialog.getActionsMenuLabelId()); + assertEquals("more-actions-menu-label-id", "more_actions_menu_label", dialog.getMoreActionsMenuLabelId()); assertNull("title should be null", dialog.getTitle()); + assertNull("subtitle should be null", dialog.getSubTitle()); assertNull("description should be null", dialog.getDescription()); + assertNull("actions-menu-label should be null", dialog.getActionsMenuLabel()); + assertNull("more-actions-menu-label should be null", dialog.getMoreActionsMenuLabel()); // get the 'spaceDetails' dialog dialog = dialogsElement.getDialog("spaceDetails"); @@ -678,13 +686,21 @@ public class WebClientConfigTest extends BaseTest assertEquals("name", "spaceDetails", dialog.getName()); assertEquals("page", "/jsp/dialog/space-details.jsp", dialog.getPage()); assertEquals("managed-bean", "SpaceDetailsDialog", dialog.getManagedBean()); - assertEquals("actions-config-id", "space-actions", dialog.getActionsConfigId()); assertEquals("icon", "/images/icons/create_space_large.gif", dialog.getIcon()); assertEquals("title", "Space Details Dialog", dialog.getTitle()); + assertEquals("subtitle", "Space details subtitle", dialog.getSubTitle()); assertEquals("description", "Space Details Dialog Decsription", dialog.getDescription()); assertEquals("error-message-id", "error_dialog", dialog.getErrorMessageId()); + assertEquals("actions-config-id", "space-actions", dialog.getActionsConfigId()); + assertNull("more-actions-config-id should be null", dialog.getMoreActionsConfigId()); + assertFalse("actions-as-menu should be false", dialog.getActionsAsMenu()); + assertEquals("actions-menu-label", "Create" , dialog.getActionsMenuLabel()); + assertEquals("more-actions-menu-label", "More Actions" , dialog.getMoreActionsMenuLabel()); assertNull("title-id should be null", dialog.getTitleId()); + assertNull("subtitle-id should be null", dialog.getSubTitleId()); assertNull("description-id should be null", dialog.getDescriptionId()); + assertNull("actions-menu-label-id should be null", dialog.getActionsMenuLabelId()); + assertNull("more-actions-menu-label-id should be null", dialog.getMoreActionsMenuLabelId()); } public void testDialogOverride() @@ -707,11 +723,13 @@ public class WebClientConfigTest extends BaseTest DialogConfig dialog = dialogsElement.getDialog("createSpace"); assertNotNull("createSpace dialog should not be null", dialog); - // make sure the page and managed bean attributes have been overridden + // make sure the relevant attributes have been overridden assertEquals("page", "/custom/my-create-space.jsp", dialog.getPage()); assertEquals("managed-bean", "MyNewSpaceDialog", dialog.getManagedBean()); - assertEquals("title-id", "create_space_title", dialog.getTitleId()); - assertEquals("description-id", "create_space_description", dialog.getDescriptionId()); + assertEquals("title-id", "my_create_space_title", dialog.getTitleId()); + assertEquals("description-id", "my_create_space_description", dialog.getDescriptionId()); + assertEquals("subtitle-id", "my_create_space_subtitle", dialog.getSubTitleId()); + assertEquals("actions-config-id", "my-space-actions", dialog.getActionsConfigId()); } public void testWizards() @@ -749,12 +767,13 @@ public class WebClientConfigTest extends BaseTest assertEquals("name", "exampleWizard", wizard.getName()); assertEquals("exampleWizard steps", 2, wizard.getNumberSteps()); assertEquals("managed-bean", "ExampleWizard", wizard.getManagedBean()); - assertEquals("actions-config-id", "example-wizard-actions", wizard.getActionsConfigId()); assertEquals("icon", "/images/icons/example-logo.gif", wizard.getIcon()); assertEquals("title", "Example Wizard Title", wizard.getTitle()); + assertEquals("subtitle", "Example wizard sub title", wizard.getSubTitle()); assertEquals("description", "Example Wizard Description", wizard.getDescription()); assertEquals("error-message-id", "error_wizard", wizard.getErrorMessageId()); assertNull("title-id should be null", wizard.getTitleId()); + assertNull("subtitle-id should be null", wizard.getSubTitleId()); assertNull("description-id should be null", wizard.getDescriptionId()); // retrive step 1 config and check it is correct @@ -769,12 +788,13 @@ public class WebClientConfigTest extends BaseTest assertEquals("name", "createSpace", wizard.getName()); assertEquals("createSpace steps", 3, wizard.getNumberSteps()); assertEquals("managed-bean", "AdvancedSpaceWizard", wizard.getManagedBean()); - assertEquals("actions-config-id", "create-space-actions", wizard.getActionsConfigId()); assertEquals("icon", "/images/icons/create_space_large.gif", wizard.getIcon()); assertEquals("title-id", "advanced_space_details_title", wizard.getTitleId()); + assertEquals("subtitle-id", "advanced_space_details_subtitle", wizard.getSubTitleId()); assertEquals("description-id", "advanced_space_details_description", wizard.getDescriptionId()); assertEquals("error-message-id", "error_create_space_wizard", wizard.getErrorMessageId()); assertNull("title should be null", wizard.getTitle()); + assertNull("subtitle should be null", wizard.getSubTitle()); assertNull("description should be null", wizard.getDescription()); List steps = wizard.getStepsAsList(); assertNotNull("steps should not be null", steps); diff --git a/source/java/org/alfresco/web/config/WizardsConfigElement.java b/source/java/org/alfresco/web/config/WizardsConfigElement.java index 8301ee4c37..b473ba2cf2 100644 --- a/source/java/org/alfresco/web/config/WizardsConfigElement.java +++ b/source/java/org/alfresco/web/config/WizardsConfigElement.java @@ -164,17 +164,18 @@ public class WizardsConfigElement extends ConfigElementAdapter */ public static class WizardConfig extends AbstractConfig { + protected String subTitle; + protected String subTitleId; protected String name; protected String managedBean; protected String icon; - protected String actionsConfigId; protected String errorMsgId = "error_wizard"; protected Map steps = new LinkedHashMap(4); - public WizardConfig(String name, String bean, - String actionsConfigId, String icon, + public WizardConfig(String name, String bean, String icon, String title, String titleId, + String subTitle, String subTitleId, String description, String descriptionId, String errorMsgId) { @@ -183,10 +184,11 @@ public class WizardsConfigElement extends ConfigElementAdapter // check we have a name ParameterCheck.mandatoryString("name", name); + this.subTitle = subTitle; + this.subTitleId = subTitleId; this.name = name; this.managedBean = bean; this.icon = icon; - this.actionsConfigId = actionsConfigId; if (errorMsgId != null && errorMsgId.length() > 0) { @@ -204,16 +206,21 @@ public class WizardsConfigElement extends ConfigElementAdapter return this.managedBean; } + public String getSubTitle() + { + return this.subTitle; + } + + public String getSubTitleId() + { + return this.subTitleId; + } + public String getIcon() { return this.icon; } - public String getActionsConfigId() - { - return this.actionsConfigId; - } - public String getErrorMessageId() { return this.errorMsgId; @@ -260,10 +267,11 @@ public class WizardsConfigElement extends ConfigElementAdapter StringBuilder buffer = new StringBuilder(super.toString()); buffer.append(" (name=").append(this.name); buffer.append(" managed-bean=").append(this.managedBean); - buffer.append(" actions-config-id=").append(this.actionsConfigId); buffer.append(" icon=").append(this.icon); buffer.append(" title=").append(this.title); buffer.append(" titleId=").append(this.titleId); + buffer.append(" subTitle=").append(this.subTitle); + buffer.append(" subTitleId=").append(this.subTitleId); buffer.append(" description=").append(this.description); buffer.append(" descriptionId=").append(this.descriptionId); buffer.append(" errorMsgId=").append(this.errorMsgId).append(")"); diff --git a/source/java/org/alfresco/web/config/WizardsElementReader.java b/source/java/org/alfresco/web/config/WizardsElementReader.java index 3f325ea6f0..0961f4897e 100644 --- a/source/java/org/alfresco/web/config/WizardsElementReader.java +++ b/source/java/org/alfresco/web/config/WizardsElementReader.java @@ -49,10 +49,11 @@ public class WizardsElementReader implements ConfigElementReader public static final String ATTR_NAME = "name"; public static final String ATTR_MANAGED_BEAN = "managed-bean"; - public static final String ATTR_ACTIONS_CONFIG_ID = "actions-config-id"; public static final String ATTR_ICON = "icon"; public static final String ATTR_TITLE = "title"; public static final String ATTR_TITLE_ID = "title-id"; + public static final String ATTR_SUBTITLE = "subtitle"; + public static final String ATTR_SUBTITLE_ID = "subtitle-id"; public static final String ATTR_DESCRIPTION = "description"; public static final String ATTR_DESCRIPTION_ID = "description-id"; public static final String ATTR_INSTRUCTION = "instruction"; @@ -88,17 +89,19 @@ public class WizardsElementReader implements ConfigElementReader String name = wizard.attributeValue(ATTR_NAME); String bean = wizard.attributeValue(ATTR_MANAGED_BEAN); - String actions = wizard.attributeValue(ATTR_ACTIONS_CONFIG_ID); String icon = wizard.attributeValue(ATTR_ICON); String title = wizard.attributeValue(ATTR_TITLE); String titleId = wizard.attributeValue(ATTR_TITLE_ID); + String subTitle = wizard.attributeValue(ATTR_SUBTITLE); + String subTitleId = wizard.attributeValue(ATTR_SUBTITLE_ID); String description = wizard.attributeValue(ATTR_DESCRIPTION); String descriptionId = wizard.attributeValue(ATTR_DESCRIPTION_ID); String errorMsgId = wizard.attributeValue(ATTR_ERROR_MSG_ID); // create the wizard config object WizardsConfigElement.WizardConfig wizardCfg = new WizardsConfigElement.WizardConfig( - name, bean, actions, icon, title, titleId, description, descriptionId, errorMsgId); + name, bean, icon, title, titleId, subTitle, subTitleId, + description, descriptionId, errorMsgId); Iterator steps = wizard.elementIterator(ELEMENT_STEP); while (steps.hasNext()) diff --git a/source/test-resources/test-config-dialogs-wizards.xml b/source/test-resources/test-config-dialogs-wizards.xml index dd8f8d4ed9..1413b6f8f2 100644 --- a/source/test-resources/test-config-dialogs-wizards.xml +++ b/source/test-resources/test-config-dialogs-wizards.xml @@ -12,13 +12,18 @@

+ icon="/images/icons/create_space_large.gif" + title-id="create_space_title" subtitle-id="create_space_subtitle" + description-id="create_space_description" error-message-id="error_create_space_dialog" + actions-config-id="space-actions" actions-as-menu="true" + actions-menu-label-id="actions_menu_label" more-actions-config-id="more-actions" + more-actions-menu-label-id="more_actions_menu_label" /> + title="Space Details Dialog" subtitle="Space details subtitle" + description="Space Details Dialog Decsription" + actions-config-id="space-actions" icon="/images/icons/create_space_large.gif" + actions-menu-label="Create" more-actions-menu-label="More Actions" /> @@ -31,8 +36,8 @@ + title="Example Wizard Title" description="Example Wizard Description" + subtitle="Example wizard sub title"> diff --git a/source/test-resources/test-config-override.xml b/source/test-resources/test-config-override.xml index 10077982db..83e2efa3f2 100644 --- a/source/test-resources/test-config-override.xml +++ b/source/test-resources/test-config-override.xml @@ -96,7 +96,8 @@ + title-id="my_create_space_title" subtitle-id="my_create_space_subtitle" + description-id="my_create_space_description" actions-config-id="my-space-actions" /> diff --git a/source/web/jsp/dialog/container.jsp b/source/web/jsp/dialog/container.jsp index 8f2db78057..48a406c2fc 100644 --- a/source/web/jsp/dialog/container.jsp +++ b/source/web/jsp/dialog/container.jsp @@ -79,6 +79,7 @@
+
diff --git a/source/web/jsp/wizard/container.jsp b/source/web/jsp/wizard/container.jsp index d84eb22009..8bcce17f6b 100644 --- a/source/web/jsp/wizard/container.jsp +++ b/source/web/jsp/wizard/container.jsp @@ -78,6 +78,7 @@
+