Newly converted dialogs now make use of the new subtitle feature of the dialog framework.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6850 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-09-21 12:18:17 +00:00
parent 3e5670ef4c
commit 403f7b3a04
6 changed files with 338 additions and 290 deletions

View File

@@ -414,8 +414,8 @@
description-id="change_password_description" error-message-id="error_wizard" />
<dialog name="itemDetails" page="/jsp/trashcan/item-details.jsp" managed-bean="TrashcanItemDetailsDialog"
icon="/images/icons/details_large.gif" title-id="details_of"
description-id="original_location" show-ok-button="false" />
icon="/images/icons/details_large.gif" description-id="deleteditem_details_description"
show-ok-button="false" />
<dialog name="recoverItem" page="/jsp/trashcan/recover-item.jsp" managed-bean="TrashcanRecoverItemDialog"
icon="/images/icons/recover_large.gif" title-id="recover_item"
@@ -438,8 +438,7 @@
description-id="recovery_report_info" show-ok-button="false" />
<dialog name="showSystemInfo" page="/jsp/dialog/system-info.jsp" managed-bean="ShowSystemInfoDialog"
icon="/images/icons/file_large.gif" title-id="system_info"
description-id="current_user" show-ok-button="false"/>
icon="/images/icons/file_large.gif" title-id="system_info" show-ok-button="false"/>
</dialogs>
</config>

View File

@@ -29,12 +29,18 @@ import javax.faces.context.FacesContext;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
/**
* Implementation for the SystemInfo dialog.
*
* @author gavinc
*/
public class ShowSystemInfoDialog extends BaseDialogBean
{
private final static String MSG_CURRENT_USER = "current_user";
private static final String LBL_CLOSE = "close";
private static final String MSG_CURRENT_USER = "current_user";
private static final String MSG_CLOSE = "close";
private static final String MSG_VERSION = "version";
private NavigationBean navigationBean;
protected AboutBean aboutBean;
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
@@ -42,27 +48,35 @@ public class ShowSystemInfoDialog extends BaseDialogBean
return null;
}
public NavigationBean getNavigationBean()
public void setAboutBean(AboutBean aboutBean)
{
return navigationBean;
this.aboutBean = aboutBean;
}
public void setNavigationBean(NavigationBean navigationBean)
@Override
public String getContainerSubTitle()
{
this.navigationBean = navigationBean;
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CURRENT_USER) + ": " +
this.navigator.getCurrentUser().getUserName();
}
@Override
public String getContainerDescription()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CURRENT_USER) + " '" + navigationBean.getCurrentUser().getUserName() + "'";
StringBuilder builder = new StringBuilder(Application.getMessage(
FacesContext.getCurrentInstance(), MSG_VERSION));
builder.append(": ");
builder.append(this.aboutBean.getEdition());
builder.append(" - v");
builder.append(this.aboutBean.getVersion());
return builder.toString();
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), LBL_CLOSE);
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
}
}

View File

@@ -35,35 +35,28 @@ public class TrashcanItemDetailsDialog extends TrashcanDialog
{
private static final String MSG_DETAILS_OF = "details_of";
private static final String MSG_ORIGINAL_LOCATION = "original_location";
private static final String MSG_DELETEDITEM_DETAILS_DESCR = "deleteditem_details_description";
private static final String MSG_CLOSE = "close";
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
return null;
}
@Override
public String getContainerDescription()
{
Path path = (Path) property.getItem().getProperties().get("locationPath");
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_ORIGINAL_LOCATION) + ": " + path.toDisplayPath(nodeService) + "\n"
+ Application.getMessage(FacesContext.getCurrentInstance(), MSG_DELETEDITEM_DETAILS_DESCR);
}
@Override
public String getContainerTitle()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_DETAILS_OF) + " '" + property.getItem().getName() + "'";
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_DETAILS_OF) + " '" +
property.getItem().getName() + "'";
}
public Node getItem()
@Override
public String getContainerSubTitle()
{
return property.getItem();
Path path = (Path) property.getItem().getProperties().get("locationPath");
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_ORIGINAL_LOCATION) + ": " +
path.toDisplayPath(nodeService);
}
@Override
@@ -72,4 +65,8 @@ public class TrashcanItemDetailsDialog extends TrashcanDialog
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
}
public Node getItem()
{
return property.getItem();
}
}

View File

