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;
}
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(" 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");
}
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;
}
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;
}
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));
}
}
}
Aggregations