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

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

Introduction

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

Prototype

String TABLE_SMALL

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

Click Source Link

Document

Small font size and reduced the white space inside the table cells.

Usage

From source file:org.ikasan.dashboard.ui.topology.component.WiretapTab.java

License:BSD License

public Layout createWiretapLayout() {
    this.wiretapTable = new Table();
    this.wiretapTable.setSizeFull();
    this.wiretapTable.addStyleName(ValoTheme.TABLE_SMALL);
    this.wiretapTable.addStyleName("ikasan");

    this.wiretapTable.addContainerProperty("Module Name", String.class, null);
    this.wiretapTable.addContainerProperty("Flow Name", String.class, null);
    this.wiretapTable.addContainerProperty("Component Name", String.class, null);
    this.wiretapTable.addContainerProperty("Event Id / Payload Id", String.class, null);
    this.wiretapTable.addContainerProperty("Timestamp", String.class, null);
    this.wiretapTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());

    this.wiretapTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override/*from w  w  w .  ja v  a  2  s. co  m*/
        public void itemClick(ItemClickEvent itemClickEvent) {
            WiretapEvent<String> wiretapEvent = (WiretapEvent<String>) itemClickEvent.getItemId();
            WiretapPayloadViewWindow wiretapPayloadViewWindow = new WiretapPayloadViewWindow(wiretapEvent);

            UI.getCurrent().addWindow(wiretapPayloadViewWindow);
        }
    });

    final Button searchButton = new Button("Search");
    searchButton.setStyleName(ValoTheme.BUTTON_SMALL);
    searchButton.addClickListener(new Button.ClickListener() {
        @SuppressWarnings("unchecked")
        public void buttonClick(ClickEvent event) {
            ProgressBarWindow pbWindow = new ProgressBarWindow();

            UI.getCurrent().addWindow(pbWindow);

            wiretapTable.removeAllItems();

            HashSet<String> modulesNames = null;

            if (modules.getItemIds().size() > 0) {
                modulesNames = new HashSet<String>();
                for (Object module : modules.getItemIds()) {
                    modulesNames.add(((Module) module).getName());
                }
            }

            HashSet<String> flowNames = null;

            if (flows.getItemIds().size() > 0) {
                flowNames = new HashSet<String>();
                for (Object flow : flows.getItemIds()) {
                    flowNames.add(((Flow) flow).getName());
                }
            }

            HashSet<String> componentNames = null;

            if (components.getItemIds().size() > 0) {
                componentNames = new HashSet<String>();
                for (Object component : components.getItemIds()) {

                    componentNames.add("before " + ((Component) component).getName());
                    componentNames.add("after " + ((Component) component).getName());
                }
            }

            if (modulesNames == null && flowNames == null && componentNames == null
                    && !((BusinessStream) businessStreamCombo.getValue()).getName().equals("All")) {
                BusinessStream businessStream = ((BusinessStream) businessStreamCombo.getValue());

                modulesNames = new HashSet<String>();

                for (BusinessStreamFlow flow : businessStream.getFlows()) {
                    modulesNames.add(flow.getFlow().getModule().getName());
                }
            }

            String errorCategory = null;

            // TODO Need to take a proper look at the wiretap search interface. We do not need to worry about paging search
            // results with Vaadin.
            PagedSearchResult<WiretapEvent> events = wiretapDao.findWiretapEvents(0, 10000, "timestamp", false,
                    modulesNames, flowNames, componentNames, eventId.getValue(), null, fromDate.getValue(),
                    toDate.getValue(), payloadContent.getValue());

            for (WiretapEvent<String> wiretapEvent : events.getPagedResults()) {
                Date date = new Date(wiretapEvent.getTimestamp());
                SimpleDateFormat format = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
                String timestamp = format.format(date);

                wiretapTable
                        .addItem(
                                new Object[] { wiretapEvent.getModuleName(), wiretapEvent.getFlowName(),
                                        wiretapEvent.getComponentName(),
                                        ((WiretapFlowEvent) wiretapEvent).getEventId(), timestamp },
                                wiretapEvent);
            }

            pbWindow.close();
        }
    });

    Button clearButton = new Button("Clear");
    clearButton.setStyleName(ValoTheme.BUTTON_SMALL);
    clearButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            modules.removeAllItems();
            flows.removeAllItems();
            components.removeAllItems();
        }
    });

    GridLayout layout = new GridLayout(1, 6);
    layout.setMargin(false);
    layout.setHeight(270, Unit.PIXELS);

    GridLayout listSelectLayout = new GridLayout(3, 1);
    listSelectLayout.setSpacing(true);
    listSelectLayout.setSizeFull();

    modules.setIcon(VaadinIcons.ARCHIVE);
    modules.addContainerProperty("Module Name", String.class, null);
    modules.addContainerProperty("", Button.class, null);
    modules.setSizeFull();
    modules.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    modules.setDragMode(TableDragMode.ROW);
    modules.setDropHandler(new DropHandler() {
        @Override
        public void drop(final DragAndDropEvent dropEvent) {
            // criteria verify that this is safe
            logger.info("Trying to drop: " + dropEvent);

            final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable();

            if (t.getItemId() instanceof Module) {
                final Module module = (Module) t.getItemId();
                logger.info("sourceContainer.getText(): " + module.getName());

                Button deleteButton = new Button();
                deleteButton.setIcon(VaadinIcons.TRASH);
                deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

                // Add the delete functionality to each role that is added
                deleteButton.addClickListener(new Button.ClickListener() {
                    public void buttonClick(ClickEvent event) {
                        modules.removeItem(module);
                    }
                });

                modules.addItem(new Object[] { module.getName(), deleteButton }, module);

                for (final Flow flow : module.getFlows()) {
                    deleteButton = new Button();
                    deleteButton.setIcon(VaadinIcons.TRASH);
                    deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                    deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

                    // Add the delete functionality to each role that is added
                    deleteButton.addClickListener(new Button.ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            flows.removeItem(flow);
                        }
                    });

                    flows.addItem(new Object[] { flow.getName(), deleteButton }, flow);

                    for (final Component component : flow.getComponents()) {
                        deleteButton = new Button();
                        deleteButton.setIcon(VaadinIcons.TRASH);
                        deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                        deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

                        // Add the delete functionality to each role that is added
                        deleteButton.addClickListener(new Button.ClickListener() {
                            public void buttonClick(ClickEvent event) {
                                components.removeItem(component);
                            }
                        });

                        components.addItem(new Object[] { component.getName(), deleteButton }, component);
                    }
                }
            }

        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }
    });

    listSelectLayout.addComponent(modules, 0, 0);

    flows.setIcon(VaadinIcons.AUTOMATION);
    flows.addContainerProperty("Flow Name", String.class, null);
    flows.addContainerProperty("", Button.class, null);
    flows.setSizeFull();
    flows.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    flows.setDropHandler(new DropHandler() {
        @Override
        public void drop(final DragAndDropEvent dropEvent) {
            // criteria verify that this is safe
            logger.info("Trying to drop: " + dropEvent);

            final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable();

            if (t.getItemId() instanceof Flow) {
                final Flow flow = (Flow) t.getItemId();
                logger.info("sourceContainer.getText(): " + flow.getName());

                Button deleteButton = new Button();
                deleteButton.setIcon(VaadinIcons.TRASH);
                deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

                // Add the delete functionality to each role that is added
                deleteButton.addClickListener(new Button.ClickListener() {
                    public void buttonClick(ClickEvent event) {
                        flows.removeItem(flow);
                    }
                });

                flows.addItem(new Object[] { flow.getName(), deleteButton }, flow);

                for (final Component component : flow.getComponents()) {
                    deleteButton = new Button();
                    deleteButton.setIcon(VaadinIcons.TRASH);
                    deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                    deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

                    // Add the delete functionality to each role that is added
                    deleteButton.addClickListener(new Button.ClickListener() {
                        public void buttonClick(ClickEvent event) {
                            components.removeItem(component);
                        }
                    });

                    components.addItem(new Object[] { component.getName(), deleteButton }, component);
                }
            }

        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }
    });

    listSelectLayout.addComponent(flows, 1, 0);

    components.setIcon(VaadinIcons.COG);
    components.setSizeFull();
    components.addContainerProperty("Component Name", String.class, null);
    components.addContainerProperty("", Button.class, null);
    components.setCellStyleGenerator(new IkasanCellStyleGenerator());
    components.setSizeFull();
    components.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    components.setDropHandler(new DropHandler() {
        @Override
        public void drop(final DragAndDropEvent dropEvent) {
            // criteria verify that this is safe
            logger.info("Trying to drop: " + dropEvent);

            final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable();

            if (t.getItemId() instanceof Component) {
                final Component component = (Component) t.getItemId();
                logger.info("sourceContainer.getText(): " + component.getName());

                Button deleteButton = new Button();
                deleteButton.setIcon(VaadinIcons.TRASH);
                deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
                deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);

                // Add the delete functionality to each role that is added
                deleteButton.addClickListener(new Button.ClickListener() {
                    public void buttonClick(ClickEvent event) {
                        components.removeItem(component);
                    }
                });

                components.addItem(new Object[] { component.getName(), deleteButton }, component);

            }

        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }
    });
    listSelectLayout.addComponent(this.components, 2, 0);

    GridLayout dateSelectLayout = new GridLayout(2, 2);
    dateSelectLayout.setColumnExpandRatio(0, 0.25f);
    dateSelectLayout.setColumnExpandRatio(1, 0.75f);
    dateSelectLayout.setSizeFull();
    this.fromDate = new PopupDateField("From date");
    this.fromDate.setResolution(Resolution.MINUTE);
    this.fromDate.setValue(this.getMidnightToday());
    dateSelectLayout.addComponent(this.fromDate, 0, 0);
    this.toDate = new PopupDateField("To date");
    this.toDate.setResolution(Resolution.MINUTE);
    this.toDate.setValue(this.getTwentyThreeFixtyNineToday());
    dateSelectLayout.addComponent(this.toDate, 0, 1);

    this.eventId = new TextField("Event Id");
    this.eventId.setWidth("80%");
    this.payloadContent = new TextField("Payload Content");
    this.payloadContent.setWidth("80%");

    this.eventId.setNullSettingAllowed(true);
    this.payloadContent.setNullSettingAllowed(true);

    dateSelectLayout.addComponent(this.eventId, 1, 0);
    dateSelectLayout.addComponent(this.payloadContent, 1, 1);

    final VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    vSplitPanel.setHeight("95%");

    GridLayout searchLayout = new GridLayout(2, 1);
    searchLayout.setSpacing(true);
    searchLayout.addComponent(searchButton, 0, 0);
    searchLayout.addComponent(clearButton, 1, 0);

    final Button hideFilterButton = new Button();
    hideFilterButton.setIcon(VaadinIcons.MINUS);
    hideFilterButton.setCaption("Hide Filter");
    hideFilterButton.setStyleName(ValoTheme.BUTTON_LINK);
    hideFilterButton.addStyleName(ValoTheme.BUTTON_SMALL);

    final Button showFilterButton = new Button();
    showFilterButton.setIcon(VaadinIcons.PLUS);
    showFilterButton.setCaption("Show Filter");
    showFilterButton.addStyleName(ValoTheme.BUTTON_LINK);
    showFilterButton.addStyleName(ValoTheme.BUTTON_SMALL);
    showFilterButton.setVisible(false);

    final HorizontalLayout hListSelectLayout = new HorizontalLayout();
    hListSelectLayout.setHeight(150, Unit.PIXELS);
    hListSelectLayout.setWidth("100%");
    hListSelectLayout.addComponent(listSelectLayout);

    final HorizontalLayout hDateSelectLayout = new HorizontalLayout();
    hDateSelectLayout.setHeight(80, Unit.PIXELS);
    hDateSelectLayout.setWidth("100%");
    hDateSelectLayout.addComponent(dateSelectLayout);

    final HorizontalLayout hSearchLayout = new HorizontalLayout();
    hSearchLayout.setHeight(30, Unit.PIXELS);
    hSearchLayout.setWidth("100%");
    hSearchLayout.addComponent(searchLayout);
    hSearchLayout.setComponentAlignment(searchLayout, Alignment.MIDDLE_CENTER);

    hideFilterButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            hideFilterButton.setVisible(false);
            showFilterButton.setVisible(true);
            splitPosition = vSplitPanel.getSplitPosition();
            splitUnit = vSplitPanel.getSplitPositionUnit();
            vSplitPanel.setSplitPosition(0, Unit.PIXELS);
        }
    });

    showFilterButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            hideFilterButton.setVisible(true);
            showFilterButton.setVisible(false);
            vSplitPanel.setSplitPosition(splitPosition, splitUnit);
        }
    });

    GridLayout filterButtonLayout = new GridLayout(2, 1);
    filterButtonLayout.setHeight(25, Unit.PIXELS);
    filterButtonLayout.addComponent(hideFilterButton, 0, 0);
    filterButtonLayout.addComponent(showFilterButton, 1, 0);

    Label filterHintLabel = new Label();
    filterHintLabel.setCaptionAsHtml(true);
    filterHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " Drag items from the topology tree to the tables below in order to narrow your search.");
    filterHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    filterHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);

    layout.addComponent(filterHintLabel);
    layout.addComponent(hListSelectLayout);
    layout.addComponent(hDateSelectLayout);
    layout.addComponent(hSearchLayout);
    layout.setSizeFull();

    Panel filterPanel = new Panel();
    filterPanel.setHeight(340, Unit.PIXELS);
    filterPanel.setWidth("100%");
    filterPanel.setContent(layout);
    filterPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);

    vSplitPanel.setFirstComponent(filterPanel);

    CssLayout hErrorTable = new CssLayout();
    hErrorTable.setSizeFull();
    hErrorTable.addComponent(this.wiretapTable);

    vSplitPanel.setSecondComponent(hErrorTable);
    vSplitPanel.setSplitPosition(350, Unit.PIXELS);

    GridLayout wrapper = new GridLayout(1, 2);
    wrapper.setRowExpandRatio(0, .01f);
    wrapper.setRowExpandRatio(1, .99f);
    wrapper.setSizeFull();
    wrapper.addComponent(filterButtonLayout);
    wrapper.setComponentAlignment(filterButtonLayout, Alignment.MIDDLE_RIGHT);
    wrapper.addComponent(vSplitPanel);

    return wrapper;
}

