Example usage for com.vaadin.ui.themes ValoTheme TEXTFIELD_SMALL

List of usage examples for com.vaadin.ui.themes ValoTheme TEXTFIELD_SMALL

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme TEXTFIELD_SMALL.

Prototype

String TEXTFIELD_SMALL

To view the source code for com.vaadin.ui.themes ValoTheme TEXTFIELD_SMALL.

Click Source Link

Document

Small size text field.

Usage

From source file:annis.gui.controlpanel.CorpusListPanel.java

License:Apache License

public CorpusListPanel(InstanceConfig instanceConfig, ExampleQueriesPanel autoGenQueries, final AnnisUI ui) {
    this.instanceConfig = instanceConfig;
    this.autoGenQueries = autoGenQueries;
    this.ui = ui;

    final CorpusListPanel finalThis = this;

    setSizeFull();//from w w  w. j  av  a 2  s . c o  m

    selectionLayout = new HorizontalLayout();
    selectionLayout.setWidth("100%");
    selectionLayout.setHeight("-1px");
    selectionLayout.setVisible(false);

    Label lblVisible = new Label("Visible: ");
    lblVisible.setSizeUndefined();
    selectionLayout.addComponent(lblVisible);

    cbSelection = new ComboBox();
    cbSelection.setDescription("Choose corpus selection set");
    cbSelection.setWidth("100%");
    cbSelection.setHeight("-1px");
    cbSelection.addStyleName(ValoTheme.COMBOBOX_SMALL);
    cbSelection.setInputPrompt("Add new corpus selection set");
    cbSelection.setNullSelectionAllowed(false);
    cbSelection.setNewItemsAllowed(true);
    cbSelection.setNewItemHandler((AbstractSelect.NewItemHandler) this);
    cbSelection.setImmediate(true);
    cbSelection.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {

            updateCorpusTable();
            updateAutoGeneratedQueriesPanel();

        }
    });

    selectionLayout.addComponent(cbSelection);
    selectionLayout.setExpandRatio(cbSelection, 1.0f);
    selectionLayout.setSpacing(true);
    selectionLayout.setComponentAlignment(cbSelection, Alignment.MIDDLE_RIGHT);
    selectionLayout.setComponentAlignment(lblVisible, Alignment.MIDDLE_LEFT);

    addComponent(selectionLayout);

    txtFilter = new TextField();
    txtFilter.setVisible(false);
    txtFilter.setInputPrompt("Filter");
    txtFilter.setImmediate(true);
    txtFilter.setTextChangeTimeout(500);
    txtFilter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(FieldEvents.TextChangeEvent event) {
            BeanContainer<String, AnnisCorpus> availableCorpora = ui.getQueryState().getAvailableCorpora();

            if (textFilter != null) {
                // remove the old filter
                availableCorpora.removeContainerFilter(textFilter);
                textFilter = null;
            }

            if (event.getText() != null && !event.getText().isEmpty()) {
                Set<String> selectedIDs = ui.getQueryState().getSelectedCorpora().getValue();

                textFilter = new SimpleStringFilter("name", event.getText(), true, false);
                availableCorpora.addContainerFilter(textFilter);
                // select the first item
                List<String> filteredIDs = availableCorpora.getItemIds();

                Set<String> selectedAndFiltered = new HashSet<>(selectedIDs);
                selectedAndFiltered.retainAll(filteredIDs);

                Set<String> selectedAndOutsideFilter = new HashSet<>(selectedIDs);
                selectedAndOutsideFilter.removeAll(filteredIDs);

                for (String id : selectedAndOutsideFilter) {
                    tblCorpora.unselect(id);
                }

                if (selectedAndFiltered.isEmpty() && !filteredIDs.isEmpty()) {
                    for (String id : selectedIDs) {
                        tblCorpora.unselect(id);
                    }
                    tblCorpora.select(filteredIDs.get(0));
                }
            }
        }
    });
    txtFilter.setWidth("100%");
    txtFilter.setHeight("-1px");
    txtFilter.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    addComponent(txtFilter);

    pbLoadCorpora = new ProgressBar();
    pbLoadCorpora.setCaption("Loading corpus list...");
    pbLoadCorpora.setIndeterminate(true);
    addComponent(pbLoadCorpora);

    tblCorpora = new Table();

    addComponent(tblCorpora);

    tblCorpora.setVisible(false); // don't show list before it was not loaded
    tblCorpora.setContainerDataSource(ui.getQueryState().getAvailableCorpora());
    tblCorpora.setMultiSelect(true);
    tblCorpora.setPropertyDataSource(ui.getQueryState().getSelectedCorpora());

    tblCorpora.addGeneratedColumn("info", new InfoGenerator());
    tblCorpora.addGeneratedColumn("docs", new DocLinkGenerator());

    tblCorpora.setVisibleColumns("name", "textCount", "tokenCount", "info", "docs");
    tblCorpora.setColumnHeaders("Name", "Texts", "Tokens", "", "");
    tblCorpora.setHeight("100%");
    tblCorpora.setWidth("100%");
    tblCorpora.setSelectable(true);
    tblCorpora.setNullSelectionAllowed(false);
    tblCorpora.setColumnExpandRatio("name", 0.6f);
    tblCorpora.setColumnExpandRatio("textCount", 0.15f);
    tblCorpora.setColumnExpandRatio("tokenCount", 0.25f);
    tblCorpora.addStyleName(ValoTheme.TABLE_SMALL);

    tblCorpora.addActionHandler((Action.Handler) this);
    tblCorpora.setImmediate(true);
    tblCorpora.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            Set selections = (Set) tblCorpora.getValue();
            if (selections.size() == 1 && event.isCtrlKey() && tblCorpora.isSelected(event.getItemId())) {
                tblCorpora.setValue(null);
            }
        }
    });
    tblCorpora.setItemDescriptionGenerator(new TooltipGenerator());
    tblCorpora.addValueChangeListener(new CorpusTableChangedListener(finalThis));

    Button btReload = new Button();
    btReload.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            updateCorpusSetList(false, false);
            Notification.show("Reloaded corpus list", Notification.Type.HUMANIZED_MESSAGE);
        }
    });
    btReload.setIcon(FontAwesome.REFRESH);
    btReload.setDescription("Reload corpus list");
    btReload.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

    selectionLayout.addComponent(btReload);
    selectionLayout.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT);

    tblCorpora.setSortContainerPropertyId("name");

    setExpandRatio(tblCorpora, 1.0f);

    updateCorpusSetList(true, true);

}

