Search in sources :

Example 6 with ScrollPanel

use of com.google.gwt.user.client.ui.ScrollPanel 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 7 with ScrollPanel

use of com.google.gwt.user.client.ui.ScrollPanel 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 8 with ScrollPanel

use of com.google.gwt.user.client.ui.ScrollPanel 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)

Example 9 with ScrollPanel

use of com.google.gwt.user.client.ui.ScrollPanel in project gerrit by GerritCodeReview.

the class ProjectListPopup method initPopup.

public void initPopup(final String popupText, final String currentPageLink) {
    createWidgets(popupText, currentPageLink);
    final FlowPanel pfp = new FlowPanel();
    pfp.add(filterPanel);
    pfp.add(closeTop);
    sp = new ScrollPanel(projectsTab);
    sp.setSize("100%", "100%");
    pfp.add(sp);
    pfp.add(closeBottom);
    popup.setWidget(pfp);
    popup.setHeight("100%");
    popupPosition = getPositionCallback();
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 10 with ScrollPanel

use of com.google.gwt.user.client.ui.ScrollPanel in project che by eclipse.

the class ImageViewer method go.

/** {@inheritDoc} */
@Override
public void go(AcceptsOneWidget container) {
    VerticalPanel panel = new VerticalPanel();
    panel.setSize("100%", "100%");
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panel.add(getImage());
    editorView = new ScrollPanel(panel);
    editorView.getElement().getFirstChildElement().getStyle().setHeight(100, Unit.PCT);
    container.setWidget(editorView);
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Aggregations

ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)14 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)7 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)5 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)3 HTML (com.google.gwt.user.client.ui.HTML)3 Label (com.google.gwt.user.client.ui.Label)3 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)3 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)3 ArrayList (java.util.ArrayList)3 FieldUpdater (com.google.gwt.cell.client.FieldUpdater)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 JsArray (com.google.gwt.core.client.JsArray)2 CheckBox (com.google.gwt.user.client.ui.CheckBox)2 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)2 GetGroupUnions (cz.metacentrum.perun.webgui.json.groupsManager.GetGroupUnions)2 GetSpecificUsersByUser (cz.metacentrum.perun.webgui.json.usersManager.GetSpecificUsersByUser)2 GetUsersBySpecificUser (cz.metacentrum.perun.webgui.json.usersManager.GetUsersBySpecificUser)2 Group (cz.metacentrum.perun.webgui.model.Group)2