Example usage for com.vaadin.ui GridLayout GridLayout

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

Introduction

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

Prototype

public GridLayout(int columns, int rows) 

Source Link

Document

Constructor for a grid of given size (number of columns and rows).

Usage

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DummyRegWithReCaptcha.java

License:Apache License

private Layout createForm() {
    RegistrationFields registrationFields = new RegistrationFields();
    fieldGroup.buildAndBindMemberFields(registrationFields);
    GridLayout layout = new GridLayout(2, 2);
    layout.setSpacing(true);// w ww.  ja  v  a 2 s  . c o  m
    layout.addComponent(registrationFields.getLogin(), 0, 0);
    layout.addComponent(registrationFields.getPassword(), 0, 1);
    layout.addComponent(registrationFields.getPasswordAgain(), 1, 1);
    registrationFields.login.focus();
    return layout;
}

From source file:de.catma.ui.tagger.TagInstanceTree.java

License:Open Source License

private void initComponents() {
    tagInstanceTree = new TreeTable();
    tagInstanceTree.setImmediate(true);/* ww w .java2  s. c  o  m*/
    tagInstanceTree.setSizeFull();
    tagInstanceTree.setSelectable(true);
    tagInstanceTree.setMultiSelect(true);
    tagInstanceTree.setColumnReorderingAllowed(true);
    tagInstanceTree.setColumnCollapsingAllowed(true);

    tagInstanceTree.setContainerDataSource(new HierarchicalContainer());
    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.caption, String.class, null);
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.caption, "Tag Instance");

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.icon, Resource.class, null);

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.path, String.class, null);

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.instanceId, String.class, null);

    tagInstanceTree.addContainerProperty(TagInstanceTreePropertyName.umc, String.class, null);

    tagInstanceTree.setItemCaptionPropertyId(TagInstanceTreePropertyName.caption);
    tagInstanceTree.setItemIconPropertyId(TagInstanceTreePropertyName.icon);

    tagInstanceTree.addGeneratedColumn(TagInstanceTreePropertyName.color,
            new ColorLabelColumnGenerator(new ColorLabelColumnGenerator.TagInstanceTagDefinitionProvider()));

    tagInstanceTree.setVisibleColumns(new Object[] { TagInstanceTreePropertyName.caption,
            TagInstanceTreePropertyName.color, TagInstanceTreePropertyName.path,
            TagInstanceTreePropertyName.instanceId, TagInstanceTreePropertyName.umc });
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.color, "Tag Color");
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.path, "Tag Path");
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.instanceId, "Tag Instance ID");
    tagInstanceTree.setColumnHeader(TagInstanceTreePropertyName.umc, "User Markup Collection");
    addComponent(tagInstanceTree);
    setExpandRatio(tagInstanceTree, 1.0f);

    GridLayout buttonGrid = new GridLayout(1, 2);
    buttonGrid.setMargin(false, true, true, true);
    buttonGrid.setSpacing(true);

    btRemoveTagInstance = new Button("Remove Tag Instance");
    buttonGrid.addComponent(btRemoveTagInstance);

    btEditPropertyValues = new Button("Edit Property values");
    buttonGrid.addComponent(btEditPropertyValues);

    addComponent(buttonGrid);
}

From source file:de.catma.ui.tagmanager.PropertyDefinitionDialog.java

License:Open Source License

private void initComponents(String caption) {
    setMargin(true);/*  ww  w  .  j a va 2  s .  co m*/
    setSpacing(true);

    GridLayout propPanel = new GridLayout(3, 3);
    propPanel.setSpacing(true);

    nameInput = new TextField("Name");
    nameInput.setRequired(true);
    if (propertyDefinition != null) {
        nameInput.setValue(propertyDefinition.getName());
    }
    propPanel.addComponent(nameInput, 0, 0, 2, 0);

    if (propertyDefinition != null) {
        valueInput = new ListSelect("Possible values",
                propertyDefinition.getPossibleValueList().getPropertyValueList().getValues());
    } else {
        valueInput = new ListSelect("Possible values");
    }
    valueInput.setWidth("100%");
    valueInput.setRequired(true);
    valueInput.setNullSelectionAllowed(false);

    propPanel.addComponent(valueInput, 0, 1, 2, 1);

    newValueInput = new TextField("Add possible value");
    propPanel.addComponent(newValueInput, 0, 2);

    btAdd = new Button("+");
    propPanel.addComponent(btAdd, 1, 2);
    propPanel.setComponentAlignment(btAdd, Alignment.BOTTOM_CENTER);

    btRemove = new Button("-");
    propPanel.addComponent(btRemove, 2, 2);
    propPanel.setComponentAlignment(btRemove, Alignment.BOTTOM_CENTER);

    addComponent(propPanel);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    btSave = new Button("Save");
    buttonPanel.addComponent(btSave);
    buttonPanel.setComponentAlignment(btSave, Alignment.MIDDLE_RIGHT);

    btCancel = new Button("Cancel");
    buttonPanel.addComponent(btCancel);
    buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT);

    addComponent(buttonPanel);
    setComponentAlignment(buttonPanel, Alignment.MIDDLE_RIGHT);

    window = new Window(caption);
    window.setContent(this);
    window.setWidth("30%");
    window.setHeight("70%");
    window.center();
}