From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.GanttTreeTable.java

License:Open Source License

public GanttTreeTable(final GanttExt gantt) {
    super();/*from w  w  w . j a va2  s .  c  o  m*/
    this.gantt = gantt;
    this.setWidth("800px");
    this.setBuffered(true);
    beanContainer = gantt.getBeanContainer();
    this.setContainerDataSource(beanContainer);
    this.setVisibleColumns("ganttIndex", "name", "startDate", "endDate", "duration", "percentageComplete",
            "predecessors", "assignUser");
    this.setColumnHeader("ganttIndex", "");
    this.setColumnWidth("ganttIndex", 25);
    this.setColumnHeader("name", "Task");
    this.setColumnExpandRatio("name", 1.0f);
    this.setHierarchyColumn("name");
    this.setColumnHeader("startDate", "Start");
    this.setColumnWidth("startDate", 90);
    this.setColumnHeader("endDate", "End");
    this.setColumnWidth("endDate", 90);
    this.setColumnHeader("duration", "Duration");
    this.setColumnWidth("duration", 65);
    this.setColumnHeader("predecessors", "Predecessors");
    this.setColumnWidth("predecessors", 100);
    this.setColumnHeader("percentageComplete", "% Complete");
    this.setColumnWidth("percentageComplete", 75);
    this.setColumnHeader("assignUser", "Assignee");
    this.setColumnWidth("assignUser", 80);
    this.setColumnCollapsingAllowed(true);
    this.setColumnCollapsed("assignUser", true);
    this.setEditable(true);
    this.setNullSelectionAllowed(false);

    this.addGeneratedColumn("ganttIndex", new ColumnGenerator() {
        @Override
        public Object generateCell(Table table, Object itemId, Object columnId) {
            GanttItemWrapper item = (GanttItemWrapper) itemId;
            return new ELabel("" + item.getGanttIndex()).withStyleName(ValoTheme.LABEL_SMALL);
        }
    });

    this.setTableFieldFactory(new TableFieldFactory() {
        @Override
        public Field<?> createField(Container container, Object itemId, final Object propertyId,
                Component uiContext) {
            Field field = null;
            final GanttItemWrapper ganttItem = (GanttItemWrapper) itemId;
            if ("name".equals(propertyId)) {
                field = new AssignmentNameCellField(ganttItem.getType());
            } else if ("percentageComplete".equals(propertyId)) {
                field = new TextField();
                ((TextField) field).setNullRepresentation("0");
                ((TextField) field).setImmediate(true);
                field.addStyleName(ValoTheme.TEXTFIELD_SMALL);
                if (ganttItem.hasSubTasks() || ganttItem.isMilestone()) {
                    field.setEnabled(false);
                    ((TextField) field).setDescription("Because this row has sub-tasks, this cell "
                            + "is a summary value and can not be edited directly. You can edit cells "
                            + "beneath this row to change its value");
                }
            } else if ("startDate".equals(propertyId) || "endDate".equals(propertyId)) {
                field = new DateField();
                field.addStyleName(ValoTheme.DATEFIELD_SMALL);
                ((DateField) field).setConverter(new LocalDateConverter());
                ((DateField) field).setImmediate(true);
                if (ganttItem.hasSubTasks()) {
                    field.setEnabled(false);
                    ((DateField) field).setDescription("Because this row has sub-tasks, this cell "
                            + "is a summary value and can not be edited directly. You can edit cells "
                            + "beneath this row to change its value");
                }
            } else if ("assignUser".equals(propertyId)) {
                field = new ProjectMemberSelectionField();
            } else if ("predecessors".equals(propertyId)) {
                field = new DefaultViewField("");
                ((DefaultViewField) field).setConverter(new PredecessorConverter());
                return field;
            } else if ("duration".equals(propertyId)) {
                field = new TextField();
                ((TextField) field).setConverter(new HumanTimeConverter());
                field.addStyleName(ValoTheme.TEXTFIELD_SMALL);
                if (ganttItem.hasSubTasks()) {
                    field.setEnabled(false);
                    ((TextField) field).setDescription("Because this row has sub-tasks, this cell "
                            + "is a summary value and can not be edited directly. You can edit cells "
                            + "beneath this row to change its value");
                }
            }

            if (field != null) {
                field.setBuffered(true);
                field.setWidth("100%");
                if (ganttItem.isMilestone()) {
                    if (!CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
                        field.setEnabled(false);
                        ((AbstractComponent) field).setDescription(
                                AppContext.getMessage(GenericI18Enum.NOTIFICATION_NO_PERMISSION_DO_TASK));
                    }
                } else if (ganttItem.isTask()) {
                    if (!CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
                        field.setEnabled(false);
                        ((AbstractComponent) field).setDescription(
                                AppContext.getMessage(GenericI18Enum.NOTIFICATION_NO_PERMISSION_DO_TASK));
                    }
                } else if (ganttItem.isBug()) {
                    if (!CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
                        field.setEnabled(false);
                        ((AbstractComponent) field).setDescription(
                                AppContext.getMessage(GenericI18Enum.NOTIFICATION_NO_PERMISSION_DO_TASK));
                    }
                } else {
                    throw new MyCollabException(
                            "Do not support gantt item type " + ganttItem.getTask().getType());
                }

                if (field instanceof FieldEvents.BlurNotifier) {
                    ((FieldEvents.BlurNotifier) field).addBlurListener(new FieldEvents.BlurListener() {
                        @Override
                        public void blur(FieldEvents.BlurEvent event) {
                            Object o = event.getSource();
                            if (o instanceof Field) {
                                Field f = (Field) o;
                                if (f.isModified()) {
                                    f.commit();
                                    EventBusFactory.getInstance().post(new GanttEvent.AddGanttItemUpdateToQueue(
                                            GanttTreeTable.this, ganttItem));
                                    GanttTreeTable.this.refreshRowCache();
                                }
                            }
                        }
                    });
                }
            }
            return field;
        }
    });

    this.addExpandListener(new Tree.ExpandListener() {
        @Override
        public void nodeExpand(Tree.ExpandEvent expandEvent) {
            GanttItemWrapper item = (GanttItemWrapper) expandEvent.getItemId();
            List<GanttItemWrapper> subTasks = item.subTasks();
            insertSubSteps(item, subTasks);
        }
    });

    this.addCollapseListener(new Tree.CollapseListener() {
        @Override
        public void nodeCollapse(Tree.CollapseEvent collapseEvent) {
            GanttItemWrapper item = (GanttItemWrapper) collapseEvent.getItemId();
            List<GanttItemWrapper> subTasks = item.subTasks();
            removeSubSteps(item, subTasks);
        }
    });

    this.setCellStyleGenerator(new CellStyleGenerator() {
        @Override
        public String getStyle(Table source, Object itemId, Object propertyId) {
            GanttItemWrapper item = (GanttItemWrapper) itemId;
            if (item.isMilestone()) {
                return "root";
            } else if (item.isTask()) {
                return "";
            }
            return "";
        }
    });

    final GanttContextMenu contextMenu = new GanttContextMenu();
    contextMenu.setAsContextMenuOf(this);
    contextMenu.setOpenAutomatically(false);

    ContextMenu.ContextMenuOpenedListener.TableListener tableListener = new ContextMenu.ContextMenuOpenedListener.TableListener() {
        public void onContextMenuOpenFromRow(ContextMenu.ContextMenuOpenedOnTableRowEvent event) {
            GanttItemWrapper item = (GanttItemWrapper) event.getItemId();
            contextMenu.displayContextMenu(item);
            contextMenu.open(GanttTreeTable.this);
        }

        public void onContextMenuOpenFromHeader(ContextMenu.ContextMenuOpenedOnTableHeaderEvent event) {
        }

        public void onContextMenuOpenFromFooter(ContextMenu.ContextMenuOpenedOnTableFooterEvent event) {
        }
    };

    contextMenu.addContextMenuTableListener(tableListener);
    gantt.setVerticalScrollDelegateTarget(this);
    this.setPageLength(currentPageLength);
}