From source file:org.ikasan.dashboard.ui.topology.window.WiretapConfigurationWindow.java

License:BSD License

/**
  * Helper method to initialise this object.
  * /*from w w  w  .j  a va 2s  .c o m*/
  * @param message
  */
protected void init() {
    setModal(true);
    setHeight("90%");
    setWidth("90%");

    GridLayout layout = new GridLayout(2, 10);
    layout.setSizeFull();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setColumnExpandRatio(0, .25f);
    layout.setColumnExpandRatio(1, .75f);

    Label wiretapLabel = new Label("Wiretap Configuration");
    wiretapLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(wiretapLabel);

    Label moduleNameLabel = new Label();
    moduleNameLabel.setContentMode(ContentMode.HTML);
    moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:");
    moduleNameLabel.setSizeUndefined();
    layout.addComponent(moduleNameLabel, 0, 1);
    layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT);

    TextField moduleNameTextField = new TextField();
    moduleNameTextField.setRequired(true);
    moduleNameTextField.setValue(this.component.getFlow().getModule().getName());
    moduleNameTextField.setReadOnly(true);
    moduleNameTextField.setWidth("80%");
    layout.addComponent(moduleNameTextField, 1, 1);

    Label flowNameLabel = new Label();
    flowNameLabel.setContentMode(ContentMode.HTML);
    flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:");
    flowNameLabel.setSizeUndefined();
    layout.addComponent(flowNameLabel, 0, 2);
    layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT);

    TextField flowNameTextField = new TextField();
    flowNameTextField.setRequired(true);
    flowNameTextField.setValue(this.component.getFlow().getName());
    flowNameTextField.setReadOnly(true);
    flowNameTextField.setWidth("80%");
    layout.addComponent(flowNameTextField, 1, 2);

    Label componentNameLabel = new Label();
    componentNameLabel.setContentMode(ContentMode.HTML);
    componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:");
    componentNameLabel.setSizeUndefined();
    layout.addComponent(componentNameLabel, 0, 3);
    layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT);

    TextField componentNameTextField = new TextField();
    componentNameTextField.setRequired(true);
    componentNameTextField.setValue(this.component.getName());
    componentNameTextField.setReadOnly(true);
    componentNameTextField.setWidth("80%");
    layout.addComponent(componentNameTextField, 1, 3);

    Label errorCategoryLabel = new Label("Relationship:");
    errorCategoryLabel.setSizeUndefined();
    layout.addComponent(errorCategoryLabel, 0, 4);
    layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT);

    final ComboBox relationshipCombo = new ComboBox();
    //      relationshipCombo.addValidator(new StringLengthValidator(
    //               "An relationship must be selected!", 1, -1, false));
    relationshipCombo.setImmediate(false);
    relationshipCombo.setValidationVisible(false);
    relationshipCombo.setRequired(true);
    relationshipCombo.setRequiredError("A relationship must be selected!");
    relationshipCombo.setHeight("30px");
    relationshipCombo.setNullSelectionAllowed(false);
    layout.addComponent(relationshipCombo, 1, 4);
    relationshipCombo.addItem("before");
    relationshipCombo.setItemCaption("before", "Before");
    relationshipCombo.addItem("after");
    relationshipCombo.setItemCaption("after", "After");

    Label jobTypeLabel = new Label("Job Type:");
    jobTypeLabel.setSizeUndefined();
    layout.addComponent(jobTypeLabel, 0, 5);
    layout.setComponentAlignment(jobTypeLabel, Alignment.MIDDLE_RIGHT);

    final ComboBox jobTopCombo = new ComboBox();
    //      jobTopCombo.addValidator(new StringLengthValidator(
    //               "A job type must be selected!", 1, -1, false));
    jobTopCombo.setImmediate(false);
    jobTopCombo.setValidationVisible(false);
    jobTopCombo.setRequired(true);
    jobTopCombo.setRequiredError("A job type must be selected!");
    jobTopCombo.setHeight("30px");
    jobTopCombo.setNullSelectionAllowed(false);
    layout.addComponent(jobTopCombo, 1, 5);
    jobTopCombo.addItem("loggingJob");
    jobTopCombo.setItemCaption("loggingJob", "Logging Job");
    jobTopCombo.addItem("wiretapJob");
    jobTopCombo.setItemCaption("wiretapJob", "Wiretap Job");

    final Label timeToLiveLabel = new Label("Time to Live:");
    timeToLiveLabel.setSizeUndefined();
    timeToLiveLabel.setVisible(false);
    layout.addComponent(timeToLiveLabel, 0, 6);
    layout.setComponentAlignment(timeToLiveLabel, Alignment.MIDDLE_RIGHT);

    final TextField timeToLiveTextField = new TextField();
    timeToLiveTextField.setRequired(true);
    timeToLiveTextField.setValidationVisible(false);
    jobTopCombo.setRequiredError("A time to live value must be entered!");
    timeToLiveTextField.setVisible(false);
    timeToLiveTextField.setWidth("40%");
    layout.addComponent(timeToLiveTextField, 1, 6);

    jobTopCombo.addValueChangeListener(new ComboBox.ValueChangeListener() {

        /* (non-Javadoc)
         * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent)
         */
        @Override
        public void valueChange(ValueChangeEvent event) {
            String value = (String) event.getProperty().getValue();

            if (value.equals("wiretapJob")) {
                timeToLiveLabel.setVisible(true);
                timeToLiveTextField.setVisible(true);
            } else {
                timeToLiveLabel.setVisible(false);
                timeToLiveTextField.setVisible(false);
            }
        }

    });

    GridLayout buttonLayouts = new GridLayout(3, 1);
    buttonLayouts.setSpacing(true);

    Button saveButton = new Button("Save");
    saveButton.setStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                relationshipCombo.validate();
                jobTopCombo.validate();

                if (timeToLiveTextField.isVisible()) {
                    timeToLiveTextField.validate();
                }
            } catch (InvalidValueException e) {
                relationshipCombo.setValidationVisible(true);
                relationshipCombo.markAsDirty();
                jobTopCombo.setValidationVisible(true);
                jobTopCombo.markAsDirty();

                if (timeToLiveTextField.isVisible()) {
                    timeToLiveTextField.setValidationVisible(true);
                    timeToLiveTextField.markAsDirty();
                }

                Notification.show("There are errors on the wiretap creation form!", Type.ERROR_MESSAGE);
                return;
            }

            createWiretap((String) relationshipCombo.getValue(), (String) jobTopCombo.getValue(),
                    timeToLiveTextField.getValue());
        }
    });

    Button cancelButton = new Button("Cancel");
    cancelButton.setStyleName(ValoTheme.BUTTON_SMALL);
    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    buttonLayouts.addComponent(saveButton);
    buttonLayouts.addComponent(cancelButton);

    layout.addComponent(buttonLayouts, 0, 7, 1, 7);
    layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER);

    Panel paramPanel = new Panel();
    paramPanel.setStyleName("dashboard");
    paramPanel.setWidth("100%");
    paramPanel.setContent(layout);

    triggerTable = new Table();

    Label existingWiretapLabel = new Label("Existing Wiretaps");
    existingWiretapLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(existingWiretapLabel, 0, 8, 1, 8);

    layout.addComponent(triggerTable, 0, 9, 1, 9);
    layout.setComponentAlignment(triggerTable, Alignment.TOP_CENTER);

    this.triggerTable.setWidth("80%");
    this.triggerTable.setHeight(150, Unit.PIXELS);
    this.triggerTable.setCellStyleGenerator(new IkasanCellStyleGenerator());
    this.triggerTable.addStyleName(ValoTheme.TABLE_SMALL);
    this.triggerTable.addStyleName("ikasan");
    this.triggerTable.addContainerProperty("Job Type", String.class, null);
    this.triggerTable.addContainerProperty("Relationship", String.class, null);
    this.triggerTable.addContainerProperty("Trigger Parameters", String.class, null);
    this.triggerTable.addContainerProperty("", Button.class, null);

    refreshTriggerTable();

    GridLayout wrapper = new GridLayout(1, 1);
    wrapper.setMargin(true);
    wrapper.setSizeFull();
    wrapper.addComponent(paramPanel);

    this.setContent(wrapper);
}

