Search in sources :

Example 21 with ClickHandler

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

the class CalendarEventGenerator method getWidget.

@Override
public Grid getWidget() {
    if (table != null) {
        return table;
    }
    datePicker1.setValue(new Date());
    datePicker2.setValue(new Date());
    table = new Grid(10, 2);
    table.setText(0, 0, "All day event");
    table.setWidget(0, 1, fullDay);
    table.setText(1, 0, "Event title");
    table.setWidget(1, 1, eventName);
    table.setText(2, 0, "Start date");
    table.setWidget(2, 1, datePicker1);
    table.setText(3, 0, "Time");
    table.setWidget(3, 1, timePicker1);
    table.setText(4, 0, "End date");
    table.setWidget(4, 1, datePicker2);
    table.setText(5, 0, "Time");
    table.setWidget(5, 1, timePicker2);
    table.setText(6, 0, "Time zone");
    table.setWidget(6, 1, timeZones);
    table.setText(7, 0, "Daylight savings");
    table.setWidget(7, 1, summerTime);
    table.setText(8, 0, "Location");
    table.setWidget(8, 1, location);
    table.setText(9, 0, "Description");
    table.setWidget(9, 1, description);
    table.getRowFormatter().getElement(3).setId(FULL_DAY_ONLY_IDS[0]);
    table.getRowFormatter().getElement(5).setId(FULL_DAY_ONLY_IDS[1]);
    table.getRowFormatter().getElement(6).setId(FULL_DAY_ONLY_IDS[2]);
    table.getRowFormatter().getElement(7).setId(FULL_DAY_ONLY_IDS[3]);
    fullDay.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            CheckBox cb = (CheckBox) event.getSource();
            for (String s : FULL_DAY_ONLY_IDS) {
                Element element = DOM.getElementById(s);
                String style = cb.getValue() ? "none" : "";
                element.getStyle().setProperty("display", style);
            }
        }
    });
    return table;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) CheckBox(com.google.gwt.user.client.ui.CheckBox) Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Element(com.google.gwt.dom.client.Element) Date(java.util.Date)

Example 22 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project gerrit by GerritCodeReview.

the class PermissionRuleEditor method setValue.

@Override
public void setValue(PermissionRule value) {
    if (clickHandler != null) {
        clickHandler.removeHandler();
        clickHandler = null;
    }
    GroupReference ref = value.getGroup();
    GroupInfo info = groupInfo != null && ref.getUUID() != null ? groupInfo.get(ref.getUUID()) : null;
    boolean link;
    if (ref.getUUID() != null && AccountGroup.isInternalGroup(ref.getUUID())) {
        final String token = Dispatcher.toGroup(ref.getUUID());
        groupNameLink.setText(ref.getName());
        groupNameLink.setHref("#" + token);
        groupNameLink.setTitle(info != null ? info.getDescription() : null);
        groupNameLink.setTarget(null);
        clickHandler = groupNameLink.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                event.preventDefault();
                event.stopPropagation();
                Gerrit.display(token);
            }
        });
        link = true;
    } else if (info != null && info.getUrl() != null) {
        groupNameLink.setText(ref.getName());
        groupNameLink.setHref(info.getUrl());
        groupNameLink.setTitle(info.getDescription());
        groupNameLink.setTarget("_blank");
        link = true;
    } else {
        groupNameSpan.setInnerText(ref.getName());
        groupNameSpan.setTitle(ref.getUUID() != null ? ref.getUUID().get() : "");
        link = false;
    }
    deletedGroupName.setInnerText(ref.getName());
    groupNameLink.setVisible(link);
    UIObject.setVisible(groupNameSpan, !link);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) GroupInfo(com.google.gerrit.common.data.GroupInfo) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) GroupReference(com.google.gerrit.common.data.GroupReference)

Example 23 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project gerrit by GerritCodeReview.

