Search in sources :

Example 36 with ComboBox

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;
}
Also used : ComboBox(com.vaadin.ui.ComboBox)

Example 37 with ComboBox

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;
}
Also used : ComboBox(com.vaadin.ui.ComboBox)

Example 38 with ComboBox

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;
}
Also used : ComboBox(com.vaadin.ui.ComboBox)

Example 39 with ComboBox

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;
}
Also used : EmailValidator(au.com.vaadinutils.validator.EmailValidator) ComboBox(com.vaadin.ui.ComboBox) IndexedContainer(com.vaadin.data.util.IndexedContainer) ClickEvent(com.vaadin.ui.Button.ClickEvent) NewItemHandler(com.vaadin.ui.AbstractSelect.NewItemHandler) LinkedList(java.util.LinkedList) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Item(com.vaadin.data.Item) Button(com.vaadin.ui.Button) ClickListener(com.vaadin.ui.Button.ClickListener) ReportEmailRecipientVisibility(au.com.vaadinutils.jasper.scheduler.entities.ReportEmailRecipientVisibility)

Example 40 with ComboBox

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;
}
Also used : PageMode(com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode) Panel(com.vaadin.ui.Panel) Arrays(java.util.Arrays) ApplicationEventGroup(com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) Secured(org.springframework.security.access.annotation.Secured) SankeyChart(com.hack23.cia.web.widgets.charts.SankeyChart) ViewAction(com.hack23.cia.web.impl.ui.application.action.ViewAction) Locale(java.util.Locale) Map(java.util.Map) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) ContentRatio(com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio) MenuBar(com.vaadin.ui.MenuBar) Collectors(java.util.stream.Collectors) DecisionFlowChartManager(com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.DecisionFlowChartManager) DataContainer(com.hack23.cia.service.api.DataContainer) List(java.util.List) Component(org.springframework.stereotype.Component) ChartIndicators(com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators) Layout(com.vaadin.ui.Layout) Collections(java.util.Collections) SankeyChart(com.hack23.cia.web.widgets.charts.SankeyChart) ComboBox(com.vaadin.ui.ComboBox) VerticalLayout(com.vaadin.ui.VerticalLayout) List(java.util.List) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

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