root / src / gr / grnet / pithos / web / client / grouptree / GroupContextMenu.java @ ea30dad9
History | View | Annotate | Download (3.5 kB)
1 | 4baffab1 | Christos Stathis | /*
|
---|---|---|---|
2 | cae2a8db | Christos Stathis | * Copyright 2011-2012 GRNET S.A. All rights reserved.
|
3 | 4baffab1 | Christos Stathis | *
|
4 | 4baffab1 | Christos Stathis | * Redistribution and use in source and binary forms, with or
|
5 | 4baffab1 | Christos Stathis | * without modification, are permitted provided that the following
|
6 | 4baffab1 | Christos Stathis | * conditions are met:
|
7 | 4baffab1 | Christos Stathis | *
|
8 | 4baffab1 | Christos Stathis | * 1. Redistributions of source code must retain the above
|
9 | 4baffab1 | Christos Stathis | * copyright notice, this list of conditions and the following
|
10 | 4baffab1 | Christos Stathis | * disclaimer.
|
11 | 4baffab1 | Christos Stathis | *
|
12 | 4baffab1 | Christos Stathis | * 2. Redistributions in binary form must reproduce the above
|
13 | 4baffab1 | Christos Stathis | * copyright notice, this list of conditions and the following
|
14 | 4baffab1 | Christos Stathis | * disclaimer in the documentation and/or other materials
|
15 | 4baffab1 | Christos Stathis | * provided with the distribution.
|
16 | 4baffab1 | Christos Stathis | *
|
17 | 4baffab1 | Christos Stathis | * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
18 | 4baffab1 | Christos Stathis | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19 | 4baffab1 | Christos Stathis | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 | 4baffab1 | Christos Stathis | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
21 | 4baffab1 | Christos Stathis | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22 | 4baffab1 | Christos Stathis | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23 | 4baffab1 | Christos Stathis | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
24 | 4baffab1 | Christos Stathis | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
25 | 4baffab1 | Christos Stathis | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26 | 4baffab1 | Christos Stathis | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
27 | 4baffab1 | Christos Stathis | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 | 4baffab1 | Christos Stathis | * POSSIBILITY OF SUCH DAMAGE.
|
29 | 4baffab1 | Christos Stathis | *
|
30 | 4baffab1 | Christos Stathis | * The views and conclusions contained in the software and
|
31 | 4baffab1 | Christos Stathis | * documentation are those of the authors and should not be
|
32 | 4baffab1 | Christos Stathis | * interpreted as representing official policies, either expressed
|
33 | 4baffab1 | Christos Stathis | * or implied, of GRNET S.A.
|
34 | 4baffab1 | Christos Stathis | */
|
35 | 4baffab1 | Christos Stathis | package gr.grnet.pithos.web.client.grouptree; |
36 | 4baffab1 | Christos Stathis | |
37 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.Pithos; |
38 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.commands.AddUserCommand; |
39 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.commands.CreateGroupCommand; |
40 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.commands.DeleteGroupCommand; |
41 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.grouptree.GroupTreeView.Images; |
42 | 4baffab1 | Christos Stathis | |
43 | 4baffab1 | Christos Stathis | import com.google.gwt.user.client.ui.AbstractImagePrototype; |
44 | 4baffab1 | Christos Stathis | import com.google.gwt.user.client.ui.MenuBar; |
45 | 4baffab1 | Christos Stathis | import com.google.gwt.user.client.ui.MenuItem; |
46 | 4baffab1 | Christos Stathis | import com.google.gwt.user.client.ui.PopupPanel; |
47 | 4baffab1 | Christos Stathis | |
48 | 4baffab1 | Christos Stathis | /**
|
49 | 4baffab1 | Christos Stathis | * The 'Folder Context' menu implementation.
|
50 | 4baffab1 | Christos Stathis | */
|
51 | 4baffab1 | Christos Stathis | public class GroupContextMenu extends PopupPanel { |
52 | 4baffab1 | Christos Stathis | |
53 | 4baffab1 | Christos Stathis | /**
|
54 | 4baffab1 | Christos Stathis | * The widget's images.
|
55 | 4baffab1 | Christos Stathis | */
|
56 | 4baffab1 | Christos Stathis | private final GroupTreeView.Images images; |
57 | 4baffab1 | Christos Stathis | |
58 | 4baffab1 | Christos Stathis | /**
|
59 | 4baffab1 | Christos Stathis | * The widget's constructor.
|
60 | 4baffab1 | Christos Stathis | *
|
61 | 4baffab1 | Christos Stathis | * @param newImages the image bundle passed on by the parent object
|
62 | 4baffab1 | Christos Stathis | */
|
63 | 4baffab1 | Christos Stathis | public GroupContextMenu(Pithos app, final Images newImages, Group group) { |
64 | 4baffab1 | Christos Stathis | // The popup's constructor's argument is a boolean specifying that it
|
65 | 4baffab1 | Christos Stathis | // auto-close itself when the user clicks outside of it.
|
66 | 4baffab1 | Christos Stathis | super(true); |
67 | 4baffab1 | Christos Stathis | setAnimationEnabled(true);
|
68 | 4baffab1 | Christos Stathis | images = newImages; |
69 | 4baffab1 | Christos Stathis | MenuBar contextMenu = new MenuBar(true); |
70 | 4baffab1 | Christos Stathis | |
71 | 4baffab1 | Christos Stathis | if (group != null) { |
72 | 4baffab1 | Christos Stathis | MenuItem addUser = new MenuItem("<span>" + AbstractImagePrototype.create(images.user()).getHTML() + " Add User</span>", true, new AddUserCommand(app, this, group)); |
73 | 4baffab1 | Christos Stathis | contextMenu.addItem(addUser); |
74 | 4baffab1 | Christos Stathis | |
75 | 4baffab1 | Christos Stathis | MenuItem deleteGroup = new MenuItem("<span>" + AbstractImagePrototype.create(images.delete()).getHTML() + " Delete Group</span>", true, new DeleteGroupCommand(app, this, group)); |
76 | 4baffab1 | Christos Stathis | contextMenu.addItem(deleteGroup); |
77 | 4baffab1 | Christos Stathis | } |
78 | 4baffab1 | Christos Stathis | else {
|
79 | 4baffab1 | Christos Stathis | MenuItem createGroup = new MenuItem("<span>" + AbstractImagePrototype.create(images.group()).getHTML() + " Create Group</span>", true, new CreateGroupCommand(app, this)); |
80 | 4baffab1 | Christos Stathis | contextMenu.addItem(createGroup); |
81 | 4baffab1 | Christos Stathis | } |
82 | 4baffab1 | Christos Stathis | |
83 | 4baffab1 | Christos Stathis | add(contextMenu); |
84 | 4baffab1 | Christos Stathis | } |
85 | 4baffab1 | Christos Stathis | } |