From 383c8028a03d82d86654ff0f77cec480f88fd8c0 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Tue, 18 Jul 2006 15:28:12 +0000 Subject: [PATCH] Merged V1.3 to HEAD (3064:3067) svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3064 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3067 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3341 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web/bean/spaces/CreateSpaceWizard.java | 30 ++++++++++++++++++- .../web/bean/wizard/BaseWizardBean.java | 10 +++++++ .../alfresco/web/bean/wizard/IWizardBean.java | 14 +++++++++ .../web/bean/wizard/WizardManager.java | 8 ++--- .../ui/common/component/data/UISortLink.java | 2 +- 5 files changed, 58 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java index ce66577e4c..6fffd00e31 100644 --- a/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java +++ b/source/java/org/alfresco/web/bean/spaces/CreateSpaceWizard.java @@ -95,6 +95,24 @@ public class CreateSpaceWizard extends BaseWizardBean this.saveAsTemplate = false; } + public String next() + { + // if the user has chosen to create the space from an existing + // space or from a template we need to find it's type to show + // the current set of icons. + if (this.createFrom.equals("existing") && this.existingSpaceId != null) + { + this.spaceType = this.nodeService.getType(this.existingSpaceId).toString(); + } + else if (this.createFrom.equals("template") && this.templateSpaceId != null) + { + NodeRef templateNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId); + this.spaceType = this.nodeService.getType(templateNode).toString(); + } + + return null; + } + @Override protected String finishImpl(FacesContext context, String outcome) throws Exception { @@ -611,6 +629,7 @@ public class CreateSpaceWizard extends BaseWizardBean // which the user can change during the advanced space wizard List icons = null; + List iconNames = new ArrayList(8); QName type = QName.createQName(this.spaceType); String typePrefixForm = type.toPrefixString(this.namespaceService); @@ -648,6 +667,7 @@ public class CreateSpaceWizard extends BaseWizardBean item.setValue(iconName); item.getAttributes().put("image", iconPath); icons.add(item); + iconNames.add(iconName); } } } @@ -660,9 +680,17 @@ public class CreateSpaceWizard extends BaseWizardBean this.icon = DEFAULT_SPACE_ICON_NAME; UIListItem item = new UIListItem(); - item.setValue("space-icon-default"); + item.setValue(DEFAULT_SPACE_ICON_NAME); item.getAttributes().put("image", "/images/icons/space-icon-default.gif"); icons.add(item); + iconNames.add(DEFAULT_SPACE_ICON_NAME); + } + + // make sure the current value for the icon is valid for the + // current list of icons about to be displayed + if (iconNames.contains(this.icon) == false) + { + this.icon = iconNames.get(0); } return icons; diff --git a/source/java/org/alfresco/web/bean/wizard/BaseWizardBean.java b/source/java/org/alfresco/web/bean/wizard/BaseWizardBean.java index 4ed69c1065..8d1a1e914f 100644 --- a/source/java/org/alfresco/web/bean/wizard/BaseWizardBean.java +++ b/source/java/org/alfresco/web/bean/wizard/BaseWizardBean.java @@ -15,6 +15,16 @@ public abstract class BaseWizardBean extends BaseDialogBean implements IWizardBe { private static final String MSG_NOT_SET = "value_not_set"; + public String next() + { + return null; + } + + public String back() + { + return null; + } + public boolean getNextButtonDisabled() { return false; diff --git a/source/java/org/alfresco/web/bean/wizard/IWizardBean.java b/source/java/org/alfresco/web/bean/wizard/IWizardBean.java index b1e436a495..d8f46a7f0e 100644 --- a/source/java/org/alfresco/web/bean/wizard/IWizardBean.java +++ b/source/java/org/alfresco/web/bean/wizard/IWizardBean.java @@ -9,6 +9,20 @@ import org.alfresco.web.bean.dialog.IDialogBean; */ public interface IWizardBean extends IDialogBean { + /** + * Called when the next button is pressed by the user + * + * @return Reserved for future use + */ + public String next(); + + /** + * Called when the back button is pressed by the user + * + * @return Reserved for future use + */ + public String back(); + /** * Returns the label to use for the next button * diff --git a/source/java/org/alfresco/web/bean/wizard/WizardManager.java b/source/java/org/alfresco/web/bean/wizard/WizardManager.java index 79c587f8c7..f708413da4 100644 --- a/source/java/org/alfresco/web/bean/wizard/WizardManager.java +++ b/source/java/org/alfresco/web/bean/wizard/WizardManager.java @@ -412,8 +412,8 @@ public class WizardManager if (logger.isDebugEnabled()) logger.debug("next called, current step is now: " + this.currentStep); - // TODO: place a hook in here to call the wizard bean so it can override - // what step comes next thus overrriding the wizard manager + // tell the wizard the next button has been pressed + this.currentWizard.next(); determineCurrentPage(); } @@ -430,8 +430,8 @@ public class WizardManager if (logger.isDebugEnabled()) logger.debug("back called, current step is now: " + this.currentStep); - // TODO: place a hook in here to call the wizard bean so it can override - // what step comes next thus overrriding the wizard manager + // tell the wizard the back button has been pressed + this.currentWizard.back(); determineCurrentPage(); } diff --git a/source/java/org/alfresco/web/ui/common/component/data/UISortLink.java b/source/java/org/alfresco/web/ui/common/component/data/UISortLink.java index 66ce576ff4..26befaef28 100644 --- a/source/java/org/alfresco/web/ui/common/component/data/UISortLink.java +++ b/source/java/org/alfresco/web/ui/common/component/data/UISortLink.java @@ -65,7 +65,7 @@ public class UISortLink extends UICommand boolean bPreviouslySorted = false; boolean descending = true; String lastSortedColumn = dataContainer.getCurrentSortColumn(); - if (lastSortedColumn.equals(getValue())) + if (lastSortedColumn != null && lastSortedColumn.equals(getValue())) { descending = !dataContainer.isCurrentSortDescending(); bPreviouslySorted = true;