From source file:steps.ProjectContextStep.java

License:Open Source License

/**
 * Create a new Context Step for the wizard
 * /*from w w w  .  ja va2 s.c  om*/
 * @param newProjectCode
 */
public ProjectContextStep(ProjectInformationComponent projSelect) {
    main = new VerticalLayout();
    main.setMargin(true);
    main.setSpacing(true);
    main.setSizeUndefined();

    projectInfoComponent = projSelect;
    projectInfoComponent.setImmediate(true);
    projectInfoComponent.setVisible(true);

    projectContext = new CustomVisibilityComponent(new OptionGroup("", contextOptions));
    projectContext.setVisible(false);

    disableContextOptions();

    experimentTable = new Table("Applicable Experiments");
    experimentTable.setColumnHeader("experiment_type", "Experimental Step");
    experimentTable.setColumnHeader("samples", "Samples");
    experimentTable.setColumnHeader("date", "Date");
    experimentTable.setColumnHeader("code", "Code");
    experimentTable.setStyleName(ValoTheme.TABLE_SMALL);
    experimentTable.setPageLength(1);
    experimentTable.setContainerDataSource(new BeanItemContainer<ExperimentBean>(ExperimentBean.class));
    experimentTable.setSelectable(true);
    experimentTable.setVisible(false);

    samples = new Table("Sample Overview");
    samples.setStyleName(ValoTheme.TABLE_SMALL);
    samples.setColumnHeader("code", "Code");
    samples.setColumnHeader("secondary_Name", "Secondary Name");
    samples.setVisible(false);
    samples.setPageLength(1);
    samples.setContainerDataSource(new BeanItemContainer<NewSampleModelBean>(NewSampleModelBean.class));

    grid = new GridLayout(2, 4);
    grid.setSpacing(true);
    grid.setMargin(true);
    grid.addComponent(projectInfoComponent, 0, 0);
    Component context = Styles.questionize(projectContext, "If this experiment's organisms or "
            + "tissue extracts are already registered at QBiC from an earlier experiment, you can chose the second "
            + "option (new tissue extracts from old organism) or the third (new measurements from old tissue extracts). "
            + "You can also create a preliminary sub-project and add samples later or "
            + "download existing sample information by choosing the last option.", "Project Context");
    grid.addComponent(context, 0, 1);
    grid.addComponent(experimentTable, 0, 2);
    grid.addComponent(samples, 1, 1, 1, 2);

    pilotBox = new CheckBox("Pilot Project");

    pilot = new CustomVisibilityComponent(pilotBox);
    pilot.setVisible(false);
    grid.addComponent(Styles.questionize(pilot,
            "Select if the samples you want to add belong to a pilot project. "
                    + "You can derive non-pilot samples from existing pilot experiments, but not the other way around.",
            "Pilot Experiment"), 0, 3);

    main.addComponent(grid);

    initListeners();
}

