Search in sources :

Example 16 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project che by eclipse.

the class CustomListBox method insertItem.

/**
     * Inserts an item into the list box.
     *
     * @param item
     *         the text of the item to be inserted.
     * @param value
     *         the item's value.
     */
public void insertItem(String item, String value) {
    //create new widget
    final RadioButton radioButton = new RadioButton(optionsGroupName, item);
    //remove the default gwt-RadioButton style
    radioButton.removeStyleName("gwt-RadioButton");
    //set value
    final InputElement inputElement = (InputElement) radioButton.getElement().getElementsByTagName("input").getItem(0);
    inputElement.removeAttribute("tabindex");
    inputElement.setAttribute("value", value);
    //set default state
    if (defaultSelectedIndex > -1 && optionsPanel.getElement().getChildCount() == defaultSelectedIndex) {
        inputElement.setChecked(true);
        currentItemLabel.setInnerText(item);
    }
    //add to widget
    optionsPanel.add(radioButton);
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) InputElement(com.google.gwt.dom.client.InputElement)

Example 17 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project ovirt-engine by oVirt.

the class RadioGroup method updateButtons.

private void updateButtons() {
    for (Map.Entry<K, RadioButton> entry : buttons.entrySet()) {
        RadioButton radioButton = entry.getValue();
        if (usePatternfly) {
            // patternfly hacks
            Element.as(radioButton.getElement().getChild(0)).getStyle().setVerticalAlign(VerticalAlign.TOP);
            getRadioButtonWidgetLabel(radioButton).getStyle().setPaddingLeft(10, Unit.PX);
            getRadioButtonWidgetLabel(radioButton).getStyle().setPosition(Position.RELATIVE);
            // $NON-NLS-1$
            getRadioButtonWidgetLabel(radioButton).getStyle().setProperty(MAX_WIDTH, "94%");
        }
        if (entry.getKey().equals(selectedValue)) {
            radioButton.setValue(true);
            radioButton.setTabIndex(tabIndex);
            if (accessKey != 0) {
                radioButton.setAccessKey(accessKey);
            }
        } else if (Objects.equals(oldSelectedValue, entry.getKey())) {
            radioButton.setTabIndex(-1);
            // $NON-NLS-1$
            radioButton.getElement().removeAttribute("accessKey");
        }
    }
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) HashMap(java.util.HashMap) Map(java.util.Map)

Example 18 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project ovirt-engine by oVirt.

the class HostInstallPopupView method initEditors.

void initEditors() {
    isoEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<RpmVersion>() {

        @Override
        public String renderNullSafe(RpmVersion version) {
            // Format string to contain major.minor version only.
            return version.getRpmName();
        }
    });
    // $NON-NLS-1$
    rbPassword = new RadioButton("1");
    // $NON-NLS-1$
    rbPublicKey = new RadioButton("1");
    publicKeyEditor = new StringEntityModelTextAreaLabelEditor();
    activateHostAfterInstallEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    overrideIpTablesEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
}
Also used : StringEntityModelTextAreaLabelEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) RadioButton(com.google.gwt.user.client.ui.RadioButton) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) RpmVersion(org.ovirt.engine.core.compat.RpmVersion)

Example 19 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project ovirt-engine by oVirt.

the class HostPopupView method initEditors.

private void initEditors() {
    publicKeyEditor = new StringEntityModelTextAreaLabelEditor();
    // List boxes
    clusterEditor = new GroupedListModelListBoxEditor<>(new GroupedListModelListBox<Cluster>(new NameRenderer<Cluster>()) {

        @Override
        public String getModelLabel(Cluster model) {
            return model.getName();
        }

        @Override
        public String getGroupLabel(Cluster model) {
            return messages.hostDataCenter(model.getStoragePoolName());
        }

        @Override
        public Comparator<Cluster> getComparator() {
            return new DataCenterClusterComparator();
        }

        /**
         * Comparator that sorts on data center name first, and then cluster name. Ignoring case.
         */
        final class DataCenterClusterComparator implements Comparator<Cluster> {

            @Override
            public int compare(Cluster cluster1, Cluster cluster2) {
                if (cluster1.getStoragePoolName() != null && cluster2.getStoragePoolName() == null) {
                    return -1;
                } else if (cluster2.getStoragePoolName() != null && cluster1.getStoragePoolName() == null) {
                    return 1;
                } else if (cluster1.getStoragePoolName() == null && cluster2.getStoragePoolName() == null) {
                    return 0;
                }
                if (cluster1.getStoragePoolName().equals(cluster2.getStoragePoolName())) {
                    return cluster1.getName().compareToIgnoreCase(cluster2.getName());
                } else {
                    return cluster1.getStoragePoolName().compareToIgnoreCase(cluster2.getStoragePoolName());
                }
            }
        }
    });
    externalHostNameEditor = new ListModelListBoxEditor<>(new NameRenderer<VDS>());
    providersEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider<OpenstackNetworkProviderProperties>>());
    externalDiscoveredHostsEditor = getListModelTypeAheadListBoxEditor();
    externalHostGroupsEditor = getListModelTypeAheadListBoxEditor();
    externalComputeResourceEditor = getListModelTypeAheadListBoxEditor();
    // Check boxes
    pmEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    pmEnabledEditor.setUsePatternFly(true);
    pmKdumpDetectionEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    pmKdumpDetectionEditor.setUsePatternFly(true);
    disableAutomaticPowerManagementEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    disableAutomaticPowerManagementEditor.setUsePatternFly(true);
    externalHostProviderEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    overrideIpTablesEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    // $NON-NLS-1$
    rbPassword = new RadioButton("1");
    // $NON-NLS-1$
    rbPublicKey = new RadioButton("1");
    // $NON-NLS-1$
    rbDiscoveredHost = new EntityModelRadioButtonEditor("2");
    // $NON-NLS-1$
    rbProvisionedHost = new EntityModelRadioButtonEditor("2");
    kernelCmdlineBlacklistNouveau = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlineIommu = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlineKvmNested = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlineUnsafeInterrupts = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlinePciRealloc = new EntityModelCheckBoxEditor(Align.RIGHT);
    consoleAddressEnabled = new EntityModelCheckBoxEditor(Align.RIGHT);
    hostedEngineDeployActionsEditor = new ListModelListBoxEditor<>(new EnumRenderer<HostedEngineDeployConfiguration.Action>());
}
Also used : StringEntityModelTextAreaLabelEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) RadioButton(com.google.gwt.user.client.ui.RadioButton) GroupedListModelListBox(org.ovirt.engine.ui.common.widget.editor.GroupedListModelListBox) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration)

Example 20 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project cuba by cuba-platform.

the class CubaOptionGroupWidget method buildOptions.

@Override
public void buildOptions(UIDL uidl) {
    super.buildOptions(uidl);
    for (Widget widget : panel) {
        if (widget instanceof RadioButton) {
            ((RadioButton) widget).addKeyDownHandler(this);
            ((RadioButton) widget).addValueChangeHandler(this);
        }
    }
    updateEnabledState();
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) RadioButton(com.google.gwt.user.client.ui.RadioButton)

Aggregations

RadioButton (com.google.gwt.user.client.ui.RadioButton)31 Test (org.junit.Test)11 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Label (com.google.gwt.user.client.ui.Label)4 Widget (com.google.gwt.user.client.ui.Widget)4 MockValueChangeHandler (com.googlecode.gwt.MockValueChangeHandler)4 InputElement (com.google.gwt.dom.client.InputElement)3 Element (com.google.gwt.dom.client.Element)2 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2 EntityModelRadioButtonEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)2 StringEntityModelTextAreaLabelEditor (org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor)2 AgreementInfo (com.google.gerrit.client.info.AgreementInfo)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 HeadingElement (com.google.gwt.dom.client.HeadingElement)1 Node (com.google.gwt.dom.client.Node)1