bugs fixed:
- back return suggest box - full name suggest box git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@71189 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1db23d384b
commit
40dd405668
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>workspace-tree-widget</artifactId>
|
||||
<version>6.0.0-SNAPSHOT</version>
|
||||
<version>6.0.1-SNAPSHOT</version>
|
||||
<name>gCube Workspace Tree Widget</name>
|
||||
<description>
|
||||
gCube Workspace Tree Widget.
|
||||
|
|
|
@ -165,9 +165,6 @@ public class ConstantsExplorer {
|
|||
public static final String IDREPORT = "idreport";
|
||||
public static final String REPORTGENERATION = "report-generation";
|
||||
|
||||
//Info contact constant
|
||||
public static final String LOGIN = "login";
|
||||
|
||||
//GRID COLUMN ADD CONTACT
|
||||
public static final String GRIDCOLUMNLOGIN = "Login";
|
||||
|
||||
|
|
|
@ -14,7 +14,9 @@ import com.extjs.gxt.ui.client.data.BaseModelData;
|
|||
public class InfoContactModel extends BaseModelData implements Serializable {
|
||||
|
||||
|
||||
protected static final String FULLNAME = "fullname";
|
||||
protected static final String ID = "id";
|
||||
public static final String FULLNAME = "fullname";
|
||||
public static final String LOGIN = "login";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -38,26 +40,26 @@ public class InfoContactModel extends BaseModelData implements Serializable {
|
|||
}
|
||||
|
||||
public String getId() {
|
||||
return get("id");
|
||||
return get(ID);
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
set("id", id);
|
||||
set(ID, id);
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return get(ConstantsExplorer.LOGIN);
|
||||
return get(LOGIN);
|
||||
}
|
||||
|
||||
public void setLogin(String login) {
|
||||
set(ConstantsExplorer.LOGIN, login);
|
||||
set(LOGIN, login);
|
||||
}
|
||||
|
||||
|
||||
public static Comparator<InfoContactModel> COMPARATOR = new Comparator<InfoContactModel>() {
|
||||
// This is where the sorting happens.
|
||||
public int compare(InfoContactModel o1, InfoContactModel o2) {
|
||||
return o1.getLogin().compareToIgnoreCase(o2.getLogin());
|
||||
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class DialogShareFolder extends Dialog {
|
|||
InfoContactModel contact = (InfoContactModel) o;
|
||||
|
||||
for (int i = 0; i < listAlreadyShared.size(); i++){
|
||||
if (contact.getLogin().compareTo(listAlreadyShared.get(i).getLogin())==0)
|
||||
if (contact.getName().compareTo(listAlreadyShared.get(i).getName())==0)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class DialogShareFolder extends Dialog {
|
|||
|
||||
for (InfoContactModel infoContactModel : result) {
|
||||
listAlreadyShared.add(infoContactModel);
|
||||
suggestPanel.addRecipient(infoContactModel.getLogin(),false);
|
||||
suggestPanel.addRecipient(infoContactModel.getName(),false);
|
||||
}
|
||||
|
||||
lc.unmask();
|
||||
|
@ -164,7 +164,7 @@ public class DialogShareFolder extends Dialog {
|
|||
|
||||
@Override
|
||||
public void onSuccess(InfoContactModel result) {
|
||||
txtOwner.setValue(result.getLogin());
|
||||
txtOwner.setValue(result.getName());
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -302,7 +302,7 @@ public class DialogShareFolder extends Dialog {
|
|||
initSuggestContacts();
|
||||
|
||||
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
||||
suggestPanel.addRecipient(infoContactModel.getLogin(),true);
|
||||
suggestPanel.addRecipient(infoContactModel.getName(),true);
|
||||
}
|
||||
|
||||
suggestPanel.boxSetFocus();
|
||||
|
@ -327,7 +327,7 @@ public class DialogShareFolder extends Dialog {
|
|||
suggestPanel.resetItemSelected();
|
||||
|
||||
for (InfoContactModel contact : listAlreadyShared) {
|
||||
suggestPanel.addRecipient(contact.getLogin(), false);
|
||||
suggestPanel.addRecipient(contact.getName(), false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class MultiDragContact extends Dialog {
|
|||
Grid<InfoContactModel> grid = new Grid<InfoContactModel>(storeSource, createColumnModel());
|
||||
grid.setSize(250,300);
|
||||
grid.setBorders(false);
|
||||
grid.setAutoExpandColumn("login");
|
||||
grid.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
||||
grid.setBorders(true);
|
||||
|
||||
vp.add(grid);
|
||||
|
@ -89,7 +89,7 @@ public class MultiDragContact extends Dialog {
|
|||
Grid<InfoContactModel> grid2 = new Grid<InfoContactModel>(storeTarget, createColumnModel());
|
||||
grid2.setSize(250, 300);
|
||||
grid2.setBorders(false);
|
||||
grid2.setAutoExpandColumn("login");
|
||||
grid2.setAutoExpandColumn(InfoContactModel.FULLNAME);
|
||||
grid2.setBorders(true);
|
||||
vp.add(grid2);
|
||||
|
||||
|
@ -130,8 +130,8 @@ public class MultiDragContact extends Dialog {
|
|||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||
|
||||
ColumnConfig column = new ColumnConfig();
|
||||
column.setId("login");
|
||||
column.setHeader("login");
|
||||
column.setId(InfoContactModel.FULLNAME);
|
||||
column.setHeader("Name");
|
||||
column.setWidth(200);
|
||||
configs.add(column);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.google.gwt.event.dom.client.KeyDownEvent;
|
|||
import com.google.gwt.event.dom.client.KeyDownHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
|
@ -69,11 +70,13 @@ public class MultiValuePanel extends Composite {
|
|||
|
||||
if(li.getWidget(0) instanceof Paragraph){
|
||||
Paragraph p = (Paragraph) li.getWidget(0);
|
||||
if (itemsSelected.contains(p.getText())) {
|
||||
GWT.log("p is removable : " + p.isRemovable());
|
||||
if (itemsSelected.contains(p.getText()) && (p.isRemovable()==true)) {
|
||||
itemsSelected.remove(p.getText());
|
||||
GWT.log("Removing selected item: " + p.getText() + "'");
|
||||
}
|
||||
listBullet.remove(li);
|
||||
}
|
||||
|
||||
itemBox.setFocus(true);
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +179,7 @@ public class MultiValuePanel extends Composite {
|
|||
oracle.clear();
|
||||
|
||||
for (InfoContactModel wsUser : result) {
|
||||
oracle.add(wsUser.getLogin());
|
||||
oracle.add(wsUser.getName());
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -196,22 +199,13 @@ public class MultiValuePanel extends Composite {
|
|||
users.clear();
|
||||
|
||||
for (InfoContactModel wsUser : result) {
|
||||
oracle.add(wsUser.getLogin());
|
||||
users.put(wsUser.getLogin(), wsUser);
|
||||
oracle.add(wsUser.getName());
|
||||
users.put(wsUser.getName(), wsUser);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public List<InfoContactModel> getAllUsers() {
|
||||
|
||||
List<InfoContactModel> listUsers = new ArrayList<InfoContactModel>();
|
||||
for (String key : users.keySet()) {
|
||||
listUsers.add(users.get(key));
|
||||
}
|
||||
return listUsers;
|
||||
}
|
||||
|
||||
public void resetItemSelected(){
|
||||
|
||||
listBullet.clear();
|
||||
|
@ -235,12 +229,13 @@ public class MultiValuePanel extends Composite {
|
|||
itemBox.setText(fullName);
|
||||
itemBox.setValue(fullName);
|
||||
final ListItem displayItem = new ListItem();
|
||||
Paragraph p = new Paragraph(fullName);
|
||||
|
||||
Paragraph p = new Paragraph(fullName);
|
||||
displayItem.add(p);
|
||||
|
||||
if(displayRemoveItem){
|
||||
displayItem.setStyleName("multivalue-panel-token-ws");
|
||||
p.setRemovable(true);
|
||||
Span span = new Span("x");
|
||||
span.addClickHandler(new ClickHandler() {
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
|
@ -250,14 +245,18 @@ public class MultiValuePanel extends Composite {
|
|||
|
||||
displayItem.add(span);
|
||||
}
|
||||
else
|
||||
else{
|
||||
displayItem.setStyleName("multivalue-panel-token-ws-notselectable");
|
||||
p.setRemovable(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
GWT.log("Adding selected wp item '" + itemBox.getValue());
|
||||
itemsSelected.add(itemBox.getValue());
|
||||
GWT.log("Total: " + itemsSelected);
|
||||
|
||||
listBullet.insert(displayItem, listBullet.getWidgetCount());
|
||||
listBullet.insert(displayItem, listBullet.getWidgetCount()-1);
|
||||
itemBox.setValue("");
|
||||
itemBox.setFocus(true);
|
||||
}
|
||||
|
|
|
@ -8,10 +8,13 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
*
|
||||
* @author Massimiliano Assante, ISTI-CNR
|
||||
* @version 0.1 Sep 2012
|
||||
* changed by Francesco Mangiacrapa
|
||||
*
|
||||
*/
|
||||
public class Paragraph extends Widget implements HasText {
|
||||
|
||||
boolean isRemovable = true;
|
||||
|
||||
public Paragraph() {
|
||||
setElement(DOM.createElement("p"));
|
||||
}
|
||||
|
@ -28,4 +31,12 @@ public class Paragraph extends Widget implements HasText {
|
|||
public void setText(String text) {
|
||||
getElement().setInnerText(text);
|
||||
}
|
||||
|
||||
public boolean isRemovable(){
|
||||
return isRemovable;
|
||||
}
|
||||
|
||||
public void setRemovable(boolean isRemovable) {
|
||||
this.isRemovable = isRemovable;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,9 @@ import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTP
|
|||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTUrlDocument;
|
||||
import org.gcube.portlets.user.workspace.server.util.AllScope;
|
||||
import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
||||
import org.gcube.portlets.user.workspace.server.util.Util;
|
||||
|
||||
import com.google.gwt.dev.util.collect.HashMap;
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
|
@ -88,6 +91,7 @@ public class GWTWorkspaceBuilder {
|
|||
|
||||
protected static final String IMAGE_SERVICE_URL = "ImageService";
|
||||
protected GCUBELog logger;
|
||||
protected static HashMap<String, InfoContactModel> hashTestUser = null;
|
||||
// private final String UNKNOWN = "unknown";
|
||||
// private final String FOLDER = "Folder";
|
||||
|
||||
|
@ -99,6 +103,28 @@ public class GWTWorkspaceBuilder {
|
|||
this.logger = logger;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used in test mode
|
||||
* @return
|
||||
*/
|
||||
public static HashMap<String, InfoContactModel> getHashTestUsers(){
|
||||
|
||||
if(hashTestUser==null){
|
||||
hashTestUser = new HashMap<String, InfoContactModel>();
|
||||
hashTestUser.put("federico.defaveri", new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri"));
|
||||
hashTestUser.put("antonio.gioia", new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia"));
|
||||
hashTestUser.put("fabio.sinibaldi", new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi"));
|
||||
hashTestUser.put("pasquale.pagano", new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano"));
|
||||
hashTestUser.put(Util.TEST_USER.toString(), new InfoContactModel(Util.TEST_USER, Util.TEST_USER, Util.TEST_USER_FULL_NAME));
|
||||
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
||||
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante"));
|
||||
|
||||
}
|
||||
|
||||
return hashTestUser;
|
||||
}
|
||||
|
||||
protected Date toDate(Calendar calendar)
|
||||
{
|
||||
if (calendar == null) return new Date(0);
|
||||
|
@ -838,11 +864,27 @@ public class GWTWorkspaceBuilder {
|
|||
}
|
||||
|
||||
|
||||
protected List<InfoContactModel> buildGxtInfoContactFromPortalLogin(List<String> listUserLogin){
|
||||
protected List<InfoContactModel> buildGxtInfoContactFromPortalLogin(List<String> listPortalLogin){
|
||||
|
||||
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
||||
for (String portalLogin : listUserLogin)
|
||||
for (String portalLogin : listPortalLogin)
|
||||
listContact.add(new InfoContactModel(portalLogin, portalLogin, UserUtil.getUserFullName(portalLogin)));
|
||||
|
||||
return listContact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used in test mode
|
||||
* @param listPortalLogin
|
||||
* @return
|
||||
*/
|
||||
protected List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<String> listPortalLogin){
|
||||
|
||||
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
||||
|
||||
for (String portalLogin : listPortalLogin)
|
||||
listContact.add(getHashTestUsers().get(portalLogin));
|
||||
|
||||
return listContact;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
||||
import org.gcube.portlets.user.homelibrary.home.workspace.Workspace;
|
||||
|
@ -61,7 +61,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
public static final String LAST_OPEN_FOLDER_ATTRIBUTE = "WORKSPACE.LAST_OPEN_FOLDER";
|
||||
public static final String SELECTION_STATE_ATTRIBUTE = "WORKSPACE.SELECTION_STATE";
|
||||
|
||||
protected GCUBELog workspaceLogger = new GCUBELog(GWTWorkspaceServiceImpl.class);
|
||||
// protected GCUBELog workspaceLogger = new GCUBELog(GWTWorkspaceServiceImpl.class);
|
||||
|
||||
protected Logger workspaceLogger = Logger.getLogger(GWTWorkspaceServiceImpl.class);
|
||||
|
||||
|
||||
protected GWTWorkspaceBuilder getGWTWorkspaceBuilder()
|
||||
|
@ -985,8 +987,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
Workspace workspace = getWorkspace();
|
||||
|
||||
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
||||
logger.trace("get all contacts");
|
||||
workspaceLogger.trace("get all contacts");
|
||||
|
||||
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
|
||||
// workspace.getAllScope();
|
||||
|
@ -995,14 +996,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
if(isTestMode()){
|
||||
|
||||
logger.warn("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS");
|
||||
workspaceLogger.warn("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS");
|
||||
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
||||
// //TEST USERS
|
||||
listContactsModel.add(new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri"));
|
||||
listContactsModel.add(new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia"));
|
||||
listContactsModel.add(new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi"));
|
||||
listContactsModel.add(new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano"));
|
||||
listContactsModel.add(new InfoContactModel(Util.TEST_USER, Util.TEST_USER, Util.TEST_USER));
|
||||
listContactsModel.add(new InfoContactModel(Util.TEST_USER, Util.TEST_USER, Util.TEST_USER_FULL_NAME));
|
||||
listContactsModel.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
||||
listContactsModel.add(new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante"));
|
||||
return listContactsModel;
|
||||
|
@ -1573,6 +1574,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
public List<InfoContactModel> getListUserSharedByFolderSharedId(String folderSharedId) throws Exception{
|
||||
|
||||
workspaceLogger.trace("getListUserSharedByFolderSharedId "+ folderSharedId);
|
||||
|
||||
try {
|
||||
Workspace workspace = getWorkspace();
|
||||
|
||||
|
@ -1588,6 +1590,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
workspaceLogger.trace("getListUserSharedByFolderSharedId return "+ listPortalLogin.size() + " user");
|
||||
|
||||
if(isTestMode())
|
||||
return builder.buildGxtInfoContactFromPortalLoginTestMode(listPortalLogin);
|
||||
|
||||
return builder.buildGxtInfoContactFromPortalLogin(listPortalLogin);
|
||||
|
||||
}
|
||||
|
|
|
@ -40,13 +40,15 @@ public class UserUtil {
|
|||
logger.error("An error occurred in getUserFullName "+e,e);
|
||||
}
|
||||
} catch (UserManagementPortalException ume) {
|
||||
|
||||
logger.error("An error occurred in getUserFullName "+ume,ume);
|
||||
}
|
||||
if (curr != null)
|
||||
return curr.getFullname();
|
||||
}else{
|
||||
|
||||
return Util.TEST_USER_FULL_NAME;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class Util {
|
|||
session.setScope(TEST_SCOPE);
|
||||
session.setUserAvatarId(TEST_USER + "Avatar");
|
||||
session.setUserFullName(TEST_USER_FULL_NAME);
|
||||
session.setUserEmailAddress("test.user@mail.test");
|
||||
session.setUserEmailAddress(TEST_USER + "@mail.test");
|
||||
}
|
||||
|
||||
withoutPortal = true;
|
||||
|
|
Loading…
Reference in New Issue