Search in sources :

Example 21 with ListBox

use of com.google.gwt.user.client.ui.ListBox in project gwt-test-utils by gwt-test-utils.

the class ListBoxTest method visible.

@Test
public void visible() {
    // Given
    ListBox listBox = new ListBox(false);
    // Preconditions
    assertThat(listBox.isVisible()).isEqualTo(true);
    // When
    listBox.setVisible(false);
    // Then
    assertThat(listBox.isVisible()).isEqualTo(false);
}
Also used : ListBox(com.google.gwt.user.client.ui.ListBox) Test(org.junit.Test)

Example 22 with ListBox

use of com.google.gwt.user.client.ui.ListBox in project rstudio by rstudio.

the class ChooseEncodingDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    listBox_ = new ListBox();
    listBox_.setMultipleSelect(true);
    listBox_.setVisibleItemCount(15);
    listBox_.setWidth("350px");
    setEncodings(commonEncodings_, currentEncoding_);
    CheckBox showAll = new CheckBox("Show all encodings");
    showAll.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        public void onValueChange(ValueChangeEvent<Boolean> e) {
            if (e.getValue())
                setEncodings(allEncodings_, currentEncoding_);
            else
                setEncodings(commonEncodings_, currentEncoding_);
        }
    });
    setCheckBoxMargins(showAll, 8, 12);
    VerticalPanel panel = new VerticalPanel();
    panel.add(listBox_);
    panel.add(showAll);
    if (includeSaveAsDefault_) {
        saveAsDefault_ = new CheckBox("Set as default encoding for " + "source files");
        setCheckBoxMargins(showAll, 8, 0);
        setCheckBoxMargins(saveAsDefault_, 3, 12);
        panel.add(saveAsDefault_);
    }
    return panel;
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) CheckBox(com.google.gwt.user.client.ui.CheckBox) ListBox(com.google.gwt.user.client.ui.ListBox)

Example 23 with ListBox

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

the class ProjectInfoScreen method renderListBox.

private ListBox renderListBox(LabeledWidgetsGrid g, ConfigParameterInfo param) {
    if (param.permittedValues() == null) {
        return null;
    }
    ListBox listBox = new ListBox();
    if (param.inheritable()) {
        listBox.addItem(AdminMessages.I.pluginProjectInheritedListValue(param.inheritedValue()));
        if (param.configuredValue() == null) {
            listBox.setSelectedIndex(0);
        }
        for (int i = 0; i < param.permittedValues().length(); i++) {
            String pv = param.permittedValues().get(i);
            listBox.addItem(pv);
            if (pv.equals(param.configuredValue())) {
                listBox.setSelectedIndex(i + 1);
            }
        }
    } else {
        for (int i = 0; i < param.permittedValues().length(); i++) {
            String pv = param.permittedValues().get(i);
            listBox.addItem(pv);
            if (pv.equals(param.value())) {
                listBox.setSelectedIndex(i);
            }
        }
    }
    if (param.editable()) {
        saveEnabler.listenTo(listBox);
        addWidget(g, listBox, param);
    } else {
        listBox.setEnabled(false);
        if (param.inheritable() && listBox.getSelectedIndex() != 0) {
            // the inherited value is not selected,
            // since the listBox is disabled the inherited value cannot be
            // seen and we have to display it explicitly
            Label inheritedLabel = new Label(AdminMessages.I.pluginProjectInheritedValue(param.inheritedValue()));
            inheritedLabel.setStyleName(Gerrit.RESOURCES.css().pluginProjectConfigInheritedValue());
            HorizontalPanel p = new HorizontalPanel();
            p.add(listBox);
            p.add(inheritedLabel);
            addWidget(g, p, param);
        } else {
            addWidget(g, listBox, param);
        }
    }
    return listBox;
}
Also used : Label(com.google.gwt.user.client.ui.Label) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ListBox(com.google.gwt.user.client.ui.ListBox) GerritUiExtensionPoint(com.google.gerrit.client.GerritUiExtensionPoint)

Example 24 with ListBox

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

the class ProjectInfoScreen method initProjectOptions.

