This commit is contained in:
Massimiliano Assante 2018-06-11 16:59:05 +00:00
parent 7115d7675e
commit 6508c02e9a
4 changed files with 21 additions and 16 deletions

View File

@ -97,7 +97,7 @@ public class PickItemsDialog extends PopupPanel {
// if it is a team, set the avatar
if(bean.isItemGroup())
bean.setThumbnailURL(CssAndImages.INSTANCE.iconTeam().getSafeUri().toString());
bean.setThumbnailURL(CssAndImages.INSTANCE.iconTeam().getSafeUri().asString());
}
}

View File

@ -3,6 +3,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.gcube.portlets.widgets.pickitem.client.bundle.CssAndImages;
import org.gcube.portlets.widgets.pickitem.client.rpc.PickItemService;
import org.gcube.portlets.widgets.pickitem.client.rpc.PickItemServiceAsync;
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
@ -22,7 +23,12 @@ public class UserOracle extends MultiWordSuggestOracle{
}
public void addContacts(List<ItemBean> users) {
contacts.addAll(users);
for (ItemBean bean : users) {
// if it is a team, set the avatar
if(bean.isItemGroup())
bean.setThumbnailURL(CssAndImages.INSTANCE.iconTeam().getSafeUri().asString());
contacts.add(bean);
}
}
@Override

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.widgets.pickitem.client.oracle;
import org.gcube.portlets.widgets.pickitem.client.bundle.CssAndImages;
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
import com.google.gwt.user.client.ui.SuggestOracle;
@ -10,6 +11,8 @@ public class UserSuggestion implements SuggestOracle.Suggestion {
public UserSuggestion(ItemBean user) {
this.user = user;
if (user.isItemGroup())
user.setThumbnailURL(CssAndImages.INSTANCE.iconTeam().getSafeUri().asString());
}
@Override

View File

@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.portlets.widgets.pickitem.client.bundle.CssAndImages;
import org.gcube.portlets.widgets.pickitem.client.rpc.PickItemService;
import org.gcube.portlets.widgets.pickitem.shared.ItemBean;
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
@ -78,7 +79,9 @@ public class PickItemServiceImpl extends RemoteServiceServlet implements PickIte
OrderByComparator teamComparator = OrderByComparatorFactoryUtil.create("team", "name", true);
List<Team> teams = TeamLocalServiceUtil.search(currentGroupId, keyword, "", null, QueryUtil.ALL_POS, QueryUtil.ALL_POS, teamComparator);
for (Team team : teams) {
toReturn.add(new ItemBean(team.getTeamId()+"", team.getName()));
ItemBean iBean = new ItemBean(team.getTeamId()+"", team.getName());
iBean.setItemGroup(true);
toReturn.add(iBean);
}
} catch (Exception e) {
e.printStackTrace();
@ -88,8 +91,11 @@ public class PickItemServiceImpl extends RemoteServiceServlet implements PickIte
toReturn.add(new ItemBean("id", "andrea.rossi", "Andrea Rossi", "email"));
if (i % 2 == 0)
toReturn.add(new ItemBean(""+i, "username"+i, "userGetFullname()"+i, "user.getEmail()"+i));
else
toReturn.add(new ItemBean(""+i, "ciccio"+i, "ciccioNome"+i, "ciccioEMail"+i));
else {
ItemBean groupBean = new ItemBean("idG"+i, "Group "+i);
groupBean.setItemGroup(true);
toReturn.add(new ItemBean(""+i, "Group "+i));
}
}
}
return toReturn;
@ -112,15 +118,5 @@ public class PickItemServiceImpl extends RemoteServiceServlet implements PickIte
}
return thumbnailURL;
}
/**
* utility method extract the @domain.com from an email address
* return @unknown-domain in case of no emails
*/
private String extractDomainFromEmail(String email) {
int index = email.indexOf('@');
if (index > 0)
return email.substring(index);
else
return "@unknown-domain";
}
}