Example usage for com.vaadin.ui Grid getColumn

List of usage examples for com.vaadin.ui Grid getColumn

Introduction

In this page you can find the example usage for com.vaadin.ui Grid getColumn.

Prototype

public Column<T, ?> getColumn(String columnId) 

Source Link

Document

Gets a Column of this grid by its identifying string.

Usage

From source file:facs.components.BookAdmin.java

License:Open Source License

private void setRenderers(Grid grid) {
    grid.getColumn("price").setRenderer(new NumberRenderer("%1$.2f "));

    grid.getColumn("start")
            .setRenderer(new DateRenderer("%1$tB %1$te %1$tY, %1$tH:%1$tM:%1$tS", Locale.GERMAN));

    grid.getColumn("end").setRenderer(new DateRenderer("%1$tB %1$te %1$tY, %1$tH:%1$tM:%1$tS", Locale.GERMAN));
}

From source file:facs.components.Statistics.java

License:Open Source License

private void setRenderers(Grid grid) {
    grid.getColumn(costCaption).setRenderer(new NumberRenderer("%1$.2f "));

    grid.getColumn(startCaption)//  w  w w. j a v a  2  s.  co m
            .setRenderer(new DateRenderer("%1$tB %1$te %1$tY, %1$tH:%1$tM:%1$tS", Locale.GERMAN));

    grid.getColumn(endCaption)
            .setRenderer(new DateRenderer("%1$tB %1$te %1$tY, %1$tH:%1$tM:%1$tS", Locale.GERMAN));

}

From source file:fi.semantum.strategia.Updates.java

License:Open Source License

private static void updateQueryGrid(final Main main, final FilterState state) {

    main.gridPanelLayout.removeAllComponents();
    main.gridPanelLayout.setMargin(false);

    final List<String> keys = state.reportColumns;
    if (keys.isEmpty()) {
        Label l = new Label("Kysely ei tuottanut yhtn tulosta.");
        l.addStyleName(ValoTheme.LABEL_BOLD);
        l.addStyleName(ValoTheme.LABEL_HUGE);
        main.gridPanelLayout.addComponent(l);
        return;//from   ww w .j  a va2 s.com
    }

    final IndexedContainer container = new IndexedContainer();

    for (String key : keys) {
        container.addContainerProperty(key, String.class, "");
    }

    rows: for (Map<String, ReportCell> map : state.report) {
        Object item = container.addItem();
        for (String key : keys)
            if (map.get(key) == null)
                continue rows;

        for (Map.Entry<String, ReportCell> entry : map.entrySet()) {
            @SuppressWarnings("unchecked")
            com.vaadin.data.Property<String> p = container.getContainerProperty(item, entry.getKey());
            p.setValue(entry.getValue().get());
        }

    }

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");

    final TextField filter = new TextField();
    filter.addStyleName(ValoTheme.TEXTFIELD_TINY);
    filter.setInputPrompt("rajaa hakutuloksia - kirjoitetun sanan tulee lyty rivin teksteist");
    filter.setWidth("100%");

    final Image clipboard = new Image();
    clipboard.setSource(new ThemeResource("page_white_excel.png"));
    clipboard.setHeight("24px");
    clipboard.setWidth("24px");

    hl.addComponent(filter);
    hl.setExpandRatio(filter, 1.0f);
    hl.setComponentAlignment(filter, Alignment.BOTTOM_CENTER);
    hl.addComponent(clipboard);
    hl.setComponentAlignment(clipboard, Alignment.BOTTOM_CENTER);
    hl.setExpandRatio(clipboard, 0.0f);

    main.gridPanelLayout.addComponent(hl);
    main.gridPanelLayout.setExpandRatio(hl, 0f);

    filter.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 3033918399018888150L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            container.removeAllContainerFilters();
            container.addContainerFilter(new QueryFilter(filter.getValue(), true, false));
        }
    });

    AbsoluteLayout abs = new AbsoluteLayout();
    abs.setSizeFull();

    final Grid queryGrid = new Grid(container);
    queryGrid.setSelectionMode(SelectionMode.NONE);
    queryGrid.setHeightMode(HeightMode.CSS);
    queryGrid.setHeight("100%");
    queryGrid.setWidth("100%");

    for (String key : keys) {
        Column col = queryGrid.getColumn(key);
        col.setExpandRatio(1);
    }

    abs.addComponent(queryGrid);

    OnDemandFileDownloader dl = new OnDemandFileDownloader(new OnDemandStreamSource() {

        private static final long serialVersionUID = 981769438054780731L;

        File f;
        Date date = new Date();

        @Override
        public InputStream getStream() {

            String uuid = UUID.randomUUID().toString();
            File printing = new File(Main.baseDirectory(), "printing");
            f = new File(printing, uuid + ".xlsx");

            Workbook w = new XSSFWorkbook();
            Sheet sheet = w.createSheet("Sheet1");
            Row header = sheet.createRow(0);
            for (int i = 0; i < keys.size(); i++) {
                Cell cell = header.createCell(i);
                cell.setCellValue(keys.get(i));
            }

            int row = 1;
            rows: for (Map<String, ReportCell> map : state.report) {
                for (String key : keys)
                    if (map.get(key) == null)
                        continue rows;

                Row r = sheet.createRow(row++);
                int column = 0;
                for (int i = 0; i < keys.size(); i++) {
                    Cell cell = r.createCell(column++);
                    ReportCell rc = map.get(keys.get(i));
                    cell.setCellValue(rc.getLong());
                }

            }

            try {
                FileOutputStream s = new FileOutputStream(f);
                w.write(s);
                s.close();
            } catch (Exception e) {
                e.printStackTrace();
            }

            try {
                return new FileInputStream(f);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }

            throw new IllegalStateException();

        }

        @Override
        public void onRequest() {
            // TODO Auto-generated method stub

        }

        @Override
        public long getFileSize() {
            return f.length();
        }

        @Override
        public String getFileName() {
            return "Strategiakartta_" + Utils.dateString(date) + ".xlsx";
        }

    });

    dl.getResource().setCacheTime(0);
    dl.extend(clipboard);

    main.gridPanelLayout.addComponent(abs);
    main.gridPanelLayout.setExpandRatio(abs, 1f);

}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java

