com.vaadin.ui.ComboBox Java Examples

The following examples show how to use com.vaadin.ui.ComboBox. 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: WinServerAddSimple.java    From primecloud-controller with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void attach() {
    // サーバ名(Prefix)
    prefixField = new TextField(ViewProperties.getCaption("field.serverNamePrefix"));
    getLayout().addComponent(prefixField);

    // プラットフォーム
    cloudTable = new SelectCloudTable();
    getLayout().addComponent(cloudTable);

    // サーバ台数
    serverNumber = new ComboBox(ViewProperties.getCaption("field.serverNumber"));
    serverNumber.setWidth("110px");
    serverNumber.setMultiSelect(false);
    for (int i = 1; i <= MAX_ADD_SERVER; i++) {
        serverNumber.addItem(i);
    }
    serverNumber.setNullSelectionAllowed(false);
    serverNumber.setValue(1); // 初期値は1
    getLayout().addComponent(serverNumber);

    initValidation();
}
 
Example #2
Source File: ComboBoxBuilder.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @return a new ComboBox
 */
public ComboBox buildCombBox() {
    final ComboBox comboBox = SPUIComponentProvider.getComboBox(null, "", null, ValoTheme.COMBOBOX_SMALL, false, "",
            prompt);
    comboBox.setImmediate(true);
    comboBox.setPageLength(7);
    comboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
    comboBox.setSizeUndefined();
    if (caption != null) {
        comboBox.setCaption(caption);
    }
    if (id != null) {
        comboBox.setId(id);
    }
    if (valueChangeListener != null) {
        comboBox.addValueChangeListener(valueChangeListener);
    }
    return comboBox;
}
 
Example #3
Source File: Tool.java    From chipster with MIT License 6 votes vote down vote up
private void initElements() {
	lbId.setValue("Id:");
	lbModule = new Label("Module:");
	lbCategory = new Label("Category:");
	
	module = new ComboBox();
	module.setWidth(WIDTH);
	
	category = new ComboBox();
	category.setWidth(WIDTH);
	
	id.setImmediate(true);
	name.setRequired(true);
	name.setRequiredError(REQUIRED_TEXT);
	description.setRequired(true);
	description.setRequiredError(REQUIRED_TEXT);
}
 
Example #4
Source File: OldLoginView.java    From gazpachoquest with GNU General Public License v3.0 6 votes vote down vote up
private ComboBox createLanguageSelector() {
    ComboBox languageSelector = new ComboBox("com.vaadin.demo.dashboard.DashboardUI.Language");
    languageSelector.setImmediate(true);
    languageSelector.setNullSelectionAllowed(false);
    addLocale(Locale.ENGLISH, languageSelector);
    addLocale(Locale.FRENCH, languageSelector);
    addLocale(new Locale("es"), languageSelector);
    // languageSelector.setValue(I18NStaticService.getI18NServive().getLocale());
    /*-languageSelector.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            Locale locale = (Locale) (event.getProperty().getValue());
            I18NStaticService.getI18NServive().setLocale(locale);
            getUI().requestRepaintAll();
        }
    });*/
    return languageSelector;
}
 
Example #5
Source File: AttributeStandardSelectorComponent.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(false);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// comboBoxCategories
	comboBoxCategories = new ComboBox();
	comboBoxCategories.setCaption("Select A Category");
	comboBoxCategories.setImmediate(false);
	comboBoxCategories.setWidth("-1px");
	comboBoxCategories.setHeight("-1px");
	comboBoxCategories.setInvalidAllowed(false);
	comboBoxCategories.setRequired(true);
	mainLayout.addComponent(comboBoxCategories);
	mainLayout.setExpandRatio(comboBoxCategories, 1.0f);
	
	// horizontalLayout_2
	horizontalLayout_2 = buildHorizontalLayout_2();
	mainLayout.addComponent(horizontalLayout_2);
	mainLayout.setExpandRatio(horizontalLayout_2, 1.0f);
	
	return mainLayout;
}
 
