Statistics
| Branch: | Tag: | Revision:

root / src / gr / grnet / pithos / web / client / FileShareDialog.java @ 64ea9b61

History | View | Annotate | Download (23.2 kB)

1
/*
2
 * Copyright 2011-2013 GRNET S.A. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or
5
 * without modification, are permitted provided that the following
6
 * conditions are met:
7
 *
8
 *   1. Redistributions of source code must retain the above
9
 *      copyright notice, this list of conditions and the following
10
 *      disclaimer.
11
 *
12
 *   2. Redistributions in binary form must reproduce the above
13
 *      copyright notice, this list of conditions and the following
14
 *      disclaimer in the documentation and/or other materials
15
 *      provided with the distribution.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
 * POSSIBILITY OF SUCH DAMAGE.
29
 *
30
 * The views and conclusions contained in the software and
31
 * documentation are those of the authors and should not be
32
 * interpreted as representing official policies, either expressed
33
 * or implied, of GRNET S.A.
34
 */
35
package gr.grnet.pithos.web.client;
36

    
37
import com.google.gwt.http.client.URL;
38
import com.google.gwt.user.client.ui.*;
39
import gr.grnet.pithos.web.client.foldertree.File;
40
import gr.grnet.pithos.web.client.rest.HeadRequest;
41
import gr.grnet.pithos.web.client.rest.PostRequest;
42

    
43
import com.google.gwt.core.client.GWT;
44
import com.google.gwt.core.client.Scheduler;
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;
49
import com.google.gwt.http.client.Response;
50
import com.google.gwt.http.client.UrlBuilder;
51
import com.google.gwt.resources.client.ImageResource;
52
import com.google.gwt.user.client.Command;
53
import com.google.gwt.user.client.Window;
54
import com.google.gwt.user.client.Event.NativePreviewEvent;
55

    
56
import java.util.Map;
57

    
58
/**
59
 * UI for the "Share" command.
60
 */