From source file:com.etest.view.systemadministration.faculty.FacultyFormWindow.java

FormLayout buildForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setSpacing(true);/* w w  w. jav a 2 s. c o m*/
    form.setMargin(true);

    firstname.setWidth("100%");
    firstname.setIcon(FontAwesome.INFO);
    firstname.setRequired(true);
    firstname.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(firstname);

    middlename.setWidth("100%");
    middlename.setIcon(FontAwesome.INFO);
    middlename.setRequired(true);
    middlename.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(middlename);

    lastname.setWidth("100%");
    lastname.setIcon(FontAwesome.INFO);
    lastname.setRequired(true);
    lastname.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(lastname);

    userType.setCaption("User Type: ");
    userType.setIcon(FontAwesome.USER_MD);
    userType.setRequired(true);
    form.addComponent(userType);

    username.setWidth("100%");
    username.setIcon(FontAwesome.USER);
    username.setRequired(true);
    username.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(username);

    password1.setWidth("100%");
    password1.setIcon(FontAwesome.CODE);
    password1.setRequired(true);
    password1.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(password1);

    password2.setWidth("100%");
    password2.setIcon(FontAwesome.CODE);
    password2.setRequired(true);
    password2.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(password2);

    facultyBtn.setCaption(getButtonCaption());
    facultyBtn.setWidth("100%");
    facultyBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    facultyBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    facultyBtn.addClickListener(buttonClickListener);
    form.addComponent(facultyBtn);

    if (getFacultyId() != 0) {
        Users u = fs.getFacultyInfoById(getFacultyId());
        firstname.setValue(u.getFirstname());
        middlename.setValue(u.getMiddlename());
        lastname.setValue(u.getLastname());
        username.setValue(u.getUsername_());
        userType.setValue(CommonVariableMap.getFacultyUserType(u.getUserType()));
        password1.setValue(u.getPassword_());
        password2.setValue(u.getPassword_());
    }

    return form;
}