Example #6
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    // サーバサイズ
    sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
    sizeSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(sizeSelect);

    // キーペア
    keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
    keySelect.setNullSelectionAllowed(false);
    keySelect.addContainerProperty(KEY_CAPTION_ID, String.class, null);
    keySelect.setItemCaptionPropertyId(KEY_CAPTION_ID);
    keySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    // Windowsの場合はキーペアを無効にする
    if (StringUtils.startsWith(image.getImage().getOs(), PCCConstant.OS_NAME_WIN)) {
        keySelect.setEnabled(false);
    }
    form.getLayout().addComponent(keySelect);

    // クラスタ
    clusterSelect = new ComboBox(ViewProperties.getCaption("field.cluster"));
    clusterSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(clusterSelect);

    // ルートサイズ
    rootSizeField = new TextField(ViewProperties.getCaption("field.rootSize"));
    rootSizeField.setImmediate(true);
    form.getLayout().addComponent(rootSizeField);

    addComponent(form);
}
 
Example #7
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    // サーバサイズ
    sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
    sizeSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(sizeSelect);

    // キーペア
    keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
    keySelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(keySelect);

    addComponent(form);
}
 
Example #8
Source File: InviteUserTokenField.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public InviteUserTokenField() {
    inviteEmails = new HashSet<>();
    this.setWidth("100%");

    ProjectMemberService prjMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class);
    candidateUsers = prjMemberService.getUsersNotInProject(CurrentProjectVariables.getProjectId(), AppUI.getAccountId());
    List<SimpleTokenizable> tokens = candidateUsers.stream().map(user -> new SimpleTokenizable(user.getUsername().hashCode(), user.getUsername())).collect(Collectors.toList());
    ComboBox<SimpleTokenizable> comboBox = new ComboBox<>("", tokens);
    comboBox.setItemCaptionGenerator(SimpleTokenizable::getStringValue);
    comboBox.setPlaceholder("Type here to add");
    comboBox.setNewItemProvider((ComboBox.NewItemProvider<SimpleTokenizable>) value -> {
        if (StringUtils.isValidEmail(value) && !inviteEmails.contains(value)) {
            inviteEmails.add(value);
            tokenField.addTokenizable(new SimpleTokenizable(value.hashCode(), value));
            return Optional.empty();
        } else {
            Notification.show("Warning", "Invalid input", Notification.Type.WARNING_MESSAGE);
            return Optional.empty();
        }
    });
    comboBox.addValueChangeListener(getComboBoxValueChange(tokenField));

    tokenField.addTokenRemovedListener(event -> {
        Tokenizable token = event.getTokenizable();
        inviteEmails.remove(token.getStringValue());
    });

    tokenField.setInputField(comboBox);
    tokenField.setEnableDefaultDeleteTokenAction(true);
    this.addComponent(tokenField);
}
 
Example #9
Source File: TimeZoneSelectionField.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public TimeZoneSelectionField(boolean isVerticalDisplay) {
    this.isVerticalDisplay = isVerticalDisplay;
    areaSelection = new StringValueComboBox(false, TimezoneVal.getAreas());
    areaSelection.addValueChangeListener((ValueChangeListener) event -> setCboTimeZone(areaSelection.getValue()));
    timezoneSelection = new ComboBox<>();
    timezoneSelection.setWidth(WebThemes.FORM_CONTROL_WIDTH);
    String area = areaSelection.getSelectedItem().orElse(null);
    areaSelection.setValue(area);
    setCboTimeZone(area);

    doSetValue(ZoneId.systemDefault().getId());
}
 