From source file:views.ProjectView.java

License:Open Source License

public ProjectView(Collection<ProjectInfo> collection, IOpenBisClient openbis, Map<String, Integer> personMap) {
    setSpacing(true);/*from   w w w  .  ja va2s.co m*/
    setMargin(true);

    this.personMap = personMap;

    projectTable = new FilterTable("Projects");
    projectTable.setPageLength(Math.min(15, collection.size()));
    projectTable.setStyleName(ValoTheme.TABLE_SMALL);
    projectTable.addContainerProperty("Sub-Project", String.class, null);
    projectTable.addContainerProperty("Short Title", String.class, null);
    projectTable.setColumnWidth("Name", 300);
    projectTable.addContainerProperty("Project", String.class, null);
    projectTable.addContainerProperty("Principal Investigator", String.class, null);
    projectTable.setSelectable(true);
    addComponent(projectTable);

    projectTable.setFilterDecorator(new ProjectFilterDecorator());
    projectTable.setFilterGenerator(new ProjectFilterGenerator());

    projectTable.setFilterBarVisible(true);

    projectTable.setImmediate(true);

    initProjectInfos(collection);

    projectPersons = new Table("Experiment Collaborators (optional)");
    projectPersons.setStyleName(ValoTheme.TABLE_SMALL);
    projectPersons.addContainerProperty("Name", ComboBox.class, null);
    projectPersons.addContainerProperty("Experiment", String.class, null);
    projectPersons.addContainerProperty("Responsibility", String.class, null);
    projectPersons.setColumnWidth("Responsibility", 150);
    projectPersons.setPageLength(1);
    addComponent(projectPersons);

    submitPersons = new Button("Submit Experiment");
    addComponent(submitPersons);
}

