use of com.vaadin.ui.ComboBox in project VaadinUtils by rlsutton1.
the class MultiColumnFormLayout method bindComboBox.
public ComboBox bindComboBox(String fieldLabel, String fieldName, Collection<?> options) {
ComboBox field = formHelper.bindComboBox(this, fieldGroup, fieldName, fieldLabel, options);
this.fieldList.add(field);
return field;
}
use of com.vaadin.ui.ComboBox in project VaadinUtils by rlsutton1.
the class MultiColumnFormLayout method bindEntityField.
// public ColorPickerField bindColorPicker(iColorFactory factory, String
// fieldLabel, SingularAttribute<E, iColor> member)
// {
// ColorPickerField field = formHelper.bindColorPickerField(this,
// fieldGroup, factory, fieldLabel, member);
// this.fieldList.add(field);
// return field;
// }
/**
* Deprecated - Use EntityFieldBuilder instead
*
* @param fieldLabel
* @param fieldName
* - name of primary entities member field that holds the foreign
* entity
* @param listClazz
* - Class of the foreign entity
* @param listFieldName
* - name of the field to display in the combo box from the
* foreign entity
* @return
*/
@Deprecated
public <L extends CrudEntity> ComboBox bindEntityField(String fieldLabel, String fieldName, Class<L> listClazz, String 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 MultiColumnFormLayout method bindEnumField.
public ComboBox bindEnumField(String fieldLabel, String fieldName, Class<?> clazz) {
ComboBox field = formHelper.bindEnumField(this, fieldGroup, fieldLabel, fieldName, clazz);
this.fieldList.add(field);
return field;
}
use of com.vaadin.ui.ComboBox in project VaadinUtils by rlsutton1.
the class EmailTargetLayout method insertTargetLine.
private EmailTargetLine insertTargetLine(final int row, ReportEmailRecipient recip) {
final HorizontalLayout recipientHolder = new HorizontalLayout();
recipientHolder.setSizeFull();
recipientHolder.setSpacing(true);
recipientHolder.setHeight("30");
final List<ReportEmailRecipientVisibility> targetTypes = new LinkedList<ReportEmailRecipientVisibility>();
for (ReportEmailRecipientVisibility rerv : ReportEmailRecipientVisibility.values()) {
targetTypes.add(rerv);
}
final EmailTargetLine line = new EmailTargetLine();
line.row = row;
line.targetTypeCombo = new ComboBox(null, targetTypes);
line.targetTypeCombo.setWidth("80");
line.targetTypeCombo.select(targetTypes.get(0));
line.targetAddress = new ComboBox(null);
line.targetAddress.setImmediate(true);
line.targetAddress.setTextInputAllowed(true);
line.targetAddress.setInputPrompt("Enter Contact Name or email address");
line.targetAddress.setWidth("100%");
line.targetAddress.addValidator(new EmailValidator("Please enter a valid email address."));
getValidEmailContacts(line.targetAddress);
line.targetAddress.setItemCaptionPropertyId("namedemail");
line.targetAddress.setNewItemsAllowed(true);
if (recip != null && recip.getEmail() != null) {
line.targetAddress.setValue(recip.getEmail());
line.targetTypeCombo.setValue(recip.getVisibility());
}
line.targetAddress.setNewItemHandler(new NewItemHandler() {
private static final long serialVersionUID = 1L;
@Override
public void addNewItem(final String newItemCaption) {
final IndexedContainer container = (IndexedContainer) line.targetAddress.getContainerDataSource();
final Item item = addItem(container, "", newItemCaption);
if (item != null) {
line.targetAddress.addItem(item.getItemProperty("id").getValue());
line.targetAddress.setValue(item.getItemProperty("id").getValue());
}
setHeight(calculateHeight());
}
});
if (recip != null) {
}
if (row == 0) {
line.actionButton = new Button("+");
line.actionButton.setDescription("Click to add another email address line.");
line.actionButton.setStyleName(Reindeer.BUTTON_SMALL);
line.actionButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 6505218353927273720L;
@Override
public void buttonClick(ClickEvent event) {
lines.add(insertTargetLine(lines.size(), null));
setHeight(calculateHeight());
}
});
} else {
line.actionButton = new Button("-");
line.actionButton.setDescription("Click to remove this email address line.");
line.actionButton.setStyleName(Reindeer.BUTTON_SMALL);
line.actionButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 3104323607502279386L;
@Override
public void buttonClick(ClickEvent event) {
removeComponent(recipientHolder);
lines.remove(line);
setHeight(calculateHeight());
}
});
}
recipientHolder.addComponent(line.targetTypeCombo);
recipientHolder.addComponent(line.targetAddress);
recipientHolder.addComponent(line.actionButton);
recipientHolder.setExpandRatio(line.targetAddress, 1);
addComponent(recipientHolder);
return line;
}
use of com.vaadin.ui.ComboBox in project cia by Hack23.
the class ParliamentDecisionFlowPageModContentFactoryImpl method createContent.
@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 = "2017/18";
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)));
ComboBox<String> comboBox = new ComboBox<>("Select year", Collections.unmodifiableList(Arrays.asList("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(event -> {
if (!event.getSource().isEmpty()) {
UI.getCurrent().getNavigator().navigateTo(NAME + "/" + PageMode.CHARTS.toString() + "/" + ChartIndicators.DECISION_FLOW_CHART.toString() + "[" + event.getValue() + "]");
}
});
SankeyChart chart = decisionFlowChartManager.createAllDecisionFlow(committeeMap, comboBox.getSelectedItem().orElse(selectedYear));
panelContent.addComponent(chart);
panelContent.setExpandRatio(chart, ContentRatio.LARGE);
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;
}
Aggregations