Example #10
Source File: ExpressionEditorWindow.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private VerticalLayout buildMainLayout() {
	// common part: create layout
	mainLayout = new VerticalLayout();
	mainLayout.setImmediate(false);
	mainLayout.setWidth("-1px");
	mainLayout.setHeight("-1px");
	mainLayout.setMargin(true);
	mainLayout.setSpacing(true);
	
	// top-level component properties
	setWidth("-1px");
	setHeight("-1px");
	
	// comboBox
	comboBox = new ComboBox();
	comboBox.setImmediate(false);
	comboBox.setWidth("-1px");
	comboBox.setHeight("-1px");
	mainLayout.addComponent(comboBox);
	
	// treeExpression
	treeExpression = new Tree();
	treeExpression.setImmediate(false);
	treeExpression.setWidth("100.0%");
	treeExpression.setHeight("-1px");
	mainLayout.addComponent(treeExpression);
	mainLayout.setExpandRatio(treeExpression, 1.0f);
	
	return mainLayout;
}
 
Example #11
Source File: RangeEditorComponent.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private HorizontalLayout buildHorizontalLayout_1() {
	// common part: create layout
	horizontalLayout_1 = new HorizontalLayout();
	horizontalLayout_1.setImmediate(false);
	horizontalLayout_1.setWidth("-1px");
	horizontalLayout_1.setHeight("-1px");
	horizontalLayout_1.setMargin(false);
	horizontalLayout_1.setSpacing(true);
	
	// comboBoxMin
	comboBoxMin = new ComboBox();
	comboBoxMin.setCaption("Minimum Type");
	comboBoxMin.setImmediate(true);
	comboBoxMin.setDescription("Select the type for the minimum.");
	comboBoxMin.setWidth("-1px");
	comboBoxMin.setHeight("-1px");
	horizontalLayout_1.addComponent(comboBoxMin);
	
	// textFieldMin
	textFieldMin = new TextField();
	textFieldMin.setCaption("Minimum Value");
	textFieldMin.setImmediate(true);
	textFieldMin.setDescription("Enter a value for the minimum.");
	textFieldMin.setWidth("-1px");
	textFieldMin.setHeight("-1px");
	textFieldMin.setInvalidAllowed(false);
	textFieldMin.setInputPrompt("eg. 1");
	horizontalLayout_1.addComponent(textFieldMin);
	horizontalLayout_1
			.setComponentAlignment(textFieldMin, new Alignment(9));
	
	return horizontalLayout_1;
}
 
Example #12
Source File: RangeEditorComponent.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private HorizontalLayout buildHorizontalLayout_2() {
	// common part: create layout
	horizontalLayout_2 = new HorizontalLayout();
	horizontalLayout_2.setImmediate(false);
	horizontalLayout_2.setWidth("-1px");
	horizontalLayout_2.setHeight("-1px");
	horizontalLayout_2.setMargin(false);
	horizontalLayout_2.setSpacing(true);
	
	// comboBoxMax
	comboBoxMax = new ComboBox();
	comboBoxMax.setCaption("Maximum Type");
	comboBoxMax.setImmediate(true);
	comboBoxMax.setDescription("Select the type for the maximum.");
	comboBoxMax.setWidth("-1px");
	comboBoxMax.setHeight("-1px");
	horizontalLayout_2.addComponent(comboBoxMax);
	
	// textFieldMax
	textFieldMax = new TextField();
	textFieldMax.setCaption("Maximum Value");
	textFieldMax.setImmediate(true);
	textFieldMax.setDescription("Enter a value for the maxmum.");
	textFieldMax.setWidth("-1px");
	textFieldMax.setHeight("-1px");
	textFieldMax.setInvalidAllowed(false);
	textFieldMax.setInputPrompt("eg. 100");
	horizontalLayout_2.addComponent(textFieldMax);
	
	return horizontalLayout_2;
}
 