From source file:com.etest.view.systemadministration.syllabus.SyllabusFormWindow.java

Component buildSyllabusForms() {
    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);//from  w ww  . jav  a  2 s.  co m

    subjects.setCaption("Subject: ");
    subjects.setWidth("50%");
    subjects.setIcon(FontAwesome.BOOK);
    subjects.addStyleName(ValoTheme.COMBOBOX_SMALL);
    form.addComponent(subjects);

    topicNo.setCaption("Topic No: ");
    topicNo.setWidth("50%");
    topicNo.setIcon(FontAwesome.TAG);
    topicNo.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(topicNo);

    topic.setCaption("Topic: ");
    topic.setWidth("100%");
    topic.setIcon(FontAwesome.TAG);
    topic.setInputPrompt("Enter Topic..");
    topic.setRows(3);
    topic.addStyleName(ValoTheme.TEXTAREA_SMALL);
    form.addComponent(topic);

    estimatedTime.setCaption("Estimated Time: ");
    estimatedTime.setWidth("50%");
    estimatedTime.setIcon(FontAwesome.TAG);
    estimatedTime.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(estimatedTime);

    Button save = new Button("SAVE");
    save.setWidth("50%");
    save.setIcon(FontAwesome.SAVE);
    save.addStyleName(ValoTheme.BUTTON_PRIMARY);
    save.addStyleName(ValoTheme.BUTTON_SMALL);
    save.addClickListener(buttonClickListener);

    Button update = new Button("UPDATE");
    update.setWidth("60%");
    update.setIcon(FontAwesome.PENCIL);
    update.addStyleName(ValoTheme.BUTTON_PRIMARY);
    update.addStyleName(ValoTheme.BUTTON_SMALL);
    update.addClickListener(buttonClickListener);

    Button remove = new Button("REMOVE");
    remove.setWidth("60%");
    remove.setIcon(FontAwesome.TRASH_O);
    remove.addStyleName(ValoTheme.BUTTON_PRIMARY);
    remove.addStyleName(ValoTheme.BUTTON_SMALL);
    remove.addClickListener(buttonClickListener);

    if (getSyllabusId() != 0) {
        s = ss.getSyllabusById(syllabusId);
        subjects.setValue(s.getCurriculumId());
        topicNo.setValue(String.valueOf(s.getTopicNo()));
        estimatedTime.setValue(String.valueOf(s.getEstimatedTime()));
        topic.setValue(s.getTopic());

        if (getButtonCaption().equals("edit")) {
            form.addComponent(update);
        } else {
            form.addComponent(remove);
        }
    } else {
        form.addComponent(save);
    }

    return form;
}

