Search in sources :

Example 1 with KeyUpHandler

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

the class ExtendedPasswordBox method buildWidget.

/**
	 * Build widget itself
	 */
private void buildWidget() {
    box.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (validator != null) {
                validator.validateTextBox();
            }
        }
    });
    box.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if (validator != null) {
                validator.validateTextBox();
            }
        }
    });
    box.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            if (validator != null) {
                validator.validateTextBox();
            }
        }
    });
    box.getElement().setClassName("passwordbox" + counter++);
    setCutCopyPasteHandler("passwordbox" + counter);
    errorText.setVisible(false);
    errorText.setStyleName("inputFormInlineComment");
    errorText.addStyleName("serverResponseLabelError");
    errorText.addStyleName("input-status-error-padding");
    sp.setWidget(box);
    sp.getElement().appendChild(errorText.getElement());
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) KeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler)

Example 2 with KeyUpHandler

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

the class ExtendedTextArea method buildWidget.

/**
	 * Build widget itself
	 */
private void buildWidget() {
    box.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (validator != null) {
                validator.validateTextArea();
            }
        }
    });
    box.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if (validator != null) {
                validator.validateTextArea();
            }
        }
    });
    box.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            if (validator != null) {
                validator.validateTextArea();
            }
        }
    });
    box.getElement().setClassName("textarea" + counter++);
    setCutCopyPasteHandler("textarea" + counter);
    errorText.setVisible(false);
    errorText.setStyleName("inputFormInlineComment");
    errorText.addStyleName("serverResponseLabelError");
    errorText.addStyleName("input-status-error-padding");
    sp.setWidget(box);
    sp.getElement().appendChild(errorText.getElement());
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) KeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler)

Example 3 with KeyUpHandler

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

the class ExtendedTextBox method buildWidget.

/**
	 * Build widget itself
	 */
private void buildWidget() {
    box.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (validator != null) {
                validator.validateTextBox();
            }
        }
    });
    box.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if (validator != null) {
                validator.validateTextBox();
            }
        }
    });
    box.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            if (validator != null) {
                validator.validateTextBox();
            }
        }
    });
    box.getElement().setClassName("textbox" + counter++);
    setCutCopyPasteHandler("textbox" + counter);
    errorText.setVisible(false);
    errorText.setStyleName("inputFormInlineComment");
    errorText.addStyleName("serverResponseLabelError");
    errorText.addStyleName("input-status-error-padding");
    sp.setWidget(box);
    sp.getElement().appendChild(errorText.getElement());
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) KeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler)

Example 4 with KeyUpHandler

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

the class AddUserExtSourceTabItem method draw.