Example #13
Source File: TicketComponentFactoryImpl.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
NewTicketWindow(LocalDate date, Integer projectId, Integer milestoneId, boolean isIncludeMilestone) {
    super(UserUIContext.getMessage(TicketI18nEnum.NEW));
    this.isIncludeMilestone = isIncludeMilestone;
    this.addStyleName(WebThemes.NO_SCROLLABLE_CONTAINER);
    MVerticalLayout content = new MVerticalLayout();
    withModal(true).withResizable(false).withCenter().withWidth(WebThemes.WINDOW_FORM_WIDTH).withContent(content);

    UserProjectComboBox projectListSelect = new UserProjectComboBox();
    projectListSelect.setEmptySelectionAllowed(false);
    selectedProject = projectListSelect.setSelectedProjectById(projectId);

    typeSelection = new ComboBox<>();
    typeSelection.setWidth(WebThemes.FORM_CONTROL_WIDTH);
    typeSelection.setEmptySelectionAllowed(false);

    projectListSelect.addValueChangeListener(valueChangeEvent -> {
        selectedProject = projectListSelect.getValue();
        loadAssociateTicketTypePerProject();
    });

    loadAssociateTicketTypePerProject();
    typeSelection.addValueChangeListener(event -> doChange(date, milestoneId));

    GridFormLayoutHelper formLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN);
    formLayoutHelper.addComponent(projectListSelect, UserUIContext.getMessage(ProjectI18nEnum.SINGLE), 0, 0);
    formLayoutHelper.addComponent(typeSelection, UserUIContext.getMessage(GenericI18Enum.FORM_TYPE), 1, 0);
    formLayoutHelper.getLayout().addStyleName(WebThemes.BORDER_BOTTOM);

    formLayout = new MCssLayout().withFullWidth();
    content.with(formLayoutHelper.getLayout(), formLayout);
    doChange(date, milestoneId);
}
 
Example #14
Source File: AttributeDictionarySelectorComponent.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private HorizontalLayout buildHorizontalLayout_2() {
	// common part: create layout
	horizontalLayout_2 = new HorizontalLayout();
	horizontalLayout_2.setImmediate(false);
	horizontalLayout_2.setWidth("-1px");
	horizontalLayout_2.setHeight("-1px");
	horizontalLayout_2.setMargin(false);
	horizontalLayout_2.setSpacing(true);
	
	// comboBoxCategoryFilter
	comboBoxCategoryFilter = new ComboBox();
	comboBoxCategoryFilter.setCaption("Filter Category");
	comboBoxCategoryFilter.setImmediate(false);
	comboBoxCategoryFilter.setWidth("-1px");
	comboBoxCategoryFilter.setHeight("-1px");
	horizontalLayout_2.addComponent(comboBoxCategoryFilter);
	horizontalLayout_2.setExpandRatio(comboBoxCategoryFilter, 1.0f);
	
	// buttonNewAttribute
	buttonNewAttribute = new Button();
	buttonNewAttribute.setCaption("New Attribute");
	buttonNewAttribute.setImmediate(true);
	buttonNewAttribute
			.setDescription("Click to create a new attribute in the dictionary.");
	buttonNewAttribute.setWidth("-1px");
	buttonNewAttribute.setHeight("-1px");
	horizontalLayout_2.addComponent(buttonNewAttribute);
	horizontalLayout_2.setComponentAlignment(buttonNewAttribute,
			new Alignment(10));
	
	return horizontalLayout_2;
}
 
Example #15
Source File: InputOutputUI.java    From chipster with MIT License 5 votes vote down vote up
protected void initElements() {
	type2 = new ComboBox();
	type2.setImmediate(true);
	type2.setWidth(WIDTH);
	lbMeta = new Label("Meta:");
	cbMeta = new CheckBox();
	cbMeta.setDescription("Is this element Meta data");
	
	optional.setWidth(WIDTH);
	type = new ComboBox();
	type.setWidth(WIDTH);
	type.setNullSelectionAllowed(false);
	type.setImmediate(true);
	type.addItem(SINGLE_FILE);
	type.addItem(MULTI_FILE);
	type.select(SINGLE_FILE);
	type.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = -1134955257251483403L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if(type.getValue().toString().contentEquals(SINGLE_FILE)) {
				getSingleFileUI();
			} else if(type.getValue().toString().contentEquals(MULTI_FILE)){
				getMultipleFilesUI();
			}
		}
	});
}
 
Example #16
Source File: ComboBoxFieldBuilder.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Field<?> build(Class<?> clazz, String name) {
	ComboBox combo = new ComboBox();
	fillComboBox(combo, clazz, name);
	combo.setItemCaptionMode(ItemCaptionMode.ID);
	
	return combo;
}
 
