Hi,
>
> What if each Issue could have more than one User attached to it? How then
> would I implement the TransformedList with Dynamic filtering?
>
The tutorial shows filtering of issues by the issue reporter: Issue.getReporter()
For the following discussion let's assume you want to filter by
all users of the issue as defined by method Issue.getAllUsers().
You would have to change
a) the IssueToUserList from tutorial chapter 4
b) the IssuesForUsersMatcher from tutorial chapter 5.
a) Instead of using the IssueToUserList I would use a CollectionList like this:
CollectionList<Issue, String> usersNonUnique = new CollectionList<Issue, String>(source, new IssueToUsersModel());
/**
* Determines all users for an issue.
*/
public class IssueToUsersModel implements CollectionList.Model<Issue, String> {
public List<String> getChildren(Issue issue) {
return issue.getAllUsers();
}
}
The CollectionList is a TransformedList that maps each issue from the source list to the associated users.
It's a kind of parent-child relationship.
b) IssuesForUsersMatcher should be changed to match all issue users using. Issue.getAllUsers():
/**
* Test whether to include or not include the specified issue based
* on whether or not their user is selected.
*/
public boolean matches(Object o) {
if(o == null) return false;
if(users.isEmpty()) return true;
Issue issue = (Issue)o;
for (Iterator i = issue.getAllUsers().iterator(); i.hasNext(); ) {
if(users.contains(i.next())) return true;
}
return false;
}
Hope this helps,
Holger
__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!
Mehr Infos unter
http://freemail.web.de/home/landingpad/?mc=021131---------------------------------------------------------------------
To unsubscribe, e-mail:
users-unsubscribe@...
For additional commands, e-mail:
users-help@...