From source file:de.catma.ui.tagmanager.TagsetTree.java

License:Open Source License

private void initComponents() {
    setSizeFull();//w w w . j a  va 2 s  . co m

    tagTree = new EndorsedTreeTable();
    tagTree.setImmediate(true);
    tagTree.setSizeFull();
    tagTree.setSelectable(true);
    tagTree.setMultiSelect(false);

    tagTree.setContainerDataSource(new HierarchicalContainer());

    tagTree.addContainerProperty(TagTreePropertyName.caption, String.class, null);
    tagTree.setColumnHeader(TagTreePropertyName.caption, "Tagsets");

    tagTree.addContainerProperty(TagTreePropertyName.icon, Resource.class, null);

    tagTree.setItemCaptionPropertyId(TagTreePropertyName.caption);
    tagTree.setItemIconPropertyId(TagTreePropertyName.icon);
    tagTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);

    tagTree.setVisibleColumns(new Object[] { TagTreePropertyName.caption });

    if (colorButtonListener != null) {
        tagTree.addGeneratedColumn(TagTreePropertyName.color,
                new ColorButtonColumnGenerator(colorButtonListener));
        tagTree.setColumnReorderingAllowed(true);
    } else {
        tagTree.addGeneratedColumn(TagTreePropertyName.color, new ColorLabelColumnGenerator());
    }
    tagTree.setColumnHeader(TagTreePropertyName.color, "Tag Color");
    addComponent(tagTree);
    setExpandRatio(tagTree, 2);

    GridLayout buttonGrid = new GridLayout(1, 19);
    buttonGrid.setMargin(true);
    buttonGrid.setSpacing(true);

    buttonGrid.addStyleName("taglibrary-action-grid");
    int buttonGridRowCount = 0;

    if (withTagsetButtons) {
        btReload = new Button("");
        btReload.setIcon(new ClassResource("ui/resources/icon-reload.gif", getApplication()));
        btReload.addStyleName("icon-button");
        buttonGrid.addComponent(btReload);
        buttonGrid.setComponentAlignment(btReload, Alignment.MIDDLE_RIGHT);
        buttonGridRowCount++;

        Label tagsetLabel = new Label();
        tagsetLabel.setIcon(new ClassResource("ui/tagmanager/resources/grndiamd.gif", application));
        tagsetLabel.setCaption("Tagset");

        buttonGrid.addComponent(tagsetLabel);
        buttonGridRowCount++;

        btInsertTagset = new Button("Create Tagset");
        btInsertTagset.setEnabled(true);
        btInsertTagset.setWidth("100%");
        buttonGrid.addComponent(btInsertTagset);
        buttonGridRowCount++;

        btRemoveTagset = new Button("Remove Tagset");
        btRemoveTagset.setWidth("100%");
        buttonGrid.addComponent(btRemoveTagset);
        buttonGridRowCount++;

        btEditTagset = new Button("Edit Tagset");
        btEditTagset.setWidth("100%");
        buttonGrid.addComponent(btEditTagset);
        buttonGridRowCount++;
    }

    Label tagLabel = new Label();
    tagLabel.setIcon(new ClassResource("ui/tagmanager/resources/reddiamd.gif", application));
    tagLabel.setCaption("Tag");

    buttonGrid.addComponent(tagLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(tagLabel, Alignment.BOTTOM_LEFT);

    btInsertTag = new Button("Create Tag");
    btInsertTag.setWidth("100%");
    if (withTagsetButtons) {
        btInsertTag.setEnabled(true);
    }
    buttonGrid.addComponent(btInsertTag);
    buttonGridRowCount++;

    btRemoveTag = new Button("Remove Tag");
    btRemoveTag.setWidth("100%");
    buttonGrid.addComponent(btRemoveTag);
    buttonGridRowCount++;

    btEditTag = new Button("Edit Tag");
    btEditTag.setWidth("100%");
    buttonGrid.addComponent(btEditTag);
    buttonGridRowCount++;

    Label propertyLabel = new Label();
    propertyLabel.setIcon(new ClassResource("ui/tagmanager/resources/ylwdiamd.gif", application));
    propertyLabel.setCaption("Property");

    buttonGrid.addComponent(propertyLabel, 0, buttonGridRowCount, 0, buttonGridRowCount + 4);
    buttonGridRowCount += 5;

    buttonGrid.setComponentAlignment(propertyLabel, Alignment.BOTTOM_LEFT);

    btInsertProperty = new Button("Create Property");
    btInsertProperty.setWidth("100%");
    buttonGrid.addComponent(btInsertProperty);
    buttonGridRowCount++;

    btRemoveProperty = new Button("Remove Property");
    // commented out on purpose: somehow this forces all the other buttons to 
    // show up in natural size...
    //      btRemoveProperty.setWidth("100%");
    buttonGrid.addComponent(btRemoveProperty);
    buttonGridRowCount++;

    btEditProperty = new Button("Edit Property");
    btEditProperty.setWidth("100%");
    buttonGrid.addComponent(btEditProperty);
    buttonGridRowCount++;

    addComponent(buttonGrid);
    setExpandRatio(buttonGrid, 0);

    if (!withButtonPanel) {
        buttonGrid.setVisible(false);
    }

}