Example #17
Source File: ComboBoxFieldBuilder.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * Fill the ComboBox with items from PersistentService
 * @param combo ComboBox to fill
 * @param clazz Class of Bean containing property name
 * @param name property name
 */
protected void fillComboBox(ComboBox combo, Class<?> clazz, String name) {
	PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(clazz, name);
	Dao<?, Serializable> service = 
		persistentServiceFactory.createPersistentService(pd.getPropertyType());
	// fill combo
	Iterator<?>  iter = service.getAll().iterator();
	while(iter.hasNext())
		combo.addItem(iter.next());
}
 
Example #18
Source File: FormUtils.java    From jdal with Apache License 2.0 5 votes vote down vote up
public static ComboBox newComboBox(List<?> elements, String sortProperty, String caption) {
	Collections.sort(elements, new PropertyComparator(sortProperty));
	ComboBox combo = new ComboBox(caption);
	addItemList(combo, elements);
	
	return combo;
}
 
Example #19
Source File: FormUtils.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * Fill combo with a list of objeces.
 * @param data list to fill with.
 * @param clear true if clear all items before adding new ones.
 */
public static void fillCombo(ComboBox combo, List<?> data, boolean clear) {
	Object selected = combo.getValue();
	
	if (clear) {
		combo.removeAllItems();
	}
	
	for (Object o : data) {
		combo.addItem(o);
	}
	
	if (data.contains(selected))
		combo.setValue(selected);
}
 
Example #20
Source File: FormUtils.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * Add a link on primary and dependent ComboBoxes by property name. 
 * When selection changes on primary use propertyName to get a Collection and fill dependent ComboBox with it
 * @param primary ComboBox when selection changes
 * @param dependent ComboBox that are filled with collection   
 * @param propertyName the property name for get the collection from primary selected item
 * @param addNull if true, add a null as first combobox item
 */
@SuppressWarnings("rawtypes")
public static void link(final ComboBox primary, final ComboBox dependent,
		final String propertyName, final boolean addNull) {

	primary.addValueChangeListener(new ValueChangeListener() {

		public void valueChange(ValueChangeEvent event) {
			Object selected = event.getProperty().getValue();
			if (selected != null) {
				BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(selected);
				if (wrapper.isReadableProperty(propertyName)) {
					Collection items = (Collection) wrapper.getPropertyValue(propertyName);
					dependent.removeAllItems();
					
					if (addNull)
						dependent.addItem(null);
					
					for (Object item : items)
						dependent.addItem(item);
				}
				else {
					log.error("Can't write on propety '" + propertyName + "' of class: '" + selected.getClass() + "'");
				}
			}

		}
	});
}
 
Example #21
Source File: ParliamentDecisionFlowPageModContentFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout panelContent = createPanelContent();
	getParliamentMenuItemFactory().createParliamentTopicMenu(menuBar);

	String selectedYear = "2018/19";
	if (parameters != null && parameters.contains("[") && parameters.contains("]")) {
		selectedYear = parameters.substring(parameters.indexOf('[') + 1, parameters.lastIndexOf(']'));
	} 
	
	final DataContainer<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager()
			.getDataContainer(ViewRiksdagenCommittee.class);
	final List<ViewRiksdagenCommittee> allCommittess = dataContainer.getAll();

	final Map<String, List<ViewRiksdagenCommittee>> committeeMap = allCommittess.stream().collect(Collectors.groupingBy(c -> c.getEmbeddedId().getOrgCode().toUpperCase(Locale.ENGLISH)));
	
	final ComboBox<String> comboBox = new ComboBox<>("Select year", Collections.unmodifiableList(Arrays.asList("2018/19","2017/18","2016/17","2015/16","2014/15","2013/14","2012/13","2011/12","2010/11")));
	panelContent.addComponent(comboBox);
	panelContent.setExpandRatio(comboBox, ContentRatio.SMALL);
	comboBox.setSelectedItem(selectedYear);
	comboBox.addValueChangeListener(new DecisionFlowValueChangeListener(NAME,""));
	
	final SankeyChart chart = decisionFlowChartManager.createAllDecisionFlow(committeeMap,comboBox.getSelectedItem().orElse(selectedYear));
	panelContent.addComponent(chart);
	panelContent.setExpandRatio(chart, ContentRatio.LARGE);

	final TextArea textarea = decisionFlowChartManager.createCommitteeeDecisionSummary(committeeMap,comboBox.getSelectedItem().orElse(selectedYear));
	textarea.setSizeFull();
	panelContent.addComponent(textarea);
	panelContent.setExpandRatio(textarea, ContentRatio.SMALL_GRID);


	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARLIAMENT_RANKING_VIEW, ApplicationEventGroup.USER, NAME,
			parameters, selectedYear);
	panel.setCaption(new StringBuilder().append(NAME).append("::").append(PARLIAMENT_DECISION_FLOW).toString());

	return panelContent;

}
 
