- Added dynamic title and description support to dialog and wizard framework

- Rationalised debugging through workfllow pages

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3651 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-09-01 14:07:31 +00:00
parent d8b436a22a
commit ac3ef0585a
10 changed files with 131 additions and 45 deletions

View File

@@ -93,12 +93,11 @@
<dialog name="manageTask" page="/jsp/workflow/manage-task-dialog.jsp"
managed-bean="ManageTaskDialog" icon="/images/icons/manage_workflow_task_large.gif"
title-id="manage_task_title" description-id="manage_task_desc" />
description-id="manage_task_desc" />
<dialog name="viewCompletedTask" page="/jsp/workflow/view-completed-task-dialog.jsp"
managed-bean="ViewCompletedTaskDialog" icon="/images/icons/completed_workflow_task_large.gif"
title-id="view_completed_task_title" description-id="view_completed_task_desc"
show-ok-button="false" />
description-id="view_completed_task_desc" show-ok-button="false" />
<dialog name="cancelWorkflow" page="/jsp/workflow/cancel-workflow-dialog.jsp"
managed-bean="CancelWorkflowDialog" icon="/images/icons/cancel_workflow_large.gif"

View File

@@ -130,6 +130,16 @@ public abstract class BaseDialogBean implements IDialogBean
return true;
}
public String getTitle()
{
return null;
}
public String getDescription()
{
return null;
}
/**
* @param browseBean The BrowseBean to set.
*/

View File

@@ -140,7 +140,13 @@ public final class DialogManager
*/
public String getTitle()
{
String title = this.currentDialogState.getConfig().getTitleId();
// try and get the title directly from the dialog
String title = this.currentDialogState.getDialog().getTitle();
if (title == null)
{
// try and get the title via a message bundle key
title = this.currentDialogState.getConfig().getTitleId();
if (title != null)
{
@@ -148,8 +154,10 @@ public final class DialogManager
}
else
{
// try and get the title from the configuration
title = this.currentDialogState.getConfig().getTitle();
}
}
return title;
}
@@ -161,7 +169,13 @@ public final class DialogManager
*/
public String getDescription()
{
String desc = this.currentDialogState.getConfig().getDescriptionId();
// try and get the description directly from the dialog
String desc = this.currentDialogState.getDialog().getDescription();
if (desc == null)
{
// try and get the description via a message bundle key
desc = this.currentDialogState.getConfig().getDescriptionId();
if (desc != null)
{
@@ -169,8 +183,10 @@ public final class DialogManager
}
else
{
// try and get the description from the configuration
desc = this.currentDialogState.getConfig().getDescription();
}
}
return desc;
}

View File

@@ -65,4 +65,22 @@ public interface IDialogBean
* @return true if the button should be disabled
*/
public boolean getFinishButtonDisabled();
/**
* Returns the title to be used for the dialog
* <p>If this returns null the DialogManager will
* lookup the title via the dialog configuration</p>
*
* @return The title or null if the title is to be acquired via configuration
*/
public String getTitle();
/**
* Returns the description to be used for the dialog
* <p>If this returns null the DialogManager will
* lookup the description via the dialog configuration</p>
*
* @return The title or null if the title is to be acquired via configuration
*/
public String getDescription();
}

View File

@@ -58,9 +58,6 @@ public class TransientNode extends Node
// initialise the node
initNode(data);
if (logger.isDebugEnabled())
logger.debug("Constructed transient node: " + this);
}
/**

View File

@@ -12,7 +12,6 @@ import javax.faces.event.ActionEvent;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.dialog.DialogState;
import org.alfresco.web.config.WizardsConfigElement.ConditionalPageConfig;
import org.alfresco.web.config.WizardsConfigElement.PageConfig;
import org.alfresco.web.config.WizardsConfigElement.StepConfig;
@@ -152,7 +151,13 @@ public final class WizardManager
*/
public String getTitle()
{
String title = this.currentWizardState.getConfig().getTitleId();
// try and get the title directly from the wizard
String title = this.currentWizardState.getWizard().getTitle();
if (title == null)
{
// try and get the title via a message bundle key
title = this.currentWizardState.getConfig().getTitleId();
if (title != null)
{
@@ -160,8 +165,10 @@ public final class WizardManager
}
else
{
// try and get the title from the configuration
title = this.currentWizardState.getConfig().getTitle();
}
}
return title;
}
@@ -173,7 +180,13 @@ public final class WizardManager
*/
public String getDescription()
{
String desc = this.currentWizardState.getConfig().getDescriptionId();
// try and get the description directly from the dialog
String desc = this.currentWizardState.getWizard().getDescription();
if (desc == null)
{
// try and get the description via a message bundle key
desc = this.currentWizardState.getConfig().getDescriptionId();
if (desc != null)
{
@@ -181,8 +194,10 @@ public final class WizardManager
}
else
{
// try and get the description from the configuration
desc = this.currentWizardState.getConfig().getDescription();
}
}
return desc;
}