the class ProjectTagsScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    initPageHeader();
    prev = PagingHyperlink.createPrev();
    prev.setVisible(false);
    next = PagingHyperlink.createNext();
    next.setVisible(false);
    addPanel = new FlowPanel();
    Grid addGrid = new Grid(2, 2);
    addGrid.setStyleName(Gerrit.RESOURCES.css().addBranch());
    int texBoxLength = 50;
    nameTxtBox = new HintTextBox();
    nameTxtBox.setVisibleLength(texBoxLength);
    nameTxtBox.setHintText(AdminConstants.I.defaultTagName());
    nameTxtBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                doAddNewTag();
            }
        }
    });
    addGrid.setText(0, 0, AdminConstants.I.columnTagName() + ":");
    addGrid.setWidget(0, 1, nameTxtBox);
    irevTxtBox = new HintTextBox();
    irevTxtBox.setVisibleLength(texBoxLength);
    irevTxtBox.setHintText(AdminConstants.I.defaultRevisionSpec());
    irevTxtBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                doAddNewTag();
            }
        }
    });
    addGrid.setText(1, 0, AdminConstants.I.initialRevision() + ":");
    addGrid.setWidget(1, 1, irevTxtBox);
    addTag = new Button(AdminConstants.I.buttonAddTag());
    addTag.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            doAddNewTag();
        }
    });
    addPanel.add(addGrid);
    addPanel.add(addTag);
    tagTable = new TagsTable();
    delTag = new Button(AdminConstants.I.buttonDeleteTag());
    delTag.setStyleName(Gerrit.RESOURCES.css().branchTableDeleteButton());
    delTag.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            tagTable.deleteChecked();
        }
    });
    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setStyleName(Gerrit.RESOURCES.css().branchTablePrevNextLinks());
    buttons.add(delTag);
    buttons.add(prev);
    buttons.add(next);
    add(tagTable);
    add(buttons);
    add(addPanel);
}
Also used : HintTextBox(com.google.gerrit.client.ui.HintTextBox) KeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) KeyPressEvent(com.google.gwt.event.dom.client.KeyPressEvent) Button(com.google.gwt.user.client.ui.Button) Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel)

Example 24 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project gerrit by GerritCodeReview.

the class PatchSetSelectBox method setUpBlame.

void setUpBlame(final CodeMirror cm, final boolean isBase, final PatchSet.Id rev, final String path) {
    if (!Patch.isMagic(path) && Gerrit.isSignedIn() && Gerrit.info().change().allowBlame()) {
        Anchor blameIcon = createBlameIcon();
        blameIcon.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent clickEvent) {
                if (cm.extras().getBlameInfo() != null) {
                    cm.extras().toggleAnnotation();
                } else {
                    ChangeApi.blame(rev, path, isBase).get(new GerritCallback<JsArray<BlameInfo>>() {

                        @Override
                        public void onSuccess(JsArray<BlameInfo> lines) {
                            cm.extras().toggleAnnotation(lines);
                        }
                    });
                }
            }
        });
        linkPanel.add(blameIcon);
    }
}
Also used : GerritCallback(com.google.gerrit.client.rpc.GerritCallback) Anchor(com.google.gwt.user.client.ui.Anchor) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JsArray(com.google.gwt.core.client.JsArray) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) BlameInfo(com.google.gerrit.client.blame.BlameInfo)

Example 25 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project gerrit by GerritCodeReview.

the class MyWatchedProjectsScreen method createWidgets.

protected void createWidgets() {
    nameBox = new RemoteSuggestBox(new ProjectNameSuggestOracle());
    nameBox.setVisibleLength(50);
    nameBox.setHintText(Util.C.defaultProjectName());
    nameBox.addSelectionHandler(new SelectionHandler<String>() {

        @Override
        public void onSelection(SelectionEvent<String> event) {
            doAddNew();
        }
    });
    filterTxt = new HintTextBox();
    filterTxt.setVisibleLength(50);
    filterTxt.setHintText(Util.C.defaultFilter());
    filterTxt.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                doAddNew();
            }
        }
    });
    addNew = new Button(Util.C.buttonWatchProject());
    addNew.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doAddNew();
        }
    });
    browse = new Button(Util.C.buttonBrowseProjects());
    browse.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            // under page header
            int top = grid.getAbsoluteTop() - 50;
            // Try to place it to the right of everything else, but not
            // right justified
            int left = 5 + Math.max(grid.getAbsoluteLeft() + grid.getOffsetWidth(), watchesTab.getAbsoluteLeft() + watchesTab.getOffsetWidth());
            projectsPopup.setPreferredCoordinates(top, left);
            projectsPopup.displayPopup();
        }
    });
    watchesTab = new MyWatchesTable();
    delSel = new Button(Util.C.buttonDeleteSshKey());
    delSel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            watchesTab.deleteChecked();
        }
    });
}
Also used : HintTextBox(com.google.gerrit.client.ui.HintTextBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) KeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) KeyPressEvent(com.google.gwt.event.dom.client.KeyPressEvent) Button(com.google.gwt.user.client.ui.Button) ProjectNameSuggestOracle(com.google.gerrit.client.ui.ProjectNameSuggestOracle) RemoteSuggestBox(com.google.gerrit.client.ui.RemoteSuggestBox)

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