Search in sources :

Example 96 with Widget

use of com.google.gwt.user.client.ui.Widget in project webprotege by protegeproject.

the class FilterViewImpl method getFilters.

public List<Filter> getFilters() {
    List<Filter> result = new ArrayList<>();
    for (int i = 0; i < container.getWidgetCount(); i++) {
        Widget w = container.getWidget(i);
        if (w instanceof FilterCheckBox) {
            FilterCheckBox cb = (FilterCheckBox) w;
            result.add(new Filter(cb.getFilterId(), cb.getSetting()));
        }
    }
    return result;
}
Also used : Filter(edu.stanford.bmir.protege.web.shared.filter.Filter) ArrayList(java.util.ArrayList) Widget(com.google.gwt.user.client.ui.Widget)

Example 97 with Widget

use of com.google.gwt.user.client.ui.Widget in project GwtMobile by dennisjzh.

the class CheckBoxGroup method onDragStart.

@Override
public void onDragStart(DragEvent e) {
    _pressed = Utils.getTargetItemIndex(getElement(), e.getNativeEvent().getEventTarget());
    if (_pressed >= 0) {
        Widget item = getWidget(_pressed);
        item.addStyleName("Pressed");
    }
}
Also used : Widget(com.google.gwt.user.client.ui.Widget)

Example 98 with Widget

use of com.google.gwt.user.client.ui.Widget in project GwtMobile by dennisjzh.

the class ListItem method setShowArrow.

public void setShowArrow(boolean show) {
    _showArrow = show ? ShowArrow.True : ShowArrow.False;
    int last = getWidgetCount() - 1;
    if (last >= 0) {
        Widget widget = getWidget(last);
        if (widget.getClass().toString().endsWith(".Chevron")) {
            if (!show) {
                remove(last);
            }
        } else {
            if (show) {
                add(new ListPanel.Chevron());
            }
        }
    }
}
Also used : Widget(com.google.gwt.user.client.ui.Widget)

Example 99 with Widget

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

the class AddAutoRegGroupTabItem method draw.

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

        @Override
        public void onFinished(JavaScriptObject jso) {
            // second callback
            final GetAutoRegistrationGroups alreadySet = new GetAutoRegistrationGroups(vo.getId(), 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));
                    }
                }
            });
            alreadySet.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(event -> {
        final ArrayList<Group> availableGroups = groups.getTableSelectedList();
        if (UiElements.cantSaveEmptyListDialogBox(availableGroups)) {
            AddAutoRegGroups request = new AddAutoRegGroups(JsonCallbackEvents.disableButtonEvents(assignButton, new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    // clear search
                    box.getSuggestBox().setText("");
                    groups.retrieveData();
                }
            }));
            request.setAutoRegGroups(availableGroups);
        }
    });
    menu.addFilterWidget(box, new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            groups.filterTable(text);
        }
    }, "Filter by name");
    menu.addWidget(assignButton);
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CLOSE, "", clickEvent -> session.getTabManager().closeTab(tab, isRefreshParentOnClose())));
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    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) ImageResource(com.google.gwt.resources.client.ImageResource) SmallIcons(cz.metacentrum.perun.webgui.client.resources.SmallIcons) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) AddAutoRegGroups(cz.metacentrum.perun.webgui.json.registrarManager.AddAutoRegGroups) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) HTML(com.google.gwt.user.client.ui.HTML) GetAllGroups(cz.metacentrum.perun.webgui.json.groupsManager.GetAllGroups) ArrayList(java.util.ArrayList) Label(com.google.gwt.user.client.ui.Label) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel) ButtonTranslation(cz.metacentrum.perun.webgui.client.localization.ButtonTranslation) UiElements(cz.metacentrum.perun.webgui.client.UiElements) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) GetAutoRegistrationGroups(cz.metacentrum.perun.webgui.json.registrarManager.GetAutoRegistrationGroups) Group(cz.metacentrum.perun.webgui.model.Group) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) MainMenu(cz.metacentrum.perun.webgui.client.mainmenu.MainMenu) PerunWebSession(cz.metacentrum.perun.webgui.client.PerunWebSession) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) JsArray(com.google.gwt.core.client.JsArray) Widget(com.google.gwt.user.client.ui.Widget) JsonUtils(cz.metacentrum.perun.webgui.json.JsonUtils) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ButtonType(cz.metacentrum.perun.webgui.client.resources.ButtonType) VirtualOrganization(cz.metacentrum.perun.webgui.model.VirtualOrganization) CellTable(com.google.gwt.user.cellview.client.CellTable) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) Group(cz.metacentrum.perun.webgui.model.Group) JsArray(com.google.gwt.core.client.JsArray) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) HTML(com.google.gwt.user.client.ui.HTML) AddAutoRegGroups(cz.metacentrum.perun.webgui.json.registrarManager.AddAutoRegGroups) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) 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) GetAutoRegistrationGroups(cz.metacentrum.perun.webgui.json.registrarManager.GetAutoRegistrationGroups) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 100 with Widget

use of com.google.gwt.user.client.ui.Widget in project opentsdb by OpenTSDB.

the class QueryUi method ensureSameWidgetSize.

/**
 * Ensures all the widgets in the given panel have the same size.
 * Otherwise by default the panel will automatically resize itself to the
 * contents of the currently active panel's widget, which is annoying
 * because it makes a number of things move around in the UI.
 * @param panel The panel containing the widgets to resize.
 */
private static void ensureSameWidgetSize(final DecoratedTabPanel panel) {
    if (!panel.isAttached()) {
        throw new IllegalArgumentException("panel not attached: " + panel);
    }
    int maxw = 0;
    int maxh = 0;
    for (final Widget widget : panel) {
        final int w = widget.getOffsetWidth();
        final int h = widget.getOffsetHeight();
        if (w > maxw) {
            maxw = w;
        }
        if (h > maxh) {
            maxh = h;
        }
    }
    if (maxw == 0 || maxh == 0) {
        throw new IllegalArgumentException("maxw=" + maxw + " maxh=" + maxh);
    }
    for (final Widget widget : panel) {
        setOffsetWidth(widget, maxw);
        setOffsetHeight(widget, maxh);
    }
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) EntryPoint(com.google.gwt.core.client.EntryPoint)

Aggregations

Widget (com.google.gwt.user.client.ui.Widget)194 Test (org.junit.Test)22 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)16 IsWidget (com.google.gwt.user.client.ui.IsWidget)16 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)15 HTML (com.google.gwt.user.client.ui.HTML)10 ArrayList (java.util.ArrayList)10 IFrameTabPanel (org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel)10 Element (com.google.gwt.dom.client.Element)9 MaterialWidget (gwt.material.design.client.base.MaterialWidget)9 Label (com.google.gwt.user.client.ui.Label)8 ListItem (gwt.material.design.client.ui.html.ListItem)8 ListBox (org.gwtbootstrap3.client.ui.ListBox)8 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)7 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)7 Command (com.google.gwt.user.client.Command)7 FileItem (org.pentaho.mantle.client.solutionbrowser.filelist.FileItem)7 Image (com.google.gwt.user.client.ui.Image)6 CubaFileUploadWidget (com.haulmont.cuba.web.toolkit.ui.client.jqueryfileupload.CubaFileUploadWidget)6 Timer (com.google.gwt.user.client.Timer)5