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

@@ -1132,6 +1132,11 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
" '" + getDocument().getName() + "'"; " '" + getDocument().getName() + "'";
} }
public String getContainerSubTitle()
{
return baseDialogBean.getContainerSubTitle();
}
public boolean getFinishButtonDisabled() public boolean getFinishButtonDisabled()
{ {
return false; return false;

View File

@@ -633,6 +633,11 @@ public class SpaceDetailsBean extends BaseDetailsBean implements IDialogBean
" '" + getSpace().getName() + "'"; " '" + getSpace().getName() + "'";
} }
public String getContainerSubTitle()
{
return baseDialogBean.getContainerSubTitle();
}
public boolean getFinishButtonDisabled() public boolean getFinishButtonDisabled()
{ {
return false; return false;

View File

@@ -169,6 +169,11 @@ public abstract class BaseDialogBean implements IDialogBean
return null; return null;
} }
public String getContainerSubTitle()
{
return null;
}
public String getContainerDescription() public String getContainerDescription()
{ {
return null; 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; 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 * Returns the resolved description to use for the dialog
* *
@@ -272,6 +301,39 @@ public final class DialogManager
return this.currentDialogState.getConfig().isOKButtonVisible(); 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 * 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(); 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 * Returns the description to be used for the dialog
* <p>If this returns null the DialogManager will * <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; 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 * 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 * @author gavinc
*/ */
public static class DialogConfig public static class DialogConfig
{ {
protected String name; protected DialogAttributes attributes;
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;
public DialogConfig(String name, String page, String bean, public DialogConfig(DialogAttributes attrs)
String actionsConfigId, String icon,
String title, String titleId,
String description, String descriptionId,
String errorMsgId, boolean isOKButtonVisible,
List<DialogButtonConfig> buttons)
{ {
// check the mandatory parameters are present // check the attributes object has been supplied
ParameterCheck.mandatoryString("name", name); ParameterCheck.mandatory("attrs", attrs);
ParameterCheck.mandatoryString("page", page);
ParameterCheck.mandatoryString("managedBean", bean);
this.name = name; this.attributes = attrs;
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;
} }
public String getName() public String getName()
{ {
return this.name; return this.attributes.getName();
} }
public String getPage() 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() public String getTitle()
{ {
return this.title; return this.attributes.getTitle();
} }
public String getTitleId() 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() public String getErrorMessageId()
{ {
return this.errorMsgId; return this.attributes.getErrorMessageId();
} }
public boolean isOKButtonVisible() public boolean isOKButtonVisible()
{ {
return this.isOKButtonVisible; return this.attributes.isOKButtonVisible();
} }
public List<DialogButtonConfig> getButtons() 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() public String toString()
{ {
StringBuilder buffer = new StringBuilder(super.toString()); StringBuilder buffer = new StringBuilder(super.toString());
buffer.append(" (name=").append(this.name); buffer.append(" (").append(this.attributes.toString()).append(")");
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(")");
return buffer.toString(); return buffer.toString();
} }
} }
/** /**
* Inner class representing the configuration for an additional * Immutable inner class representing the configuration for an additional
* dialog button. * dialog button.
* *
* @author gavinc * @author gavinc
@@ -343,4 +339,272 @@ public class DialogsConfigElement extends ConfigElementAdapter
return buffer.toString(); 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_NAME = "name";
public static final String ATTR_PAGE = "page"; public static final String ATTR_PAGE = "page";
public static final String ATTR_MANAGED_BEAN = "managed-bean"; 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_ICON = "icon";
public static final String ATTR_TITLE = "title"; public static final String ATTR_TITLE = "title";
public static final String ATTR_TITLE_ID = "title-id"; 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 = "description";
public static final String ATTR_DESCRIPTION_ID = "description-id"; 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_ERROR_MSG_ID = "error-message-id";
public static final String ATTR_SHOW_OK_BUTTON = "show-ok-button"; 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_ID = "id";
public static final String ATTR_LABEL = "label"; public static final String ATTR_LABEL = "label";
public static final String ATTR_LABEL_ID = "label-id"; 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 name = item.attributeValue(ATTR_NAME);
String page = item.attributeValue(ATTR_PAGE); String page = item.attributeValue(ATTR_PAGE);
String bean = item.attributeValue(ATTR_MANAGED_BEAN); String bean = item.attributeValue(ATTR_MANAGED_BEAN);
String actions = item.attributeValue(ATTR_ACTIONS_CONFIG_ID);
String icon = item.attributeValue(ATTR_ICON); String icon = item.attributeValue(ATTR_ICON);
String title = item.attributeValue(ATTR_TITLE); String title = item.attributeValue(ATTR_TITLE);
String titleId = item.attributeValue(ATTR_TITLE_ID); 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 description = item.attributeValue(ATTR_DESCRIPTION);
String descriptionId = item.attributeValue(ATTR_DESCRIPTION_ID); String descriptionId = item.attributeValue(ATTR_DESCRIPTION_ID);
String errorMsgId = item.attributeValue(ATTR_ERROR_MSG_ID); String errorMsgId = item.attributeValue(ATTR_ERROR_MSG_ID);
@@ -107,13 +120,46 @@ public class DialogsElementReader implements ConfigElementReader
isOKButtonVisible = Boolean.parseBoolean(showOK); 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 // parse any buttons that may be present
List<DialogButtonConfig> buttons = parseButtons(item); List<DialogButtonConfig> buttons = parseButtons(item);
DialogsConfigElement.DialogConfig cfg = new DialogsConfigElement.DialogConfig( // setup the attrbiutes object
name, page, bean, actions, icon, title, titleId, description, DialogsConfigElement.DialogAttributes attrs =
descriptionId, errorMsgId, isOKButtonVisible, buttons); 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); configElement.addDialog(cfg);
} }
} }

View File

@@ -662,13 +662,21 @@ public class WebClientConfigTest extends BaseTest
assertEquals("name", "createSpace", dialog.getName()); assertEquals("name", "createSpace", dialog.getName());
assertEquals("page", "/jsp/dialog/create-space.jsp", dialog.getPage()); assertEquals("page", "/jsp/dialog/create-space.jsp", dialog.getPage());
assertEquals("managed-bean", "NewSpaceDialog", dialog.getManagedBean()); 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("icon", "/images/icons/create_space_large.gif", dialog.getIcon());
assertEquals("title-id", "create_space_title", dialog.getTitleId()); 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("description-id", "create_space_description", dialog.getDescriptionId());
assertEquals("error-message-id", "error_create_space_dialog", dialog.getErrorMessageId()); 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("title should be null", dialog.getTitle());
assertNull("subtitle should be null", dialog.getSubTitle());
assertNull("description should be null", dialog.getDescription()); 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 // get the 'spaceDetails' dialog
dialog = dialogsElement.getDialog("spaceDetails"); dialog = dialogsElement.getDialog("spaceDetails");
@@ -678,13 +686,21 @@ public class WebClientConfigTest extends BaseTest
assertEquals("name", "spaceDetails", dialog.getName()); assertEquals("name", "spaceDetails", dialog.getName());
assertEquals("page", "/jsp/dialog/space-details.jsp", dialog.getPage()); assertEquals("page", "/jsp/dialog/space-details.jsp", dialog.getPage());
assertEquals("managed-bean", "SpaceDetailsDialog", dialog.getManagedBean()); 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("icon", "/images/icons/create_space_large.gif", dialog.getIcon());
assertEquals("title", "Space Details Dialog", dialog.getTitle()); assertEquals("title", "Space Details Dialog", dialog.getTitle());
assertEquals("subtitle", "Space details subtitle", dialog.getSubTitle());
assertEquals("description", "Space Details Dialog Decsription", dialog.getDescription()); assertEquals("description", "Space Details Dialog Decsription", dialog.getDescription());
assertEquals("error-message-id", "error_dialog", dialog.getErrorMessageId()); 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("title-id should be null", dialog.getTitleId());
assertNull("subtitle-id should be null", dialog.getSubTitleId());
assertNull("description-id should be null", dialog.getDescriptionId()); 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() public void testDialogOverride()
@@ -707,11 +723,13 @@ public class WebClientConfigTest extends BaseTest
DialogConfig dialog = dialogsElement.getDialog("createSpace"); DialogConfig dialog = dialogsElement.getDialog("createSpace");
assertNotNull("createSpace dialog should not be null", dialog); 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("page", "/custom/my-create-space.jsp", dialog.getPage());
assertEquals("managed-bean", "MyNewSpaceDialog", dialog.getManagedBean()); assertEquals("managed-bean", "MyNewSpaceDialog", dialog.getManagedBean());
assertEquals("title-id", "create_space_title", dialog.getTitleId()); assertEquals("title-id", "my_create_space_title", dialog.getTitleId());
assertEquals("description-id", "create_space_description", dialog.getDescriptionId()); 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() public void testWizards()
@@ -749,12 +767,13 @@ public class WebClientConfigTest extends BaseTest
assertEquals("name", "exampleWizard", wizard.getName()); assertEquals("name", "exampleWizard", wizard.getName());
assertEquals("exampleWizard steps", 2, wizard.getNumberSteps()); assertEquals("exampleWizard steps", 2, wizard.getNumberSteps());
assertEquals("managed-bean", "ExampleWizard", wizard.getManagedBean()); 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("icon", "/images/icons/example-logo.gif", wizard.getIcon());
assertEquals("title", "Example Wizard Title", wizard.getTitle()); assertEquals("title", "Example Wizard Title", wizard.getTitle());
assertEquals("subtitle", "Example wizard sub title", wizard.getSubTitle());
assertEquals("description", "Example Wizard Description", wizard.getDescription()); assertEquals("description", "Example Wizard Description", wizard.getDescription());
assertEquals("error-message-id", "error_wizard", wizard.getErrorMessageId()); assertEquals("error-message-id", "error_wizard", wizard.getErrorMessageId());
assertNull("title-id should be null", wizard.getTitleId()); assertNull("title-id should be null", wizard.getTitleId());
assertNull("subtitle-id should be null", wizard.getSubTitleId());
assertNull("description-id should be null", wizard.getDescriptionId()); assertNull("description-id should be null", wizard.getDescriptionId());
// retrive step 1 config and check it is correct // retrive step 1 config and check it is correct
@@ -769,12 +788,13 @@ public class WebClientConfigTest extends BaseTest
assertEquals("name", "createSpace", wizard.getName()); assertEquals("name", "createSpace", wizard.getName());
assertEquals("createSpace steps", 3, wizard.getNumberSteps()); assertEquals("createSpace steps", 3, wizard.getNumberSteps());
assertEquals("managed-bean", "AdvancedSpaceWizard", wizard.getManagedBean()); 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("icon", "/images/icons/create_space_large.gif", wizard.getIcon());
assertEquals("title-id", "advanced_space_details_title", wizard.getTitleId()); 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("description-id", "advanced_space_details_description", wizard.getDescriptionId());
assertEquals("error-message-id", "error_create_space_wizard", wizard.getErrorMessageId()); assertEquals("error-message-id", "error_create_space_wizard", wizard.getErrorMessageId());
assertNull("title should be null", wizard.getTitle()); assertNull("title should be null", wizard.getTitle());
assertNull("subtitle should be null", wizard.getSubTitle());
assertNull("description should be null", wizard.getDescription()); assertNull("description should be null", wizard.getDescription());
List<StepConfig> steps = wizard.getStepsAsList(); List<StepConfig> steps = wizard.getStepsAsList();
assertNotNull("steps should not be null", steps); assertNotNull("steps should not be null", steps);

View File

@@ -164,17 +164,18 @@ public class WizardsConfigElement extends ConfigElementAdapter
*/ */
public static class WizardConfig extends AbstractConfig public static class WizardConfig extends AbstractConfig
{ {
protected String subTitle;
protected String subTitleId;
protected String name; protected String name;
protected String managedBean; protected String managedBean;
protected String icon; protected String icon;
protected String actionsConfigId;
protected String errorMsgId = "error_wizard"; protected String errorMsgId = "error_wizard";
protected Map<String, StepConfig> steps = new LinkedHashMap<String, StepConfig>(4); protected Map<String, StepConfig> steps = new LinkedHashMap<String, StepConfig>(4);
public WizardConfig(String name, String bean, public WizardConfig(String name, String bean, String icon,
String actionsConfigId, String icon,
String title, String titleId, String title, String titleId,
String subTitle, String subTitleId,
String description, String descriptionId, String description, String descriptionId,
String errorMsgId) String errorMsgId)
{ {
@@ -183,10 +184,11 @@ public class WizardsConfigElement extends ConfigElementAdapter
// check we have a name // check we have a name
ParameterCheck.mandatoryString("name", name); ParameterCheck.mandatoryString("name", name);
this.subTitle = subTitle;
this.subTitleId = subTitleId;
this.name = name; this.name = name;
this.managedBean = bean; this.managedBean = bean;
this.icon = icon; this.icon = icon;
this.actionsConfigId = actionsConfigId;
if (errorMsgId != null && errorMsgId.length() > 0) if (errorMsgId != null && errorMsgId.length() > 0)
{ {
@@ -204,16 +206,21 @@ public class WizardsConfigElement extends ConfigElementAdapter
return this.managedBean; return this.managedBean;
} }
public String getSubTitle()
{
return this.subTitle;
}
public String getSubTitleId()
{
return this.subTitleId;
}
public String getIcon() public String getIcon()
{ {
return this.icon; return this.icon;
} }
public String getActionsConfigId()
{
return this.actionsConfigId;
}
public String getErrorMessageId() public String getErrorMessageId()
{ {
return this.errorMsgId; return this.errorMsgId;
@@ -260,10 +267,11 @@ public class WizardsConfigElement extends ConfigElementAdapter
StringBuilder buffer = new StringBuilder(super.toString()); StringBuilder buffer = new StringBuilder(super.toString());
buffer.append(" (name=").append(this.name); buffer.append(" (name=").append(this.name);
buffer.append(" managed-bean=").append(this.managedBean); buffer.append(" managed-bean=").append(this.managedBean);
buffer.append(" actions-config-id=").append(this.actionsConfigId);
buffer.append(" icon=").append(this.icon); buffer.append(" icon=").append(this.icon);
buffer.append(" title=").append(this.title); buffer.append(" title=").append(this.title);
buffer.append(" titleId=").append(this.titleId); 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(" description=").append(this.description);
buffer.append(" descriptionId=").append(this.descriptionId); buffer.append(" descriptionId=").append(this.descriptionId);
buffer.append(" errorMsgId=").append(this.errorMsgId).append(")"); 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_NAME = "name";
public static final String ATTR_MANAGED_BEAN = "managed-bean"; 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_ICON = "icon";
public static final String ATTR_TITLE = "title"; public static final String ATTR_TITLE = "title";
public static final String ATTR_TITLE_ID = "title-id"; 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 = "description";
public static final String ATTR_DESCRIPTION_ID = "description-id"; public static final String ATTR_DESCRIPTION_ID = "description-id";
public static final String ATTR_INSTRUCTION = "instruction"; public static final String ATTR_INSTRUCTION = "instruction";
@@ -88,17 +89,19 @@ public class WizardsElementReader implements ConfigElementReader
String name = wizard.attributeValue(ATTR_NAME); String name = wizard.attributeValue(ATTR_NAME);
String bean = wizard.attributeValue(ATTR_MANAGED_BEAN); String bean = wizard.attributeValue(ATTR_MANAGED_BEAN);
String actions = wizard.attributeValue(ATTR_ACTIONS_CONFIG_ID);
String icon = wizard.attributeValue(ATTR_ICON); String icon = wizard.attributeValue(ATTR_ICON);
String title = wizard.attributeValue(ATTR_TITLE); String title = wizard.attributeValue(ATTR_TITLE);
String titleId = wizard.attributeValue(ATTR_TITLE_ID); 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 description = wizard.attributeValue(ATTR_DESCRIPTION);
String descriptionId = wizard.attributeValue(ATTR_DESCRIPTION_ID); String descriptionId = wizard.attributeValue(ATTR_DESCRIPTION_ID);
String errorMsgId = wizard.attributeValue(ATTR_ERROR_MSG_ID); String errorMsgId = wizard.attributeValue(ATTR_ERROR_MSG_ID);
// create the wizard config object // create the wizard config object
WizardsConfigElement.WizardConfig wizardCfg = new WizardsConfigElement.WizardConfig( 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); Iterator<Element> steps = wizard.elementIterator(ELEMENT_STEP);
while (steps.hasNext()) while (steps.hasNext())

View File

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

View File

@@ -96,7 +96,8 @@
<dialogs> <dialogs>
<dialog name="createSpace" page="/custom/my-create-space.jsp" managed-bean="MyNewSpaceDialog" <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> </dialogs>
</config> </config>

View File

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

View File

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