Search in sources :

Example 16 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project opennms by OpenNMS.

the class OpenLayersMapPanel method showLocationDetails.

/** {@inheritDoc} */
@Override
public void showLocationDetails(String name, String htmlTitle, String htmlContent) {
    final Marker marker = getMarker(name);
    if (marker != null) {
        m_map.setCenter(marker.getLonLat());
        final VerticalPanel panel = new VerticalPanel();
        panel.add(new Label(htmlTitle));
        panel.add(new HTML(htmlContent));
        Popup p = new Popup(name, marker.getLonLat(), new Size(300, 300), panel.toString(), true);
        // p.setAutoSize(true);
        p.getJSObject().setProperty("autoSize", true);
        m_map.addPopupExclusive(p);
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Size(org.gwtopenmaps.openlayers.client.Size) Popup(org.gwtopenmaps.openlayers.client.popup.Popup) Label(com.google.gwt.user.client.ui.Label) HTML(com.google.gwt.user.client.ui.HTML) Marker(org.gwtopenmaps.openlayers.client.Marker)

Example 17 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project perun by CESNET.

the class GroupRelationsTabItem method draw.

@Override
public Widget draw() {
    titleWidget.setText(Utils.getStrippedStringWithEllipsis(group.getName()) + ": unions");
    // main panel
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // if members group, hide
    if (group.isCoreGroup()) {
        vp.add(new HTML("<h2>Members group cannot have unions.</h2>"));
        this.contentWidget.setWidget(vp);
        return getWidget();
    }
    final GetGroupUnions unions = new GetGroupUnions(group, false);
    // Events for reloading when group is created
    final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(unions);
    // menu
    TabMenu menu = new TabMenu();
    final CheckBox subGroupsCheckBox = new CheckBox("Show sub-groups");
    final ListBox reverseDropdown = new ListBox();
    reverseDropdown.addItem("Normal");
    reverseDropdown.addItem("Reverse");
    reverseDropdown.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            switch(reverseDropdown.getSelectedIndex()) {
                case 1:
                    unions.setReverseAndRefresh(true);
                    subGroupsCheckBox.setVisible(false);
                    break;
                default:
                    unions.setReverseAndRefresh(false);
                    subGroupsCheckBox.setVisible(true);
            }
        }
    });
    menu.addWidget(UiElements.getRefreshButton(this));
    CustomButton createButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addGroupUnion(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            // creates a new form
            session.getTabManager().addTabToCurrentTab(new AddGroupUnionTabItem(group), true);
        }
    });
    if (!session.isGroupAdmin(groupId) && !session.isVoAdmin(group.getVoId())) {
        createButton.setEnabled(false);
        unions.setCheckable(false);
    }
    menu.addWidget(createButton);
    final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeGroupUnion());
    removeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final ArrayList<Group> itemsToRemove = unions.getTableSelectedList();
            String text = "Following group unions will be deleted.";
            UiElements.showDeleteConfirm(itemsToRemove, text, new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    RemoveGroupUnions request = new RemoveGroupUnions(JsonCallbackEvents.disableButtonEvents(removeButton, events));
                    if (unions.isReverse()) {
                        request.deleteGroupUnions(itemsToRemove, group);
                    } else {
                        request.deleteGroupUnions(group, itemsToRemove);
                    }
                }
            });
        }
    });
    menu.addWidget(removeButton);
    // filter box
    final ExtendedSuggestBox box = new ExtendedSuggestBox(unions.getOracle());
    menu.addFilterWidget(box, new PerunSearchEvent() {

        public void searchFor(String text) {
            unions.filterTable(text);
        }
    }, ButtonTranslation.INSTANCE.filterGroup());
    subGroupsCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            unions.setShowSubgroupsAndRefresh(valueChangeEvent.getValue(), box.getSuggestBox().getText());
        }
    });
    menu.addWidget(new HTML("<strong>Direction: </strong>"));
    menu.addWidget(reverseDropdown);
    menu.addWidget(subGroupsCheckBox);
    // add menu to the main panel
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    CellTable<Group> table = unions.getTable(new FieldUpdater<Group, String>() {

        @Override
        public void update(int arg0, Group group, String arg2) {
            if (session.isGroupAdmin(group.getId()) || session.isVoAdmin(group.getId())) {
                session.getTabManager().addTab(new GroupDetailTabItem(group.getId()));
            } else {
                UiElements.generateInfo("Not privileged", "You are not manager of selected group or its VO.");
            }
        }
    });
    removeButton.setEnabled(false);
    if (session.isGroupAdmin(groupId) || session.isVoAdmin(group.getVoId()))
        JsonUtils.addTableManagedButton(unions, table, removeButton);
    // adds the table into the panel
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    vp.add(sp);
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Group(cz.metacentrum.perun.webgui.model.Group) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) HTML(com.google.gwt.user.client.ui.HTML) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) RemoveGroupUnions(cz.metacentrum.perun.webgui.json.groupsManager.RemoveGroupUnions) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) CheckBox(com.google.gwt.user.client.ui.CheckBox) GetGroupUnions(cz.metacentrum.perun.webgui.json.groupsManager.GetGroupUnions) ListBox(com.google.gwt.user.client.ui.ListBox) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 18 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project perun by CESNET.

