- Added error-message-id attribute to dialog and wizard framework

- Added error component to container pages
- Removed error component from each dialog/wizard page
- Fixed problem where dialog or wizard would not work after an error

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2872 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-05-12 12:40:16 +00:00
parent af93c5f1af
commit 02cb2ac1e7
22 changed files with 76 additions and 66 deletions

View File

@@ -130,11 +130,13 @@ public class DialogsConfigElement extends ConfigElementAdapter
protected String titleId;
protected String description;
protected String descriptionId;
protected String errorMsgId = "error_dialog";
public DialogConfig(String name, String page, String bean,
String actionsConfigId, String icon,
String title, String titleId,
String description, String descriptionId)
String description, String descriptionId,
String errorMsgId)
{
// check the mandatory parameters are present
ParameterCheck.mandatoryString("name", name);
@@ -150,6 +152,11 @@ public class DialogsConfigElement extends ConfigElementAdapter
this.titleId = titleId;
this.description = description;
this.descriptionId = descriptionId;
if (errorMsgId != null && errorMsgId.length() > 0)
{
this.errorMsgId = errorMsgId;
}
}
public String getDescription()
@@ -197,6 +204,11 @@ public class DialogsConfigElement extends ConfigElementAdapter
return this.titleId;
}
public String getErrorMessageId()
{
return this.errorMsgId;
}
/**
* @see java.lang.Object#toString()
*/
@@ -212,7 +224,8 @@ public class DialogsConfigElement extends ConfigElementAdapter
buffer.append(" title=").append(this.title);
buffer.append(" titleId=").append(this.titleId);
buffer.append(" description=").append(this.description);
buffer.append(" descriptionId=").append(this.descriptionId).append(")");
buffer.append(" descriptionId=").append(this.descriptionId);
buffer.append(" errorMsgId=").append(this.errorMsgId).append(")");
return buffer.toString();
}
}

View File

@@ -41,6 +41,7 @@ public class DialogsElementReader implements ConfigElementReader
public static final String ATTR_TITLE_ID = "title-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";
/**
* @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
@@ -76,10 +77,11 @@ public class DialogsElementReader implements ConfigElementReader
String titleId = item.attributeValue(ATTR_TITLE_ID);
String description = item.attributeValue(ATTR_DESCRIPTION);
String descriptionId = item.attributeValue(ATTR_DESCRIPTION_ID);
String errorMsgId = item.attributeValue(ATTR_ERROR_MSG_ID);
DialogsConfigElement.DialogConfig cfg = new DialogsConfigElement.DialogConfig(
name, page, bean, actions, icon, title, titleId, description,
descriptionId);
descriptionId, errorMsgId);
configElement.addDialog(cfg);
}

View File

@@ -656,6 +656,7 @@ public class WebClientConfigTest extends BaseTest
assertEquals("icon", "/images/icons/create_space_large.gif", dialog.getIcon());
assertEquals("title-id", "create_space_title", dialog.getTitleId());
assertEquals("description-id", "create_space_description", dialog.getDescriptionId());
assertEquals("error-message-id", "error_create_space_dialog", dialog.getErrorMessageId());
assertNull("title should be null", dialog.getTitle());
assertNull("description should be null", dialog.getDescription());
@@ -671,6 +672,7 @@ public class WebClientConfigTest extends BaseTest
assertEquals("icon", "/images/icons/create_space_large.gif", dialog.getIcon());
assertEquals("title", "Space Details Dialog", dialog.getTitle());
assertEquals("description", "Space Details Dialog Decsription", dialog.getDescription());
assertEquals("error-message-id", "error_dialog", dialog.getErrorMessageId());
assertNull("title-id should be null", dialog.getTitleId());
assertNull("description-id should be null", dialog.getDescriptionId());
}
@@ -741,6 +743,7 @@ public class WebClientConfigTest extends BaseTest
assertEquals("icon", "/images/icons/example-logo.gif", wizard.getIcon());
assertEquals("title", "Example Wizard Title", wizard.getTitle());
assertEquals("description", "Example Wizard Description", wizard.getDescription());
assertEquals("error-message-id", "error_wizard", wizard.getErrorMessageId());
assertNull("title-id should be null", wizard.getTitleId());
assertNull("description-id should be null", wizard.getDescriptionId());
@@ -760,6 +763,7 @@ public class WebClientConfigTest extends BaseTest
assertEquals("icon", "/images/icons/create_space_large.gif", wizard.getIcon());
assertEquals("title-id", "advanced_space_details_title", wizard.getTitleId());
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("description should be null", wizard.getDescription());
List<StepConfig> steps = wizard.getStepsAsList();

View File

@@ -160,12 +160,15 @@ public class WizardsConfigElement extends ConfigElementAdapter
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,
String title, String titleId,
String description, String descriptionId)
String description, String descriptionId,
String errorMsgId)
{
super(title, titleId, description, descriptionId);
@@ -176,6 +179,11 @@ public class WizardsConfigElement extends ConfigElementAdapter
this.managedBean = bean;
this.icon = icon;
this.actionsConfigId = actionsConfigId;
if (errorMsgId != null && errorMsgId.length() > 0)
{
this.errorMsgId = errorMsgId;
}
}
public String getName()
@@ -198,6 +206,11 @@ public class WizardsConfigElement extends ConfigElementAdapter
return this.actionsConfigId;
}
public String getErrorMessageId()
{
return this.errorMsgId;
}
public int getNumberSteps()
{
return this.steps.size();
@@ -244,7 +257,8 @@ public class WizardsConfigElement extends ConfigElementAdapter
buffer.append(" title=").append(this.title);
buffer.append(" titleId=").append(this.titleId);
buffer.append(" description=").append(this.description);
buffer.append(" descriptionId=").append(this.descriptionId).append(")");
buffer.append(" descriptionId=").append(this.descriptionId);
buffer.append(" errorMsgId=").append(this.errorMsgId).append(")");
return buffer.toString();
}
}

View File

@@ -49,6 +49,7 @@ public class WizardsElementReader implements ConfigElementReader
public static final String ATTR_DESCRIPTION_ID = "description-id";
public static final String ATTR_INSTRUCTION = "instruction";
public static final String ATTR_INSTRUCTION_ID = "instruction-id";
public static final String ATTR_ERROR_MSG_ID = "error-message-id";
public static final String ATTR_IF = "if";
public static final String ATTR_PATH = "path";
@@ -85,10 +86,11 @@ public class WizardsElementReader implements ConfigElementReader
String titleId = wizard.attributeValue(ATTR_TITLE_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);
name, bean, actions, icon, title, titleId, description, descriptionId, errorMsgId);
Iterator<Element> steps = wizard.elementIterator(ELEMENT_STEP);
while (steps.hasNext())