61
public class FileShareDialog extends AbstractPropertiesDialog {
62
    private static final class PermissionsUncheckWarning extends AbstractPropertiesDialog {
63
        private PermissionsUncheckWarning(Pithos app) {
64
            super(app);
65
            final Anchor close = new Anchor("close");
66
            close.addStyleName("close");
67
            close.addClickHandler(new ClickHandler() {
68
                @Override
69
                public void onClick(ClickEvent event) {
70
                    hide();
71
                }
72
            });
73
            final String dialogText = "Info";
74
            setText(dialogText);
75
            setStyleName("pithos-DialogBox");
76

    
77
            final VerticalPanel panel = new VerticalPanel();
78
            panel.add(close);
79

    
80
            VerticalPanel inner = new VerticalPanel();
81
            inner.addStyleName("inner");
82

    
83
            inner.add(
84
                new InlineHTML(
85
                    "It seems you are already sharing this file with some users." +
86
                    "<br>" +
87
                    "Please remove all users from the sharing list, to be able to uncheck this option."
88
                )
89
            );
90

    
91
            final Button ok = new Button("OK", new ClickHandler() {
92
                @Override
93
                public void onClick(ClickEvent event) {
94
                    hide();
95
                }
96
            });
97

    
98
            ok.addStyleName("button");
99
            inner.add(ok);
100

    
101
            panel.add(inner);
102
            panel.setCellHorizontalAlignment(inner, HasHorizontalAlignment.ALIGN_CENTER);
103

    
104
            setWidget(panel);
105
        }
106

    
107
        @Override
108
        protected boolean accept() {
109
            return true;
110
        }
111
    }
112

    
113
    // For public sharing
114
        private final HorizontalPanel publicPathPanel = new HorizontalPanel();
115
        private final TextBox publicPathText = new TextBox();
116

    
117
    // For private sharing
118
    private final HorizontalPanel privatePathPanel = new HorizontalPanel();
119
    private final TextBox privatePathText = new TextBox();
120
    private PermissionsList permList;
121
        
122
        /**
123
         * An image bundle for this widgets images.
124
         */
125
        public interface PublicSharingImages extends MessagePanel.Images {
126

    
127
                @Source("gr/grnet/pithos/resources/edit_user.png")
128
                ImageResource permUser();
129

    
130
                @Source("gr/grnet/pithos/resources/groups22.png")
131
                ImageResource permGroup();
132

    
133
                @Source("gr/grnet/pithos/resources/editdelete.png")
134
                ImageResource delete();
135
    }
136

    
137
    public interface PrivateSharingImages extends MessagePanel.Images {
138

    
139
        @Source("gr/grnet/pithos/resources/edit_user.png")
140
        ImageResource permUser();
141

    
142
        @Source("gr/grnet/pithos/resources/groups22.png")
143
        ImageResource permGroup();
144

    
145
        @Source("gr/grnet/pithos/resources/delete.gif")
146
        ImageResource delete();
147
    }
148

    
149
    private final File file;
150

    
151
    private final PrivateSharingImages privateSharingImages = GWT.create(PrivateSharingImages.class);
152

    
153
        /**
154
         * The widget's constructor.
155
         */
156
        public FileShareDialog(Pithos app, File file) {
157
        super(app);
158
        this.file = file;
159

    
160
                Anchor close = new Anchor("close");
161
                close.addStyleName("close");
162
                close.addClickHandler(new ClickHandler() {
163
                        
164
                        @Override
165
                        public void onClick(ClickEvent event) {
166
                                hide();
167
                        }
168
                });
169
                // Set the dialog's caption.
170
                setText(Const.TXT_SHARE_FILE);
171
                setGlassEnabled(true);
172
                setStyleName("pithos-DialogBox");
173

    
174
                // Outer contains inner and buttons.
175
                final VerticalPanel outer = new VerticalPanel();
176
                outer.add(close);
177
                final FocusPanel focusPanel = new FocusPanel(outer);
178
                // Inner contains generalPanel and permPanel.
179
                inner = new VerticalPanel();
180
                inner.addStyleName("inner");
181

    
182
        inner.add(createMainPanel());
183

    
184
        outer.add(inner);
185

    
186
                final Button ok = new Button("OK", new ClickHandler() {
187
                        @Override
188
                        public void onClick(ClickEvent event) {
189
                                closeDialog();
190
                        }
191
                });
192
                ok.addStyleName("button");
193

    
194
        outer.add(ok);
195
        outer.setCellHorizontalAlignment(inner, HasHorizontalAlignment.ALIGN_CENTER);
196

    
197
        focusPanel.setFocus(true);
198
        setWidget(outer);
199
        }
200

    
201
    private boolean IamOwner() {
202
        return file.getOwnerID().equals(app.getUserID());
203
    }
204

    
205
    private void populatePublicSharingPanel(VerticalPanel publicSharingPanel) {
206
        if(IamOwner()) {
207
            final HorizontalPanel publicCheckPanel = new HorizontalPanel();
208
            publicCheckPanel.setSpacing(8);
209

    
210
            // Check box header
211
            final CheckBox publicCheckBox = new CheckBox();
212
            Label publicCheckTitle = new InlineHTML("<b>Public on the Internet</b>");
213
            Label publicCheckInfo = new Label("Anyone who has the public link can access. No sign-in required.", true);
214

    
215
            publicCheckBox.setValue(isFilePubliclyShared());
216
            publicCheckBox.addClickHandler(new ClickHandler() {
217
                @Override
218
                public void onClick(ClickEvent event) {
219
                    final Boolean published;
220
                    if(publicCheckBox.getValue() != file.isPublished() && IamOwner()) {
221
                        published = publicCheckBox.getValue();
222
                    }
223
                    else {
224
                        published = Boolean.FALSE;
225
                    }
226

    
227
                    updateMetaDataForPublicSharing(published);
228
                }
229
            });
230

    
231
            publicCheckPanel.add(publicCheckBox);
232
            publicCheckPanel.add(publicCheckTitle);
233
            publicCheckPanel.add(publicCheckInfo);
234

    
235
            // Public Link
236
            publicPathPanel.setVisible(false);
237
            publicPathPanel.setWidth(Const.PERCENT_100);
238
            publicPathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
239
            publicPathPanel.add(new Label(Const.TXT_PUBLIC_LINK));
240
            publicPathPanel.setSpacing(8);
241
            publicPathPanel.addStyleName("pithos-TabPanelBottom");
242

    
243
            publicPathText.setWidth(Const.PERCENT_100);
244
            publicPathText.addClickHandler(new ClickHandler() {
245
                @Override
246
                public void onClick(ClickEvent event) {
247
                    Pithos.enableIESelection();
248
                    ((TextBox) event.getSource()).selectAll();
249
                    Pithos.preventIESelection();
250
                }
251
            });
252
            publicPathText.setText(Window.Location.getHost() + file.getPublicUri());
253
            publicPathText.setTitle("Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)");
254
            publicPathText.setReadOnly(true);
255
            publicPathPanel.add(publicPathText);
256

    
257
            publicSharingPanel.add(publicCheckPanel);
258
            publicSharingPanel.add(publicPathPanel);
259

    
260
            Scheduler.get().scheduleDeferred(new Command() {
261
                @Override
262
                public void execute() {
263
                    showLinkForPublicSharing();
264
                }
265
            });
266
        }
267
    }
268

    
269
    private void populatePrivateSharingPanel(VerticalPanel privateSharingPanel) {
270
        final HorizontalPanel privateCheckPanel = new HorizontalPanel();
271
        final VerticalPanel privatePermPanel = new VerticalPanel();
272
        final HorizontalPanel permButtons = new HorizontalPanel();
273

    
274
        privateCheckPanel.setSpacing(8);
275
        privatePermPanel.setVisible(isFilePrivatelyShared());
276
        permButtons.setSpacing(8);
277

    
278
        // Check box header
279
        final CheckBox privateCheckBox = new CheckBox();
280
        final Label privateCheckTitle = new  InlineHTML("<b>Private sharing</b>");
281
        final Label privateCheckInfo = new Label("Only people explicitly granted permission can access. Sign-in required.", true);
282

    
283
        privateCheckBox.setValue(isFilePrivatelyShared());
284
        privateCheckBox.addClickHandler(new ClickHandler() {
285
            @Override
286
            public void onClick(ClickEvent event) {
287
                // This is the value *after* the click is applied :)
288
                boolean userCheckedIt = privateCheckBox.getValue();
289
                boolean userUncheckedIt = !userCheckedIt;
290

    
291
                if(isFilePrivatelyShared()) {
292
                    // ignore the click, set it always to "checked"
293
                    privateCheckBox.setValue(true);
294
                    // show permissions
295
                    privatePermPanel.setVisible(true);
296

    
297
                    // Refs #3593
298
                    if(userUncheckedIt) {
299
                        new PermissionsUncheckWarning(app).center();
300
                    }
301
                }
302
                else {
303
                    privatePermPanel.setVisible(userCheckedIt);
304
                }
305
            }
306
        });
307

    
308
        privateCheckPanel.add(privateCheckBox);
309
        privateCheckPanel.add(privateCheckTitle);
310
        privateCheckPanel.add(privateCheckInfo);
311

    
312
        // Permission list
313
        permList = new PermissionsList(app, privateSharingImages, file.getPermissions(), file.getOwnerID(), false, new Command() {
314
            @Override
315
            public void execute() {
316
                updateMetaDataForPrivateSharing();
317
            }
318
        });
319

    
320
        // Permission Add buttons
321
        Button addUser = new Button("Add User", new ClickHandler() {
322
            @Override
323
            public void onClick(ClickEvent event) {
324
                PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, true);
325
                dlg.center();
326
                permList.updatePermissionTable();
327
            }
328
        });
329
        addUser.addStyleName("button");
330
        permButtons.add(addUser);
331

    
332
        final boolean haveGroups = app.getAccount().getGroups().size() > 0;
333

    
334
        if(haveGroups) {
335
            Button addGroup = new Button("Add Group", new ClickHandler() {
336
                @Override
337
                public void onClick(ClickEvent event) {
338
                    PermissionsAddDialog dlg = new PermissionsAddDialog(app, app.getAccount().getGroups(), permList, false);
339
                    dlg.center();
340
                    permList.updatePermissionTable();
341
                }
342
            });
343
            addGroup.addStyleName("button");
344

    
345
            permButtons.add(addGroup);
346
            permButtons.setCellHorizontalAlignment(addGroup, HasHorizontalAlignment.ALIGN_CENTER);
347
        }
348

    
349
        final Button addEverybody = new Button("Add everybody", new ClickHandler() {
350
            @Override
351
            public void onClick(ClickEvent event) {
352
                Pithos.LOG("Adding to Everybody");
353
                Pithos.LOG("");
354
                permList.addPermission("*", true, false);
355
                permList.updatePermissionTable();
356
            }
357
        });
358
        addEverybody.addStyleName("button");
359
        permButtons.add(addEverybody);
360

    
361
        privatePermPanel.add(permList);
362
        privatePermPanel.add(permButtons);
363

    
364
        // Private Link
365
        privatePathPanel.setVisible(false);
366
        privatePathPanel.setWidth(Const.PERCENT_100);
367
        privatePathPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
368
        privatePathPanel.add(new Label(Const.TXT_PRIVATE_LINK));
369
        privatePathPanel.setSpacing(8);
370
        privatePathPanel.addStyleName("pithos-TabPanelBottom");
371

    
372
        privatePathText.setWidth(Const.PERCENT_100);
373
        privatePathText.addClickHandler(new ClickHandler() {
374
            @Override
375
            public void onClick(ClickEvent event) {
376
                Pithos.enableIESelection();
377
                ((TextBox) event.getSource()).selectAll();
378
                Pithos.preventIESelection();
379
            }
380
        });
381
        privatePathText.setText(Window.Location.getHost() + file.getPublicUri());
382
        privatePathText.setTitle("Use this link for sharing the file via e-mail, IM, etc. (crtl-C/cmd-C to copy to system clipboard)");
383
        privatePathText.setWidth(Const.PERCENT_100);
384
        privatePathText.setReadOnly(true);
385
        privatePathPanel.add(privatePathText);
386

    
387
        Scheduler.get().scheduleDeferred(new Command() {
388
            @Override
389
            public void execute() {
390
                showLinkForPrivateSharing();
391
            }
392
        });
393

    
394
        privateSharingPanel.add(privateCheckPanel);
395
        privateSharingPanel.add(privatePermPanel);
396
        privateSharingPanel.add(privatePathPanel);
397
    }