License:Apache License

private Component displayIssueTypes() {
    VerticalLayout vl = new VerticalLayout();
    Grid grid = new Grid(TRANSLATOR.translate(ISSUE_TYPE));
    BeanItemContainer<IssueType> types = new BeanItemContainer<>(IssueType.class);
    types.addAll(new IssueTypeJpaController(DataBaseManager.getEntityManagerFactory()).findIssueTypeEntities());
    grid.setContainerDataSource(types);/*from w w w  .jav a2  s  .c  o m*/
    grid.setSelectionMode(SelectionMode.SINGLE);
    grid.setColumns("typeName", DESC);
    Grid.Column name = grid.getColumn("typeName");
    name.setHeaderCaption(TRANSLATOR.translate("general.name"));
    name.setConverter(new TranslationConverter());
    Grid.Column desc = grid.getColumn(DESC);
    desc.setHeaderCaption(TRANSLATOR.translate("general.description"));
    desc.setConverter(new TranslationConverter());
    grid.setSizeFull();
    vl.addComponent(grid);
    grid.setHeightMode(HeightMode.ROW);
    grid.setHeightByRows(types.size() > 5 ? 5 : types.size());
    //Menu
    HorizontalLayout hl = new HorizontalLayout();
    Button add = new Button(TRANSLATOR.translate("general.create"));
    add.addClickListener(listener -> {
        VMWindow w = new VMWindow();
        w.setContent(new IssueTypeComponent(new IssueType(), true));
        ((VMUI) UI.getCurrent()).addWindow(w);
        w.addCloseListener(l -> {
            ((VMUI) UI.getCurrent()).updateScreen();
        });
    });
    hl.addComponent(add);
    Button delete = new Button(TRANSLATOR.translate("general.delete"));
    delete.setEnabled(false);
    delete.addClickListener(listener -> {
        IssueType selected = (IssueType) ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow();
        if (selected != null && selected.getId() >= 1000) {
            try {
                new IssueTypeJpaController(DataBaseManager.getEntityManagerFactory()).destroy(selected.getId());
                ((VMUI) UI.getCurrent()).updateScreen();
            } catch (IllegalOrphanException | NonexistentEntityException ex) {
                LOG.log(Level.SEVERE, null, ex);
                Notification.show(TRANSLATOR.translate(DELETE_ERROR), TRANSLATOR.translate(DELETE_ERROR),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });
    hl.addComponent(delete);
    vl.addComponent(hl);
    grid.addSelectionListener(event -> { // Java 8
        // Get selection from the selection model
        IssueType selected = (IssueType) ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow();
        //Only delete custom ones.
        delete.setEnabled(selected != null && selected.getId() >= 1000);
    });
    return vl;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java

License:Apache License

private Component displayIssueResolutions() {
    VerticalLayout vl = new VerticalLayout();
    Grid grid = new Grid(TRANSLATOR.translate(ISSUE_RESOLUTION));
    BeanItemContainer<IssueResolution> types = new BeanItemContainer<>(IssueResolution.class);
    types.addAll(new IssueResolutionJpaController(DataBaseManager.getEntityManagerFactory())
            .findIssueResolutionEntities());
    grid.setContainerDataSource(types);//from w  w w  . ja v  a 2s.c  o  m
    grid.setSelectionMode(SelectionMode.SINGLE);
    grid.setColumns(NAME);
    Grid.Column name = grid.getColumn(NAME);
    name.setHeaderCaption(TRANSLATOR.translate("general.name"));
    name.setConverter(new TranslationConverter());
    grid.setSizeFull();
    vl.addComponent(grid);
    grid.setHeightMode(HeightMode.ROW);
    grid.setHeightByRows(types.size() > 5 ? 5 : types.size());
    //Menu
    HorizontalLayout hl = new HorizontalLayout();
    Button add = new Button(TRANSLATOR.translate("general.create"));
    add.addClickListener(listener -> {
        VMWindow w = new VMWindow();
        w.setContent(new IssueResolutionComponent(new IssueResolution(), true));
        ((VMUI) UI.getCurrent()).addWindow(w);
        w.addCloseListener(l -> {
            ((VMUI) UI.getCurrent()).updateScreen();
        });
    });
    hl.addComponent(add);
    Button delete = new Button(TRANSLATOR.translate("general.delete"));
    delete.setEnabled(false);
    delete.addClickListener(listener -> {
        IssueResolution selected = (IssueResolution) ((SingleSelectionModel) grid.getSelectionModel())
                .getSelectedRow();
        if (selected != null && selected.getId() >= 1000) {
            try {
                new IssueResolutionJpaController(DataBaseManager.getEntityManagerFactory())
                        .destroy(selected.getId());
                ((VMUI) UI.getCurrent()).updateScreen();
            } catch (IllegalOrphanException | NonexistentEntityException ex) {
                LOG.log(Level.SEVERE, null, ex);
                Notification.show(TRANSLATOR.translate(DELETE_ERROR), TRANSLATOR.translate(DELETE_ERROR),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });
    hl.addComponent(delete);
    vl.addComponent(hl);
    grid.addSelectionListener(event -> { // Java 8
        // Get selection from the selection model
        IssueResolution selected = (IssueResolution) ((SingleSelectionModel) grid.getSelectionModel())
                .getSelectedRow();
        //Only delete custom ones.
        delete.setEnabled(selected != null && selected.getId() >= 1000);
    });
    return vl;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java

License:Apache License

private Component displayRequirementTypes() {
    VerticalLayout vl = new VerticalLayout();
    Grid grid = new Grid(TRANSLATOR.translate(REQUIREMENT_TYPE));
    BeanItemContainer<RequirementType> types = new BeanItemContainer<>(RequirementType.class);
    types.addAll(new RequirementTypeJpaController(DataBaseManager.getEntityManagerFactory())
            .findRequirementTypeEntities());
    grid.setContainerDataSource(types);/*from   w w  w  .  j  a  va 2s . c  o  m*/
    grid.setSelectionMode(SelectionMode.SINGLE);
    grid.setColumns(NAME, DESC);
    Grid.Column name = grid.getColumn(NAME);
    name.setHeaderCaption(TRANSLATOR.translate("general.name"));
    name.setConverter(new TranslationConverter());
    Grid.Column desc = grid.getColumn(DESC);
    desc.setHeaderCaption(TRANSLATOR.translate("general.description"));
    desc.setConverter(new TranslationConverter());
    grid.setSizeFull();
    vl.addComponent(grid);
    grid.setHeightMode(HeightMode.ROW);
    grid.setHeightByRows(types.size() > 5 ? 5 : types.size());
    //Menu
    HorizontalLayout hl = new HorizontalLayout();
    Button add = new Button(TRANSLATOR.translate("general.create"));
    add.addClickListener(listener -> {
        VMWindow w = new VMWindow();
        w.setContent(new RequirementTypeComponent(new RequirementType(), true));
        ((VMUI) UI.getCurrent()).addWindow(w);
        w.addCloseListener(l -> {
            ((VMUI) UI.getCurrent()).updateScreen();
        });
    });
    hl.addComponent(add);
    Button delete = new Button(TRANSLATOR.translate("general.delete"));
    delete.setEnabled(false);
    delete.addClickListener(listener -> {
        RequirementType selected = (RequirementType) ((SingleSelectionModel) grid.getSelectionModel())
                .getSelectedRow();
        if (selected != null && selected.getId() >= 1000) {
            try {
                new RequirementTypeJpaController(DataBaseManager.getEntityManagerFactory())
                        .destroy(selected.getId());
                ((VMUI) UI.getCurrent()).updateScreen();
            } catch (IllegalOrphanException | NonexistentEntityException ex) {
                LOG.log(Level.SEVERE, null, ex);
                Notification.show(TRANSLATOR.translate(DELETE_ERROR), TRANSLATOR.translate(DELETE_ERROR),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });
    hl.addComponent(delete);
    vl.addComponent(hl);
    grid.addSelectionListener(event -> { // Java 8
        // Get selection from the selection model
        RequirementType selected = (RequirementType) ((SingleSelectionModel) grid.getSelectionModel())
                .getSelectedRow();
        //Only delete custom ones.
        delete.setEnabled(selected != null && selected.getId() >= 1000);
    });
    return vl;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.dashboard.DashboardProvider.java

License:Apache License

@Override
public Component getContent() {
    try {//from   w ww  . j  av a2 s .c  om
        BorderLayout bl = new BorderLayout();
        //Add activity stream
        List<Activity> activities = ActivityServer.getActivities();
        BeanItemContainer<Activity> container = new BeanItemContainer<>(Activity.class, activities);
        GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(container);
        gpc.addGeneratedProperty("avatar", new PropertyValueGenerator<Resource>() {

            @Override
            public Resource getValue(Item item, Object itemId, Object propertyId) {
                VmUser user = ((Activity) itemId).getSourceUser();
                Resource image = new ThemeResource("VMSmall.png");
                AvatarProvider ap = Lookup.getDefault().lookup(AvatarProvider.class);
                Resource icon = ap == null ? null : ap.getAvatar(user, 30);
                if (icon != null) {
                    image = icon;
                }
                return image;
            }

            @Override
            public Class<Resource> getType() {
                return Resource.class;
            }
        });
        Grid grid = new Grid(TRANSLATOR.translate("general.activity.stream"), gpc);
        Column at = grid.getColumn("activityType");
        at.setHeaderCaption(TRANSLATOR.translate("activity.type"));
        at.setConverter(new Converter<String, ActivityType>() {
            int type;

            @Override
            public ActivityType convertToModel(String value, Class<? extends ActivityType> targetType,
                    Locale locale) throws Converter.ConversionException {
                return new ActivityTypeJpaController(DataBaseManager.getEntityManagerFactory())
                        .findActivityType(type);
            }

            @Override
            public String convertToPresentation(ActivityType value, Class<? extends String> targetType,
                    Locale locale) throws Converter.ConversionException {
                type = value.getId();
                return TRANSLATOR.translate(value.getTypeName());
            }

            @Override
            public Class<ActivityType> getModelType() {
                return ActivityType.class;
            }

            @Override
            public Class<String> getPresentationType() {
                return String.class;
            }
        });
        Column type = grid.getColumn("activityType");
        type.setHeaderCaption(TRANSLATOR.translate("general.type"));
        Column desc = grid.getColumn("description");
        desc.setHeaderCaption(TRANSLATOR.translate("general.description"));
        Column user = grid.getColumn("sourceUser");
        user.setHeaderCaption(TRANSLATOR.translate("general.user"));
        user.setConverter(new Converter<String, VmUser>() {
            private int user;

            @Override
            public String convertToPresentation(VmUser value, Class<? extends String> targetType, Locale l)
                    throws Converter.ConversionException {
                try {
                    user = value.getId();
                    return new VMUserServer(user).toString();
                } catch (Exception ex) {
                    Exceptions.printStackTrace(ex);
                }
                return "";
            }

            @Override
            public Class<VmUser> getModelType() {
                return VmUser.class;
            }

            @Override
            public Class<String> getPresentationType() {
                return String.class;
            }

            @Override
            public VmUser convertToModel(String value, Class<? extends VmUser> targetType, Locale locale)
                    throws Converter.ConversionException {
                return new VmUserJpaController(DataBaseManager.getEntityManagerFactory()).findVmUser(user);
            }
        });
        Column avatar = grid.getColumn("avatar");
        avatar.setHeaderCaption("");
        avatar.setRenderer(new ImageRenderer());
        Column time = grid.getColumn("activityTime");
        time.setHeaderCaption(TRANSLATOR.translate("general.time"));
        grid.setColumns("avatar", "sourceUser", "activityType", "description", "activityTime");
        grid.sort("activityTime", SortDirection.DESCENDING);
        bl.addComponent(grid, BorderLayout.Constraint.CENTER);
        bl.setId(getComponentCaption());
        return bl;
    } catch (IllegalArgumentException | IllegalStateException ex) {
        Exceptions.printStackTrace(ex);
    }
    return null;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.notification.NotificationScreenProvider.java

License:Apache License

@Override
public Component getContent() {
    VerticalLayout vs = new VerticalLayout();
    //On top put a list of notifications
    BeanItemContainer<Notification> container = new BeanItemContainer<>(Notification.class);
    ValidationManagerUI.getInstance().getUser().getNotificationList().forEach(n -> {
        container.addBean(n);/*from  w  ww  . j  av a2  s  . c  o  m*/
    });
    //        Unable to use VerticalSplitPanel as I hoped.
    //        See: https://github.com/vaadin/framework/issues/9460
    //        VerticalSplitPanel vs = new VerticalSplitPanel();
    //        vs.setSplitPosition(25, Sizeable.Unit.PERCENTAGE);
    TextArea text = new TextArea(TRANSLATOR.translate("general.text"));
    text.setWordwrap(true);
    text.setReadOnly(true);
    text.setSizeFull();
    Grid grid = new Grid(TRANSLATOR.translate("general.notifications"), container);
    grid.setColumns("notificationType", "author", "creationDate", "archieved");
    if (container.size() > 0) {
        grid.setHeightMode(HeightMode.ROW);
        grid.setHeightByRows(container.size() > 5 ? 5 : container.size());
    }
    GridCellFilter filter = new GridCellFilter(grid);
    filter.setBooleanFilter("archieved",
            new GridCellFilter.BooleanRepresentation(VaadinIcons.CHECK, TRANSLATOR.translate("general.yes")),
            new GridCellFilter.BooleanRepresentation(VaadinIcons.CLOSE, TRANSLATOR.translate("general.no")));
    filter.setDateFilter("creationDate",
            new SimpleDateFormat(VMSettingServer.getSetting("date.format").getStringVal()), true);
    grid.sort("creationDate");
    Column nt = grid.getColumn("notificationType");
    nt.setHeaderCaption(TRANSLATOR.translate("notification.type"));
    nt.setConverter(new Converter<String, NotificationType>() {
        @Override
        public NotificationType convertToModel(String value, Class<? extends NotificationType> targetType,
                Locale locale) throws Converter.ConversionException {
            for (NotificationType n : new NotificationTypeJpaController(
                    DataBaseManager.getEntityManagerFactory()).findNotificationTypeEntities()) {
                if (Lookup.getDefault().lookup(InternationalizationProvider.class).translate(n.getTypeName())
                        .equals(value)) {
                    return n;
                }
            }
            return null;
        }

        @Override
        public String convertToPresentation(NotificationType value, Class<? extends String> targetType,
                Locale locale) throws Converter.ConversionException {
            return Lookup.getDefault().lookup(InternationalizationProvider.class)
                    .translate(value.getTypeName());
        }

        @Override
        public Class<NotificationType> getModelType() {
            return NotificationType.class;
        }

        @Override
        public Class<String> getPresentationType() {
            return String.class;
        }
    });
    Column author = grid.getColumn("author");
    author.setConverter(new UserToStringConverter());
    author.setHeaderCaption(TRANSLATOR.translate("notification.author"));
    Column creation = grid.getColumn("creationDate");
    creation.setHeaderCaption(TRANSLATOR.translate("creation.time"));
    Column archive = grid.getColumn("archieved");
    archive.setHeaderCaption(TRANSLATOR.translate("general.archived"));
    archive.setConverter(new Converter<String, Boolean>() {
        @Override
        public Boolean convertToModel(String value, Class<? extends Boolean> targetType, Locale locale)
                throws Converter.ConversionException {
            return value.equals(TRANSLATOR.translate("general.yes"));
        }

        @Override
        public String convertToPresentation(Boolean value, Class<? extends String> targetType, Locale locale)
                throws Converter.ConversionException {
            return value ? TRANSLATOR.translate("general.yes") : TRANSLATOR.translate("general.no");
        }

        @Override
        public Class<Boolean> getModelType() {
            return Boolean.class;
        }

        @Override
        public Class<String> getPresentationType() {
            return String.class;
        }
    });
    grid.setSelectionMode(SelectionMode.SINGLE);
    grid.setSizeFull();
    ContextMenu menu = new ContextMenu(grid, true);
    menu.addItem(TRANSLATOR.translate("notification.mark.unread"), (MenuItem selectedItem) -> {
        Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow();
        if (selected != null) {
            NotificationServer ns = new NotificationServer((Notification) selected);
            ns.setAcknowledgeDate(null);
            try {
                ns.write2DB();
                ((VMUI) UI.getCurrent()).updateScreen();
                ((VMUI) UI.getCurrent()).showTab(getComponentCaption());
            } catch (VMException ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        }
    });
    menu.addItem(TRANSLATOR.translate("notification.archive"), (MenuItem selectedItem) -> {
        Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow();
        if (selected != null) {
            NotificationServer ns = new NotificationServer((Notification) selected);
            ns.setArchieved(true);
            try {
                ns.write2DB();
                ((VMUI) UI.getCurrent()).updateScreen();
                ((VMUI) UI.getCurrent()).showTab(getComponentCaption());
            } catch (VMException ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        }
    });
    grid.addSelectionListener(selectionEvent -> {
        // Get selection from the selection model
        Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow();
        if (selected != null) {
            text.setReadOnly(false);
            Notification n = (Notification) selected;
            text.setValue(n.getContent());
            text.setReadOnly(true);
            if (n.getAcknowledgeDate() != null) {
                try {
                    //Mark as read
                    NotificationServer ns = new NotificationServer((Notification) n);
                    ns.setAcknowledgeDate(new Date());
                    ns.write2DB();
                } catch (VMException ex) {
                    LOG.log(Level.SEVERE, null, ex);
                }
            }
        }
    });
    vs.addComponent(grid);
    vs.addComponent(text);
    vs.setSizeFull();
    vs.setId(getComponentCaption());
    return vs;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java

License:Apache License

@Override
public Component createStepHistoryTable(String title, List<History> historyItems, boolean showVersionFields) {
    Grid grid = new HistoryTable(title, historyItems, null, showVersionFields, "text", "expectedResult",
            "notes");
    Grid.Column text = grid.getColumn("text");
    text.setHeaderCaption(TRANSLATOR.translate("step.text"));
    Grid.Column result = grid.getColumn("expectedResult");
    result.setHeaderCaption(TRANSLATOR.translate("expected.result"));
    Grid.Column notes = grid.getColumn("notes");
    notes.setHeaderCaption(TRANSLATOR.translate("general.notes"));
    return grid;/*from w w  w . j a  v  a  2s.c  o  m*/
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java

License:Apache License

@Override
public Component createRequirementHistoryTable(String title, List<History> historyItems,
        boolean showVersionFields) {
    Grid grid = new HistoryTable(title, historyItems, "uniqueId", showVersionFields, "uniqueId", "description",
            "notes");
    Grid.Column uniqueId = grid.getColumn("uniqueId");
    uniqueId.setHeaderCaption(TRANSLATOR.translate("unique.id"));
    Grid.Column description = grid.getColumn("description");
    description.setHeaderCaption(TRANSLATOR.translate("general.description"));
    Grid.Column notes = grid.getColumn("notes");
    notes.setHeaderCaption(TRANSLATOR.translate("general.notes"));
    return grid;//from  ww w.j  a v a  2 s  .co m
}