Example #22
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 #23
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 #24
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);
}
 
Example #25
Source File: CommitteeDecisionFlowPageModContentFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout panelContent = createPanelContent();
	final String pageId = getPageId(parameters);

	final ViewRiksdagenCommittee viewRiksdagenCommittee = getItem(parameters);
	getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId);

	String selectedYear = "2018/19";
	if (parameters != null && parameters.contains("[") && parameters.contains("]")) {
		selectedYear = parameters.substring(parameters.indexOf('[') + 1, parameters.lastIndexOf(']'));
	}

	final ComboBox<String> comboBox = new ComboBox<>("Select year", Collections.unmodifiableList(
			Arrays.asList("2018/19","2017/18", "2016/17", "2015/16", "2014/15", "2013/14", "2012/13", "2011/12", "2010/11")));
	panelContent.addComponent(comboBox);
	panelContent.setExpandRatio(comboBox, ContentRatio.SMALL2);
	comboBox.setSelectedItem(selectedYear);
	
	comboBox.addValueChangeListener(new DecisionFlowValueChangeListener(NAME,pageId));

	final Map<String, List<ViewRiksdagenCommittee>> committeeMap = getApplicationManager()
			.getDataContainer(ViewRiksdagenCommittee.class).getAll().stream()
			.collect(Collectors.groupingBy(c -> c.getEmbeddedId().getOrgCode().toUpperCase(Locale.ENGLISH)));

	final SankeyChart chart = decisionFlowChartManager.createCommitteeDecisionFlow(viewRiksdagenCommittee,
			committeeMap, comboBox.getSelectedItem().orElse(selectedYear));
	panelContent.addComponent(chart);
	panelContent.setExpandRatio(chart, ContentRatio.LARGE);

	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME,
			parameters, pageId);
	panel.setCaption(new StringBuilder().append(NAME).append("::").append(COMMITTEE_DECISION_FLOW).toString());

	return panelContent;

}
 
Example #26
Source File: CubaComboBoxPickerField.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void setItems(ComboBox.CaptionFilter captionFilter, Collection<T> items) {
    getFieldInternal().setItems(captionFilter, items);
}
 
Example #27
Source File: CubaSearchSelectPickerField.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void setItems(ComboBox.CaptionFilter captionFilter, T... items) {
    getFieldInternal().setItems(captionFilter, items);
}
 
Example #28
Source File: CubaComboBoxPickerField.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void setItems(ComboBox.CaptionFilter captionFilter, T... items) {
    getFieldInternal().setItems(captionFilter, items);
}
 
Example #29
Source File: CubaComboBoxPickerField.java    From cuba with Apache License 2.0 4 votes vote down vote up
public ComboBox.NewItemHandler getNewItemHandler() {
    return getFieldInternal().getNewItemHandler();
}
 
Example #30
Source File: CubaComboBoxPickerField.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void setNewItemHandler(ComboBox.NewItemHandler newItemHandler) {
    getFieldInternal().setNewItemHandler(newItemHandler);
}