Search in sources :

Example 6 with ComboBox

use of com.vaadin.ui.ComboBox in project Activiti by Activiti.

the class MonthFormPropertyRenderer method getPropertyField.

public Field getPropertyField(FormProperty formProperty) {
    ComboBox comboBox = new MonthCombobox(getPropertyLabel(formProperty));
    comboBox.setRequired(formProperty.isRequired());
    comboBox.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
    comboBox.setEnabled(formProperty.isWritable());
    // Fill combobox
    I18nManager i18nManager = ExplorerApp.get().getI18nManager();
    for (int i = 0; i < 12; i++) {
        comboBox.addItem(i);
        comboBox.setItemCaption(i, i18nManager.getMessage(Messages.MONTH_PREFIX + i));
    }
    // Select first
    comboBox.setNullSelectionAllowed(false);
    Calendar cal = Calendar.getInstance();
    comboBox.select(cal.get(Calendar.MONTH));
    return comboBox;
}
Also used : ComboBox(com.vaadin.ui.ComboBox) Calendar(java.util.Calendar) I18nManager(org.activiti.explorer.I18nManager)

Example 7 with ComboBox

use of com.vaadin.ui.ComboBox in project VaadinUtils by rlsutton1.

the class BaseCrudView method buildActionLayout.

private void buildActionLayout() {
    actionLayout = new HorizontalLayout();
    actionLayout.setWidth("100%");
    actionLayout.setMargin(new MarginInfo(false, true, false, false));
    actionLabel = new Label("&nbsp;Action");
    actionLabel.setContentMode(ContentMode.HTML);
    actionLabel.setWidth("50");
    actionGroupLayout.addStyleName("v-component-group");
    actionLayout.addComponent(actionGroupLayout);
    actionGroupLayout.addComponent(actionLabel);
    actionCombo = new ComboBox(null);
    actionCombo.setWidth("160");
    actionCombo.setNullSelectionAllowed(false);
    actionCombo.setTextInputAllowed(false);
    actionGroupLayout.addComponent(actionCombo);
    addCrudActions();
    actionGroupLayout.addComponent(actionApplyButton);
    actionApplyButton.setId("applyButton");
    actionMessage = new Label("", ContentMode.HTML);
    actionGroupLayout.addComponent(actionMessage);
    String newButtonLabel = getNewButtonLabel();
    if (newButtonLabel == null) {
        newButtonLabel = "";
    }
    actionNewButton.setCaption(newButtonLabel);
    actionNewButton.setId("CrudNewButton-" + newButtonLabel.replace(" ", ""));
    actionLayout.addComponent(actionNewButton);
    actionLayout.setComponentAlignment(actionGroupLayout, Alignment.MIDDLE_LEFT);
    actionLayout.setComponentAlignment(actionNewButton, Alignment.MIDDLE_RIGHT);
    actionLayout.setExpandRatio(actionGroupLayout, 1.0f);
    actionLayout.setHeight("35");
}
Also used : MarginInfo(com.vaadin.shared.ui.MarginInfo) ComboBox(com.vaadin.ui.ComboBox) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 8 with ComboBox

use of com.vaadin.ui.ComboBox in project VaadinUtils by rlsutton1.

the class FormHelper method bindComboBox.

public <L> ComboBox bindComboBox(AbstractLayout form, ValidatingFieldGroup<E> fieldGroup, String fieldName, String fieldLabel, Collection<?> options) {
    ComboBox field = new SplitComboBox(fieldLabel, options);
    field.setNewItemsAllowed(false);
    field.setNullSelectionAllowed(false);
    field.setTextInputAllowed(true);
    field.setWidth(STANDARD_COMBO_WIDTH);
    field.setPopupWidth("100%");
    field.setImmediate(true);
    form.addComponent(field);
    addValueChangeListeners(field);
    doBinding(group, fieldName, field);
    return field;
}
Also used : SplitComboBox(au.com.vaadinutils.crud.splitFields.SplitComboBox) LegacySplitComboBox(au.com.vaadinutils.crud.splitFields.legacy.LegacySplitComboBox) ComboBox(com.vaadin.ui.ComboBox) LegacyComboBox(org.vaadin.ui.LegacyComboBox) SplitComboBox(au.com.vaadinutils.crud.splitFields.SplitComboBox) LegacySplitComboBox(au.com.vaadinutils.crud.splitFields.legacy.LegacySplitComboBox)

Example 9 with ComboBox

use of com.vaadin.ui.ComboBox in project VaadinUtils by rlsutton1.

the class MultiColumnFormLayout method bindEntityField.

/**
 * Deprecated - Use EntityFieldBuilder instead
 *
 * @param fieldLabel
 * @param fieldName
 * @param listClazz
 * @param listFieldName
 * @return
 */
@Deprecated
public <L extends CrudEntity> ComboBox bindEntityField(String fieldLabel, SingularAttribute<E, L> fieldName, Class<L> listClazz, SingularAttribute<L, ?> listFieldName) {
    ComboBox field = formHelper.bindEntityField(this, fieldGroup, fieldLabel, fieldName, listClazz, listFieldName);
    this.fieldList.add(field);
    return field;
}
Also used : ComboBox(com.vaadin.ui.ComboBox)

