git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@92618 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-03-04 14:07:29 +00:00
parent 3992036db5
commit 486be86cec
5 changed files with 27 additions and 5 deletions

View File

@ -76,6 +76,7 @@ public class WorkspaceSharingController {
@Override
public void onFailure(Throwable caught) {
sharingDialog.unmask();
sharingDialog.setAsError(caught.getMessage());
MessageBox.alert("Error", caught.getMessage(), null);
}

View File

@ -19,6 +19,7 @@ import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.form.TextArea;
@ -263,6 +264,12 @@ public class DialogShareWItem extends Dialog {
permission.setEnabled(bool);
}
public void setAsError(String message){
enableFormDialog(false);
this.add(new Html("<br/> <p style=\"color:red; font-family:verdana, arial; font-size:14px;\">"+message+"</p>"));
this.layout();
}
/**
*
* @return

View File

@ -19,6 +19,7 @@ import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.form.TextField;
@ -133,8 +134,8 @@ public class SmartShare extends Dialog{
public void onSuccess(List<InfoContactModel> result) {
for (InfoContactModel infoContactModel : result) {
if(infoContactModel.getName()!=null){
listAlreadyShared.add(infoContactModel);
suggestPanel.addRecipient(infoContactModel.getName(),false);
listAlreadyShared.add(infoContactModel);
suggestPanel.addRecipient(infoContactModel.getName(),false);
layout();
}
}
@ -344,6 +345,17 @@ public class SmartShare extends Dialog{
}
public void setAsError(String message){
enableFormDialog(false);
this.add(new Html("<br/> <p style=\"color:red; font-family:verdana, arial; font-size:14px;\">"+message+"</p>"));
this.layout();
}
private void enableFormDialog(boolean bool){
getButtonById(Dialog.OK).setEnabled(bool);
buttonMultiDrag.setEnabled(bool);
}
public String getName() {
return txtName.getValue();

View File

@ -7,6 +7,7 @@ import java.util.List;
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.ContactFetcher;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@ -191,6 +192,7 @@ public class MultiValuePanel extends Composite {
@Override
public void onFailure(Throwable caught) {
GWT.log("Error on loading contacts");
MessageBox.alert("Error", caught.getMessage(), null);
}
@Override

View File

@ -76,16 +76,16 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
public List<InfoContactModel> getAllContacts() throws Exception {
try {
WsUtil.getAslSession(this.getThreadLocalRequest().getSession()); //THIS FORCE THE SESSION CREATION
logger.info("Get all contacts");
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
// workspace.getAllScope();
// workspace.getAllScope();
GWTWorkspaceSharingBuilder builder = getGWTWorkspaceBuilder();
if(isTestMode()){
logger.info("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS");
logger.warn("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS");
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
// //TEST USERS