public Widget draw() {
    titleWidget.setText("Add ext. identity");
    VerticalPanel vp = new VerticalPanel();
    // get available ext sources
    final ListBoxWithObjects<ExtSource> extSourcesDropDown = new ListBoxWithObjects<ExtSource>();
    final TextBox externalLogin = new TextBox();
    final TextBox loaTextBox = new TextBox();
    final CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, "Add external identity to user");
    // fill listbox
    JsonCallbackEvents fillEvent = new JsonCallbackEvents() {

        @Override
        public void onError(PerunError error) {
            extSourcesDropDown.clear();
            extSourcesDropDown.addItem("Error while loading");
            callDone = false;
        }

        @Override
        public void onFinished(JavaScriptObject jso) {
            extSourcesDropDown.clear();
            ArrayList<ExtSource> list = JsonUtils.jsoAsList(jso);
            list = new TableSorter<ExtSource>().sortByName(list);
            if (list == null || list.isEmpty()) {
                extSourcesDropDown.addItem("No external sources available");
                return;
            }
            for (ExtSource ex : list) {
                extSourcesDropDown.addItem(ex);
            }
            callDone = true;
            if (!externalLogin.getText().isEmpty() && !extSourcesDropDown.isEmpty() && JsonUtils.checkParseInt(loaTextBox.getText()) && callDone) {
                addButton.setEnabled(true);
            }
        }

        @Override
        public void onLoadingStart() {
            extSourcesDropDown.clear();
            extSourcesDropDown.addItem("Loading...");
            callDone = false;
        }
    };
    // callback
    final GetExtSources extSources = new GetExtSources(fillEvent);
    extSources.retrieveData();
    // create layout
    FlexTable layout = new FlexTable();
    layout.setStyleName("inputFormFlexTable");
    layout.setHTML(0, 0, "External login:");
    layout.setWidget(0, 1, externalLogin);
    layout.setHTML(1, 0, "External source:");
    layout.setWidget(1, 1, extSourcesDropDown);
    layout.setHTML(2, 0, "Level of Assurance:");
    layout.setWidget(2, 1, loaTextBox);
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
    for (int i = 0; i < layout.getRowCount(); i++) {
        cellFormatter.setStyleName(i, 0, "itemName");
    }
    cellFormatter.setStyleName(3, 1, "inputFormInlineComment");
    layout.setHTML(3, 1, "0 - not verified = default</br>1 - verified email</br>2 - verified identity</br>3 - verified identity, strict password strength");
    TabMenu menu = new TabMenu();
    // close tab events
    final JsonCallbackEvents addExtSrcEvents = JsonCallbackEvents.closeTabDisableButtonEvents(addButton, this);
    addButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            ExtSource selected = extSourcesDropDown.getObjectAt(extSourcesDropDown.getSelectedIndex());
            String login = externalLogin.getText();
            AddUserExtSource request = new AddUserExtSource(addExtSrcEvents);
            int loa = 0;
            if (JsonUtils.checkParseInt(loaTextBox.getText())) {
                loa = Integer.parseInt(loaTextBox.getText());
            } else {
                JsonUtils.cantParseIntConfirm("Level of Assurance", loaTextBox.getText());
                return;
            }
            request.addUserExtSource(userId, login.trim(), selected, loa);
        }
    });
    addButton.setEnabled(false);
    menu.addWidget(addButton);
    final TabItem tab = this;
    menu.addWidget(TabMenu.getPredefinedButton(ButtonType.CANCEL, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            session.getTabManager().closeTab(tab);
        }
    }));
    KeyUpHandler handler = new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (!externalLogin.getText().isEmpty() && !extSourcesDropDown.isEmpty() && JsonUtils.checkParseInt(loaTextBox.getText()) && callDone) {
                addButton.setEnabled(true);
            } else {
                addButton.setEnabled(false);
            }
        }
    };
    externalLogin.addKeyUpHandler(handler);
    loaTextBox.addKeyUpHandler(handler);
    vp.add(layout);
    vp.add(menu);
    vp.setCellHorizontalAlignment(menu, HasHorizontalAlignment.ALIGN_RIGHT);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) GetExtSources(cz.metacentrum.perun.webgui.json.extSourcesManager.GetExtSources) KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) KeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ListBoxWithObjects(cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) AddUserExtSource(cz.metacentrum.perun.webgui.json.usersManager.AddUserExtSource) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) AddUserExtSource(cz.metacentrum.perun.webgui.json.usersManager.AddUserExtSource) ExtSource(cz.metacentrum.perun.webgui.model.ExtSource) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 5 with KeyUpHandler

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

the class ProjectBranchesScreen method initPageHeader.

private void initPageHeader() {
    parseToken();
    HorizontalPanel hp = new HorizontalPanel();
    hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
    Label filterLabel = new Label(AdminConstants.I.projectFilter());
    filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
    hp.add(filterLabel);
    filterTxt = new NpTextBox();
    filterTxt.setValue(match);
    filterTxt.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            Query q = new Query(filterTxt.getValue());
            if (match.equals(q.qMatch)) {
                q.start(start);
            } else {
                if (query == null) {
                    q.run();
                }
                query = q;
            }
        }
    });
    hp.add(filterTxt);
    add(hp);
}
Also used : KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) InlineLabel(com.google.gwt.user.client.ui.InlineLabel) KeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox)

Aggregations

KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)15 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)15 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)5 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)5 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)5 Label (com.google.gwt.user.client.ui.Label)5 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)5 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)3 KeyPressHandler (com.google.gwt.event.dom.client.KeyPressHandler)3 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)2 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)2 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)2 PerunError (cz.metacentrum.perun.webgui.model.PerunError)2 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)2 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)2 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)2 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1