34 |
34 |
*/
|
35 |
35 |
package gr.grnet.pithos.web.client;
|
36 |
36 |
|
37 |
|
import com.google.gwt.event.dom.client.*;
|
38 |
37 |
import com.google.gwt.http.client.URL;
|
39 |
|
import com.google.gwt.user.client.Event;
|
40 |
38 |
import com.google.gwt.user.client.ui.*;
|
41 |
39 |
import gr.grnet.pithos.web.client.foldertree.File;
|
42 |
40 |
import gr.grnet.pithos.web.client.rest.HeadRequest;
|
... | ... | |
45 |
43 |
import com.google.gwt.core.client.GWT;
|
46 |
44 |
import com.google.gwt.core.client.Scheduler;
|
47 |
45 |
import com.google.gwt.dom.client.NativeEvent;
|
|
46 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
47 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
48 |
import com.google.gwt.event.dom.client.KeyCodes;
|
48 |
49 |
import com.google.gwt.http.client.Response;
|
49 |
50 |
import com.google.gwt.http.client.UrlBuilder;
|
50 |
51 |
import com.google.gwt.resources.client.ImageResource;
|
... | ... | |
58 |
59 |
* UI for the "Share" command.
|
59 |
60 |
*/
|
60 |
61 |
public class FileShareDialog extends AbstractPropertiesDialog {
|
61 |
|
private static final class LinkTextContextMenu extends PopupPanel {
|
62 |
|
private final TextBox toCopy;
|
63 |
|
|
64 |
|
public LinkTextContextMenu(TextBox toCopy) {
|
65 |
|
super(true); // autoHide
|
66 |
|
|
67 |
|
this.toCopy = toCopy;
|
68 |
|
|
69 |
|
final MenuBar contextMenu = new MenuBar(true);
|
70 |
|
final MenuItem copy = new MenuItem("Copy", false, new Command() {
|
71 |
|
@Override
|
72 |
|
public void execute() {
|
73 |
|
Pithos.LOG("Copying ", LinkTextContextMenu.this.toCopy.getText());
|
74 |
|
LinkTextContextMenu.this.hide();
|
75 |
|
Helpers.copyToClipboardFrom(LinkTextContextMenu.this.toCopy.getElement());
|
76 |
|
}
|
77 |
|
});
|
78 |
|
contextMenu.addItem(copy);
|
79 |
|
|
80 |
|
add(contextMenu);
|
81 |
|
}
|
82 |
|
}
|
83 |
|
|
84 |
|
private static final class LinkTextBox extends TextBox {
|
85 |
|
public LinkTextBox() {
|
86 |
|
sinkEvents(Event.ONCONTEXTMENU);
|
87 |
|
|
88 |
|
addHandler(new ContextMenuHandler() {
|
89 |
|
@Override
|
90 |
|
public void onContextMenu(ContextMenuEvent event) {
|
91 |
|
final int x = event.getNativeEvent().getClientX();
|
92 |
|
final int y = event.getNativeEvent().getClientY();
|
93 |
|
|
94 |
|
final LinkTextContextMenu menu = new LinkTextContextMenu(LinkTextBox.this);
|
95 |
|
menu.setPopupPosition(x, y);
|
96 |
|
menu.show();
|
97 |
|
|
98 |
|
}
|
99 |
|
}, ContextMenuEvent.getType());
|
100 |
|
}
|
101 |
|
}
|
102 |
|
|
103 |
62 |
// For public sharing
|
104 |
63 |
private final HorizontalPanel publicPathPanel = new HorizontalPanel();
|
105 |
|
private final TextBox publicPathText = new LinkTextBox();
|
|
64 |
private final TextBox publicPathText = new TextBox();
|
106 |
65 |
|
107 |
66 |
// For private sharing
|
108 |
67 |
private final HorizontalPanel privatePathPanel = new HorizontalPanel();
|
109 |
|
private final TextBox privatePathText = new LinkTextBox();
|
|
68 |
private final TextBox privatePathText = new TextBox();
|
|
69 |
private final VerticalPanel privatePermSuperPanel = new VerticalPanel();
|
110 |
70 |
private PermissionsList permList;
|
111 |
71 |
|
112 |
72 |
/**
|
... | ... | |
354 |
314 |
privatePathPanel.addStyleName("pithos-TabPanelBottom");
|
355 |
315 |
|
356 |
316 |
privatePathText.setWidth(Const.PERCENT_100);
|
357 |
|
|
358 |
317 |
privatePathText.addClickHandler(new ClickHandler() {
|
359 |
318 |
@Override
|
360 |
319 |
public void onClick(ClickEvent event) {
|