Search in sources :

Example 11 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project che by eclipse.

the class ExpandEditorAction method createCustomComponent.

@Override
public Widget createCustomComponent(Presentation presentation) {
    if (buttonPanel != null) {
        return buttonPanel;
    }
    final Element tooltip = DOM.createSpan();
    tooltip.setInnerHTML(constant.actionExpandEditorTitle());
    buttonPanel = new FlowPanel();
    buttonPanel.addStyleName(resources.coreCss().editorFullScreen());
    button = new FlowPanel();
    button.getElement().setInnerHTML(FontAwesome.EXPAND);
    button.addDomHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            toggleExpand();
        }
    }, ClickEvent.getType());
    buttonPanel.add(button);
    buttonPanel.getElement().appendChild(tooltip);
    buttonPanel.addDomHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            final Element panel = event.getRelativeElement();
            tooltip.getStyle().setProperty("top", (panel.getAbsoluteTop() + panel.getOffsetHeight() + 9) + "px");
            tooltip.getStyle().setProperty("right", (Document.get().getClientWidth() - panel.getAbsoluteRight() - 2) + "px");
        }
    }, MouseOverEvent.getType());
    return buttonPanel;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Element(com.google.gwt.dom.client.Element) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) MouseOverEvent(com.google.gwt.event.dom.client.MouseOverEvent) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) MouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)

Example 12 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project che by eclipse.

the class BaseView method addMenuButton.

/**
     * Adds part menu button.
     */
private void addMenuButton() {
    final ToolButton menuButton = new ToolButton(FontAwesome.COG + " " + FontAwesome.CARET_DOWN);
    menuButton.getElement().setAttribute("name", "workBenchIconMenu");
    menuButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            int left = getAbsoluteLeft(menuButton.getElement());
            int top = getAbsoluteTop(menuButton.getElement());
            delegate.onPartMenu(left, top + 21);
        }
    });
    toolbarHeader.addEast(menuButton, 25);
    if (menuButton.getElement() instanceof elemental.dom.Element) {
        Tooltip.create((elemental.dom.Element) menuButton.getElement(), PositionController.VerticalAlign.BOTTOM, PositionController.HorizontalAlign.MIDDLE, "Panel options");
    }
}
Also used : DoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent)

Example 13 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project che by eclipse.

the class ChangedListViewImpl method createButtons.

