mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Completion of dialog and wizard frameworks also converted advanced space wizard and create space dialog to the new frameworks.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2615 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -84,16 +84,6 @@ public class DialogsConfigElement extends ConfigElementAdapter
|
||||
return combined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a dialog
|
||||
*
|
||||
* @param dialogConfig A pre-configured dialog config object
|
||||
*/
|
||||
/*package*/ void addDialog(DialogConfig dialogConfig)
|
||||
{
|
||||
this.dialogs.put(dialogConfig.getName(), dialogConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the named dialog
|
||||
*
|
||||
@@ -114,6 +104,16 @@ public class DialogsConfigElement extends ConfigElementAdapter
|
||||
return this.dialogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a dialog
|
||||
*
|
||||
* @param dialogConfig A pre-configured dialog config object
|
||||
*/
|
||||
/*package*/ void addDialog(DialogConfig dialogConfig)
|
||||
{
|
||||
this.dialogs.put(dialogConfig.getName(), dialogConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inner class representing the configuration of a single dialog
|
||||
*
|
||||
@@ -124,14 +124,16 @@ public class DialogsConfigElement extends ConfigElementAdapter
|
||||
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;
|
||||
|
||||
public DialogConfig(String name, String page, String bean,
|
||||
String icon, String title, String titleId,
|
||||
public DialogConfig(String name, String page, String bean,
|
||||
String actionsConfigId, String icon,
|
||||
String title, String titleId,
|
||||
String description, String descriptionId)
|
||||
{
|
||||
// check the mandatory parameters are present
|
||||
@@ -142,6 +144,7 @@ public class DialogsConfigElement extends ConfigElementAdapter
|
||||
this.name = name;
|
||||
this.page = page;
|
||||
this.managedBean = bean;
|
||||
this.actionsConfigId = actionsConfigId;
|
||||
this.icon = icon;
|
||||
this.title = title;
|
||||
this.titleId = titleId;
|
||||
@@ -164,6 +167,11 @@ public class DialogsConfigElement extends ConfigElementAdapter
|
||||
return this.managedBean;
|
||||
}
|
||||
|
||||
public String getActionsConfigId()
|
||||
{
|
||||
return this.actionsConfigId;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
@@ -199,6 +207,7 @@ public class DialogsConfigElement extends ConfigElementAdapter
|
||||
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);
|
||||
|
@@ -35,6 +35,7 @@ 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";
|
||||
@@ -69,6 +70,7 @@ 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);
|
||||
@@ -76,7 +78,8 @@ public class DialogsElementReader implements ConfigElementReader
|
||||
String descriptionId = item.attributeValue(ATTR_DESCRIPTION_ID);
|
||||
|
||||
DialogsConfigElement.DialogConfig cfg = new DialogsConfigElement.DialogConfig(
|
||||
name, page, bean, icon, title, titleId, description, descriptionId);
|
||||
name, page, bean, actions, icon, title, titleId, description,
|
||||
descriptionId);
|
||||
|
||||
configElement.addDialog(cfg);
|
||||
}
|
||||
|
@@ -618,6 +618,8 @@ 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("description-id", "create_space_description", dialog.getDescriptionId());
|
||||
assertNull("title should be null", dialog.getTitle());
|
||||
@@ -631,6 +633,8 @@ 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("description", "Space Details Dialog Decsription", dialog.getDescription());
|
||||
assertNull("title-id should be null", dialog.getTitleId());
|
||||
@@ -699,16 +703,27 @@ 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("description", "Example Wizard Description", wizard.getDescription());
|
||||
assertNull("title-id should be null", wizard.getTitleId());
|
||||
assertNull("description-id should be null", wizard.getDescriptionId());
|
||||
|
||||
// retrive step 1 config and check it is correct
|
||||
Map<String, StepConfig> stepsMap = wizard.getSteps();
|
||||
StepConfig step1 = stepsMap.get("details");
|
||||
assertNotNull("step 1 of example wizard should not be null", step1);
|
||||
assertEquals("step title", "Details", step1.getTitle());
|
||||
assertNull("step 1 title-id should be null", step1.getTitleId());
|
||||
|
||||
// get the 'createSpace' wizard and ensure all the data is correct
|
||||
wizard = wizardsElement.getWizard("createSpace");
|
||||
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("description-id", "advanced_space_details_description", wizard.getDescriptionId());
|
||||
assertNull("title should be null", wizard.getTitle());
|
||||
@@ -717,8 +732,9 @@ public class WebClientConfigTest extends BaseTest
|
||||
assertNotNull("steps should not be null", steps);
|
||||
|
||||
// retrieve step1 information and check it is correct
|
||||
StepConfig step1 = steps.get(0);
|
||||
step1 = steps.get(0);
|
||||
assertEquals("step 1 name", "details", step1.getName());
|
||||
assertEquals("step 1 title-id", "starting_space", step1.getTitleId());
|
||||
assertFalse("step 1 should not have conditional pages", step1.hasConditionalPages());
|
||||
PageConfig step1Page = step1.getDefaultPage();
|
||||
assertNotNull("step1Page should not be null", step1Page);
|
||||
@@ -732,6 +748,7 @@ public class WebClientConfigTest extends BaseTest
|
||||
// check the conditional step2 data
|
||||
StepConfig step2 = steps.get(1);
|
||||
assertEquals("step 2 name", "properties", step2.getName());
|
||||
assertEquals("step 2 title-id", "space_options", step2.getTitleId());
|
||||
assertTrue("step 2 should have conditional pages", step2.hasConditionalPages());
|
||||
PageConfig step2DefaultPage = step2.getDefaultPage();
|
||||
assertNotNull("step 2 default page should not be null", step2DefaultPage);
|
||||
@@ -756,6 +773,7 @@ public class WebClientConfigTest extends BaseTest
|
||||
// check step 3 data
|
||||
StepConfig step3 = steps.get(2);
|
||||
assertEquals("step 3 name", "summary", step3.getName());
|
||||
assertEquals("step 3 title-id", "summary", step3.getTitleId());
|
||||
assertFalse("step 3 should not have conditional pages", step3.hasConditionalPages());
|
||||
PageConfig step3Page = step3.getDefaultPage();
|
||||
assertNotNull("step3Page should not be null", step3Page);
|
||||
|
@@ -85,16 +85,6 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
return combined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a wizard
|
||||
*
|
||||
* @param wizardConfig A pre-configured wizard config object
|
||||
*/
|
||||
/*package*/ void addWizard(WizardConfig wizardConfig)
|
||||
{
|
||||
this.wizards.put(wizardConfig.getName(), wizardConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the named wizard
|
||||
*
|
||||
@@ -114,6 +104,16 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
return this.wizards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a wizard
|
||||
*
|
||||
* @param wizardConfig A pre-configured wizard config object
|
||||
*/
|
||||
/*package*/ void addWizard(WizardConfig wizardConfig)
|
||||
{
|
||||
this.wizards.put(wizardConfig.getName(), wizardConfig);
|
||||
}
|
||||
|
||||
public abstract static class AbstractConfig
|
||||
{
|
||||
protected String title;
|
||||
@@ -159,9 +159,11 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
protected String name;
|
||||
protected String managedBean;
|
||||
protected String icon;
|
||||
protected String actionsConfigId;
|
||||
protected Map<String, StepConfig> steps = new LinkedHashMap<String, StepConfig>(4);
|
||||
|
||||
public WizardConfig(String name, String bean, String icon,
|
||||
public WizardConfig(String name, String bean,
|
||||
String actionsConfigId, String icon,
|
||||
String title, String titleId,
|
||||
String description, String descriptionId)
|
||||
{
|
||||
@@ -173,6 +175,7 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
this.name = name;
|
||||
this.managedBean = bean;
|
||||
this.icon = icon;
|
||||
this.actionsConfigId = actionsConfigId;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
@@ -190,9 +193,9 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
public void addStep(StepConfig step)
|
||||
public String getActionsConfigId()
|
||||
{
|
||||
this.steps.put(step.getName(), step);
|
||||
return this.actionsConfigId;
|
||||
}
|
||||
|
||||
public int getNumberSteps()
|
||||
@@ -222,6 +225,11 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
return this.steps.get(name);
|
||||
}
|
||||
|
||||
/*package*/ void addStep(StepConfig step)
|
||||
{
|
||||
this.steps.put(step.getName(), step);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@@ -231,6 +239,7 @@ 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);
|
||||
@@ -347,18 +356,28 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
* Represents the configuration of a step in a wizard
|
||||
* i.e. the <step> element.
|
||||
*/
|
||||
public static class StepConfig
|
||||
public static class StepConfig extends AbstractConfig
|
||||
{
|
||||
protected String name;
|
||||
protected PageConfig defaultPage;
|
||||
protected List<ConditionalPageConfig> conditionalPages =
|
||||
new ArrayList<ConditionalPageConfig>(3);
|
||||
|
||||
public StepConfig(String name)
|
||||
public StepConfig(String name,
|
||||
String title, String titleId,
|
||||
String description, String descriptionId)
|
||||
{
|
||||
super(title, titleId, description, descriptionId);
|
||||
|
||||
// check we have a name
|
||||
ParameterCheck.mandatoryString("name", name);
|
||||
|
||||
// check we have a title
|
||||
if (this.title == null && this.titleId == null)
|
||||
{
|
||||
throw new IllegalArgumentException("A title or title-id attribute must be supplied for a step");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -367,11 +386,6 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setDefaultPage(PageConfig page)
|
||||
{
|
||||
this.defaultPage = page;
|
||||
}
|
||||
|
||||
public PageConfig getDefaultPage()
|
||||
{
|
||||
return this.defaultPage;
|
||||
@@ -382,14 +396,19 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
return (this.conditionalPages.size() > 0);
|
||||
}
|
||||
|
||||
public void addConditionalPage(ConditionalPageConfig conditionalPage)
|
||||
public List<ConditionalPageConfig> getConditionalPages()
|
||||
{
|
||||
return this.conditionalPages;
|
||||
}
|
||||
|
||||
/*package*/ void addConditionalPage(ConditionalPageConfig conditionalPage)
|
||||
{
|
||||
this.conditionalPages.add(conditionalPage);
|
||||
}
|
||||
|
||||
public List<ConditionalPageConfig> getConditionalPages()
|
||||
/*package*/ void setDefaultPage(PageConfig page)
|
||||
{
|
||||
return this.conditionalPages;
|
||||
this.defaultPage = page;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,6 +419,10 @@ public class WizardsConfigElement extends ConfigElementAdapter
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder(super.toString());
|
||||
buffer.append(" (name=").append(this.name);
|
||||
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(" defaultPage=").append(this.defaultPage);
|
||||
buffer.append(" conditionalPages=").append(this.conditionalPages).append(")");
|
||||
return buffer.toString();
|
||||
|
@@ -41,6 +41,7 @@ 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";
|
||||
@@ -78,6 +79,7 @@ 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);
|
||||
@@ -86,7 +88,7 @@ public class WizardsElementReader implements ConfigElementReader
|
||||
|
||||
// create the wizard config object
|
||||
WizardsConfigElement.WizardConfig wizardCfg = new WizardsConfigElement.WizardConfig(
|
||||
name, bean, icon, title, titleId, description, descriptionId);
|
||||
name, bean, actions, icon, title, titleId, description, descriptionId);
|
||||
|
||||
Iterator<Element> steps = wizard.elementIterator(ELEMENT_STEP);
|
||||
while (steps.hasNext())
|
||||
@@ -111,7 +113,13 @@ public class WizardsElementReader implements ConfigElementReader
|
||||
protected StepConfig parseStep(Element step)
|
||||
{
|
||||
// get the name of the step and create the config object
|
||||
StepConfig stepCfg = new StepConfig(step.attributeValue(ATTR_NAME));
|
||||
String stepName = step.attributeValue(ATTR_NAME);
|
||||
String stepTitle = step.attributeValue(ATTR_TITLE);
|
||||
String stepTitleId = step.attributeValue(ATTR_TITLE_ID);
|
||||
String stepDescription = step.attributeValue(ATTR_DESCRIPTION);
|
||||
String stepDescriptionId = step.attributeValue(ATTR_DESCRIPTION_ID);
|
||||
StepConfig stepCfg = new StepConfig(stepName, stepTitle, stepTitleId,
|
||||
stepDescription, stepDescriptionId);
|
||||
|
||||
// find and parse the default page
|
||||
Element defaultPageElem = step.element(ELEMENT_PAGE);
|
||||
|
Reference in New Issue
Block a user