Example usage for com.vaadin.ui GridLayout setWidth

List of usage examples for com.vaadin.ui GridLayout setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui GridLayout setWidth.

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:org.sensorhub.ui.NetworkAdminPanel.java

License:Mozilla Public License

@Override
public void build(final MyBeanItem<ModuleConfig> beanItem, final ICommNetwork<?> module) {
    super.build(beanItem, module);

    // add sub form
    final GridLayout form = new GridLayout();
    form.setWidth(100.0f, Unit.PERCENTAGE);
    form.setMargin(false);/*from w  ww .  j  a va2s . c  o m*/
    form.setSpacing(true);

    // add sections
    addAvailableNetworks(form, module);
    addScannedDevices(form, module);

    addComponent(form);
}

From source file:org.sensorhub.ui.SensorAdminPanel.java

License:Mozilla Public License

@Override
public void build(final MyBeanItem<ModuleConfig> beanItem, final ISensorModule<?> module) {
    super.build(beanItem, module);

    // add section label
    final GridLayout form = new GridLayout();
    form.setWidth(100.0f, Unit.PERCENTAGE);
    form.setMargin(false);//www .  java2  s  .  c om
    form.setSpacing(true);

    // section title
    form.addComponent(new Label(""));
    HorizontalLayout titleBar = new HorizontalLayout();
    titleBar.setSpacing(true);
    Label sectionLabel = new Label("Inputs/Outputs");
    sectionLabel.addStyleName(STYLE_H3);
    sectionLabel.addStyleName(STYLE_COLORED);
    titleBar.addComponent(sectionLabel);
    titleBar.setComponentAlignment(sectionLabel, Alignment.MIDDLE_LEFT);

    // refresh button to show latest record
    Button refreshButton = new Button("Refresh");
    refreshButton.setDescription("Load latest data from sensor");
    refreshButton.setIcon(REFRESH_ICON);
    refreshButton.addStyleName(STYLE_QUIET);
    titleBar.addComponent(refreshButton);
    titleBar.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT);
    refreshButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            rebuildSwePanels(form, module);
        }
    });

    form.addComponent(titleBar);

    // add I/O panel
    rebuildSwePanels(form, module);
    addComponent(form);
}

From source file:org.sensorhub.ui.StorageAdminPanel.java

License:Mozilla Public License

@Override
public void build(final MyBeanItem<ModuleConfig> beanItem, final IRecordStorageModule<?> storage) {
    super.build(beanItem, storage);

    if (storage != null) {
        // section layout
        final GridLayout form = new GridLayout();
        form.setWidth(100.0f, Unit.PERCENTAGE);
        form.setMargin(false);// www.  ja  va2 s  .c  om
        form.setSpacing(true);

        // section title
        form.addComponent(new Label(""));
        HorizontalLayout titleBar = new HorizontalLayout();
        titleBar.setSpacing(true);
        Label sectionLabel = new Label("Data Store Content");
        sectionLabel.addStyleName(STYLE_H3);
        sectionLabel.addStyleName(STYLE_COLORED);
        titleBar.addComponent(sectionLabel);
        titleBar.setComponentAlignment(sectionLabel, Alignment.MIDDLE_LEFT);

        // refresh button to show latest record
        Button refreshButton = new Button("Refresh");
        refreshButton.setDescription("Reload data from storage");
        refreshButton.setIcon(REFRESH_ICON);
        refreshButton.addStyleName(STYLE_QUIET);
        titleBar.addComponent(refreshButton);
        titleBar.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT);
        refreshButton.addClickListener(new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                buildDataPanel(form, storage);
            }
        });

        form.addComponent(titleBar);

        // add I/O panel
        buildDataPanel(form, storage);
        addComponent(form);
    }
}

From source file:org.sensorhub.ui.StorageAdminPanel.java

License:Mozilla Public License

protected Panel newPanel(String title) {
    Panel panel = new Panel(title);
    GridLayout layout = new GridLayout(2, 2);
    layout.setWidth(100.0f, Unit.PERCENTAGE);
    layout.setMargin(true);//from w w  w .  j  a  va  2s. com
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.2f);
    layout.setColumnExpandRatio(1, 0.8f);
    layout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    panel.setContent(layout);
    return panel;
}

From source file:org.vaadin.spinkit.demo.DemoUI.java

License:Apache License

private Component spinnersContainer(String primaryStyleName) {
    int types = SpinnerType.values().length;
    GridLayout spinners = new GridLayout(4, (types / 4 + types % 4));
    spinners.setSizeFull();//w  w w .  jav  a 2 s .com
    spinners.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    spinners.setSpacing(true);
    spinners.setWidth(100, Unit.PERCENTAGE);
    StringToEnumConverter converter = new StringToEnumConverter();
    for (SpinnerType type : SpinnerType.values()) {
        Spinner spinner = new Spinner(type);
        spinner.setCaption(converter.convertToPresentation(type, String.class, getLocale()));
        if (primaryStyleName != null) {
            spinner.setPrimaryStyleName(primaryStyleName);
        }
        spinners.addComponent(spinner);
    }
    return spinners;
}

From source file:org.vaadin.spring.samples.mvp.ui.view.BannerView.java

License:Apache License

protected GridLayout buildRightArea(String username) {
    GridLayout right = new GridLayout(1, 1);
    right.setWidth(100f, Unit.PERCENTAGE);
    Layout loggedInUser = buildUserArea(username);
    right.addComponent(loggedInUser, 0, 0);
    right.setComponentAlignment(loggedInUser, Alignment.MIDDLE_RIGHT);
    return right;
}