Completion of dialog framework enabling all remaining pages in the web client to be converted.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6857 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-09-22 22:08:18 +00:00
parent 3df0a89e60
commit a6222e94e5
7 changed files with 231 additions and 14 deletions

View File

@@ -1156,4 +1156,9 @@ public class DocumentDetailsBean extends BaseDetailsBean implements IDialogBean
{ {
baseDialogBean.restored(); baseDialogBean.restored();
} }
public Object getActionsContext()
{
return baseDialogBean.getActionsContext();
}
} }

View File

@@ -657,4 +657,9 @@ public class SpaceDetailsBean extends BaseDetailsBean implements IDialogBean
{ {
baseDialogBean.restored(); baseDialogBean.restored();
} }
public Object getActionsContext()
{
return baseDialogBean.getActionsContext();
}
} }

View File

@@ -31,6 +31,7 @@ import java.util.Map;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -146,6 +147,8 @@ public abstract class BaseDialogBean implements IDialogBean
public List<DialogButtonConfig> getAdditionalButtons() public List<DialogButtonConfig> getAdditionalButtons()
{ {
// none by default, subclasses can override if necessary
return null; return null;
} }
@@ -166,18 +169,39 @@ public abstract class BaseDialogBean implements IDialogBean
public String getContainerTitle() public String getContainerTitle()
{ {
// nothing by default, subclasses can override if necessary
return null; return null;
} }
public String getContainerSubTitle() public String getContainerSubTitle()
{ {
// nothing by default, subclasses can override if necessary
return null; return null;
} }
public String getContainerDescription() public String getContainerDescription()
{ {
// nothing by default, subclasses can override if necessary
return null; return null;
} }
public Object getActionsContext()
{
// return the current node as the context for actions be default
// dialog implementations can override this method to return the
// appropriate object for their use case
if (this.navigator == null)
{
throw new AlfrescoRuntimeException("To use actions in the dialog the 'navigator' " +
"property must be injected with an instance of NavigationBean!");
}
return this.navigator.getCurrentNode();
}
/** /**
* @param browseBean The BrowseBean to set. * @param browseBean The BrowseBean to set.

View File

@@ -269,10 +269,20 @@ public final class DialogManager
return desc; return desc;
} }
/**
* Returns the page the dialog will use
*
* @return The page
*/
public String getPage()
{
return this.currentDialogState.getConfig().getPage();
}
/** /**
* Returns the id of a configured action group representing the actions to * Returns the id of a configured action group representing the actions to
* display for the dialog. * display for the dialog
* *
* @return The action group id * @return The action group id
*/ */
@@ -282,13 +292,96 @@ public final class DialogManager
} }
/** /**
* Returns the page the dialog will use * Returns the id of a configured action group representing the
* 'more actions' to display for the dialog
* *
* @return The page * @return The action group id
*/ */
public String getPage() public String getMoreActions()
{ {
return this.currentDialogState.getConfig().getPage(); return this.currentDialogState.getConfig().getMoreActionsConfigId();
}
/**
* Returns the object to use as the context for the main and more
* actions that may be configured by the dialog
*
* @return Object to use as the context for actions, the current
* node by default
*/
public Object getActionsContext()
{
return this.currentDialogState.getDialog().getActionsContext();
}
/**
* Returns the label to use for the main actions when a menu is being used
*
* @return The actions menu label
*/
public String getActionsMenuLabel()
{
// try and get the label via a message bundle key
String label = this.currentDialogState.getConfig().getActionsMenuLabelId();
if (label != null)
{
label = Application.getMessage(FacesContext.getCurrentInstance(), label);
}
else
{
// try and get the description from the configuration
label = this.currentDialogState.getConfig().getActionsMenuLabel();
}
// if the label is still null use the default of 'Create'
if (label == null)
{
label = Application.getMessage(FacesContext.getCurrentInstance(), "create_options");
}
return label;
}
/**
* Returns the label to use for the more actions menu
*
* @return The more actions menu label
*/
public String getMoreActionsMenuLabel()
{
// try and get the label via a message bundle key
String label = this.currentDialogState.getConfig().getMoreActionsMenuLabelId();
if (label != null)
{
label = Application.getMessage(FacesContext.getCurrentInstance(), label);
}
else
{
// try and get the description from the configuration
label = this.currentDialogState.getConfig().getMoreActionsMenuLabel();
}
// if the label is still null use the default of 'More Actions'
if (label == null)
{
label = Application.getMessage(FacesContext.getCurrentInstance(), "more_actions");
}
return label;
}
/**
* Determines whether the main actions should be rendered as a
* menu
*
* @return true to render the main set of actions as a menu, false
* to render them as a horizontal list
*/
public boolean getActionsAsMenu()
{
return this.currentDialogState.getConfig().getActionsAsMenu();
} }
/** /**
@@ -303,7 +396,7 @@ public final class DialogManager
/** /**
* Determines whether the current dialog should display the next * Determines whether the current dialog should display the next
* and previous buttons in the header area. * and previous buttons in the header area
* *
* @return true if navigation support is enabled * @return true if navigation support is enabled
*/ */
@@ -314,7 +407,7 @@ public final class DialogManager
/** /**
* Determines whether the current dialog should display the list * Determines whether the current dialog should display the list
* of views in the header area. * of views in the header area
* *
* @return true if change view support is enabled * @return true if change view support is enabled
*/ */
@@ -325,7 +418,7 @@ public final class DialogManager
/** /**
* Determines whether the current dialog should display the list * Determines whether the current dialog should display the list
* of filters in the header area. * of filters in the header area
* *
* @return true if filter support is enabled * @return true if filter support is enabled
*/ */