From source file:com.etest.view.tq.TQCoverageUI.java

Component buildTQCoverageForms() {
    FormLayout form = new FormLayout();
    form.setWidth("500px");

    examTitle.setCaption("Exam Title: ");
    examTitle.setWidth("100%");
    examTitle.setIcon(FontAwesome.TAG);// w w w. j  a va2s.com
    examTitle.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    form.addComponent(examTitle);

    subject.setCaption("Subject: ");
    subject.setWidth("100%");
    subject.setIcon(FontAwesome.BOOK);
    subject.addStyleName(ValoTheme.COMBOBOX_SMALL);
    subject.addValueChangeListener((new CurriculumPropertyChangeListener(topic)));
    form.addComponent(subject);

    totalItems.setCaption("No. of Test Items: ");
    totalItems.setWidth("50%");
    totalItems.setValue("0");
    totalItems.setIcon(FontAwesome.TAG);
    totalItems.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    totalItems.addValueChangeListener(fieldValueListener);
    form.addComponent(totalItems);

    Button button = new Button("ADD ROW");
    button.setWidth("50%");
    button.setIcon(FontAwesome.GEAR);
    button.addStyleName(ValoTheme.BUTTON_PRIMARY);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        if (examTitle.getValue() == null || examTitle.getValue().trim().isEmpty()) {
            Notification.show("Select an Exam Title!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (subject.getValue() == null) {
            Notification.show("Select a Subject!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        if (totalItems.getValue() == null || totalItems.getValue().trim().isEmpty()) {
            Notification.show("Enter No. of Test Items!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        grid.addRow(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null, null, null, null, null, null, null, null, null, null, null, null, null, "del");
    });
    form.addComponent(button);

    return form;
}

From source file:com.hris.employee.grid.EmployeeDataGridProperties.java

private void filterDataGrid(IndexedContainer container) {
    // Create a header row to hold column filters
    HeaderRow filterRow = appendHeaderRow();

    // Set up a filter for all columns
    this.getContainerDataSource().getContainerPropertyIds().stream().filter((pid) -> (pid.equals("name")))
            .forEach((pid) -> {/*  www . j  av a2 s. com*/
                HeaderCell cell = filterRow.getCell(pid);

                // Have an input field to use for filter
                TextField filterField = new TextField();
                filterField.setWidth("100%");
                filterField.setIcon(FontAwesome.SEARCH);
                filterField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
                filterField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
                filterField.setInputPrompt("Filter");

                filterField.addTextChangeListener(change -> {
                    container.removeContainerFilters(pid);

                    if (!change.getText().isEmpty()) {
                        container.addContainerFilter(
                                new SimpleStringFilter(pid, change.getText().toUpperCase(), true, false));
                    }
                });
                cell.setComponent(filterField);
            });
}

From source file:com.hybridbpm.ui.component.chart.configuration.ChartConfigureLayout.java

License:Apache License

public ChartConfigureLayout(BeanFieldGroup<DiagrammePreference> preferences) {
    super(preferences);

    setCaption("Configuration");
    setMargin(false);/*ww w.  j a  v a2 s.  c  o m*/
    setSpacing(true);
    refresh.setConverter(new StringToIntegerConverter());
    refresh.setStyleName(ValoTheme.TEXTFIELD_SMALL);
    horizontalLayout.setExpandRatio(verticalLayout, 1f);

    verticalLayout.setSpacing(true);

    firstColumnChoice.setWidth(100, Sizeable.Unit.PERCENTAGE);
    firstColumnChoice.setRequired(true);
    firstColumnChoice.setStyleName(ValoTheme.COMBOBOX_SMALL);

    firstColumnChoice.setFilteringMode(FilteringMode.CONTAINS);
    firstColumnChoice.setNullSelectionAllowed(false);
    firstColumnChoice.setNewItemsAllowed(false);
    firstColumnChoice.setImmediate(true);
    firstColumnChoice.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    firstColumnChoice.setItemCaptionPropertyId("name");

    firstColumnSortOrder.setWidth(100, Unit.PERCENTAGE);
    firstColumnSortOrder.setRequired(false);
    firstColumnSortOrder.setFilteringMode(FilteringMode.CONTAINS);
    firstColumnSortOrder.setNewItemsAllowed(false);
    firstColumnSortOrder.setImmediate(true);
    firstColumnSortOrder.setNullSelectionAllowed(true);
    firstColumnSortOrder.setStyleName(ValoTheme.COMBOBOX_SMALL);

    firstColumnAndSortLayout.addComponent(firstColumnChoice);
    firstColumnAndSortLayout.addComponent(firstColumnSortOrder);
    firstColumnAndSortLayout.setExpandRatio(firstColumnChoice, 0.8f);
    firstColumnAndSortLayout.setExpandRatio(firstColumnSortOrder, 0.2f);
    firstColumnAndSortLayout.setSpacing(true);
    firstColumnAndSortLayout.setSizeFull();
    firstColumnAndSortLayout.setStyleName(ValoTheme.COMBOBOX_SMALL);

    verticalLayout.addComponent(firstColumnAndSortLayout);

    valuesColumnChoice.setWidth(100, Sizeable.Unit.PERCENTAGE);
    valuesColumnChoice.setRequired(true);
    valuesColumnChoice.setFilteringMode(FilteringMode.CONTAINS);
    valuesColumnChoice.setNullSelectionAllowed(false);
    valuesColumnChoice.setNewItemsAllowed(false);
    valuesColumnChoice.setImmediate(true);
    valuesColumnChoice.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    valuesColumnChoice.setItemCaptionPropertyId("name");
    valuesColumnChoice.setStyleName(ValoTheme.COMBOBOX_SMALL);

    valuesColumnSortOrder.setWidth(100, Unit.PERCENTAGE);
    valuesColumnSortOrder.setRequired(false);
    valuesColumnSortOrder.setFilteringMode(FilteringMode.CONTAINS);
    valuesColumnSortOrder.setNewItemsAllowed(false);
    valuesColumnSortOrder.setImmediate(true);
    valuesColumnSortOrder.setNullSelectionAllowed(true);
    valuesColumnSortOrder.setStyleName(ValoTheme.COMBOBOX_SMALL);

    valuesColumnAndSortLayout.addComponent(valuesColumnChoice);
    valuesColumnAndSortLayout.addComponent(valuesColumnSortOrder);

    valuesColumnAndSortLayout.setExpandRatio(valuesColumnChoice, 0.8f);
    valuesColumnAndSortLayout.setExpandRatio(valuesColumnSortOrder, 0.2f);
    valuesColumnAndSortLayout.setSpacing(true);
    valuesColumnAndSortLayout.setSizeFull();

    verticalLayout.addComponent(valuesColumnAndSortLayout);

    addComponent(horizontalLayout);
    horizontalLayout.setSpacing(true);
    horizontalLayout.setSizeFull();

    setComboBoxChoices();
}

From source file:com.hybridbpm.ui.UsersMenu.java

License:Apache License

public UsersMenu() {
    textSearch.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    textSearch.setWidth(100, Unit.PERCENTAGE);
    textSearch.setNullRepresentation("");
    textSearch.setWidth(100, Unit.PERCENTAGE);
    textSearch.setInputPrompt("type to search users");
    textSearch.addTextChangeListener(new FieldEvents.TextChangeListener() {

        @Override//from www.  j  av  a 2 s  .  c  o  m
        public void textChange(FieldEvents.TextChangeEvent event) {
            search(event.getText());
        }
    });

    table.addStyleName(ValoTheme.TABLE_BORDERLESS);
    table.addStyleName(ValoTheme.TABLE_NO_HEADER);
    table.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
    table.addStyleName(ValoTheme.TABLE_SMALL);
    table.addStyleName(ValoTheme.TABLE_COMPACT);
    table.addStyleName(ValoTheme.TABLE_NO_STRIPES);
    table.addContainerProperty("user", User.class, null, "Username", null, Table.Align.LEFT);
    table.addContainerProperty("tasks", Label.class, null, "Tasks", null, Table.Align.LEFT);
    table.setColumnExpandRatio("user", 1f);
    table.setVisibleColumns("user", "tasks");
    table.setSizeFull();
    table.setColumnExpandRatio("user", 1f);
    table.setSelectable(false);
    table.addGeneratedColumn("user", new UserColumnGenerator());

    addComponents(textSearch, table);
    setExpandRatio(table, 1f);
    setHeight(100, Unit.PERCENTAGE);
    setWidth(300, Unit.PIXELS);
    addStyleName("users-list");
    setVisible(false);
}

From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java

License:Open Source License

public ProjectMemberListViewImpl() {
    super();/*from   w ww  . j a  v a2  s . c om*/
    this.setMargin(new MarginInfo(false, true, true, true));
    MHorizontalLayout viewHeader = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth();
    viewHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    headerText = ComponentUtils.headerH2(ProjectTypeConstants.MEMBER,
            UserUIContext.getMessage(ProjectMemberI18nEnum.LIST));
    viewHeader.with(headerText).expand(headerText);

    final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;
        if (sortAsc) {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
            displayMembers();
        } else {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
            displayMembers();
        }
    });
    viewHeader.addComponent(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setMemberFullName(StringSearchField.and(value));
            displayMembers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setMemberFullName(null);
            displayMembers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    viewHeader.addComponent(searchTextField);

    MButton printBtn = new MButton("", clickEvent -> {
        UI.getCurrent().addWindow(new ProjectMemberCustomizeReportOutputWindow(new LazyValueInjector() {
            @Override
            protected Object doEval() {
                return searchCriteria;
            }
        }));
    }).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION)
            .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    viewHeader.addComponent(printBtn);

    MButton createBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES),
            clickEvent -> EventBusFactory.getInstance()
                    .post(new ProjectMemberEvent.GotoInviteMembers(this, null)))
                            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SEND);
    createBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    viewHeader.addComponent(createBtn);

    addComponent(viewHeader);

    contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    addComponent(contentLayout);
}