the class MemberSponsoredUsersTabItem method draw.

public Widget draw() {
    if (member.getUser().isSponsoredUser()) {
        this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": sponsors");
    } else {
        this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": sponsored users");
    }
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // MENU
    TabMenu menu = new TabMenu();
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    menu.addWidget(UiElements.getRefreshButton(this));
    if (member.getUser().isSponsoredUser()) {
        // request
        final GetUsersBySpecificUser request = new GetUsersBySpecificUser(member.getUserId());
        request.setCheckable(false);
        // table
        CellTable<User> table;
        if (session.isPerunAdmin()) {
            table = request.getTable(new FieldUpdater<User, String>() {

                public void update(int i, User user, String s) {
                    session.getTabManager().addTab(new UserDetailTabItem(user));
                }
            });
        } else {
            table = request.getTable();
        }
        table.addStyleName("perun-table");
        table.setWidth("100%");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        vp.add(sp);
    } else {
        final GetSpecificUsersByUser request = new GetSpecificUsersByUser(member.getUserId());
        request.setCheckable(false);
        request.setHideService(true);
        // table
        CellTable<User> table;
        if (session.isPerunAdmin()) {
            table = request.getTable(new FieldUpdater<User, String>() {

                public void update(int i, User user, String s) {
                    session.getTabManager().addTab(new UserDetailTabItem(user));
                }
            });
        } else {
            table = request.getTable();
        }
        table.addStyleName("perun-table");
        table.setWidth("100%");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        vp.add(sp);
    }
    contentWidget.setWidget(vp);
    return getWidget();
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) FieldUpdater(com.google.gwt.cell.client.FieldUpdater) GetUsersBySpecificUser(cz.metacentrum.perun.webgui.json.usersManager.GetUsersBySpecificUser) User(cz.metacentrum.perun.webgui.model.User) GetSpecificUsersByUser(cz.metacentrum.perun.webgui.json.usersManager.GetSpecificUsersByUser) GetSpecificUsersByUser(cz.metacentrum.perun.webgui.json.usersManager.GetSpecificUsersByUser) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) GetUsersBySpecificUser(cz.metacentrum.perun.webgui.json.usersManager.GetUsersBySpecificUser) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu)

Example 19 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project perun by CESNET.

the class AddGroupUnionTabItem method draw.

@Override
public Widget draw() {
    titleWidget.setText("Add group union");
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // menu
    TabMenu menu = new TabMenu();
    menu.addWidget(new HTML(""));
    final GetAllGroups groups = new GetAllGroups(group.getVoId());
    groups.setCoreGroupsCheckable(true);
    // remove already added union groups from offering
    JsonCallbackEvents localEvents = new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            // second callback
            final GetGroupUnions alreadyAssigned = new GetGroupUnions(group, false, new JsonCallbackEvents() {

                public void onFinished(JavaScriptObject jso) {
                    JsArray<Group> esToRemove = JsonUtils.jsoAsArray(jso);
                    for (int i = 0; i < esToRemove.length(); i++) {
                        groups.removeFromTable(esToRemove.get(i));
                    }
                    // remove itself
                    groups.removeFromTable(group);
                }
            });
            alreadyAssigned.retrieveData();
        }
    };
    groups.setEvents(localEvents);
    final ExtendedSuggestBox box = new ExtendedSuggestBox(groups.getOracle());
    // button
    final CustomButton assignButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addSelectedExtSource());
    final TabItem tab = this;
    assignButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final ArrayList<Group> groupsToAdd = groups.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(groupsToAdd)) {
                // FIXME - Should have only one callback to core
                for (int i = 0; i < groupsToAdd.size(); i++) {
                    final int n = i;
                    AddGroupUnion request = new AddGroupUnion(JsonCallbackEvents.disableButtonEvents(assignButton, new JsonCallbackEvents() {

                        @Override
                        public void onFinished(JavaScriptObject jso) {
                            // unselect added person
                            groups.getSelectionModel().setSelected(groupsToAdd.get(n), false);
                            alreadyAddedList.add(groupsToAdd.get(n));
                            rebuildAlreadyAddedWidget();
                            // clear search
                            box.getSuggestBox().setText("");
                        }
                    }));
                    request.createGroupUnion(group, groupsToAdd.get(i));
                }
            }
        }
    });
    menu.addFilterWidget(box, new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            groups.filterTable(text);
        }
    }, "Filter by ext source name or type");
    menu.addWidget(assignButton);
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CLOSE, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().closeTab(tab, !alreadyAddedList.isEmpty());
        }
    }));
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    vp.add(alreadyAdded);
    CellTable<Group> table = groups.getTable();
    assignButton.setEnabled(false);
    JsonUtils.addTableManagedButton(groups, table, assignButton);
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    vp.add(sp);
    // do not use resizePerunTable() when tab is in overlay - wrong width is calculated
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Group(cz.metacentrum.perun.webgui.model.Group) JsArray(com.google.gwt.core.client.JsArray) AddGroupUnion(cz.metacentrum.perun.webgui.json.groupsManager.AddGroupUnion) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) HTML(com.google.gwt.user.client.ui.HTML) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) GetAllGroups(cz.metacentrum.perun.webgui.json.groupsManager.GetAllGroups) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) GetGroupUnions(cz.metacentrum.perun.webgui.json.groupsManager.GetGroupUnions) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 20 with VerticalPanel