Example 10 with ComboBox

use of com.vaadin.ui.ComboBox in project VaadinUtils by rlsutton1.

the class JasperReportScheduleLayout method dateParamsHandleRowChange.

private void dateParamsHandleRowChange(EntityItem<ReportEmailScheduleEntity> item) {
    paramForm.removeAllComponents();
    paramForm.setSpacing(true);
    paramForm.setSizeFull();
    paramForm.setMargin(true);
    updaters.clear();
    if (item != null) {
        ReportEmailScheduleEntity entity = item.getEntity();
        List<DateParameterOffsetType> offsetTypes = new LinkedList<DateParameterOffsetType>();
        for (DateParameterOffsetType offsetType : DateParameterOffsetType.values()) {
            offsetTypes.add(offsetType);
        }
        for (final ScheduledDateParameter dateParam : entity.getDateParameters()) {
            HorizontalLayout dateLayout = new HorizontalLayout();
            dateLayout.setSizeFull();
            dateLayout.setSpacing(true);
            dateLayout.setHeight("55");
            final ComboBox offsetType = new ComboBox(dateParam.getLabel(), offsetTypes);
            offsetType.setImmediate(true);
            offsetType.setNullSelectionAllowed(false);
            offsetType.setWidth("140");
            final DateField startDateField = new DateField("From", dateParam.getStartDate());
            startDateField.setResolution(Resolution.DAY);
            startDateField.setDateFormat("yyyy/MM/dd");
            // pickers visability doesn't change, it's determined by the
            // parameter type which can't be changed here
            final TimePicker startTimePicker = new TimePicker("");
            startTimePicker.setValues(dateParam.getStartDate());
            startTimePicker.setVisible(dateParam.getType() == DateParameterType.DATE_TIME);
            final DateField endDateField = new DateField("To", dateParam.getEndDate());
            endDateField.setResolution(Resolution.DAY);
            endDateField.setDateFormat("yyyy/MM/dd");
            // pickers visability doesn't change, it's determined by the
            // parameter type which can't be changed here
            final TimePicker endTimePicker = new TimePicker("");
            endTimePicker.setValues(dateParam.getStartDate());
            endTimePicker.setVisible(dateParam.getType() == DateParameterType.DATE_TIME);
            offsetType.addValueChangeListener(new ValueChangeListener() {

                private static final long serialVersionUID = 7081417825842355432L;

                @Override
                public void valueChange(ValueChangeEvent event) {
                    DateParameterOffsetType offsetTypeValue = (DateParameterOffsetType) event.getProperty().getValue();
                    startDateField.setVisible(offsetTypeValue == DateParameterOffsetType.CONSTANT);
                    endDateField.setVisible(offsetTypeValue == DateParameterOffsetType.CONSTANT);
                }
            });
            offsetType.setValue(dateParam.getOffsetType());
            dateLayout.addComponent(offsetType);
            dateLayout.addComponent(startDateField);
            dateLayout.addComponent(startTimePicker);
            dateLayout.addComponent(endDateField);
            dateLayout.addComponent(endTimePicker);
            paramForm.addComponent(dateLayout);
            updaters.add(new EntityParamUpdater(dateParam.getLabel(), offsetType, startDateField, startTimePicker, endDateField, endTimePicker));
        }
    }
}
Also used : TimePicker(au.com.vaadinutils.layout.TimePicker) ComboBox(com.vaadin.ui.ComboBox) ReportEmailScheduleEntity(au.com.vaadinutils.jasper.scheduler.entities.ReportEmailScheduleEntity) DateParameterOffsetType(au.com.vaadinutils.jasper.scheduler.entities.DateParameterOffsetType) LinkedList(java.util.LinkedList) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) DateField(com.vaadin.ui.DateField)

Aggregations

ComboBox (com.vaadin.ui.ComboBox)41 HorizontalLayout (com.vaadin.ui.HorizontalLayout)7 TextField (com.vaadin.ui.TextField)7 Button (com.vaadin.ui.Button)6 SplitComboBox (au.com.vaadinutils.crud.splitFields.SplitComboBox)5 LegacySplitComboBox (au.com.vaadinutils.crud.splitFields.legacy.LegacySplitComboBox)5 Item (com.vaadin.data.Item)5 Label (com.vaadin.ui.Label)5 VerticalLayout (com.vaadin.ui.VerticalLayout)5 Test (org.junit.Test)4 LegacyComboBox (org.vaadin.ui.LegacyComboBox)4 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)3 ClickEvent (com.vaadin.ui.Button.ClickEvent)3 Panel (com.vaadin.ui.Panel)3 UI (com.vaadin.ui.UI)3 LinkkiComboBox (org.linkki.core.ui.components.LinkkiComboBox)3 TimePicker (au.com.vaadinutils.layout.TimePicker)2 ViewRiksdagenCommittee (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee)2 ApplicationEventGroup (com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup)2 DataContainer (com.hack23.cia.service.api.DataContainer)2