enhancements
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@92568 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a8377863c5
commit
a82619e6ca
|
@ -16,5 +16,5 @@ public interface ConstantsSharing {
|
||||||
|
|
||||||
|
|
||||||
public static int WIDTH_DIALOG = 530;
|
public static int WIDTH_DIALOG = 530;
|
||||||
public static int HEIGHT_DIALOG = 530;
|
public static int HEIGHT_DIALOG = 430;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class WorkspaceSharingController {
|
||||||
|
|
||||||
private ACL_TYPE defaultPermission;
|
private ACL_TYPE defaultPermission;
|
||||||
|
|
||||||
private Window win = null;
|
private DialogShareWItem sharingDialog = null;
|
||||||
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
@ -71,9 +71,9 @@ public class WorkspaceSharingController {
|
||||||
|
|
||||||
|
|
||||||
private void initWindow(){
|
private void initWindow(){
|
||||||
win = new Window();
|
sharingDialog = new DialogShareWItem();
|
||||||
win.setSize(ConstantsSharing.WIDTH_DIALOG+20, ConstantsSharing.HEIGHT_DIALOG+20);
|
sharingDialog.setSize(ConstantsSharing.WIDTH_DIALOG+20, ConstantsSharing.HEIGHT_DIALOG+20);
|
||||||
win.mask("Loading File from Workspace", ConstantsSharing.LOADINGSTYLE);
|
sharingDialog.mask("Loading File from Workspace", ConstantsSharing.LOADINGSTYLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,16 +83,17 @@ public class WorkspaceSharingController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
win.unmask();
|
sharingDialog.unmask();
|
||||||
MessageBox.alert("Error", caught.getMessage(), null);
|
MessageBox.alert("Error", caught.getMessage(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(FileModel result) {
|
public void onSuccess(FileModel result) {
|
||||||
win.mask("File loaded", ConstantsSharing.LOADINGSTYLE);
|
sharingDialog.unmask();
|
||||||
|
sharingDialog.mask("File loaded", ConstantsSharing.LOADINGSTYLE);
|
||||||
|
|
||||||
if(showSharingDialog)
|
if(showSharingDialog)
|
||||||
createDialog(result);
|
updateSharingDialog(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -101,13 +102,12 @@ public class WorkspaceSharingController {
|
||||||
*
|
*
|
||||||
* @param fileModel
|
* @param fileModel
|
||||||
*/
|
*/
|
||||||
private void createDialog(FileModel fileModel){
|
private void updateSharingDialog(FileModel fileModel){
|
||||||
win.unmask();
|
sharingDialog.unmask();
|
||||||
DialogShareWItem dialogShareItem = new DialogShareWItem(fileModel, shareOnlyOwner, defaultPermission);
|
sharingDialog.updateSharingDialog(fileModel, shareOnlyOwner, defaultPermission);
|
||||||
win.add(dialogShareItem);
|
// dialogShareItem.show();
|
||||||
dialogShareItem.show();
|
|
||||||
|
|
||||||
win.layout();
|
sharingDialog.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,8 +160,8 @@ public class WorkspaceSharingController {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Window getSharingWindow() {
|
public Window getSharingDialog() {
|
||||||
return win;
|
return sharingDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,9 @@ import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||||
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
|
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
|
||||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
|
import com.extjs.gxt.ui.client.event.EventType;
|
||||||
|
import com.extjs.gxt.ui.client.event.Events;
|
||||||
|
import com.extjs.gxt.ui.client.event.Listener;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||||
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
||||||
|
@ -51,7 +54,16 @@ public class DialogShareWItem extends Dialog {
|
||||||
private TextField<String> txtOwner;
|
private TextField<String> txtOwner;
|
||||||
private PanelTogglePermission permission;
|
private PanelTogglePermission permission;
|
||||||
private HorizontalPanel hpPermission = null;
|
private HorizontalPanel hpPermission = null;
|
||||||
|
private boolean showError = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public DialogShareWItem() {
|
||||||
|
initLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,16 +93,18 @@ public class DialogShareWItem extends Dialog {
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to modify a shared folder or share an existing folder
|
* Use to modify a shared folder or share an existing folder
|
||||||
* @param fileModel
|
* @param fileModel
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
public DialogShareWItem(FileModel fileModel, final boolean shareOnlyOwner, final ACL_TYPE defaultACL) {
|
|
||||||
initLayout();
|
public void updateSharingDialog(FileModel fileModel, final boolean shareOnlyOwner, final ACL_TYPE defaultACL){
|
||||||
this.fileToShare = fileModel;
|
this.fileToShare = fileModel;
|
||||||
|
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
|
|
||||||
String heading = "Share workspace";
|
String heading = "Share workspace";
|
||||||
|
@ -220,19 +234,32 @@ public class DialogShareWItem extends Dialog {
|
||||||
if(shareOnlyOwner)
|
if(shareOnlyOwner)
|
||||||
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
|
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
private void permissionControl(String owner, boolean showAlert){
|
private void permissionControl(String owner, boolean showAlert){
|
||||||
GWT.log("Permission control compare between owner: "+owner +" and my login: "+WorkspaceSharingController.getMyLogin());
|
GWT.log("Permission control compare between owner: "+owner +" and my login: "+WorkspaceSharingController.getMyLogin());
|
||||||
|
|
||||||
if(WorkspaceSharingController.getMyLogin().compareToIgnoreCase(owner)!=0){
|
if(WorkspaceSharingController.getMyLogin().compareToIgnoreCase(owner)!=0){
|
||||||
enableFormDialog(false);
|
enableFormDialog(false);
|
||||||
if(showAlert)
|
if(showAlert){
|
||||||
MessageBox.alert("Permission denied", "You have no permissions to change sharing. You are not owner of \""+txtName.getValue()+"\"", null);
|
showError = true;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
enableFormDialog(true);
|
enableFormDialog(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.extjs.gxt.ui.client.widget.Window#afterShow()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void afterShow() {
|
||||||
|
super.afterShow();
|
||||||
|
|
||||||
|
if(showError){
|
||||||
|
MessageBox.alert("Permission denied", "You have no permissions to change sharing. You are not owner of \""+txtName.getValue()+"\"", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void enableFormDialog(boolean bool){
|
private void enableFormDialog(boolean bool){
|
||||||
getButtonById(Dialog.OK).setEnabled(bool);
|
getButtonById(Dialog.OK).setEnabled(bool);
|
||||||
buttonMultiDrag.setEnabled(bool);
|
buttonMultiDrag.setEnabled(bool);
|
||||||
|
|
|
@ -224,7 +224,7 @@ public class DialogShareWItemNoACL extends Dialog {
|
||||||
if(shareOnlyOwner)
|
if(shareOnlyOwner)
|
||||||
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
|
enableFormDialog(false); //FORM IS DISABLED BY DEFAULT
|
||||||
|
|
||||||
this.show();
|
// this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void permissionControl(String owner, boolean showAlert){
|
private void permissionControl(String owner, boolean showAlert){
|
||||||
|
|
|
@ -62,8 +62,10 @@ public class PanelTogglePermission extends LayoutContainer {
|
||||||
bToggle.setAllowDepress(false);
|
bToggle.setAllowDepress(false);
|
||||||
|
|
||||||
if(defaultACLType!=null){
|
if(defaultACLType!=null){
|
||||||
defaultACLType.equals(acl.getAclType());
|
GWT.log("comparing.. "+defaultACLType + " and "+acl.getAclType());
|
||||||
bToggle.toggle(true);
|
GWT.log(defaultACLType.equals(acl.getAclType())+"");
|
||||||
|
// defaultACLType.equals(acl.getAclType());
|
||||||
|
bToggle.toggle(defaultACLType.equals(acl.getAclType()));
|
||||||
}else{
|
}else{
|
||||||
bToggle.toggle(acl.getDefaultValue());
|
bToggle.toggle(acl.getDefaultValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class UserStore implements ContactFetcher{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
GWT.log("loaded "+result.size() + " contacts from server");
|
GWT.log("Get all contacts loaded "+result.size() + " contacts from server");
|
||||||
listAllContact = result;
|
listAllContact = result;
|
||||||
callback.onSuccess(listAllContact);
|
callback.onSuccess(listAllContact);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class UserStore implements ContactFetcher{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<InfoContactModel> result) {
|
public void onSuccess(List<InfoContactModel> result) {
|
||||||
GWT.log("loaded "+result.size() + " contacts from server for "+sharedFolderId);
|
GWT.log("Get List user shared loaded "+result.size() + " contacts from server for "+sharedFolderId);
|
||||||
callback.onSuccess(result);
|
callback.onSuccess(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class InfoContactModel extends BaseModelData implements Serializable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -77,5 +78,4 @@ public class InfoContactModel extends BaseModelData implements Serializable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue