Java Code Examples for com.vaadin.ui.ComboBox#addStyleName()

The following examples show how to use com.vaadin.ui.ComboBox#addStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SPUIComboBoxDecorator.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Decorate.
 * 
 * @param caption
 *            caption of the combobox
 * @param height
 *            as H
 * @param width
 *            as W
 * @param style
 *            as style
 * @param styleName
 *            as style name
 * @param required
 *            as T|F
 * @param data
 *            as data
 * @param prompt
 *            as promt
 * @return ComboBox as comp
 */
public static ComboBox decorate(final String caption, final String width, final String style,
        final String styleName, final boolean required, final String data, final String prompt) {
    final ComboBox spUICombo = new ComboBox();
    // Default settings
    spUICombo.setRequired(required);
    spUICombo.addStyleName(ValoTheme.COMBOBOX_TINY);

    if (!StringUtils.isEmpty(caption)) {
        spUICombo.setCaption(caption);
    }
    // Add style
    if (!StringUtils.isEmpty(style)) {
        spUICombo.setStyleName(style);
    }
    // Add style Name
    if (!StringUtils.isEmpty(styleName)) {
        spUICombo.addStyleName(styleName);
    }
    // AddWidth
    if (!StringUtils.isEmpty(width)) {
        spUICombo.setWidth(width);
    }
    // Set prompt
    if (!StringUtils.isEmpty(prompt)) {
        spUICombo.setInputPrompt(prompt);
    }
    // Set Data
    if (!StringUtils.isEmpty(data)) {
        spUICombo.setData(data);
    }

    return spUICombo;
}
 
Example 2
Source File: TargetBulkUpdateWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private ComboBox getDsComboField() {
    final Container container = createContainer();
    final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("bulkupload.ds.name"), "", null,
            null, false, "", i18n.getMessage("bulkupload.ds.name"));
    dsComboBox.setSizeUndefined();
    dsComboBox.addStyleName(SPUIDefinitions.BULK_UPLOD_DS_COMBO_STYLE);
    dsComboBox.setImmediate(true);
    dsComboBox.setFilteringMode(FilteringMode.STARTSWITH);
    dsComboBox.setPageLength(7);
    dsComboBox.setContainerDataSource(container);
    dsComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME_VERSION);
    dsComboBox.setId(UIComponentIdProvider.BULK_UPLOAD_DS_COMBO);
    dsComboBox.setWidth("100%");
    return dsComboBox;
}
 
Example 3
Source File: MaintenanceWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Combo box to pick the time zone offset.
 */
private void createMaintenanceTimeZoneControl() {
    // ComboBoxBuilder cannot be used here, because Builder do
    // 'comboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);'
    // which interferes our code: 'timeZone.addItems(getAllTimeZones());'
    timeZone = new ComboBox();
    timeZone.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_TIME_ZONE_ID);
    timeZone.setCaption(i18n.getMessage("caption.maintenancewindow.timezone"));
    timeZone.addItems(getAllTimeZones());
    timeZone.setValue(getClientTimeZone());
    timeZone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    timeZone.setTextInputAllowed(false);
    timeZone.setNullSelectionAllowed(false);
}