@@ -53,10 +53,10 @@ import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIGenericPicker;
/**
* Implementation of the add user dialog.
*
* @author YanO
*/
/**
* @author Administrator
* @author gavinc
*/
public class AddUsersDialog extends GroupsDialog
{
@@ -88,26 +88,42 @@ public class AddUsersDialog extends GroupsDialog
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
outcome = null;
}
setActionGroup(null);
return outcome;
}
@Override
public String getContainerSubTitle()
{
return properties.getActionGroupName();
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), BUTTON_FINISH);
}
/**
* Query callback method executed by the Generic Picker component. This method is part of the contract to the Generic Picker, it is up to the backing bean to execute whatever
* query is appropriate and return the results.
* Query callback method executed by the Generic Picker component. This
* method is part of the contract to the Generic Picker, it is up to the
* backing bean to execute whatever query is appropriate and return the
* results.
*
* @param filterIndex Index of the filter drop-down selection
* @param contains Text from the contains textbox
* @return An array of SelectItem objects containing the results to display in the picker.
* @return An array of SelectItem objects containing the results to display
* in the picker.
*/
public SelectItem[] pickerCallback(int filterIndex, final String contains)
{
@@ -126,10 +142,12 @@ public class AddUsersDialog extends GroupsDialog
// build xpath to match available User/Person objects
ServiceRegistry services = Repository.getServiceRegistry(context);
NodeRef peopleRef = properties.getPersonService().getPeopleContainer();
String xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains + "%', false)" + " or " + "like(@"
+ NamespaceService.CONTENT_MODEL_PREFIX + ":" + "lastName, '%" + contains + "%', false)]";
String xpath = "*[like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + "firstName, '%" + contains +
"%', false)" + " or " + "like(@" + NamespaceService.CONTENT_MODEL_PREFIX + ":" +
"lastName, '%" + contains + "%', false)]";
List<NodeRef> nodes = services.getSearchService().selectNodes(peopleRef, xpath, null, services.getNamespaceService(), false);
List<NodeRef> nodes = services.getSearchService().selectNodes(peopleRef, xpath, null,
services.getNamespaceService(), false);
ArrayList<SelectItem> itemList = new ArrayList<SelectItem>(nodes.size());
for (NodeRef personRef : nodes)
@@ -152,7 +170,8 @@ public class AddUsersDialog extends GroupsDialog
}
catch (Exception err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
try
{
if (tx != null)
@@ -207,7 +226,8 @@ public class AddUsersDialog extends GroupsDialog
// build a sensible label for display
label.append(firstName).append(' ').append(lastName);
// add a wrapper object with the details to the results list for display
// add a wrapper object with the details to the results list
// for display
UserAuthorityDetails userDetails = new UserAuthorityDetails(label.toString(), authority);
this.usersForGroup.add(userDetails);
}
@@ -217,7 +237,8 @@ public class AddUsersDialog extends GroupsDialog
}
/**
* Action handler called when the Remove button is pressed to remove a user from the results list
* Action handler called when the Remove button is pressed to remove a user
* from the results list
*/
public void removeUserSelection(ActionEvent event)
{
@@ -242,10 +263,4 @@ public class AddUsersDialog extends GroupsDialog
return this.usersDataModel;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), BUTTON_FINISH);
}
}

View File

@@ -42,8 +42,14 @@ import org.alfresco.web.ui.common.Utils;
public class CreateGroupDialog extends GroupsDialog
{
private static final String MSG_ERR_EXISTS = "groups_err_exists";
private static final String MSG_BUTTON_NEW_GROUP = "new_group";
private static final String BUTTON_NEW_GROUP = "new_group";
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
properties.setName("");
}
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
@@ -64,7 +70,8 @@ public class CreateGroupDialog extends GroupsDialog
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
context, Repository.ERROR_GENERIC), err.getMessage()), err);
outcome = null;
}
@@ -77,26 +84,38 @@ public class CreateGroupDialog extends GroupsDialog
}
@Override
public void init(Map<String, String> parameters)
public String getFinishButtonLabel()
{
super.init(parameters);
properties.setName("");
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_BUTTON_NEW_GROUP);
}
@Override
public String getContainerSubTitle()
{
String subtitle = null;
if (properties.getActionGroup() != null)
{
subtitle = properties.getActionGroupName();
}
else
{
subtitle = properties.getGroupName();
}
return subtitle;
}
public void validateGroupName(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
String name = (String) value;
if (name.indexOf('\'') != -1 || name.indexOf('"') != -1 || name.indexOf('\\') != -1)
{
String err = MessageFormat.format(Application.getMessage(context, "groups_err_group_name"), new Object[] { "', \", \\" });
String err = MessageFormat.format(Application.getMessage(context, "groups_err_group_name"),
new Object[] { "', \", \\" });
throw new ValidatorException(new FacesMessage(err));
}
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), BUTTON_NEW_GROUP);
}
}

View File

@@ -4999,9 +4999,13 @@
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>navigationBean</property-name>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>aboutBean</property-name>
<value>#{AboutBean}</value>
</managed-property>
</managed-bean>
</faces-config>