First cut of dialog/wizard framework needed to convert remaining pages in web client

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6847 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-09-21 09:51:17 +00:00
parent 40463fbf00
commit 3e5670ef4c
18 changed files with 715 additions and 117 deletions

View File

@@ -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()
{

View File

@@ -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()
{

View File

@@ -169,6 +169,11 @@ public abstract class BaseDialogBean implements IDialogBean
return null;
}
public String getContainerSubTitle()
{
return null;
}
public String getContainerDescription()
{
return null;

View File

@@ -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<UIListItem> getViewItems();
public String getViewMode();
public void setViewMode(String viewMode);
public void viewModeChanged(ActionEvent event);
}

View File

@@ -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
*

View File

@@ -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<UIListItem> getFilterItems();
public String getFilterMode();
public void setFilterMode(String filterMode);
public void filterModeChanged(ActionEvent event);
}

View File

@@ -99,6 +99,15 @@ public interface IDialogBean
*/
public String getContainerTitle();
/**
* Returns the subtitle to be used for the dialog
* <p>If this returns null the DialogManager will
* lookup the subtitle via the dialog configuration</p>
*
* @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
* <p>If this returns null the DialogManager will

View File

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

View File

@@ -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
*

View File

@@ -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<DialogButtonConfig> 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<DialogButtonConfig> 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<DialogButtonConfig> 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<DialogButtonConfig> 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<DialogButtonConfig> 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<DialogButtonConfig> 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();
}
}
}

View File

@@ -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<DialogButtonConfig> 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
*/

View File

@@ -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<StepConfig> steps = wizard.getStepsAsList();
assertNotNull("steps should not be null", steps);

View File

@@ -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<String, StepConfig> steps = new LinkedHashMap<String, StepConfig>(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(")");

View File

@@ -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<Element> steps = wizard.elementIterator(ELEMENT_STEP);
while (steps.hasNext())

View File

@@ -12,13 +12,18 @@
<dialogs>
<dialog name="createSpace" page="/jsp/dialog/create-space.jsp" managed-bean="NewSpaceDialog"
actions-config-id="space-actions" icon="/images/icons/create_space_large.gif"
title-id="create_space_title" description-id="create_space_description"
error-message-id="error_create_space_dialog" />
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" />
<dialog name="spaceDetails" page="/jsp/dialog/space-details.jsp" managed-bean="SpaceDetailsDialog"
title="Space Details Dialog" description="Space Details Dialog Decsription"
actions-config-id="space-actions" icon="/images/icons/create_space_large.gif" />
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" />
</dialogs>
</config>
@@ -31,8 +36,8 @@
<!-- example wizard -->
<wizard name="exampleWizard" managed-bean="ExampleWizard"
icon="/images/icons/example-logo.gif"
actions-config-id="example-wizard-actions"
title="Example Wizard Title" description="Example Wizard Description">
title="Example Wizard Title" description="Example Wizard Description"
subtitle="Example wizard sub title">
<step name="details" title="Details">
<page path="/jsp/wizard/example/details.jsp"
title="Step Title" description="Step Description"
@@ -48,8 +53,8 @@
<!-- Definition of an advanced space wizard -->
<wizard name="createSpace" managed-bean="AdvancedSpaceWizard"
icon="/images/icons/create_space_large.gif"
actions-config-id="create-space-actions"
title-id="advanced_space_details_title"
title-id="advanced_space_details_title"
subtitle-id="advanced_space_details_subtitle"
description-id="advanced_space_details_description"
error-message-id="error_create_space_wizard">
<step name="details" title-id="starting_space">

View File

@@ -96,7 +96,8 @@
<dialogs>
<dialog name="createSpace" page="/custom/my-create-space.jsp" managed-bean="MyNewSpaceDialog"
title-id="create_space_title" description-id="create_space_description" />
title-id="my_create_space_title" subtitle-id="my_create_space_subtitle"
description-id="my_create_space_description" actions-config-id="my-space-actions" />
</dialogs>
</config>

View File

@@ -79,6 +79,7 @@
</td>
<td>
<div class="mainTitle"><h:outputText value="#{DialogManager.title}" /></div>
<div class="mainSubTitle"><h:outputText value="#{DialogManager.subTitle}" /></div>
<div class="mainSubText"><h:outputText value="#{DialogManager.description}" /></div>
</td>
<td style="padding-left:4px" align="right">

View File

@@ -78,6 +78,7 @@
</td>
<td>
<div class="mainTitle"><h:outputText value="#{WizardManager.title}" /></div>
<div class="mainSubTitle"><h:outputText value="#{WizardManager.subTitle}" /></div>
<div class="mainSubText"><h:outputText value="#{WizardManager.description}" /></div>
</td>
</tr>