From source file:com.mycollab.module.project.view.user.MyProjectListComponent.java

License:Open Source License

public MyProjectListComponent() {
    withSpacing(false).withMargin(new MarginInfo(true, false, true, false));
    this.addStyleName("myprojectlist");

    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true))
            .withStyleName(WebThemes.PANEL_HEADER);
    titleLbl = new Label(UserUIContext.getMessage(ProjectCommonI18nEnum.WIDGET_ACTIVE_PROJECTS_TITLE, 0));

    final MButton sortBtn = new MButton("").withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        isSortAsc = !isSortAsc;//from www.  j  a v a 2 s.  co  m
        if (searchCriteria != null) {
            if (isSortAsc) {
                sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
                searchCriteria.setOrderFields(
                        Collections.singletonList(new SearchCriteria.OrderField("name", SearchCriteria.ASC)));
            } else {
                sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
                searchCriteria.setOrderFields(
                        Collections.singletonList(new SearchCriteria.OrderField("name", SearchCriteria.DESC)));
            }
            displayResults();
        }
    });

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria = getAllProjectsSearchCriteria();
            searchCriteria.setProjectName(StringSearchField.and(value));
            displayResults();
        }

        @Override
        public void emptySearch() {
            searchCriteria = getAllProjectsSearchCriteria();
            searchCriteria.setProjectName(null);
            displayResults();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);

    final PopupButton projectsPopup = new PopupButton("");
    projectsPopup.setIcon(FontAwesome.CARET_SQUARE_O_DOWN);
    projectsPopup.addStyleName(WebThemes.BUTTON_ICON_ONLY);

    OptionPopupContent filterBtnLayout = new OptionPopupContent();

    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class);
    int allProjectCount = projectService.getTotalCount(getAllProjectsSearchCriteria());
    Button allProjectsBtn = new Button(
            UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ALL_PROJECTS, allProjectCount),
            clickEvent -> {
                displayAllProjects();
                projectsPopup.setPopupVisible(false);
            });
    filterBtnLayout.addOption(allProjectsBtn);

    int activeProjectsCount = projectService.getTotalCount(getActiveProjectsSearchCriteria());
    Button activeProjectsBtn = new Button(
            UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECTS, activeProjectsCount),
            clickEvent -> {
                displayActiveProjects();
                projectsPopup.setPopupVisible(false);
            });
    filterBtnLayout.addOption(activeProjectsBtn);

    int archiveProjectsCount = projectService.getTotalCount(getArchivedProjectsSearchCriteria());
    Button archiveProjectsBtn = new Button(
            UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECTS, archiveProjectsCount),
            clickEvent -> {
                displayArchiveProjects();
                projectsPopup.setPopupVisible(false);
            });
    filterBtnLayout.addOption(archiveProjectsBtn);
    projectsPopup.setContent(filterBtnLayout);

    header.with(titleLbl, sortBtn, searchTextField, projectsPopup).expand(titleLbl)
            .alignAll(Alignment.MIDDLE_LEFT);

    this.projectList = new ProjectPagedList();
    this.with(header, projectList);
}