mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,117 +1,117 @@
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
/**
|
||||
* Base class for all wizard beans providing common functionality
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public abstract class BaseWizardBean extends BaseDialogBean implements IWizardBean
|
||||
{
|
||||
private static final String MSG_NOT_SET = "value_not_set";
|
||||
|
||||
public String next()
|
||||
{
|
||||
if (isFinished())
|
||||
{
|
||||
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"error_wizard_completed_already"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String back()
|
||||
{
|
||||
if (isFinished())
|
||||
{
|
||||
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"error_wizard_completed_already"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getNextButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getNextButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "next_button");
|
||||
}
|
||||
|
||||
public String getBackButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "back_button");
|
||||
}
|
||||
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "finish_button");
|
||||
}
|
||||
|
||||
public String getStepTitle()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getStepDescription()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build summary table from the specified list of Labels and Values
|
||||
*
|
||||
* @param labels Array of labels to display
|
||||
* @param values Array of values to display
|
||||
*
|
||||
* @return summary table HTML
|
||||
*/
|
||||
protected String buildSummary(String[] labels, String[] values)
|
||||
{
|
||||
if (labels == null || values == null || labels.length != values.length)
|
||||
{
|
||||
throw new IllegalArgumentException("Labels and Values passed to summary must be valid and of equal length.");
|
||||
}
|
||||
|
||||
String msg = Application.getMessage(FacesContext.getCurrentInstance(), MSG_NOT_SET);
|
||||
String notSetMsg = "<" + msg + ">";
|
||||
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
|
||||
buf.append("<table cellspacing='4' cellpadding='2' border='0' class='summary'>");
|
||||
for (int i=0; i<labels.length; i++)
|
||||
{
|
||||
String value = values[i];
|
||||
buf.append("<tr><td valign='top'><b>");
|
||||
buf.append(labels[i]);
|
||||
buf.append(":</b></td><td>");
|
||||
buf.append(value != null ? value : notSetMsg);
|
||||
buf.append("</td></tr>");
|
||||
}
|
||||
buf.append("</table>");
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultCancelOutcome()
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFinishOutcome()
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||
}
|
||||
}
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
|
||||
/**
|
||||
* Base class for all wizard beans providing common functionality
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public abstract class BaseWizardBean extends BaseDialogBean implements IWizardBean
|
||||
{
|
||||
private static final String MSG_NOT_SET = "value_not_set";
|
||||
|
||||
public String next()
|
||||
{
|
||||
if (isFinished())
|
||||
{
|
||||
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"error_wizard_completed_already"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String back()
|
||||
{
|
||||
if (isFinished())
|
||||
{
|
||||
Utils.addErrorMessage(Application.getMessage(FacesContext.getCurrentInstance(),
|
||||
"error_wizard_completed_already"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getNextButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getNextButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "next_button");
|
||||
}
|
||||
|
||||
public String getBackButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "back_button");
|
||||
}
|
||||
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "finish_button");
|
||||
}
|
||||
|
||||
public String getStepTitle()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getStepDescription()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build summary table from the specified list of Labels and Values
|
||||
*
|
||||
* @param labels Array of labels to display
|
||||
* @param values Array of values to display
|
||||
*
|
||||
* @return summary table HTML
|
||||
*/
|
||||
protected String buildSummary(String[] labels, String[] values)
|
||||
{
|
||||
if (labels == null || values == null || labels.length != values.length)
|
||||
{
|
||||
throw new IllegalArgumentException("Labels and Values passed to summary must be valid and of equal length.");
|
||||
}
|
||||
|
||||
String msg = Application.getMessage(FacesContext.getCurrentInstance(), MSG_NOT_SET);
|
||||
String notSetMsg = "<" + msg + ">";
|
||||
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
|
||||
buf.append("<table cellspacing='4' cellpadding='2' border='0' class='summary'>");
|
||||
for (int i=0; i<labels.length; i++)
|
||||
{
|
||||
String value = values[i];
|
||||
buf.append("<tr><td valign='top'><b>");
|
||||
buf.append(labels[i]);
|
||||
buf.append(":</b></td><td>");
|
||||
buf.append(value != null ? value : notSetMsg);
|
||||
buf.append("</td></tr>");
|
||||
}
|
||||
buf.append("</table>");
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultCancelOutcome()
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultFinishOutcome()
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_WIZARD_OUTCOME;
|
||||
}
|
||||
}
|
||||
|
@@ -1,64 +1,64 @@
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import org.alfresco.web.bean.dialog.IDialogBean;
|
||||
|
||||
/**
|
||||
* Interface that defines the contract for a wizard backing bean
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @return The next button label
|
||||
*/
|
||||
public String getNextButtonLabel();
|
||||
|
||||
/**
|
||||
* Returns the label to use for the back button
|
||||
*
|
||||
* @return The back button label
|
||||
*/
|
||||
public String getBackButtonLabel();
|
||||
|
||||
/**
|
||||
* Determines whether the next button on the wizard should be disabled
|
||||
*
|
||||
* @return true if the button should be disabled
|
||||
*/
|
||||
public boolean getNextButtonDisabled();
|
||||
|
||||
/**
|
||||
* Returns the title to be used for the current step
|
||||
* <p>If this returns <tt>null</tt> the WizardManager will
|
||||
* lookup the title via the dialog configuration</p>
|
||||
*
|
||||
* @return The title or <tt>null</tt> if the title is to be acquired via configuration
|
||||
*/
|
||||
public String getStepTitle();
|
||||
|
||||
/**
|
||||
* Returns the description to be used for the current step
|
||||
* <p>If this returns <tt>null</tt> the WizardManager will
|
||||
* lookup the description via the dialog configuration</p>
|
||||
*
|
||||
* @return The decsription or <tt>null</tt> if the title is to be acquired via configuration
|
||||
*/
|
||||
public String getStepDescription();
|
||||
}
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import org.alfresco.web.bean.dialog.IDialogBean;
|
||||
|
||||
/**
|
||||
* Interface that defines the contract for a wizard backing bean
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @return The next button label
|
||||
*/
|
||||
public String getNextButtonLabel();
|
||||
|
||||
/**
|
||||
* Returns the label to use for the back button
|
||||
*
|
||||
* @return The back button label
|
||||
*/
|
||||
public String getBackButtonLabel();
|
||||
|
||||
/**
|
||||
* Determines whether the next button on the wizard should be disabled
|
||||
*
|
||||
* @return true if the button should be disabled
|
||||
*/
|
||||
public boolean getNextButtonDisabled();
|
||||
|
||||
/**
|
||||
* Returns the title to be used for the current step
|
||||
* <p>If this returns <tt>null</tt> the WizardManager will
|
||||
* lookup the title via the dialog configuration</p>
|
||||
*
|
||||
* @return The title or <tt>null</tt> if the title is to be acquired via configuration
|
||||
*/
|
||||
public String getStepTitle();
|
||||
|
||||
/**
|
||||
* Returns the description to be used for the current step
|
||||
* <p>If this returns <tt>null</tt> the WizardManager will
|
||||
* lookup the description via the dialog configuration</p>
|
||||
*
|
||||
* @return The decsription or <tt>null</tt> if the title is to be acquired via configuration
|
||||
*/
|
||||
public String getStepDescription();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,116 +1,116 @@
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.config.WizardsConfigElement.PageConfig;
|
||||
import org.alfresco.web.config.WizardsConfigElement.StepConfig;
|
||||
import org.alfresco.web.config.WizardsConfigElement.WizardConfig;
|
||||
|
||||
/**
|
||||
* Object responsible for holding the current state of an active wizard.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public final class WizardState implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6816474382767569256L;
|
||||
|
||||
private int currentStep = 1;
|
||||
private PageConfig currentPageCfg;
|
||||
private WizardConfig config;
|
||||
private IWizardBean wizard;
|
||||
private List<StepConfig> steps;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*
|
||||
* @param config The configuration for the wizard
|
||||
* @param wizard The wizard bean instance
|
||||
*/
|
||||
public WizardState(WizardConfig config, IWizardBean wizard)
|
||||
{
|
||||
this.config = config;
|
||||
this.wizard = wizard;
|
||||
|
||||
this.steps = this.config.getStepsAsList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the configuration for the current page of the wizard
|
||||
*
|
||||
* @param currentPageCfg The configuration
|
||||
*/
|
||||
public void setCurrentPageCfg(PageConfig currentPageCfg)
|
||||
{
|
||||
this.currentPageCfg = currentPageCfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current step the wizard is on
|
||||
*
|
||||
* @param currentStep The current step number
|
||||
*/
|
||||
public void setCurrentStep(int currentStep)
|
||||
{
|
||||
this.currentStep = currentStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the wizard bean instance
|
||||
*
|
||||
* @return The wizard bean instance
|
||||
*/
|
||||
public IWizardBean getWizard()
|
||||
{
|
||||
return this.wizard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration for the current wizard
|
||||
*
|
||||
* @return The wizard configuration
|
||||
*/
|
||||
public WizardConfig getConfig()
|
||||
{
|
||||
return this.config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration for the current page of the wizard
|
||||
*
|
||||
* @return The current page configuration
|
||||
*/
|
||||
public PageConfig getCurrentPageCfg()
|
||||
{
|
||||
return currentPageCfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current step the wizard is on
|
||||
*
|
||||
* @return The current wizard step
|
||||
*/
|
||||
public int getCurrentStep()
|
||||
{
|
||||
return currentStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of steps the wizard has
|
||||
*
|
||||
* @return List of wizard steps
|
||||
*/
|
||||
public List<StepConfig> getSteps()
|
||||
{
|
||||
return steps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return AlfrescoNavigationHandler.WIZARD_PREFIX + this.config.getName() +
|
||||
"[" + this.currentStep + "]";
|
||||
}
|
||||
}
|
||||
package org.alfresco.web.bean.wizard;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.config.WizardsConfigElement.PageConfig;
|
||||
import org.alfresco.web.config.WizardsConfigElement.StepConfig;
|
||||
import org.alfresco.web.config.WizardsConfigElement.WizardConfig;
|
||||
|
||||
/**
|
||||
* Object responsible for holding the current state of an active wizard.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public final class WizardState implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6816474382767569256L;
|
||||
|
||||
private int currentStep = 1;
|
||||
private PageConfig currentPageCfg;
|
||||
private WizardConfig config;
|
||||
private IWizardBean wizard;
|
||||
private List<StepConfig> steps;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*
|
||||
* @param config The configuration for the wizard
|
||||
* @param wizard The wizard bean instance
|
||||
*/
|
||||
public WizardState(WizardConfig config, IWizardBean wizard)
|
||||
{
|
||||
this.config = config;
|
||||
this.wizard = wizard;
|
||||
|
||||
this.steps = this.config.getStepsAsList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the configuration for the current page of the wizard
|
||||
*
|
||||
* @param currentPageCfg The configuration
|
||||
*/
|
||||
public void setCurrentPageCfg(PageConfig currentPageCfg)
|
||||
{
|
||||
this.currentPageCfg = currentPageCfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current step the wizard is on
|
||||
*
|
||||
* @param currentStep The current step number
|
||||
*/
|
||||
public void setCurrentStep(int currentStep)
|
||||
{
|
||||
this.currentStep = currentStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the wizard bean instance
|
||||
*
|
||||
* @return The wizard bean instance
|
||||
*/
|
||||
public IWizardBean getWizard()
|
||||
{
|
||||
return this.wizard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration for the current wizard
|
||||
*
|
||||
* @return The wizard configuration
|
||||
*/
|
||||
public WizardConfig getConfig()
|
||||
{
|
||||
return this.config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration for the current page of the wizard
|
||||
*
|
||||
* @return The current page configuration
|
||||
*/
|
||||
public PageConfig getCurrentPageCfg()
|
||||
{
|
||||
return currentPageCfg;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current step the wizard is on
|
||||
*
|
||||
* @return The current wizard step
|
||||
*/
|
||||
public int getCurrentStep()
|
||||
{
|
||||
return currentStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of steps the wizard has
|
||||
*
|
||||
* @return List of wizard steps
|
||||
*/
|
||||
public List<StepConfig> getSteps()
|
||||
{
|
||||
return steps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return AlfrescoNavigationHandler.WIZARD_PREFIX + this.config.getName() +
|
||||
"[" + this.currentStep + "]";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user