Example usage for com.vaadin.ui GridLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

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

License:Apache License

private Component spinnerSizesContainer() {
    int types = SpinnerSize.values().length;
    GridLayout spinners = new GridLayout(4, (types / 4 + types % 4));
    spinners.setSizeFull();
    spinners.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    spinners.setSpacing(true);//from w w  w. j a  va  2s.  com

    ComboBox selector = new ComboBox("Select spinner type", Arrays.asList(SpinnerType.values()));
    selector.setNullSelectionAllowed(false);
    selector.setPageLength(0);
    selector.setValue(SpinnerType.ROTATING_PLANE);
    selector.addValueChangeListener(e -> {
        for (Component c : spinners) {
            if (c instanceof Spinner) {
                ((Spinner) c).setType((SpinnerType) selector.getValue());
            }
        }
    });

    StringToEnumConverter converter = new StringToEnumConverter();
    for (SpinnerSize size : SpinnerSize.values()) {
        Spinner spinner = new Spinner(SpinnerType.ROTATING_PLANE);
        spinner.setSize(size);
        spinner.setCaption(converter.convertToPresentation(size, String.class, getLocale()));
        spinners.addComponent(spinner);
    }

    VerticalLayout l = new VerticalLayout();
    l.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    l.setSizeFull();
    l.setMargin(false);
    l.setSpacing(true);
    l.addComponents(selector, spinners);
    l.setExpandRatio(spinners, 1);
    return l;
}

From source file:ro.zg.netcell.vaadin.action.ActionsManager.java

License:Apache License

private void showProgressIndicator(ComponentContainer container) {
    if (container == null) {
        return;/*from  w w  w. j a  v a  2 s. c  o  m*/
    }
    container.removeAllComponents();
    GridLayout lc = new GridLayout(1, 1);
    lc.setSizeFull();
    ProgressIndicator pi = new ProgressIndicator();
    pi.setIndeterminate(true);
    lc.addComponent(pi, 0, 0);
    lc.setComponentAlignment(pi, Alignment.TOP_CENTER);
    container.addComponent(lc);
}

From source file:uk.q3c.krail.testapp.view.GridViewBase.java

License:Apache License

@Override
protected void doBuild() {
    Label label = new Label("This is the " + this.getClass().getSimpleName());
    label.setHeight("100px");
    GridLayout grid = new GridLayout(3, 3);

    grid.addComponent(label, 1, 1);/*  w ww.  ja  v a  2s  .c o m*/
    grid.setSizeFull();
    grid.setColumnExpandRatio(0, 0.33f);
    grid.setColumnExpandRatio(1, 0.33f);
    grid.setColumnExpandRatio(2, 0.33f);

    grid.setRowExpandRatio(0, 0.4f);
    grid.setRowExpandRatio(1, 0.2f);
    grid.setRowExpandRatio(2, 0.4f);

    label.setSizeFull();
    setRootComponent(grid);

}

From source file:uk.q3c.krail.testapp.view.ViewBaseGrid.java

License:Apache License

@Override
public void doBuild() {
    GridLayout grid = new GridLayout(3, 4);
    Panel topMarginPanel = new Panel();
    topMarginPanel.setHeight(topMargin + "px");
    topMarginPanel.setWidth("100%");

    grid.setSizeFull();
    grid.setColumnExpandRatio(0, 0.400f);
    grid.setColumnExpandRatio(1, 0.20f);
    grid.setColumnExpandRatio(2, 0.40f);

    grid.setRowExpandRatio(1, 0.40f);//w  w  w  .  j  ava2s  . com
    grid.setRowExpandRatio(2, 0.20f);
    grid.setRowExpandRatio(3, 0.40f);
    setRootComponent(grid);
}

From source file:uk.q3c.krail.testapp.view.WidgetsetView.java

License:Apache License