View File

@@ -116,4 +116,12 @@ public interface IDialogBean
* @return The title or null if the title is to be acquired via configuration * @return The title or null if the title is to be acquired via configuration
*/ */
public String getContainerDescription(); public String getContainerDescription();
/**
* Returns the object to use as the context for the main and more
* actions that may be configured by the dialog
*
* @return Object to use as the context for actions
*/
public Object getActionsContext();
} }

View File

@@ -310,6 +310,13 @@ input,textarea,select
height: 5px; height: 5px;
} }
.dialogMainActions
{
padding-left: 2px;
padding-right: 5px;
vertical-align: -1px;
}
.topToolbar .topToolbar
{ {
} }

View File

@@ -75,18 +75,93 @@
<table cellspacing="4" cellpadding="0" width="100%"> <table cellspacing="4" cellpadding="0" width="100%">
<tr> <tr>
<td width="32"> <td width="32">
<h:graphicImage id="wizard-logo" url="#{DialogManager.icon}" /> <h:graphicImage id="dialog-logo" url="#{DialogManager.icon}" />
</td> </td>
<td> <td width="100%">
<div class="mainTitle"><h:outputText value="#{DialogManager.title}" /></div> <div class="mainTitle"><h:outputText value="#{DialogManager.title}" /></div>
<div class="mainSubTitle"><h:outputText value="#{DialogManager.subTitle}" /></div> <div class="mainSubTitle"><h:outputText value="#{DialogManager.subTitle}" /></div>
<div class="mainSubText"><h:outputText value="#{DialogManager.description}" /></div> <div class="mainSubText"><h:outputText value="#{DialogManager.description}" /></div>
</td> </td>
<td style="padding-left:4px" align="right"> <td>
<r:actions id="dialog_actions" value="#{DialogManager.actions}" <table cellspacing="4" cellpadding="1" width="100%">
context="#{NavigationBean.currentNode}" /> <tr>
<%-- Main actions --%>
<a:panel id="main-actions-panel" rendered="#{DialogManager.actions != null}">
<td style="white-space: nowrap;">
<r:actions id="main_actions_list" rendered="#{DialogManager.actionsAsMenu == false}"
styleClass="dialogMainActions" value="#{DialogManager.actions}"
context="#{DialogManager.actionsContext}" />
<a:menu id="main_actions_menu" rendered="#{DialogManager.actionsAsMenu == true}"
itemSpacing="4" image="/images/icons/menu.gif" menuStyleClass="moreActionsMenu"
style="white-space: nowrap" label="#{DialogManager.actionsMenuLabel}">
<r:actions id="main_actions_menu_items" value="#{DialogManager.actions}"
context="#{DialogManager.actionsContext}" />
</a:menu>
</td>
</a:panel>
<%-- More actions menu --%>
<a:panel id="more-actions-panel" rendered="#{DialogManager.moreActions != null}">
<td style="padding-left: 4px" width="80">
<a:menu id="more_actions_menu" itemSpacing="4" image="/images/icons/menu.gif"
menuStyleClass="moreActionsMenu" style="white-space:nowrap"
label="#{DialogManager.moreActionsMenuLabel}">
<r:actions id="more_actions_menu_items" value="#{DialogManager.moreActions}"
context="#{DialogManager.actionsContext}" />
</a:menu>
</td>
</a:panel>
<%-- View Filters --%>
<a:panel id="filters-panel" rendered="#{DialogManager.filterListVisible}">
<td class="separator" width="1">
<img src="<%=request.getContextPath()%>/images/parts/dotted_separator.gif" border="0" height="29" width="1" />
</td>
<td style="padding-left: 4px" width="80" valign="middle">
<a:modeList itemSpacing="3" iconColumnWidth="20" selectedStyleClass="statusListHighlight"
selectedImage="/images/icons/filter.gif" menu="true" styleClass="moreActionsMenu"
menuImage="/images/icons/menu.gif" value="#{DialogManager.bean.filterMode}"
actionListener="#{DialogManager.bean.filterModeChanged}">
<a:listItems value="#{DialogManager.bean.filterItems}" />
</a:modeList>
</td>
</a:panel>
<%-- View Mode --%>
<a:panel id="views-panel" rendered="#{DialogManager.viewListVisible}">
<td class="separator" width="1">
<img src="<%=request.getContextPath()%>/images/parts/dotted_separator.gif" border="0" height="29" width="1" />
</td>
<td style="padding-left: 4px" width="80" valign="middle">
<a:modeList itemSpacing="3" iconColumnWidth="20" selectedStyleClass="statusListHighlight"
selectedImage="/images/icons/Details.gif" menu="true" styleClass="moreActionsMenu"
menuImage="/images/icons/menu.gif" value="#{DialogManager.bean.viewMode}"
actionListener="#{DialogManager.bean.viewModeChanged}">
<a:listItems value="#{DialogManager.bean.viewItems}" />
</a:modeList>
</td>
</a:panel>
<%-- Navigation --%>
<a:panel id="nav-panel" rendered="#{DialogManager.navigationVisible}">
<td style="padding-left: 10px; white-space: nowrap;" valign="middle">
<a:actionLink id="act-prev" value="#{msg.previous_item}" image="/images/icons/nav_prev.gif"
showLink="false" actionListener="#{DialogManager.bean.previousItem}">
<f:param name="id" value="#{DialogManager.bean.currentItemId}" />
</a:actionLink>
<img src="<%=request.getContextPath()%>/images/icons/nav_file.gif" width="24" height="24" align="absmiddle" />
<a:actionLink id="act-next" value="#{msg.next_item}" image="/images/icons/nav_next.gif"
showLink="false" actionListener="#{DialogManager.bean.nextItem}">
<f:param name="id" value="#{DialogManager.bean.currentItemId}" />
</a:actionLink>
</td>
</a:panel>
<td><div style="width: 5px;">&nbsp;</div></td>
</tr>
</table>
</td> </td>
<td width="10">&nbsp;</td>
</tr> </tr>
</table> </table>