From source file:de.decidr.ui.view.ProfileSettingsComponent.java

License:Apache License

/**
 * This method initializes the components of the
 * {@link ProfileSettingsComponent}.//from  ww  w .j a  v  a2s  .c  om
 */
private void init() {
    settingsForm.setWriteThrough(false);
    settingsItem = new BeanItem(user.getUserProfile(), properties);
    settingsForm.setItemDataSource(settingsItem);
    settingsForm.setFormFieldFactory(new SettingsFieldFactory());

    settingsForm.setVisibleItemProperties(properties);

    addressPanel = new Panel();
    usernamePanel = new Panel();
    profileButtonPanel = new Panel();

    usernameGridLayout = new GridLayout(2, 2);
    verticalLayout = new VerticalLayout();
    addressVerticalLayout = new VerticalLayout();
    profileButtonHorizontalLayout = new HorizontalLayout();

    myProfileLabel = new Label("<h2> My Profile </h2>");
    myProfileLabel.setContentMode(Label.CONTENT_XHTML);
    usernameLabel = new Label("Username: ");
    emailLabel = new Label("Email address: ");
    usernameNameLabel = new Label(user.getUserProfile().getUsername());
    emailNameLabel = new Label(user.getEmail());

    changeEmailLink = new Button("Change email", new ShowChangeEmailAction());
    changeEmailLink.setStyleName(Button.STYLE_LINK);
    changePasswordLink = new Button("Change password", new ShowChangePasswordAction());
    changePasswordLink.setStyleName(Button.STYLE_LINK);
    leaveTenantLink = new Button("Leave tenant", new ShowLeaveTenantDialogAction());
    leaveTenantLink.setStyleName(Button.STYLE_LINK);

    saveButton = new Button("Save", new SaveProfileAction());
    settingsForm.addField("button", saveButton);

    statusCheckBox = new CheckBox();
    statusCheckBox.setValue(user.getUnavailableSince() != null ? true : false);
    statusCheckBox.addListener(new ChangeStatusAction(user.getId()));
    statusCheckBox.setImmediate(true);

    this.setCompositionRoot(verticalLayout);

    verticalLayout.setSpacing(true);
    verticalLayout.addComponent(myProfileLabel);
    verticalLayout.addComponent(usernamePanel);

    usernamePanel.addComponent(usernameGridLayout);
    usernameGridLayout.setSpacing(true);
    usernameGridLayout.addComponent(usernameLabel, 0, 0);
    usernameGridLayout.addComponent(usernameNameLabel, 1, 0);
    usernameGridLayout.addComponent(emailLabel, 0, 1);
    usernameGridLayout.addComponent(emailNameLabel, 1, 1);

    verticalLayout.addComponent(profileButtonPanel);

    profileButtonPanel.addComponent(profileButtonHorizontalLayout);
    profileButtonHorizontalLayout.setSpacing(true);
    profileButtonHorizontalLayout.addComponent(changeEmailLink);
    profileButtonHorizontalLayout.addComponent(changePasswordLink);
    profileButtonHorizontalLayout.addComponent(leaveTenantLink);
    profileButtonHorizontalLayout.addComponent(statusCheckBox);
    statusCheckBox.setCaption("Set my status to unavailable");
    profileButtonHorizontalLayout.setComponentAlignment(statusCheckBox, Alignment.TOP_RIGHT);

    verticalLayout.addComponent(addressPanel);

    addressPanel.addComponent(addressVerticalLayout);

    addressVerticalLayout.setSpacing(true);
    addressVerticalLayout.addComponent(settingsForm);
}