398

    
399
    private Panel createMainPanel() {
400
        VerticalPanel panelAll = new VerticalPanel();
401
        VerticalPanel panelPublic = new VerticalPanel();
402
        VerticalPanel panelPrivate = new VerticalPanel();
403

    
404
        populatePrivateSharingPanel(panelPrivate);
405
        populatePublicSharingPanel(panelPublic);
406

    
407
        panelAll.add(panelPrivate);
408
        panelAll.add(new InlineHTML("<hr/>"));
409
        panelAll.add(panelPublic);
410

    
411
        return panelAll;
412
    }
413

    
414
    private boolean isFilePubliclyShared() {
415
        return file.isPublished();
416
    }
417

    
418
    private boolean isFilePrivatelyShared() {
419
        return file.isShared();
420
    }
421

    
422
    private void showLinkForPublicSharing() {
423
                if (isFilePubliclyShared()) {
424
                        UrlBuilder b = Window.Location.createUrlBuilder();
425
                        b.setPath(file.getPublicUri());
426
                        publicPathText.setText(b.buildString());
427
                publicPathPanel.setVisible(true);
428
                }
429
                else {
430
                        publicPathPanel.setVisible(false);
431
                }
432
    }
433

    
434
    private void showLinkForPrivateSharing() {
435
        if (isFilePrivatelyShared()) {
436
            UrlBuilder b = Window.Location.createUrlBuilder();
437
            b.setPath(Pithos.getStorageAPIURL() + file.getOwnerID() + file.getUri());
438
            String href = Window.Location.getHref();
439
            boolean hasParameters = href.contains(Const.QUESTION_MARK);
440
            privatePathText.setText(href + (hasParameters ? Const.AMPERSAND : Const.QUESTION_MARK) + Const.GOTO_EQ + b.buildString());
441
            privatePathPanel.setVisible(true);
442
        }
443
        else {
444
            privatePathPanel.setVisible(false);
445
        }
446
    }