From source file:views.SearchView.java

License:Open Source License

public SearchView() {
    setSpacing(true);//from ww  w  .jav a2 s.  com
    setMargin(true);

    setCaption("Search for entries in the Database");
    HorizontalLayout searchFields = new HorizontalLayout();
    searchFields.setSpacing(true);
    inputPerson = new TextField("Search for Person");
    // searchFields.
    addComponent(inputPerson);
    // searchFields.addComponent(inputAffiliation);
    searchPerson = new Button("Search");
    // addComponent(searchFields);
    addComponent(searchPerson);

    personsTable = new Table("People");
    personsTable.setPageLength(1);
    personsTable.setStyleName(ValoTheme.TABLE_SMALL);
    // persons.addContainerProperty("ID", Integer.class, null);
    // persons.addContainerProperty("User", String.class, null);
    personsTable.addContainerProperty("Title", String.class, null);
    personsTable.addContainerProperty("First", String.class, null);
    personsTable.addContainerProperty("Last", String.class, null);
    personsTable.addContainerProperty("eMail", String.class, null);
    personsTable.addContainerProperty("Phone", String.class, null);
    // personsTable.addContainerProperty("(1st) Affiliation", String.class, null);
    // personsTable.addContainerProperty("Role", String.class, null);TODO maybe move this to the
    // next table
    addComponent(personsTable);
    personsTable.setSelectable(true);
    personsTable.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            affiliationsOfPerson.removeAllItems();
            affiliationsOfPerson.setVisible(false);
            Object id = personsTable.getValue();
            if (id != null) {
                Person p = listIDToPerson.get(id);
                affiliationsOfPerson.setCaption("Affiliations of " + p.getFirst() + " " + p.getLast());
                List<Affiliation> affiliations = p.getAffiliations();

                affiliationsOfPerson.setVisible(true);
                for (int i = 0; i < affiliations.size(); i++) {
                    int itemId = i;
                    List<Object> row = new ArrayList<Object>();
                    Affiliation a = affiliations.get(i);
                    row.add(a.getGroupName());
                    row.add(a.getOrganization());
                    row.add(a.getInstitute());
                    row.add(a.getFaculty());
                    row.add(a.getStreet());
                    row.add(a.getZipCode());
                    affiliationsOfPerson.addItem(row.toArray(new Object[row.size()]), itemId);
                }
                affiliationsOfPerson.setPageLength(affiliations.size());
            }
        }
    });

    affiliationsOfPerson = new Table();
    affiliationsOfPerson.setVisible(false);
    affiliationsOfPerson.setStyleName(ValoTheme.TABLE_SMALL);
    // affiliationsOfPerson.addContainerProperty("ID", Integer.class, null);
    affiliationsOfPerson.addContainerProperty("Group", String.class, null);
    // affiliationsOfPerson.addContainerProperty("acronym", String.class, null);
    affiliationsOfPerson.addContainerProperty("Organization", String.class, null);
    affiliationsOfPerson.addContainerProperty("Institute", String.class, null);
    affiliationsOfPerson.addContainerProperty("Faculty", String.class, null);
    // affiliationsOfPerson.addContainerProperty("contactPerson", String.class, null);
    affiliationsOfPerson.addContainerProperty("Street", String.class, null);
    affiliationsOfPerson.addContainerProperty("ZIP", String.class, null);
    addComponent(affiliationsOfPerson);

    inputAffiliation = new TextField("Search for Affiliation");
    addComponent(inputAffiliation);
    searchAffiliation = new Button("Search");
    addComponent(searchAffiliation);

    affiliations = new Table("Affiliations");
    affiliations.setStyleName(ValoTheme.TABLE_SMALL);
    // affiliations.addContainerProperty("ID", Integer.class, null);
    affiliations.addContainerProperty("Group", String.class, null);
    // affiliations.addContainerProperty("acronym", String.class, null);
    affiliations.addContainerProperty("Organization", String.class, null);
    affiliations.addContainerProperty("Institute", String.class, null);
    affiliations.addContainerProperty("Faculty", String.class, null);
    // affiliations.addContainerProperty("contactPerson", String.class, null);
    affiliations.addContainerProperty("Street", String.class, null);
    affiliations.addContainerProperty("ZIP", String.class, null);
    affiliations.setPageLength(1);
    addComponent(affiliations);
}

From source file:views.TableOverview.java

License:Open Source License

public TableOverview(List<Person> personData, List<Affiliation> affiliationData) {
    tabs = new TabSheet();

    persons = new Table("People");
    persons.setStyleName(ValoTheme.TABLE_SMALL);
    //    persons.addContainerProperty("ID", Integer.class, null);
    //    persons.addContainerProperty("User", String.class, null);
    persons.addContainerProperty("Title", String.class, null);
    persons.addContainerProperty("First", String.class, null);
    persons.addContainerProperty("Last", String.class, null);
    persons.addContainerProperty("eMail", String.class, null);
    persons.addContainerProperty("Phone", String.class, null);
    persons.addContainerProperty("Affiliation", String.class, null);
    persons.addContainerProperty("Role", String.class, null);
    tabs.addTab(persons, "People");

    affiliations = new Table("Affiliations");
    affiliations.setStyleName(ValoTheme.TABLE_SMALL);
    //    affiliations.addContainerProperty("ID", Integer.class, null);
    affiliations.addContainerProperty("group", String.class, null);
    // affiliations.addContainerProperty("acronym", String.class, null);
    affiliations.addContainerProperty("organization", String.class, null);
    affiliations.addContainerProperty("institute", String.class, null);
    affiliations.addContainerProperty("faculty", String.class, null);
    // affiliations.addContainerProperty("contactPerson", String.class, null);
    affiliations.addContainerProperty("street", String.class, null);
    affiliations.addContainerProperty("zipCode", String.class, null);
    // affiliations.addContainerProperty("city", String.class, null);
    // affiliations.addContainerProperty("country", String.class, null);
    // affiliations.addContainerProperty("webpage", String.class, null);
    tabs.addTab(affiliations, "Organizations");
    addComponent(tabs);//from www .j  a va 2 s.  c om

    for (int i = 0; i < personData.size(); i++) {
        int itemId = i;
        List<Object> row = new ArrayList<Object>();
        Person p = personData.get(i);
        //      row.add(p.getID());
        //      row.add(p.getUsername());
        row.add(p.getTitle());
        row.add(p.getFirst());
        row.add(p.getLast());
        row.add(p.geteMail());
        row.add(p.getPhone());
        RoleAt a = p.getOneAffiliationWithRole();
        row.add(a.getAffiliation());
        row.add(a.getRole());
        // String affs = StringUtils.join(p.getAffiliationInfos().values(), ",");
        // row.add(affs);
        persons.addItem(row.toArray(new Object[row.size()]), itemId);
    }
    persons.setPageLength(persons.size());

    for (int i = 0; i < affiliationData.size(); i++) {
        int itemId = i;
        List<Object> row = new ArrayList<Object>();
        Affiliation a = affiliationData.get(i);
        //      row.add(a.getID());
        row.add(a.getGroupName());
        // row.add(a.getAcronym());
        row.add(a.getOrganization());
        row.add(a.getInstitute());
        row.add(a.getFaculty());
        // row.add(a.getContactPerson());
        row.add(a.getStreet());
        row.add(a.getZipCode());
        // row.add(a.getCity());
        // row.add(a.getCountry());
        // row.add(a.getWebpage());
        affiliations.addItem(row.toArray(new Object[row.size()]), itemId);
    }
    affiliations.setPageLength(affiliationData.size());
}

From source file:views.WizardBarcodeView.java

License:Open Source License

private void initExperimentTable() {
    experimentTable = new Table("Experiments");
    experimentTable.setStyleName(ValoTheme.TABLE_SMALL);
    experimentTable.setPageLength(1);//from   ww  w .  ja  va 2  s.c  o  m
    experimentTable.setSelectable(true);
    experimentTable.setMultiSelect(true);
    experimentTable.addContainerProperty("Samples", String.class, null);
    experimentTable.addContainerProperty("Type", String.class, null);
    experimentTable.addContainerProperty("Date", String.class, null);
    experimentTable.addContainerProperty("Experiment", String.class, null);
}

From source file:views.WizardBarcodeView.java

License:Open Source License

private void initSampleTable(SampleFilterGenerator gen) {
    sampleTable = new FilterTable("Samples (optional sub-selection)");
    sampleTable.setStyleName(ValoTheme.TABLE_SMALL);
    sampleTable.setPageLength(1);/*from  w  w w.  j a  va2  s.  c  om*/
    sampleTable.setSelectable(true);
    sampleTable.setMultiSelect(true);
    sampleTable.addContainerProperty("QBiC Code", String.class, null);
    sampleTable.addContainerProperty("Secondary Name", String.class, null);
    sampleTable.addContainerProperty("Lab ID", String.class, null);
    sampleTable.addContainerProperty("Type", String.class, null);
    sampleTable.setColumnWidth("Lab ID", 120);
    sampleTable.setColumnWidth("Type", 130);
    sampleTable.setFilterDecorator(new SampleFilterDecorator());
    sampleTable.setFilterGenerator(gen);
    sampleTable.setFilterBarVisible(true);
    sampleTable.setImmediate(true);
    sampleTable.setVisible(false);
}