@Override
public void doBuild() {
    buttonPanel = new Panel();
    VerticalLayout verticalLayout = new VerticalLayout();
    buttonPanel.setContent(verticalLayout);

    setRootComponent(new GridLayout(3, 4));

    GridLayout grid = getGrid();

    grid.addComponent(buttonPanel, 1, 2);
    grid.setSizeFull();
    grid.setColumnExpandRatio(0, 0.400f);
    grid.setColumnExpandRatio(1, 0.20f);
    grid.setColumnExpandRatio(2, 0.40f);

    grid.setRowExpandRatio(0, 0.05f);//from w ww  . j  a v a2 s  . c om
    grid.setRowExpandRatio(1, 0.15f);
    grid.setRowExpandRatio(2, 0.4f);
    grid.setRowExpandRatio(3, 0.15f);

    spinner = new Spinner(SpinnerType.FOLDING_CUBE).large();
    verticalLayout.addComponent(spinner);

    changeSpinnerType = new Button("Change Spinner Type");
    changeSpinnerType.addClickListener(e -> spinner.setType(SpinnerType.WAVE));
    verticalLayout.addComponent(changeSpinnerType);

    stepper = new IntStepper("Stepper");
    stepper.setValue(5);
    verticalLayout.addComponent(stepper);

    infoArea = new Label();
    infoArea.setContentMode(ContentMode.HTML);
    infoArea.setSizeFull();
    infoArea.setValue("These components are used purely to ensure that the Widgetset has compiled and included "
            + "add-ons");
    grid.addComponent(infoArea, 0, 1, 1, 1);

    param1 = new Label();
    param2 = new Label();
    VerticalLayout parameters = new VerticalLayout(param1, param2);
    grid.addComponent(parameters, 0, 2, 0, 2);
}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getBasicInfo(V7CR v7, Review r, Project proj, String linkUrl) {

    Panel p = new Panel(v7.getMessage("reviewTab.review"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(3, 4);
    grid.setSizeFull();
    p.setContent(grid);//w w  w  . j a v a 2 s.  co m
    grid.setSpacing(true);
    Locale l = v7.getLocale();
    SchemaDefinition sd = r.getSchemaDefinition();
    grid.addComponent(new Label(sd.getFieldCaption("s", l)), 0, 0, 1, 0);
    p.addComponent(new Label("<b>" + LocalizedString
            .get(sd.getFieldDefinition("s").getPossibleValueMetaData(r.getStatus()), "caption", l) + "</b>",
            Label.CONTENT_XHTML));
    p.addComponent(new Label(sd.getFieldCaption("p", l)));
    p.addComponent(new Label("[" + proj.getId() + "]"));
    grid.addComponent(new Label(proj.getName()));
    p.addComponent(new Label(sd.getFieldCaption("reviewee", l)));
    p.addComponent(new Label(r.getReviewee().getId()));
    grid.addComponent(new Label(r.getReviewee().getName()));
    p.addComponent(new Label(sd.getFieldCaption("t", l)));
    grid.addComponent(new Label(r.getTitle()), 1, 3, 2, 3);
    p.addComponent(new Label(v7.getMessage("reviewTab.directLink")));
    Link link = new Link(linkUrl, new ExternalResource(linkUrl));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    grid.addComponent(link);
    return p;

}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getSVNPanel(V7CR v7, SchemaDefinition sd, SVNLogEntry svn, Project proj) {
    if (svn == null)
        return null;
    Locale l = v7.getLocale();/*from w w  w.  j  a v  a  2  s .c  om*/
    Panel p = new Panel(v7.getMessage("reviewTab.subversion"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(4, 4);
    grid.setSizeFull();
    p.setContent(grid);
    grid.setSpacing(true);
    p.addComponent(new Label(sd.getFieldCaption("svn.rev", l)));
    p.addComponent(new Label("" + svn.getRevision()));
    p.addComponent(new Label(DateFormat.getDateTimeInstance().format(svn.getDate())));
    p.addComponent(new Label(svn.getAuthor()));
    Link link = new Link(v7.getMessage("reviewTab.viewChanges"),
            new ExternalResource(proj.getChangesetViewUrl(svn.getRevision())));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    p.addComponent(link);
    grid.addComponent(new Label(svn.getMessage()), 1, 1, 3, 1);

    Map<String, SVNLogEntryPath> changed = svn.getChangedPaths();

    if (changed != null) {
        Tree changeTree = new Tree(sd.getFieldCaption("svn.changed", l) + "(" + changed.size() + ")");
        Set<String> paths = changed.keySet();
        for (String s : changed.keySet()) {
            changeTree.addItem(s);
            changeTree.setChildrenAllowed(s, false);
            changeTree.setItemCaption(s, changed.get(s).getType() + " " + s);
        }
        if (paths.size() > 5) {
            compressTree(changeTree, paths);
        }

        grid.addComponent(changeTree, 0, 2, 3, 2);
    }
    return p;
}

From source file:VaadinIRC.GUI.channelGUI.java

License:Open Source License

/**
 * Creates the GUI for a channel./*from  w  w  w. ja  va  2s. co m*/
 */
public void createChannelGUI() {
    panel = new Panel();
    panel.setCaption(channelName);
    panel.setSizeFull();
    panel.getContent().setSizeFull();
    AbstractLayout panelLayout = (AbstractLayout) panel.getContent();
    panelLayout.setMargin(false);
    panel.setImmediate(true);
    labelTitle.setValue("<b>" + channelName + "</b>");

    VerticalLayout mainVerticalLayout = new VerticalLayout();
    mainVerticalLayout.setSizeFull();
    // Top bar containing channel title & topright buttons
    GridLayout topGrid = new GridLayout(2, 1);
    topGrid.setStyleName("topBar");
    topGrid.addComponent(labelTitle);
    topGrid.setSizeFull();
    labelTitle.setSizeFull();
    HorizontalLayout hori = new HorizontalLayout();
    hori.setStyleName("rightTopBar");
    hori.setWidth(100, Sizeable.UNITS_PIXELS);
    hori.addComponent(buttonSettings);
    hori.addComponent(buttonChangeNick);
    hori.addComponent(buttonRefreshUsernames);
    topGrid.addComponent(hori);
    topGrid.setComponentAlignment(hori, Alignment.TOP_RIGHT);
    mainVerticalLayout.addComponent(topGrid);
    mainVerticalLayout.setExpandRatio(topGrid, 0.05f);
    // Message area & table of nicknames
    HorizontalLayout horizontal = new HorizontalLayout();
    horizontal.setSpacing(false);
    horizontal.setMargin(false);
    horizontal.setSizeFull();
    horizontal.addComponent(panelMessages);
    mainVerticalLayout.addComponent(horizontal);
    mainVerticalLayout.setExpandRatio(horizontal, 0.90f);
    if (channelName.startsWith("#")) {
        horizontal.addComponent(tableNicknames);
        horizontal.setExpandRatio(panelMessages, 0.8f);
        horizontal.setExpandRatio(tableNicknames, 0.2f);
    }
    // Send message textfield & send button
    HorizontalLayout bottomBar = new HorizontalLayout();
    //bottomBar.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    bottomBar.setSizeFull();
    //bottomBar.setSpacing(true);
    //bottomBar.setMargin(true, false, false, false);
    bottomBar.addComponent(textfieldMessagefield);
    bottomBar.addComponent(buttonSendMessage);
    bottomBar.setExpandRatio(textfieldMessagefield, 1f);
    bottomBar.setExpandRatio(buttonSendMessage, 0f);
    mainVerticalLayout.addComponent(bottomBar);
    mainVerticalLayout.setExpandRatio(bottomBar, 0.05f);

    horizontal.setImmediate(true);
    panelMessages.setImmediate(true);
    tableNicknames.setImmediate(true);
    textfieldMessagefield.setImmediate(true);
    tableNicknames.addContainerProperty("Rights", String.class, null);
    tableNicknames.addContainerProperty("Nicknames", String.class, null);
    tableNicknames.setSelectable(true);

    textfieldMessagefield.focus();

    //mainVerticalLayout.setSizeFull();
    panel.addComponent(mainVerticalLayout);
}