private void initProjectOptions() {
    grid.addHeader(new SmallHeading(AdminConstants.I.headingProjectOptions()));
    state = new ListBox();
    for (ProjectState stateValue : ProjectState.values()) {
        state.addItem(Util.toLongString(stateValue), stateValue.name());
    }
    saveEnabler.listenTo(state);
    grid.add(AdminConstants.I.headingProjectState(), state);
    submitType = new ListBox();
    for (final SubmitType type : SubmitType.values()) {
        submitType.addItem(Util.toLongString(type), type.name());
    }
    submitType.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            setEnabledForUseContentMerge();
        }
    });
    saveEnabler.listenTo(submitType);
    grid.add(AdminConstants.I.headingProjectSubmitType(), submitType);
    contentMerge = newInheritedBooleanBox();
    saveEnabler.listenTo(contentMerge);
    grid.add(AdminConstants.I.useContentMerge(), contentMerge);
    newChangeForAllNotInTarget = newInheritedBooleanBox();
    saveEnabler.listenTo(newChangeForAllNotInTarget);
    grid.add(AdminConstants.I.createNewChangeForAllNotInTarget(), newChangeForAllNotInTarget);
    requireChangeID = newInheritedBooleanBox();
    saveEnabler.listenTo(requireChangeID);
    grid.addHtml(AdminConstants.I.requireChangeID(), requireChangeID);
    if (Gerrit.info().receive().enableSignedPush()) {
        enableSignedPush = newInheritedBooleanBox();
        saveEnabler.listenTo(enableSignedPush);
        grid.add(AdminConstants.I.enableSignedPush(), enableSignedPush);
        requireSignedPush = newInheritedBooleanBox();
        saveEnabler.listenTo(requireSignedPush);
        grid.add(AdminConstants.I.requireSignedPush(), requireSignedPush);
    }
    rejectImplicitMerges = newInheritedBooleanBox();
    saveEnabler.listenTo(rejectImplicitMerges);
    grid.addHtml(AdminConstants.I.rejectImplicitMerges(), rejectImplicitMerges);
    enableReviewerByEmail = newInheritedBooleanBox();
    saveEnabler.listenTo(enableReviewerByEmail);
    grid.addHtml(AdminConstants.I.enableReviewerByEmail(), enableReviewerByEmail);
    maxObjectSizeLimit = new NpTextBox();
    saveEnabler.listenTo(maxObjectSizeLimit);
    effectiveMaxObjectSizeLimit = new Label();
    effectiveMaxObjectSizeLimit.setStyleName(Gerrit.RESOURCES.css().maxObjectSizeLimitEffectiveLabel());
    HorizontalPanel p = new HorizontalPanel();
    p.add(maxObjectSizeLimit);
    p.add(effectiveMaxObjectSizeLimit);
    grid.addHtml(AdminConstants.I.headingMaxObjectSizeLimit(), p);
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Label(com.google.gwt.user.client.ui.Label) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ProjectState(com.google.gerrit.extensions.client.ProjectState) SubmitType(com.google.gerrit.extensions.client.SubmitType) ListBox(com.google.gwt.user.client.ui.ListBox) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox)

Example 25 with ListBox

use of com.google.gwt.user.client.ui.ListBox in project opennms by OpenNMS.

the class AlarmControl method doOnAdd.

public Element doOnAdd() {
    LOG.info("AlarmControl.doOnAdd()");
    final AlarmControlCss css = AlarmControlBundle.INSTANCE.css();
    css.ensureInjected();
    m_eventManager.addHandler(AlarmSeverityUpdatedEvent.TYPE, this);
    this.setStylePrimaryName("leaflet-control-alarm");
    this.addStyleName("leaflet-bar");
    this.addStyleName("leaflet-control");
    final Label label = new Label("Show Severity >=");
    label.getElement().setAttribute("for", "alarmControl");
    label.addStyleName(css.label());
    m_severityBox = new ListBox(false);
    m_severityBox.getElement().setId("alarmControl");
    for (final AlarmSeverity sev : AlarmSeverity.values()) {
        m_severityBox.addItem(sev.getLabel());
    }
    m_severityBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(final ChangeEvent event) {
            final int selected = m_severityBox.getSelectedIndex();
            LOG.info("new selection index = " + selected);
            final String value = m_severityBox.getValue(selected);
            LOG.info("new severity = " + value);
            m_eventManager.fireEvent(new AlarmSeverityUpdatedEvent(AlarmSeverity.get(value)));
            event.stopPropagation();
        }
    });
    m_severityBox.addStyleName(css.label());
    this.add(label);
    this.add(m_severityBox);
    LOG.info("AlarmControl.doOnAdd(): finished, returning: " + this.getElement());
    m_componentTracker.ready(getClass());
    return this.getElement();
}
Also used : AlarmSeverity(org.opennms.features.vaadin.nodemaps.internal.gwt.client.AlarmSeverity) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Label(com.google.gwt.user.client.ui.Label) AlarmSeverityUpdatedEvent(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.AlarmSeverityUpdatedEvent) ListBox(com.google.gwt.user.client.ui.ListBox)

Aggregations

ListBox (com.google.gwt.user.client.ui.ListBox)25 Test (org.junit.Test)10 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)5 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)5 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)5 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)5 CheckBox (com.google.gwt.user.client.ui.CheckBox)5 Label (com.google.gwt.user.client.ui.Label)5 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)3 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)3 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)3 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)2 OnEditEnabler (com.google.gerrit.client.ui.OnEditEnabler)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 Button (com.google.gwt.user.client.ui.Button)2 FlexTable (com.google.gwt.user.client.ui.FlexTable)2 Grid (com.google.gwt.user.client.ui.Grid)2 HTML (com.google.gwt.user.client.ui.HTML)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 TextBox (com.google.gwt.user.client.ui.TextBox)2