private void createButtons() {
    changeViewModeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            delegate.onChangeViewModeButtonClicked();
        }
    });
    expandButton.setTitle(locale.changeListExpandCollapseAllButtonTitle());
    expandButton.getElement().setInnerHTML(FontAwesome.EXPAND);
    expandButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            delegate.onExpandButtonClicked();
        }
    });
    collapseButton.setTitle(locale.changeListCollapseAllButtonTitle());
    collapseButton.getElement().setInnerHTML(FontAwesome.COMPRESS);
    collapseButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            delegate.onCollapseButtonClicked();
        }
    });
    Button btnClose = createButton(locale.buttonClose(), "git-compare-btn-close", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            delegate.onCloseClicked();
        }
    });
    addButtonToFooter(btnClose);
    btnCompare = createButton(locale.buttonCompare(), "git-compare-btn-compare", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            delegate.onCompareClicked();
        }
    });
    addButtonToFooter(btnCompare);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(com.google.gwt.user.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 14 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project perun by CESNET.

the class UsersApplicationsPage method refresh.

/**
	 * Refresh the page
	 */
private void refresh() {
    bodyContents.clear();
    String user = "";
    if (session.getUser() != null) {
        user = this.session.getUser().getFullNameWithTitles().trim();
    } else {
        PerunPrincipal pp = session.getPerunPrincipal();
        if (!pp.getAdditionInformations("displayName").equals("")) {
            user = pp.getAdditionInformations("displayName");
        } else if (!pp.getAdditionInformations("cn").equals("")) {
            user = pp.getAdditionInformations("cn");
        } else {
            if (pp.getExtSourceType().equals("cz.metacentrum.perun.core.impl.ExtSourceX509")) {
                user = Utils.convertCertCN(pp.getActor());
            } else {
                user = pp.getActor();
            }
        }
    }
    bodyContents.add(new HTML("<h1>" + ApplicationMessages.INSTANCE.applicationsForUser(user) + "</h1>"));
    // callback
    int userId = 0;
    if (session.getUser() != null) {
        userId = session.getUser().getId();
    }
    final GetApplicationsForUserForAppFormGui req = new GetApplicationsForUserForAppFormGui(userId);
    final ListBox listBox = new ListBox();
    req.setEvents(new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            ArrayList<Application> appls = JsonUtils.jsoAsList(jso);
            ArrayList<String> vos = new ArrayList<String>();
            for (Application app : appls) {
                if (!vos.contains(app.getVo().getName())) {
                    vos.add(app.getVo().getName());
                }
            }
            Collections.sort(vos);
            for (String s : vos) {
                listBox.addItem(s);
            }
            if (listBox.getItemCount() > 0) {
                listBox.insertItem(WidgetTranslation.INSTANCE.listboxAll(), 0);
            }
            for (int i = 0; i < listBox.getItemCount(); i++) {
                if (listBox.getItemText(i).equals(ApplicationFormGui.getVo().getName())) {
                    listBox.setSelectedIndex(i);
                    req.filterTable(ApplicationFormGui.getVo().getName());
                    break;
                }
            }
        }

        @Override
        public void onError(PerunError error) {
        }

        @Override
        public void onLoadingStart() {
            listBox.clear();
        }
    });
    req.setCheckable(false);
    listBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            if (listBox.getSelectedIndex() > 0) {
                req.filterTable(listBox.getItemText(listBox.getSelectedIndex()));
            } else {
                // show all
                req.filterTable("");
            }
        }
    });
    final TabMenu tabMenu = new TabMenu();
    tabMenu.addWidget(new HTML("<strong>" + ApplicationMessages.INSTANCE.filterByVo() + ":</strong>"));
    tabMenu.addWidget(listBox);
    tabMenu.addWidget(new Image(SmallIcons.INSTANCE.helpIcon()));
    tabMenu.addWidget(new HTML("<strong>" + ApplicationMessages.INSTANCE.clickOnApplicationToSee() + "</strong>"));
    tabMenu.addStyleName("tabMenu");
    final VerticalPanel applicationsWrapper = new VerticalPanel();
    applicationsWrapper.setSize("100%", "100%");
    applicationsWrapper.add(tabMenu);
    final CellTable<Application> appsTable = req.getTable(new FieldUpdater<Application, String>() {

        public void update(int index, Application object, String value) {
            applicationsWrapper.clear();
            applicationsWrapper.add(backButton);
            applicationsWrapper.add(getApplicationDetailWidget(object));
        }
    });
    appsTable.addStyleName("perun-table");
    applicationsWrapper.add(appsTable);
    backButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            applicationsWrapper.clear();
            applicationsWrapper.add(tabMenu);
            applicationsWrapper.add(appsTable);
        }
    });
    bodyContents.add(applicationsWrapper);
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) PerunPrincipal(cz.metacentrum.perun.webgui.model.PerunPrincipal) GetApplicationsForUserForAppFormGui(cz.metacentrum.perun.webgui.json.registrarManager.GetApplicationsForUserForAppFormGui) PerunError(cz.metacentrum.perun.webgui.model.PerunError) Application(cz.metacentrum.perun.webgui.model.Application)

Example 15 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project perun by CESNET.

the class ApplicationFormLeftMenu method addLogoutItem.

public void addLogoutItem() {
    // if not anonymous identity
    if (!PerunWebSession.getInstance().getRpcUrl().startsWith("/non/rpc")) {
        int i = menuContents.getRowCount();
        menuContents.setWidget(i, 0, new Image(SmallIcons.INSTANCE.doorOutIcon()));
        Anchor a = new Anchor(ApplicationMessages.INSTANCE.logout());
        a.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                Logout call = new Logout(new JsonCallbackEvents() {

                    @Override
                    public void onFinished(JavaScriptObject jso) {
                        Utils.clearFederationCookies();
                        History.newItem("logout");
                        RootLayoutPanel.get().clear();
                        RootLayoutPanel.get().add(new LogoutWidget());
                    }
                });
                call.retrieveData();
            }
        });
        menuContents.setWidget(i, 1, a);
    }
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Logout(cz.metacentrum.perun.webgui.json.authzResolver.Logout) LogoutWidget(cz.metacentrum.perun.webgui.widgets.LogoutWidget)

Aggregations

ClickHandler (com.google.gwt.event.dom.client.ClickHandler)448 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)442 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)168 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)143 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)129 ArrayList (java.util.ArrayList)125 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)110 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)79 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)49 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)48 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)41 PerunError (cz.metacentrum.perun.webgui.model.PerunError)38 Button (com.google.gwt.user.client.ui.Button)35 HashMap (java.util.HashMap)34 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)33 Button (org.gwtbootstrap3.client.ui.Button)33 HTML (com.google.gwt.user.client.ui.HTML)31 Image (com.google.gwt.user.client.ui.Image)29 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)28 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)26