Example usage for com.vaadin.ui GridLayout getColumns

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

Introduction

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

Prototype

public int getColumns() 

Source Link

Document

Get the number of columns in the grid.

Usage

From source file:de.metas.ui.web.vaadin.window.editor.FieldEditorsContainer.java

License:Open Source License

private void addChildEditor(final Label label, final Component editorComp,
        final PropertyLayoutInfo layoutInfo) {
    final GridLayout content = getContent();
    int labelColumn = contentNextColumn * 2;
    int labelRow = contentNextRow;

    if (layoutInfo.isNextColumn()) {
        labelColumn = content.getColumns();
        labelRow = 0;// w  w w  . ja va2 s.  c  om
    }

    final int editorRowsSpan = layoutInfo.getRowsSpan();
    final int editorColumnFrom = labelColumn + 1;
    final int editorColumnTo = editorColumnFrom;
    final int editorRowFrom = labelRow;
    final int editorRowTo = editorRowFrom + (editorRowsSpan - 1);
    if (editorColumnTo >= content.getColumns()) {
        content.setColumns(editorColumnTo + 1);
    }
    if (editorRowTo >= content.getRows()) {
        content.setRows(editorRowTo + 1);
    }

    //
    //
    if (label != null) {
        content.addComponent(label, labelColumn, labelRow);
        content.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);
    }
    content.addComponent(editorComp, editorColumnFrom, editorRowFrom, editorColumnTo, editorRowTo);
    content.setComponentAlignment(editorComp, Alignment.MIDDLE_LEFT);
    editorComp.setSizeFull();

    //
    //
    // contentNextColumn;
    contentNextRow = editorRowTo + 1;
}

From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java

public Component getFooter(Runnable cancelRunnable, Runnable nextRunnable, Component... extraComponents) {
    Label placeholder = new Label();
    Button cancel = new Button(Language.get(Word.CANCEL), VaadinIcons.CLOSE);
    cancel.addClickListener(ce -> cancelRunnable.run());
    Button next = new Button(Language.get(Word.NEXT), VaadinIcons.ARROW_RIGHT);
    next.addClickListener(ce -> nextRunnable.run());
    GridLayout footer = new GridLayout(3 + extraComponents.length, 1);
    footer.setSpacing(true);/*  w w w  .j  a v  a 2  s  .c om*/
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Sizeable.Unit.PERCENTAGE);
    footer.setSizeUndefined();
    footer.setWidth("100%");
    for (Component extraComponent : extraComponents) {
        footer.addComponent(extraComponent);
        footer.setComponentAlignment(extraComponent, Alignment.MIDDLE_CENTER);
    }
    footer.addComponents(placeholder, cancel, next);
    footer.setColumnExpandRatio(footer.getColumns() - 1 - 2, 1);//ExpandRatio(placeholder, 1);
    footer.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);
    footer.setComponentAlignment(next, Alignment.MIDDLE_CENTER);
    return footer;
}

From source file:edu.kit.dama.ui.admin.utils.UIComponentTools.java

License:Apache License

/**
 *
 *//*www.  j  a v  a  2 s .c  o m*/
private static void setLockedGridComponents(GridLayout layout, boolean locked) {
    for (int i = 0; i < layout.getColumns(); i++) {
        for (int j = 0; j < layout.getRows(); j++) {
            if (layout.getComponent(i, j) == null) {
                continue;
            }
            if (layout.getComponent(i, j).getClass().equals(Button.class)) {
                layout.getComponent(i, j).setEnabled(!locked);
            } else if (layout.getComponent(i, j).getClass().equals(ComboBox.class)) {
                layout.getComponent(i, j).setEnabled(!locked);
                layout.getComponent(i, j).setReadOnly(false);
            } else {
                layout.getComponent(i, j).setReadOnly(locked);
            }
        }
    }
}