AWC-489; user list did not refresh

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2329 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-02-08 21:30:58 +00:00
parent a8f4846d45
commit 63a39037d3
2 changed files with 21 additions and 6 deletions

View File

@@ -141,6 +141,11 @@ public class UsersBean implements IContextListener
*/ */
public List<Node> getUsers() public List<Node> getUsers()
{ {
if (this.users == null)
{
search();
}
return this.users; return this.users;
} }
@@ -282,6 +287,9 @@ public class UsersBean implements IContextListener
// commit the transaction // commit the transaction
tx.commit(); tx.commit();
// re-do the search to refresh the list
search();
} }
catch (Throwable e) catch (Throwable e)
{ {
@@ -328,9 +336,9 @@ public class UsersBean implements IContextListener
/** /**
* Event handler called when the user wishes to search for a user * Event handler called when the user wishes to search for a user
* *
* @param event The event * @return The outcome
*/ */
public void search(ActionEvent event) public String search()
{ {
this.usersRichList.setValue(null); this.usersRichList.setValue(null);
@@ -408,19 +416,25 @@ public class UsersBean implements IContextListener
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {} try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
} }
} }
// return null to stay on the same page
return null;
} }
/** /**
* Action handler to show all the users currently in the system * Action handler to show all the users currently in the system
* *
* @param event The event * @return The outcome
*/ */
public void showAll(ActionEvent event) public String showAll()
{ {
this.usersRichList.setValue(null); this.usersRichList.setValue(null);
this.users = Repository.getUsers(FacesContext.getCurrentInstance(), this.users = Repository.getUsers(FacesContext.getCurrentInstance(),
this.nodeService, this.searchService); this.nodeService, this.searchService);
// return null to stay on the same page
return null;
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
@@ -434,6 +448,7 @@ public class UsersBean implements IContextListener
if (this.usersRichList != null) if (this.usersRichList != null)
{ {
this.usersRichList.setValue(null); this.usersRichList.setValue(null);
this.users = null;
} }
} }
} }

View File

@@ -124,8 +124,8 @@
<div style="padding: 6px;" /> <div style="padding: 6px;" />
<h:inputText value="#{UsersBean.searchCriteria}" size="35" maxlength="1024" />&nbsp; <h:inputText value="#{UsersBean.searchCriteria}" size="35" maxlength="1024" />&nbsp;
<h:commandButton value="Search" actionListener="#{UsersBean.search}" />&nbsp; <h:commandButton value="Search" action="#{UsersBean.search}" />&nbsp;
<h:commandButton value="Show All" actionListener="#{UsersBean.showAll}" /> <h:commandButton value="Show All" action="#{UsersBean.showAll}" />
<div style="padding: 6px;" /> <div style="padding: 6px;" />
<a:richList id="users-list" binding="#{UsersBean.usersRichList}" viewMode="details" pageSize="10" <a:richList id="users-list" binding="#{UsersBean.usersRichList}" viewMode="details" pageSize="10"