ref 17169: Selection of users in the Sharing panel

https://support.d4science.org/issues/17169

Added users discovery by keyword search 

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@181294 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-07-23 10:02:03 +00:00
parent 1a3d022adc
commit 05c926a1d6
8 changed files with 1323 additions and 1133 deletions

View File

@ -13,7 +13,11 @@
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" path="src/main/resources"/> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>

View File

@ -1,4 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//src/main/java=UTF-8 encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8 encoding//src/test/java=UTF-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8

View File

@ -23,8 +23,8 @@ public class ExtendedInfoContactModel extends InfoContactModel {
public ExtendedInfoContactModel() {} public ExtendedInfoContactModel() {}
public ExtendedInfoContactModel(String id, String login, String fullName, boolean isGroup) { public ExtendedInfoContactModel(String id, String login, String fullName, String emailDomain,boolean isGroup) {
super(id, login, fullName, isGroup); super(id, login, fullName, emailDomain, isGroup);
} }

View File

@ -230,9 +230,9 @@ public class DialogShareFolder extends Dialog {
for (InfoContactModel contact : listContacts) { for (InfoContactModel contact : listContacts) {
if (contact != null && contact.getName() != null) { if (contact != null && contact.getName() != null) {
if (!isShareOwner(contact)) // skip owner if (!isShareOwner(contact)) // skip owner
suggestPanel.addRecipient(contact.getName(), true); suggestPanel.addRecipient(contact, true);
else else
suggestPanel.addRecipient(contact.getName(), false); // owner suggestPanel.addRecipient(contact, false); // owner
// is // is
// not // not
// deletable // deletable
@ -484,10 +484,10 @@ public class DialogShareFolder extends Dialog {
suggestPanel.resetItemSelected(); suggestPanel.resetItemSelected();
// SHARE OWNER IS NULL IN CASE OF NEW SHARE // SHARE OWNER IS NULL IN CASE OF NEW SHARE
if (shareOwner != null) if (shareOwner != null)
suggestPanel.addRecipient(shareOwner.getName(), false); suggestPanel.addRecipient(shareOwner, false);
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) { for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
suggestPanel.addRecipient(infoContactModel.getName(), true); suggestPanel.addRecipient(infoContactModel, true);
} }
suggestPanel.boxSetFocus(); suggestPanel.boxSetFocus();
// printSelectedUser(); // printSelectedUser();
@ -552,7 +552,7 @@ public class DialogShareFolder extends Dialog {
private void initSuggestContacts() { private void initSuggestContacts() {
suggestPanel.resetItemSelected(); suggestPanel.resetItemSelected();
for (InfoContactModel contact : listAlreadyShared) for (InfoContactModel contact : listAlreadyShared)
suggestPanel.addRecipient(contact.getName(), false); suggestPanel.addRecipient(contact, false);
} }
/** /**

View File

@ -66,10 +66,10 @@ public class MultiDragContact extends Dialog {
private static final int HEIGHT_CONTAINER_TEXT_AREA = 72; private static final int HEIGHT_CONTAINER_TEXT_AREA = 72;
private static final int HEIGHT_TEXT_AREA = 55; private static final int HEIGHT_TEXT_AREA = 55;
private static final int WIDTH_CP = 597; private static final int WIDTH_CP = 597;
// private static final int HEIGHT_DIALOG = 542; // private static final int HEIGHT_DIALOG = 542;
private static final int HEIGHT_DIALOG = 580; private static final int HEIGHT_DIALOG = 580;
private static final int WIDTH_DIALOG = 630; private static final int WIDTH_DIALOG = 630;
// private static final int WIDTH_DIALOG = 625; // private static final int WIDTH_DIALOG = 625;
private static final int HEIGHT_GRID = 310; private static final int HEIGHT_GRID = 310;
private GridDropTarget dropSource; private GridDropTarget dropSource;
@ -101,7 +101,7 @@ public class MultiDragContact extends Dialog {
setResizable(true); setResizable(true);
setButtonAlign(HorizontalAlignment.CENTER); setButtonAlign(HorizontalAlignment.CENTER);
setButtons(Dialog.OKCANCEL); setButtons(Dialog.OKCANCEL);
//SORTING STORE // SORTING STORE
setGropUserStoreSorter(storeSource); setGropUserStoreSorter(storeSource);
setGropUserStoreSorter(storeTarget); setGropUserStoreSorter(storeTarget);
@ -119,8 +119,8 @@ public class MultiDragContact extends Dialog {
hpSharedContacts.setHorizontalAlign(HorizontalAlignment.CENTER); hpSharedContacts.setHorizontalAlign(HorizontalAlignment.CENTER);
hpSharedContacts.setVerticalAlign(VerticalAlignment.MIDDLE); hpSharedContacts.setVerticalAlign(VerticalAlignment.MIDDLE);
textAreaAlreadyShared = new TextArea(); textAreaAlreadyShared = new TextArea();
// textField.setFieldLabel("Already shared with"); // textField.setFieldLabel("Already shared with");
// textField.setHeight(30); // textField.setHeight(30);
textAreaAlreadyShared.setWidth(501); textAreaAlreadyShared.setWidth(501);
textAreaAlreadyShared.setHeight(HEIGHT_TEXT_AREA); textAreaAlreadyShared.setHeight(HEIGHT_TEXT_AREA);
cpAlreadyShared.setStyleAttribute("padding-bottom", "5px"); cpAlreadyShared.setStyleAttribute("padding-bottom", "5px");
@ -137,7 +137,6 @@ public class MultiDragContact extends Dialog {
cpAlreadyShared.add(vpShared); cpAlreadyShared.add(vpShared);
add(cpAlreadyShared); add(cpAlreadyShared);
final ContentPanel cp = new ContentPanel(); final ContentPanel cp = new ContentPanel();
cp.setSize(WIDTH_CP, HEIGHT_CONTAINER_GRID); cp.setSize(WIDTH_CP, HEIGHT_CONTAINER_GRID);
cp.setHeaderVisible(false); cp.setHeaderVisible(false);
@ -151,7 +150,9 @@ public class MultiDragContact extends Dialog {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
MessageBox.info("Group dragging action", "Drag one or more contacts from the left (All Contacts) to the right (Share with) to add users in your sharing list.", null); MessageBox.info("Group dragging action",
"Drag one or more contacts from the left (All Contacts) to the right (Share with) to add users in your sharing list.",
null);
} }
}); });
@ -165,15 +166,15 @@ public class MultiDragContact extends Dialog {
gridAllContacts = new Grid<ExtendedInfoContactModel>(storeSource, createColumnModel()); gridAllContacts = new Grid<ExtendedInfoContactModel>(storeSource, createColumnModel());
GridCellRenderer<ExtendedInfoContactModel> displayNameCellRender = new GridCellRenderer<ExtendedInfoContactModel>() { GridCellRenderer<ExtendedInfoContactModel> displayNameCellRender = new GridCellRenderer<ExtendedInfoContactModel>() {
public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) { public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex,
int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) {
if(model!=null){ if (model != null) {
String value = model.get (property); String value = model.get(property);
if (value != null){ if (value != null) {
return "<span qtitle='' qtip='" + model.getLogin() +"'>" + value + "</span>"; return "<span qtitle='' qtip='" + model.getLogin() + "'>" + value + "</span>";
} }
} }
@ -189,13 +190,11 @@ public class MultiDragContact extends Dialog {
storeTarget.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC); storeTarget.setDefaultSort(InfoContactModel.FULLNAME, SortDir.ASC);
storeTarget.sort(InfoContactModel.FULLNAME, SortDir.ASC); storeTarget.sort(InfoContactModel.FULLNAME, SortDir.ASC);
final StoreFilterField<ExtendedInfoContactModel> filter = new StoreFilterField<ExtendedInfoContactModel>() { final StoreFilterField<ExtendedInfoContactModel> filter = new StoreFilterField<ExtendedInfoContactModel>() {
@Override @Override
protected boolean doSelect(Store<ExtendedInfoContactModel> store, protected boolean doSelect(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel parent,
ExtendedInfoContactModel parent, ExtendedInfoContactModel record, ExtendedInfoContactModel record, String property, String filter) {
String property, String filter) {
String name = record.getName(); String name = record.getName();
name = name.toLowerCase(); name = name.toLowerCase();
@ -242,9 +241,8 @@ public class MultiDragContact extends Dialog {
final StoreFilterField<ExtendedInfoContactModel> filter2 = new StoreFilterField<ExtendedInfoContactModel>() { final StoreFilterField<ExtendedInfoContactModel> filter2 = new StoreFilterField<ExtendedInfoContactModel>() {
@Override @Override
protected boolean doSelect(Store<ExtendedInfoContactModel> store, protected boolean doSelect(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel parent,
ExtendedInfoContactModel parent, ExtendedInfoContactModel record, ExtendedInfoContactModel record, String property, String filter) {
String property, String filter) {
String name = record.getName(); String name = record.getName();
name = name.toLowerCase(); name = name.toLowerCase();
@ -267,7 +265,7 @@ public class MultiDragContact extends Dialog {
gridShareWith.setHeight(HEIGHT_GRID); gridShareWith.setHeight(HEIGHT_GRID);
gridShareWith.setBorders(false); gridShareWith.setBorders(false);
gridShareWith.getView().setAutoFill(true); gridShareWith.getView().setAutoFill(true);
// gridShareWith.setAutoExpandColumn(InfoContactModel.FULLNAME); // gridShareWith.setAutoExpandColumn(InfoContactModel.FULLNAME);
gridShareWith.setBorders(true); gridShareWith.setBorders(true);
vpShareWith.add(hp); vpShareWith.add(hp);
vpShareWith.add(gridShareWith); vpShareWith.add(gridShareWith);
@ -293,28 +291,28 @@ public class MultiDragContact extends Dialog {
} }
}); });
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() { this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
List<ExtendedInfoContactModel> shareContacts = storeTarget.getModels(); List<ExtendedInfoContactModel> shareContacts = storeTarget.getModels();
if(shareContacts==null || shareContacts.isEmpty()){ if (shareContacts == null || shareContacts.isEmpty()) {
MessageBoxConfirm mbc = new MessageBoxConfirm("Confirm exit?", "You have not selected any contact to share, confirm exit?"); MessageBoxConfirm mbc = new MessageBoxConfirm("Confirm exit?",
"You have not selected any contact to share, confirm exit?");
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() { mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
@Override @Override
public void handleEvent(MessageBoxEvent be) { public void handleEvent(MessageBoxEvent be) {
String clickedButton = be.getButtonClicked().getItemId(); String clickedButton = be.getButtonClicked().getItemId();
if(clickedButton.equals(Dialog.YES)){ if (clickedButton.equals(Dialog.YES)) {
hide(); hide();
} }
} }
}); });
}else } else
hide(); hide();
} }
}); });
@ -327,12 +325,12 @@ public class MultiDragContact extends Dialog {
@Override @Override
public void handleEvent(BaseEvent be) { public void handleEvent(BaseEvent be) {
int width = gridAllContacts.getWidth(); int width = gridAllContacts.getWidth();
filter.setWidth(width-2); filter.setWidth(width - 2);
filter2.setWidth(width-2); filter2.setWidth(width - 2);
gridShareWith.setWidth(width+5); gridShareWith.setWidth(width + 5);
vpShareWith.setWidth(width+15); vpShareWith.setWidth(width + 15);
gridAllContacts.setWidth(width+5); gridAllContacts.setWidth(width + 5);
vpAllContacts.setWidth(width+15); vpAllContacts.setWidth(width + 15);
vpShareWith.layout(); vpShareWith.layout();
vpAllContacts.layout(); vpAllContacts.layout();
cp.layout(); cp.layout();
@ -357,16 +355,13 @@ public class MultiDragContact extends Dialog {
buttonSelectedLeft = new Button(); buttonSelectedLeft = new Button();
buttonSelectedLeft.setIcon(Resources.getSelectedLeft()); buttonSelectedLeft.setIcon(Resources.getSelectedLeft());
buttonSelectedLeft buttonSelectedLeft.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'");
.setToolTip("Move selected contact/s from 'All Contact' to 'Share with'"); buttonSelectedLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
buttonSelectedLeft
.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
List<ExtendedInfoContactModel> selectedItems = gridAllContacts List<ExtendedInfoContactModel> selectedItems = gridAllContacts.getSelectionModel().getSelectedItems();
.getSelectionModel().getSelectedItems();
if (selectedItems != null && selectedItems.size() > 0) { if (selectedItems != null && selectedItems.size() > 0) {
@ -380,17 +375,14 @@ public class MultiDragContact extends Dialog {
buttonSelectedRight = new Button(); buttonSelectedRight = new Button();
buttonSelectedRight.setIcon(Resources.getSelectedRight()); buttonSelectedRight.setIcon(Resources.getSelectedRight());
buttonSelectedRight buttonSelectedRight.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
.setToolTip("Move selected contact/s from 'Share with' to 'All Contact'");
buttonSelectedRight buttonSelectedRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
List<ExtendedInfoContactModel> selectedItems = gridShareWith List<ExtendedInfoContactModel> selectedItems = gridShareWith.getSelectionModel().getSelectedItems();
.getSelectionModel().getSelectedItems();
if (selectedItems != null && selectedItems.size() > 0) { if (selectedItems != null && selectedItems.size() > 0) {
@ -404,18 +396,15 @@ public class MultiDragContact extends Dialog {
buttonAllLeft = new Button(); buttonAllLeft = new Button();
buttonAllLeft.setIcon(Resources.getAllLeft()); buttonAllLeft.setIcon(Resources.getAllLeft());
buttonAllLeft buttonAllLeft.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
.setToolTip("Move all contact/s from 'All Contact' to 'Share with'");
buttonAllLeft buttonAllLeft.addSelectionListener(new SelectionListener<ButtonEvent>() {
.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
if (storeSource != null && storeSource.getCount() > 0) { if (storeSource != null && storeSource.getCount() > 0) {
for (ExtendedInfoContactModel extendedInfoContactModel : storeSource for (ExtendedInfoContactModel extendedInfoContactModel : storeSource.getModels()) {
.getModels()) {
storeTarget.add(extendedInfoContactModel); storeTarget.add(extendedInfoContactModel);
storeSource.remove(extendedInfoContactModel); storeSource.remove(extendedInfoContactModel);
} }
@ -426,18 +415,15 @@ public class MultiDragContact extends Dialog {
buttonAllRight = new Button(); buttonAllRight = new Button();
buttonAllRight.setIcon(Resources.getAllRight()); buttonAllRight.setIcon(Resources.getAllRight());
buttonAllRight buttonAllRight.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
.setToolTip("Move all contact/s from 'Share with' to 'All Contact'");
buttonAllRight buttonAllRight.addSelectionListener(new SelectionListener<ButtonEvent>() {
.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override @Override
public void componentSelected(ButtonEvent ce) { public void componentSelected(ButtonEvent ce) {
if (storeTarget != null && storeTarget.getCount() > 0) { if (storeTarget != null && storeTarget.getCount() > 0) {
for (ExtendedInfoContactModel extendedInfoContactModel : storeTarget for (ExtendedInfoContactModel extendedInfoContactModel : storeTarget.getModels()) {
.getModels()) {
storeSource.add(extendedInfoContactModel); storeSource.add(extendedInfoContactModel);
storeTarget.remove(extendedInfoContactModel); storeTarget.remove(extendedInfoContactModel);
} }
@ -485,18 +471,18 @@ public class MultiDragContact extends Dialog {
ColumnConfig type = new ColumnConfig(ExtendedInfoContactModel.ISGROUP, "Type", 50); ColumnConfig type = new ColumnConfig(ExtendedInfoContactModel.ISGROUP, "Type", 50);
configs.add(type); configs.add(type);
GridCellRenderer<ExtendedInfoContactModel> typeRender = new GridCellRenderer<ExtendedInfoContactModel>() { GridCellRenderer<ExtendedInfoContactModel> typeRender = new GridCellRenderer<ExtendedInfoContactModel>() {
@Override @Override
public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) { public String render(ExtendedInfoContactModel model, String property, ColumnData config, int rowIndex,
int colIndex, ListStore<ExtendedInfoContactModel> store, Grid<ExtendedInfoContactModel> grid) {
Boolean isGroup = (Boolean) model.get(property); Boolean isGroup = (Boolean) model.get(property);
String color = "#0F4FA8"; String color = "#0F4FA8";
String val = ""; String val = "";
if(isGroup){ if (isGroup) {
val = "Group"; val = "Group";
color = "#05316D"; color = "#05316D";
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>"; return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
}else{ } else {
val = "User"; val = "User";
return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>"; return "<span style='font-weight: bold; color:" + color + "'>" + val + "</span>";
} }
@ -510,22 +496,25 @@ public class MultiDragContact extends Dialog {
/** /**
* Adds the source contacts. * Adds the source contacts.
* *
* @param listContact the list contact * @param listContact
* the list contact
*/ */
public void addSourceContacts(List<InfoContactModel> listContact){ public void addSourceContacts(List<InfoContactModel> listContact) {
gridAllContacts.mask("", ConstantsExplorer.LOADINGSTYLE); gridAllContacts.mask("", ConstantsExplorer.LOADINGSTYLE);
if(listContact!=null && listContact.size()>0){ if (listContact != null && listContact.size() > 0) {
List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>(); List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>();
//SETTING ICONS // SETTING ICONS
for (InfoContactModel infoContactModel : listContact) { for (InfoContactModel infoContactModel : listContact) {
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(), infoContactModel.getLogin(), infoContactModel.getName(), infoContactModel.isGroup()); ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(),
infoContactModel.getLogin(), infoContactModel.getName(), infoContactModel.getEmailDomain(),
infoContactModel.isGroup());
ext.setIcon(); ext.setIcon();
listExtended.add(ext); listExtended.add(ext);
} }
storeSource.add(listExtended); storeSource.add(listExtended);
// GWT.log("Added sources: "+listExtended.toString()); // GWT.log("Added sources: "+listExtended.toString());
} }
gridAllContacts.unmask(); gridAllContacts.unmask();
@ -535,18 +524,19 @@ public class MultiDragContact extends Dialog {
/** /**
* Adds the already shared contacts. * Adds the already shared contacts.
* *
* @param listContact the list contact * @param listContact
* the list contact
*/ */
public void addAlreadySharedContacts(List<InfoContactModel> listContact){ public void addAlreadySharedContacts(List<InfoContactModel> listContact) {
gridShareWith.mask("", ConstantsExplorer.LOADINGSTYLE); gridShareWith.mask("", ConstantsExplorer.LOADINGSTYLE);
if(listContact!=null && listContact.size()>0){ if (listContact != null && listContact.size() > 0) {
String alreadyShared = ""; String alreadyShared = "";
for (int i=0; i<listContact.size()-1; i++) for (int i = 0; i < listContact.size() - 1; i++)
alreadyShared+=listContact.get(i).getName()+", "; alreadyShared += listContact.get(i).getName() + ", ";
alreadyShared+=listContact.get(listContact.size()-1).getName(); alreadyShared += listContact.get(listContact.size() - 1).getName();
textAreaAlreadyShared.setValue(alreadyShared); textAreaAlreadyShared.setValue(alreadyShared);
} }
@ -557,10 +547,11 @@ public class MultiDragContact extends Dialog {
/** /**
* Adds the target contacts. * Adds the target contacts.
* *
* @param listContact the list contact * @param listContact
* the list contact
*/ */
public void addTargetContacts(List<InfoContactModel> listContact){ public void addTargetContacts(List<InfoContactModel> listContact) {
if(listContact!=null && listContact.size()>0){ if (listContact != null && listContact.size() > 0) {
storeTarget.add(convertFromInfoContactModel(listContact)); storeTarget.add(convertFromInfoContactModel(listContact));
} }
} }
@ -568,14 +559,15 @@ public class MultiDragContact extends Dialog {
/** /**
* Convert from info contact model. * Convert from info contact model.
* *
* @param listContact the list contact * @param listContact
* the list contact
* @return the list * @return the list
*/ */
private List<ExtendedInfoContactModel> convertFromInfoContactModel(List<InfoContactModel> listContact){ private List<ExtendedInfoContactModel> convertFromInfoContactModel(List<InfoContactModel> listContact) {
if(listContact!=null){ if (listContact != null) {
List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>(listContact.size()); List<ExtendedInfoContactModel> listExtended = new ArrayList<ExtendedInfoContactModel>(listContact.size());
//SETTING ICONS // SETTING ICONS
for (InfoContactModel infoContactModel : listContact) { for (InfoContactModel infoContactModel : listContact) {
listExtended.add(convertFromInfoContactModel(infoContactModel)); listExtended.add(convertFromInfoContactModel(infoContactModel));
} }
@ -587,16 +579,19 @@ public class MultiDragContact extends Dialog {
/** /**
* Convert from info contact model. * Convert from info contact model.
* *
* @param infoContactModel the info contact model * @param infoContactModel
* the info contact model
* @return the extended info contact model * @return the extended info contact model
*/ */
private ExtendedInfoContactModel convertFromInfoContactModel(InfoContactModel infoContactModel){ private ExtendedInfoContactModel convertFromInfoContactModel(InfoContactModel infoContactModel) {
if(infoContactModel!=null){ if (infoContactModel != null) {
String fullName = infoContactModel.getName(); String fullName = infoContactModel.getName();
if(fullName==null || fullName.isEmpty()) if (fullName == null || fullName.isEmpty())
fullName = infoContactModel.getLogin(); fullName = infoContactModel.getLogin();
ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(), infoContactModel.getLogin(), fullName, infoContactModel.isGroup()); ExtendedInfoContactModel ext = new ExtendedInfoContactModel(infoContactModel.getId(),
infoContactModel.getLogin(), fullName, infoContactModel.getEmailDomain(),
infoContactModel.isGroup());
ext.setIcon(); ext.setIcon();
return ext; return ext;
} }
@ -606,10 +601,11 @@ public class MultiDragContact extends Dialog {
/** /**
* Adds the target contact. * Adds the target contact.
* *
* @param contact the contact * @param contact
* the contact
*/ */
public void addTargetContact(InfoContactModel contact){ public void addTargetContact(InfoContactModel contact) {
if(contact!=null) if (contact != null)
storeTarget.add(convertFromInfoContactModel(contact)); storeTarget.add(convertFromInfoContactModel(contact));
} }
@ -618,25 +614,26 @@ public class MultiDragContact extends Dialog {
* *
* @return the target list contact * @return the target list contact
*/ */
public List<InfoContactModel> getTargetListContact(){ public List<InfoContactModel> getTargetListContact() {
List<? extends InfoContactModel> infoContacts = storeTarget.getModels(); List<? extends InfoContactModel> infoContacts = storeTarget.getModels();
return (List<InfoContactModel>) infoContacts; return (List<InfoContactModel>) infoContacts;
} }
/** /**
* Sets the grop user store sorter. * Sets the grop user store sorter.
* *
* @param store the new grop user store sorter * @param store
* the new grop user store sorter
*/ */
private void setGropUserStoreSorter(ListStore<ExtendedInfoContactModel> store){ private void setGropUserStoreSorter(ListStore<ExtendedInfoContactModel> store) {
// Sorting files // Sorting files
store.setStoreSorter(new StoreSorter<ExtendedInfoContactModel>() { store.setStoreSorter(new StoreSorter<ExtendedInfoContactModel>() {
@Override @Override
public int compare(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel m1, ExtendedInfoContactModel m2, String property) { public int compare(Store<ExtendedInfoContactModel> store, ExtendedInfoContactModel m1,
ExtendedInfoContactModel m2, String property) {
boolean m1Folder = m1.isGroup(); boolean m1Folder = m1.isGroup();
boolean m2Folder = m2.isGroup(); boolean m2Folder = m2.isGroup();

View File

@ -247,7 +247,7 @@ public class StorageHubToWorkpaceConverter implements Serializable{
portalLogin = ""; portalLogin = "";
} }
return new InfoContactModel(portalLogin, portalLogin, UserUtil.getUserFullName(portalLogin), false); return new InfoContactModel(portalLogin, portalLogin, UserUtil.getUserFullName(portalLogin), "",false);
} }
/** /**

View File

@ -225,6 +225,18 @@ public class WsUtil {
} }
/**
* 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";
}
/** /**
* Gets the GWT workspace builder. * Gets the GWT workspace builder.
* *
@ -244,7 +256,7 @@ public class WsUtil {
builder = new GWTWorkspaceBuilder(); builder = new GWTWorkspaceBuilder();
// ADDED 03/09/2013 // ADDED 03/09/2013
builder.setContexInfo( builder.setContexInfo(
new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false), new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), "", false),
info.getCurrentScope()); info.getCurrentScope());
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder); session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
} }