98 lines
2.9 KiB
Java
98 lines
2.9 KiB
Java
package org.gcube.portlets.widgets.workspacesharingwidget.client;
|
|
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.view.sharing.SmartShare;
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
|
|
|
import com.extjs.gxt.ui.client.event.BaseEvent;
|
|
import com.extjs.gxt.ui.client.event.Events;
|
|
import com.extjs.gxt.ui.client.event.Listener;
|
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
|
import com.extjs.gxt.ui.client.widget.Window;
|
|
import com.google.gwt.core.client.EntryPoint;
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
import com.google.gwt.user.client.ui.Button;
|
|
import com.google.gwt.user.client.ui.RootPanel;
|
|
|
|
/**
|
|
* Entry point classes define <code>onModuleLoad()</code>.
|
|
*/
|
|
public class WorkspaceSharingWidgetEntryPoint implements EntryPoint {
|
|
|
|
public static String ITEMID = "3f461fcf-c60f-4243-9212-4f7c89dbf7bc";
|
|
|
|
/**
|
|
* This is the entry point method.
|
|
*/
|
|
public void onModuleLoad() {
|
|
|
|
try {
|
|
|
|
|
|
/*WorkspaceSharingController controller = new WorkspaceSharingController(ITEMID, true, ACL_TYPE.READ_ONLY);
|
|
|
|
final Window sharingWindow = controller.getSharingDialog();
|
|
|
|
Button openSharingWindow = new Button("Show Sharing Window",
|
|
new ClickHandler() {
|
|
public void onClick(ClickEvent event) {
|
|
|
|
sharingWindow.show();
|
|
}
|
|
});
|
|
|
|
RootPanel.get("workpacesharingwidget").add(openSharingWindow);
|
|
|
|
*/
|
|
|
|
FileModel file = new FileModel("123", "test", false);
|
|
WorkspaceSmartSharingController controller = new WorkspaceSmartSharingController(file, null, false, false);
|
|
|
|
SmartConstants.HEADER_TITLE = "puppa";
|
|
SmartConstants.ITEM_NAME = "aa";
|
|
|
|
final SmartShare sharingWindow = controller.getSharingDialog();
|
|
Button openSharingWindow = new Button("Show Smart Share Window",
|
|
new ClickHandler() {
|
|
public void onClick(ClickEvent event) {
|
|
|
|
sharingWindow.show();
|
|
}
|
|
});
|
|
|
|
RootPanel.get("workpacesharingwidget").add(openSharingWindow);
|
|
|
|
sharingWindow.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
|
|
|
|
@Override
|
|
public void handleEvent(BaseEvent be) {
|
|
|
|
if(sharingWindow.isValidForm(true)){
|
|
//THAT'S OK
|
|
|
|
sharingWindow.getSharedListUsers(); //@return the selected contacts (as InfoContactModel)
|
|
|
|
sharingWindow.getSharedListUsersCredential(); //@return the selected contacts (as CredentialModel)
|
|
|
|
for (InfoContactModel contact : sharingWindow.getSharedListUsers()) {
|
|
System.out.println(contact);
|
|
}
|
|
|
|
for (CredentialModel credential : sharingWindow.getSharedListUsersCredential()) {
|
|
System.out.println(credential);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
}
|