Revision 5ec7b091
b/src/gr/grnet/pithos/web/client/FilePermissionsDialog.java | ||
---|---|---|
173 | 173 |
Button add = new Button("Add Group", new ClickHandler() { |
174 | 174 |
@Override |
175 | 175 |
public void onClick(ClickEvent event) { |
176 |
PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, false); |
|
177 |
dlg.center(); |
|
178 |
permList.updatePermissionTable(); |
|
176 |
if (app.getAccount().getGroups().isEmpty()) { |
|
177 |
new GroupCreateDialog(app, new Command() { |
|
178 |
|
|
179 |
@Override |
|
180 |
public void execute() { |
|
181 |
if (app.getAccount().getGroups().isEmpty()) |
|
182 |
return; |
|
183 |
PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, false); |
|
184 |
dlg.center(); |
|
185 |
permList.updatePermissionTable(); |
|
186 |
} |
|
187 |
}).center(); |
|
188 |
} |
|
189 |
else { |
|
190 |
PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, false); |
|
191 |
dlg.center(); |
|
192 |
permList.updatePermissionTable(); |
|
193 |
} |
|
179 | 194 |
} |
180 | 195 |
}); |
181 | 196 |
add.addStyleName("button"); |
b/src/gr/grnet/pithos/web/client/FolderPermissionsDialog.java | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
package gr.grnet.pithos.web.client; |
36 | 36 |
|
37 |
import gr.grnet.pithos.web.client.commands.CreateGroupCommand; |
|
37 | 38 |
import gr.grnet.pithos.web.client.foldertree.File; |
38 | 39 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
39 | 40 |
import gr.grnet.pithos.web.client.foldertree.Resource; |
... | ... | |
137 | 138 |
Button add = new Button("Add Group", new ClickHandler() { |
138 | 139 |
@Override |
139 | 140 |
public void onClick(ClickEvent event) { |
140 |
PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, false); |
|
141 |
dlg.center(); |
|
141 |
if (app.getAccount().getGroups().isEmpty()) { |
|
142 |
new GroupCreateDialog(app, new Command() { |
|
143 |
|
|
144 |
@Override |
|
145 |
public void execute() { |
|
146 |
if (app.getAccount().getGroups().isEmpty()) |
|
147 |
return; |
|
148 |
PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, false); |
|
149 |
dlg.center(); |
|
150 |
} |
|
151 |
}).center(); |
|
152 |
} |
|
153 |
else { |
|
154 |
PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, false); |
|
155 |
dlg.center(); |
|
156 |
} |
|
142 | 157 |
} |
143 | 158 |
}); |
144 | 159 |
add.addStyleName("button"); |
b/src/gr/grnet/pithos/web/client/GroupCreateDialog.java | ||
---|---|---|
41 | 41 |
import com.google.gwt.event.dom.client.ClickHandler; |
42 | 42 |
import com.google.gwt.event.dom.client.KeyCodes; |
43 | 43 |
import com.google.gwt.event.dom.client.KeyDownEvent; |
44 |
import com.google.gwt.user.client.Command; |
|
44 | 45 |
import com.google.gwt.user.client.Event.NativePreviewEvent; |
45 | 46 |
import com.google.gwt.user.client.ui.Anchor; |
46 | 47 |
import com.google.gwt.user.client.ui.Button; |
... | ... | |
57 | 58 |
|
58 | 59 |
protected Pithos app; |
59 | 60 |
|
61 |
private Command callback; |
|
62 |
|
|
60 | 63 |
/** |
61 | 64 |
* The widget that holds the folderName of the folder. |
62 | 65 |
*/ |
... | ... | |
64 | 67 |
|
65 | 68 |
final VerticalPanel inner; |
66 | 69 |
|
70 |
public GroupCreateDialog(final Pithos app) { |
|
71 |
this(app, null); |
|
72 |
} |
|
73 |
|
|
67 | 74 |
/** |
68 | 75 |
* The widget's constructor. |
69 | 76 |
*/ |
70 |
public GroupCreateDialog(final Pithos app) { |
|
77 |
public GroupCreateDialog(final Pithos app, Command callback) {
|
|
71 | 78 |
this.app = app; |
79 |
this.callback = callback; |
|
80 |
|
|
72 | 81 |
Anchor close = new Anchor(); |
73 | 82 |
close.addStyleName("close"); |
74 | 83 |
close.addClickHandler(new ClickHandler() { |
... | ... | |
160 | 169 |
public void closeDialog() { |
161 | 170 |
Pithos.preventIESelection(); |
162 | 171 |
hide(); |
172 |
if (callback != null) |
|
173 |
callback.execute(); |
|
163 | 174 |
} |
164 | 175 |
|
165 | 176 |
/** |
166 | 177 |
* Generate an RPC request to create a new folder. |
167 | 178 |
*/ |
168 |
private void createGroup() {
|
|
179 |
void createGroup() { |
|
169 | 180 |
String name = groupName.getText().trim(); |
170 | 181 |
if (name.length() == 0) |
171 | 182 |
return; |
Also available in: Unified diff