447

    
448
        protected void updateMetaDataForPublicSharing(String api, String owner, final String path, final Boolean published) {
449
        if (published != null) {
450
            PostRequest updateFile = new PostRequest(api, owner, path) {
451
                @Override
452
                public void onSuccess(Resource result) {
453
                        HeadRequest<File> headFile = new HeadRequest<File>(File.class, Pithos.getStorageAPIURL(), file.getOwnerID(), path, file) {
454

    
455
                                                @Override
456
                                                public void onSuccess(File _result) {
457
                                                        showLinkForPublicSharing();
458
                                                        if (!app.isMySharedSelected()) {
459
                                            app.updateFolder(file.getParent(), true, new Command() {
460
                                                                        
461
                                                                        @Override
462
                                                                        public void execute() {
463
                                                                                app.updateMySharedRoot();
464
                                                                        }
465
                                                                }, true);
466
                            }
467
                                                        else {
468
                                                                app.updateSharedFolder(file.getParent(), true);
469
                            }
470
                                                }
471

    
472
                                                @Override
473
                                                public void onError(Throwable t) {
474
                                                        app.setError(t);
475
                                    app.displayError("System error modifying file:" + t.getMessage());
476
                                                }
477

    
478
                                                @Override
479
                                                protected void onUnauthorized(Response response) {
480
                                                        app.sessionExpired();
481
                                                }
482
                                        };
483
                                        headFile.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
484
                                        Scheduler.get().scheduleDeferred(headFile);
485
                }
486

    
487
                @Override
488
                public void onError(Throwable t) {
489
                                        app.setError(t);
490
                    app.displayError("System error modifying file:" + t.getMessage());
491
                }
492

    
493
                                @Override
494
                                protected void onUnauthorized(Response response) {
495
                                        app.sessionExpired();
496
                                }
497
            };
498
            updateFile.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
499
            updateFile.setHeader(Const.X_OBJECT_PUBLIC, published.toString());
500
            Scheduler.get().scheduleDeferred(updateFile);
501
        }
502
        else if (!app.isMySharedSelected())
503
            app.updateFolder(file.getParent(), true, new Command() {
504
                                @Override
505
                                public void execute() {
506
                                        if (file.isSharedOrPublished()) {
507
                        app.updateMySharedRoot();
508
                    }
509
                                }
510
                        }, true);
511
        else
512
                app.updateSharedFolder(file.getParent(), true);
513
    }