View File

@@ -60,11 +60,11 @@ public class ManageTaskDialog extends BaseDialogBean
protected String[] itemsToAdd;
protected boolean isItemBeingAdded = false;
protected final Log logger = LogFactory.getLog(getClass());
protected static final String ID_PREFIX = "transition_";
protected static final String CLIENT_ID_PREFIX = AlfrescoNavigationHandler.DIALOG_PREFIX + ID_PREFIX;
private static final Log logger = LogFactory.getLog(ManageTaskDialog.class);
// ------------------------------------------------------------------------------
// Dialog implementation
@@ -117,8 +117,11 @@ public class ManageTaskDialog extends BaseDialogBean
}
if (logger.isDebugEnabled())
logger.debug("Found workflow package for task '" +
this.task.id + "': " + this.workflowPackage );
{
logger.debug("Task: " + this.task);
logger.debug("Trasient node: " + this.taskNode);
logger.debug("Workflow package: " + this.workflowPackage );
}
}
}
@@ -143,6 +146,9 @@ public class ManageTaskDialog extends BaseDialogBean
// prepare the edited parameters for saving
Map<QName, Serializable> params = WorkflowBean.prepareTaskParams(this.taskNode);
if (logger.isDebugEnabled())
logger.debug("Saving task with parameters: " + params);
// remove any items the user selected to remove
if (this.workflowPackage != null && this.packageItemsToRemove != null &&
this.packageItemsToRemove.size() > 0)
@@ -211,6 +217,20 @@ public class ManageTaskDialog extends BaseDialogBean
return false;
}
@Override
public String getTitle()
{
String titleStart = Application.getMessage(FacesContext.getCurrentInstance(), "manage_task_title");
return titleStart + ": " + this.task.title;
}
@Override
public String getDescription()
{
return this.task.description;
}
// ------------------------------------------------------------------------------
// Event handlers
@@ -220,7 +240,7 @@ public class ManageTaskDialog extends BaseDialogBean
String outcome = getDefaultFinishOutcome();
if (logger.isDebugEnabled())
logger.debug("Transitioning task: " + this.taskNode.getId());
logger.debug("Transitioning task: " + this.task.id);
// to find out which transition button was pressed we need
// to look for the button's id in the request parameters,
@@ -252,6 +272,9 @@ public class ManageTaskDialog extends BaseDialogBean
// prepare the edited parameters for saving
Map<QName, Serializable> params = WorkflowBean.prepareTaskParams(this.taskNode);
if (logger.isDebugEnabled())
logger.debug("Transitioning task with parameters: " + params);
// update the task with the updated parameters
this.workflowService.updateTask(this.task.id, params, null, null);

View File

@@ -129,6 +129,9 @@ public class StartWorkflowWizard extends BaseWizardBean
// prepare the parameters from the current state of the property sheet
Map<QName, Serializable> params = WorkflowBean.prepareTaskParams(this.startTaskNode);
if (logger.isDebugEnabled())
logger.debug("Starting workflow with parameters: " + params);
// create a workflow package for the attached items and add them
if (this.packageItemsToAdd.size() > 0)
{

View File

@@ -37,4 +37,12 @@ public class ViewCompletedTaskDialog extends ManageTaskDialog
{
return null;
}
@Override
public String getTitle()
{
String titleStart = Application.getMessage(FacesContext.getCurrentInstance(), "view_completed_task_title");
return titleStart + ": " + this.task.title;
}
}

View File

@@ -199,9 +199,6 @@ public class WorkflowBean
params.put(assocQName, (Serializable)targets);
}
if (logger.isDebugEnabled())
logger.debug("Prepared parameters: " + params);
return params;
}