From source file:de.decidr.ui.view.SiteFrame.java

License:Apache License

/**
 * Initializes the components of the site frame.
 *//*w  w  w  . j ava2s  .c  o  m*/
private void init() {
    gridFrame = new GridLayout(3, 5);
    this.setCompositionRoot(gridFrame);

    gridFrame.setSizeFull();
    gridFrame.setMargin(false);
    gridFrame.setSpacing(false);

    splitPanel = new SplitPanel();

    splitPanel.setOrientation(SplitPanel.ORIENTATION_HORIZONTAL);
    splitPanel.setWidth("1000px");
    splitPanel.setHeight("600px");
    splitPanel.setSplitPosition(200, Sizeable.UNITS_PIXELS);
    splitPanel.setLocked(true);

    gridFrame.setColumnExpandRatio(0, 1);
    gridFrame.setColumnExpandRatio(2, 1);

    gridFrame.addComponent(splitPanel, 1, 3);
}

From source file:de.escidoc.admintool.view.factory.ToolbarFactory.java

License:Open Source License

public GridLayout createToolbar(final Layout layout) {
    if (gLayout == null) {
        gLayout = new GridLayout(COLUMNS, ROWS);
        gLayout.setMargin(false);//  www  . j  a  va2s .  com
        gLayout.setSpacing(false);
        gLayout.setWidth("100%");
        gLayout.setStyleName(ViewConstants.TOOLBAR_STYLE_NAME);
        gLayout.addComponent(hLayout, 0, 0);
        addBackgroundImage();
        add(layout);
    }

    return gLayout;
}

From source file:de.escidoc.admintool.view.util.LayoutHelper.java

License:Open Source License

/**
 * Helper method. Puts a blank in front of a component. Useful for buttons.
 * /*from  w  ww  . j a  v a2 s.  c  om*/
 * @param comp
 *            The component to display.
 * @return The component in an grid layout. A blank in front and afterwards is inserted.
 */
public static synchronized GridLayout create(final Component comp) {
    final GridLayout hor = new GridLayout(3, 1);
    hor.setHeight(Constants.DEFAULT_HEIGHT);
    hor.addComponent(new Label(" "), 0, 0);
    hor.addComponent(comp, 1, 0);
    hor.setComponentAlignment(comp, Alignment.MIDDLE_RIGHT);
    hor.addComponent(new Label(" "), 2, 0);
    hor.setSpacing(false);
    return hor;
}

From source file:de.fatalix.timeline.web.root.block.TimelineConfigLayout.java

@PostConstruct
private void postInit() {
    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.addComponents(createLeftSide(), createRightSide());

    eventGridContainer = new GridLayout(3, 1);
    eventGridContainer.setSizeFull();/*from w  ww  .  j a v a2  s  .  c o  m*/
    proxy = new AnimatorProxy();

    this.addStyleName("timeline-config-layout");
    this.setMargin(true);
    this.setSpacing(true);
    this.addComponents(proxy, topLayout, eventGridContainer);
}

From source file:de.gedoplan.webclients.vaadin.views.CustomerForm.java

protected void buildLayout() {
    GridLayout gridLayout = new GridLayout(4, 4);
    gridLayout.setSpacing(true);//from  ww w .  j a  v  a 2  s  .  c  o m
    gridLayout.setMargin(true);
    gridLayout.setWidth(100, Unit.PERCENTAGE);
    gridLayout.addComponent(id, 0, 0);
    gridLayout.addComponent(name, 1, 0, 2, 0);
    gridLayout.addComponent(kontakt, 3, 0);
    gridLayout.addComponent(strasse, 0, 1);
    gridLayout.addComponent(plz, 1, 1);
    gridLayout.addComponent(stadt, 2, 1, 3, 1);
    gridLayout.addComponent(region, 0, 2);
    gridLayout.addComponent(land, 1, 2);
    gridLayout.addComponent(telefon, 2, 2);
    gridLayout.addComponent(fax, 3, 2);
    gridLayout.addComponent(speichern, 1, 3);
    gridLayout.addComponent(abbrechen, 2, 3);
    gridLayout.setComponentAlignment(speichern, Alignment.MIDDLE_CENTER);
    gridLayout.setComponentAlignment(abbrechen, Alignment.MIDDLE_CENTER);
    speichern.setWidth(200, Unit.PIXELS);
    abbrechen.setWidth(200, Unit.PIXELS);
    setSpacing(true);
    setWidth(100, Unit.PERCENTAGE);
    addComponent(gridLayout);
}