use of com.google.gwt.user.client.ui.VerticalPanel in project perun by CESNET.

the class UserExtSourceSettingsTabItem method draw.

public Widget draw() {
    this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(userExtSource.getLogin().trim()));
    // MAIN TAB PANEL
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // MENU
    TabMenu menu = new TabMenu();
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    final GetAttributesV2 callback = new GetAttributesV2(true);
    callback.getUserExtSourceAttributes(userExtSource.getId());
    final CellTable<Attribute> table = callback.getEmptyTable();
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    session.getUiElements().resizePerunTable(sp, 350, this);
    menu.addWidget(UiElements.getRefreshButton(this));
    // save changes in attributes
    final CustomButton saveChangesButton = TabMenu.getPredefinedButton(ButtonType.SAVE, ButtonTranslation.INSTANCE.saveChangesInAttributes());
    saveChangesButton.setEnabled(false);
    saveChangesButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (UiElements.cantSaveEmptyListDialogBox(callback.getTableSelectedList())) {
                SetAttributes request = new SetAttributes(JsonCallbackEvents.disableButtonEvents(saveChangesButton, new JsonCallbackEvents() {

                    public void onFinished(JavaScriptObject jso) {
                        callback.clearTable();
                        callback.getUserExtSourceAttributes(userExtSourceId);
                        callback.retrieveData();
                    }
                }));
                final Map<String, Integer> ids = new HashMap<String, Integer>();
                ids.put("userExtSource", userExtSourceId);
                request.setAttributes(ids, callback.getTableSelectedList());
            }
        }
    });
    menu.addWidget(saveChangesButton);
    // buttons
    CustomButton setNewMemberAttributeButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.setNewAttributes(), new ClickHandler() {

        public void onClick(ClickEvent event) {
            Map<String, Integer> ids = new HashMap<String, Integer>();
            ids.put("userExtSource", userExtSource.getId());
            session.getTabManager().addTabToCurrentTab(new SetNewAttributeTabItem(ids), true);
        }
    });
    menu.addWidget(setNewMemberAttributeButton);
    // REMOVE ATTRIBUTES BUTTON
    final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeAttributes());
    removeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            // if selected
            if (UiElements.cantSaveEmptyListDialogBox(callback.getTableSelectedList())) {
                Map<String, Integer> ids = new HashMap<String, Integer>();
                ids.put("userExtSource", userExtSource.getId());
                RemoveAttributes request = new RemoveAttributes(JsonCallbackEvents.disableButtonEvents(removeButton, new JsonCallbackEvents() {

                    public void onFinished(JavaScriptObject jso) {
                        callback.clearTable();
                        callback.getUserExtSourceAttributes(userExtSource.getId());
                        callback.retrieveData();
                    }
                }));
                // make removeAttributes call
                request.removeAttributes(ids, callback.getTableSelectedList());
            }
        }
    });
    removeButton.setEnabled(false);
    JsonUtils.addTableManagedButton(callback, table, removeButton);
    menu.addWidget(removeButton);
    callback.retrieveData();
    // ATTRIBUTES TABLE
    vp.add(sp);
    vp.setCellHeight(sp, "100%");
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Attribute(cz.metacentrum.perun.webgui.model.Attribute) GetAttributesV2(cz.metacentrum.perun.webgui.json.attributesManager.GetAttributesV2) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) SetAttributes(cz.metacentrum.perun.webgui.json.attributesManager.SetAttributes) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) SetNewAttributeTabItem(cz.metacentrum.perun.webgui.tabs.attributestabs.SetNewAttributeTabItem) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel) HashMap(java.util.HashMap) Map(java.util.Map) RemoveAttributes(cz.metacentrum.perun.webgui.json.attributesManager.RemoveAttributes)

Aggregations

VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)49 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)16 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)16 Label (com.google.gwt.user.client.ui.Label)15 HTML (com.google.gwt.user.client.ui.HTML)12 CheckBox (com.google.gwt.user.client.ui.CheckBox)9 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)9 SmallHeading (com.google.gerrit.client.ui.SmallHeading)7 Button (com.google.gwt.user.client.ui.Button)7 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)7 TextBox (com.google.gwt.user.client.ui.TextBox)7 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)5 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)4 Grid (com.google.gwt.user.client.ui.Grid)4 Image (com.google.gwt.user.client.ui.Image)4 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)4 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)4 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)4 VoidResult (com.google.gerrit.client.VoidResult)3