514
    protected void updateMetaDataForPublicSharing(Boolean published) {
515
        updateMetaDataForPublicSharing(
516
            Pithos.getStorageAPIURL(),
517
            app.getUserID(),
518
            file.getUri() + Const.QUESTION_MARK_UPDATE_EQ,
519
            published
520
        );
521
    }
522

    
523
    protected void updateMetaDataForPrivateSharing(String api, String owner, final String path, final Map<String, Boolean[]> newPermissions) {
524
        if (newPermissions != null) {
525
            PostRequest updateFile = new PostRequest(api, owner, path) {
526
                @Override
527
                public void onSuccess(Resource result) {
528
                    HeadRequest<File> headFile = new HeadRequest<File>(File.class, Pithos.getStorageAPIURL(), file.getOwnerID(), path, file) {
529

    
530
                        @Override
531
                        public void onSuccess(File _result) {
532
                            showLinkForPrivateSharing();
533
                            if (!app.isMySharedSelected())
534
                                app.updateFolder(file.getParent(), true, new Command() {
535

    
536
                                    @Override
537
                                    public void execute() {
538
                                        app.updateMySharedRoot();
539
                                    }
540
                                }, true);
541
                            else
542
                                app.updateSharedFolder(file.getParent(), true);
543
                        }
544

    
545
                        @Override
546
                        public void onError(Throwable t) {
547
                            app.setError(t);
548
                            app.displayError("System error modifying file:" + t.getMessage());
549
                        }
550

    
551
                        @Override
552
                        protected void onUnauthorized(Response response) {
553
                            app.sessionExpired();
554
                        }
555
                    };
556
                    headFile.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
557
                    Scheduler.get().scheduleDeferred(headFile);
558
                }
559

    
560
                @Override
561
                public void onError(Throwable t) {
562
                    app.setError(t);
563
                    app.displayError("System error modifying file:" + t.getMessage());
564
                }
565

    
566
                @Override
567
                protected void onUnauthorized(Response response) {
568
                    app.sessionExpired();
569
                }
570
            };
571
            updateFile.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
572

    
573
            String readPermHeader = Const.READ_EQ;
574
            String writePermHeader = Const.WRITE_EQ;
575
            for (String u : newPermissions.keySet()) {
576
                Boolean[] p = newPermissions.get(u);
577
                if (p[0] != null && p[0]) {
578
                    readPermHeader += u + Const.COMMA;
579
                }
580
                if (p[1] != null && p[1]) {
581
                    writePermHeader += u + Const.COMMA;
582
                }
583
            }
584
            if (readPermHeader.endsWith(Const.EQ)) {
585
                readPermHeader = "";
586
            }
587
            else if (readPermHeader.endsWith(Const.COMMA)) {
588
                readPermHeader = readPermHeader.substring(0, readPermHeader.length() - 1);
589
            }
590
            if (writePermHeader.endsWith(Const.EQ)) {
591
                writePermHeader = "";
592
            }
593
            else if (writePermHeader.endsWith(Const.COMMA)) {
594
                writePermHeader = writePermHeader.substring(0, writePermHeader.length() - 1);
595
            }
596
            String permHeader = readPermHeader +
597
                ((readPermHeader.length()  > 0 && writePermHeader.length() > 0) ?  Const.SEMI : "") + writePermHeader;
598
            if (permHeader.length() == 0) {
599
                permHeader=Const.TILDE;
600
            }
601
            else {
602
                permHeader = URL.encodePathSegment(permHeader);
603
            }
604
            updateFile.setHeader(Const.X_OBJECT_SHARING, permHeader);
605
            Scheduler.get().scheduleDeferred(updateFile);
606
        }
607
        else if (!app.isMySharedSelected()) {
608
            app.updateFolder(file.getParent(), true, new Command() {
609
                @Override
610
                public void execute() {
611
                    if (file.isSharedOrPublished())
612
                        app.updateMySharedRoot();
613
                }
614
            }, true);
615
        }
616
        else {
617
            app.updateSharedFolder(file.getParent(), true);
618
        }
619
    }
620
    protected void updateMetaDataForPrivateSharing() {
621
        updateMetaDataForPrivateSharing(
622
            Pithos.getStorageAPIURL(),
623
            app.getUserID(),
624
            file.getUri() + Const.QUESTION_MARK_UPDATE_EQ,
625
            permList.getPermissions()
626
        );
627
    }
628

    
629
    @Override
630
        protected void onPreviewNativeEvent(NativePreviewEvent preview) {
631
            super.onPreviewNativeEvent(preview);
632

    
633
            NativeEvent evt = preview.getNativeEvent();
634
            if (evt.getType().equals(Const.EVENT_TYPE_KEYDOWN) &&
635
            evt.getKeyCode() == KeyCodes.KEY_ENTER) {
636

    
637
            closeDialog();
638
        }
639
        }
640

    
641
    @Override
642
    protected boolean accept() {
643
        return true;
644
    }
645
}