Example usage for com.vaadin.ui HorizontalLayout HorizontalLayout

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

Introduction

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

Prototype

public HorizontalLayout() 

Source Link

Document

Constructs an empty HorizontalLayout.

Usage

From source file:com.expressui.core.view.entityselect.EntitySelectResults.java

License:Open Source License

@PostConstruct
@Override/*  w  w w .  j av a  2 s .  c  o  m*/
public void postConstruct() {
    super.postConstruct();
    addSelectionChangedListener(this, "selectionChanged");

    HorizontalLayout crudButtons = new HorizontalLayout();
    setDebugId(crudButtons, "crudButtons");
    crudButtons.setMargin(false);
    crudButtons.setSpacing(true);

    selectButton = new Button(uiMessageSource.getMessage("results.select"));
    selectButton.setDescription(uiMessageSource.getToolTip("results.select.toolTip"));
    selectButton.setEnabled(false);
    selectButton.addStyleName("small default");
    crudButtons.addComponent(selectButton);

    getCrudButtons().addComponent(crudButtons, 0);
    getCrudButtons().setComponentAlignment(crudButtons, Alignment.MIDDLE_LEFT);

    getEntityQuery().setPageSize(applicationProperties.getDefaultSelectPageSize());

    addCodePopupButtonIfEnabled(EntitySelectResults.class);
}

From source file:com.expressui.core.view.field.SelectField.java

License:Open Source License

private void initialize() {
    setSizeUndefined();//w  w  w  .j av a2s  .com
    field = new TextField();
    FormField.initAbstractFieldDefaults(field);
    FormField.initTextFieldDefaults(field);
    field.setReadOnly(true);

    HorizontalLayout selectFieldLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, selectFieldLayout, "selectFieldLayout");
    selectFieldLayout.setDebugId(id);
    selectFieldLayout.addComponent(field);

    searchButton = new Button();
    searchButton.setDescription(uiMessageSource.getToolTip("selectField.search.toolTip"));
    searchButton.setSizeUndefined();
    searchButton.addStyleName("borderless");
    searchButton.setIcon(new ThemeResource("../chameleon/img/magnifier.png"));
    searchButton.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            entitySelect.open();
        }
    });
    selectFieldLayout.addComponent(searchButton);

    clearButton = new Button();
    clearButton.setDescription(uiMessageSource.getToolTip("selectField.clear.toolTip"));
    clearButton.setSizeUndefined();
    clearButton.addStyleName("borderless");
    clearButton.setIcon(new ThemeResource("../runo/icons/16/cancel.png"));
    selectFieldLayout.addComponent(clearButton);

    entitySelect.getResults().addSelectActionListener(this, "itemSelected");
    clearButton.addListener(Button.ClickEvent.class, this, "itemCleared");

    setCompositionRoot(selectFieldLayout);
}

From source file:com.expressui.core.view.form.EntityForm.java

License:Open Source License

@PostConstruct
@Override/* w w w  . j  a va 2s  . c  o  m*/
public void postConstruct() {
    super.postConstruct();

    String typeName = domainMessageSource.getMessage(getType().getName(), getType().getSimpleName());
    labelRegistry.putTypeLabel(getType().getName(), typeName);

    List<ToManyRelationship> toManyRelationships = getViewableToManyRelationships();
    if (toManyRelationships.size() > 0) {
        toManyRelationshipTabs = new TabSheet();
        setDebugId(toManyRelationshipTabs, "toManyRelationshipTabs");
        toManyRelationshipTabs.setSizeUndefined();
        for (ToManyRelationship toManyRelationship : toManyRelationships) {
            toManyRelationshipTabs.addTab(toManyRelationship);
            toManyRelationship.getResultsTable().addExecuteQueryListener(this, "requestRepaintAll");
            labelRegistry.putFieldLabel(getType().getName(), toManyRelationship.getChildPropertyId(),
                    "Relationship", toManyRelationship.getTypeCaption());
        }

        HorizontalLayout toManyRelationshipLayout = new HorizontalLayout();
        setDebugId(toManyRelationshipLayout, "toManyRelationshipLayout");
        toManyRelationshipLayout.setSizeUndefined();
        Label label = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        toManyRelationshipLayout.addComponent(label);
        toManyRelationshipLayout.addComponent(toManyRelationshipTabs);
        addComponent(toManyRelationshipLayout);
    }

    addCodePopupButtonIfEnabled(Alignment.MIDDLE_RIGHT, EntityForm.class);
}

From source file:com.expressui.core.view.form.layout.LeftLabelGridLayout.java

License:Open Source License

private void addFieldImpl(FormField formField) {
    Label label = formField.getFieldLabel();

    HorizontalLayout fieldLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, fieldLayout, "fieldLayout");
    fieldLayout.setDebugId(id);/* w ww  .  j  a va2  s  .c  o m*/
    fieldLayout.setSizeUndefined();
    Field field = formField.getField();
    fieldLayout.addComponent(field);

    Label spacer = new Label();
    spacer.setWidth("1em");

    if (formField.getColumnEnd() != null && formField.getRowEnd() != null) {
        addComponent(label, getLabelColumn(formField), getRowStart(formField), getLabelColumn(formField),
                getRowEnd(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField), getColumnEnd(formField),
                getRowEnd(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField), getSpacerColumn(formField),
                getRowEnd(formField));
    } else {
        addComponent(label, getLabelColumn(formField), getRowStart(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField));
    }
    setComponentAlignment(fieldLayout, Alignment.TOP_LEFT);
    setComponentAlignment(label, Alignment.TOP_RIGHT);
    setComponentAlignment(spacer, Alignment.TOP_LEFT);
}

From source file:com.expressui.core.view.form.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout");
    navigationFormLayout.setDebugId(id);
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout");
    previousButtonLayout.setDebugId(id);

    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();//from ww  w  .  ja  v a  2s.com
    previousButtonLayout.addComponent(spaceLabel);

    Button previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout,
                "previousButtonHorizontalLayout");
        previousButtonHorizontalLayout.setDebugId(id);
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout");
    nextButtonLayout.setDebugId(id);
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    Button nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout");
    nextButtonHorizontalLayout.setDebugId(id);
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.expressui.core.view.form.TypedForm.java

License:Open Source License

/**
 * Makes the component collapsible by wrapping it with a layout and button for toggling
 * the component's visibility. This allows the user to expand/collapse the given component in order
 * to free space for viewing other components.
 *
 * @param component         component to show/hide
 * @param useVerticalLayout true if toggle button should be laid out vertically next to animated component
 * @return the newly created layout that contains the toggle button and animated component
 *///from  ww  w.jav a  2  s.c o m
protected Component makeCollapsible(String caption, Component component, boolean useVerticalLayout) {
    formAnimator = new Animator(component);
    formAnimator.setSizeUndefined();

    AbstractOrderedLayout animatorLayout;
    if (useVerticalLayout) {
        animatorLayout = new VerticalLayout();
    } else {
        animatorLayout = new HorizontalLayout();
    }
    setDebugId(animatorLayout, "animatorLayout");

    animatorLayout.setMargin(false, false, false, false);
    animatorLayout.setSpacing(false);

    toggleFormCollapseButton = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            setFormVisible(!isFormVisible());
        }
    });
    toggleFormCollapseButton.setDescription(uiMessageSource.getToolTip("typedForm.toggleSearchForm.toolTip"));
    toggleFormCollapseButton.setIcon(new ThemeResource("../expressui/icons/collapse-icon.png"));
    toggleFormCollapseButton.addStyleName("borderless");

    if (useVerticalLayout) {
        HorizontalLayout toggleFormButtonAndCaption = new HorizontalLayout();
        setDebugId(toggleFormButtonAndCaption, "toggleFormButtonAndCaption");
        toggleFormButtonAndCaption.setSizeUndefined();
        toggleFormButtonAndCaption.addComponent(toggleFormCollapseButton);
        Label label = new Label(caption);
        label.setSizeUndefined();
        toggleFormButtonAndCaption.addComponent(label);
        animatorLayout.addComponent(toggleFormButtonAndCaption);
        animatorLayout.addComponent(formAnimator);
    } else {
        animatorLayout.addComponent(toggleFormCollapseButton);
        animatorLayout.addComponent(formAnimator);
    }

    return animatorLayout;
}

From source file:com.expressui.core.view.menu.MainMenuBar.java

License:Open Source License

@Override
public void postConstruct() {
    super.postConstruct();

    HorizontalLayout menuBarLayout = new HorizontalLayout();
    setDebugId(menuBarLayout, "menuBarLayout");
    menuBarLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    setCompositionRoot(menuBarLayout);//from  w w w  .j a  va2 s.co m

    leftMenuBarRoot = new MenuBarNode();
    rightMenuBarRoot = new MenuBarNode();
}

From source file:com.expressui.core.view.page.DashboardPage.java

License:Open Source License

/**
 * Adds a component to the dashboard./*from  ww w  .  ja  v  a2 s  . c o m*/
 *
 * @param component   component to add
 * @param caption     caption to display above component
 * @param startRow    start row coordinate in Dashboard grid
 * @param startColumn start column coordinate in Dashboard grid
 * @param endRow      end row coordinate in Dashboard grid
 * @param endColumn   end column coordinate in Dashboard grid
 */
public void addComponent(Component component, String caption, int startRow, int startColumn, int endRow,
        int endColumn) {
    if (component instanceof TypedComponent && !((TypedComponent) component).isViewAllowed())
        return;

    Panel panel = new Panel(caption);
    panel.addStyleName(ChameleonTheme.PANEL_BUBBLE);
    HorizontalLayout panelLayout = new HorizontalLayout();
    panelLayout.setSizeUndefined();
    panel.setSizeUndefined();

    setWidthAndHeightIfNotNull(component);

    panel.setContent(panelLayout);
    panelLayout.setMargin(true);
    panelLayout.setSpacing(true);
    panelLayout.addComponent(component);
    int rows = Math.max(rootLayout.getRows() - 1, endRow);
    int columns = Math.max(rootLayout.getColumns() - 1, endColumn);

    if (rootLayout.getRows() < rows) {
        rootLayout.setRows(rows);
    }
    if (rootLayout.getColumns() < columns) {
        rootLayout.setColumns(columns);
    }

    removeComponent(startRow, startColumn);
    rootLayout.addComponent(panel, startColumn - 1, startRow - 1, endColumn - 1, endRow - 1);
}

From source file:com.expressui.core.view.results.CrudResults.java

License:Open Source License

@PostConstruct
@Override//from w  w w  . ja va2 s . c o  m
public void postConstruct() {
    super.postConstruct();

    getResultsTable().setMultiSelect(true);

    HorizontalLayout crudButtons = new HorizontalLayout();
    setDebugId(crudButtons, "crudButtons");
    crudButtons.setMargin(false);
    crudButtons.setSpacing(true);

    newButton = new Button(uiMessageSource.getMessage("crudResults.new"), this, "create");
    newButton.setDescription(uiMessageSource.getToolTip("crudResults.new.toolTip"));
    newButton.setIcon(new ThemeResource("../expressui/icons/16/add.png"));
    newButton.addStyleName("small default");
    crudButtons.addComponent(newButton);

    viewButton = new Button(uiMessageSource.getMessage("crudResults.view"), this, "view");
    viewButton.setDescription(uiMessageSource.getToolTip("crudResults.view.toolTip"));
    viewButton.setIcon(new ThemeResource("../expressui/icons/16/view.png"));
    viewButton.addStyleName("small default");
    crudButtons.addComponent(viewButton);

    editButton = new Button(uiMessageSource.getMessage("crudResults.edit"), this, "edit");
    editButton.setDescription(uiMessageSource.getToolTip("crudResults.edit.toolTip"));
    editButton.setIcon(new ThemeResource("../expressui/icons/16/edit.png"));
    editButton.addStyleName("small default");
    crudButtons.addComponent(editButton);

    deleteButton = new Button(uiMessageSource.getMessage("crudResults.delete"), this, "delete");
    deleteButton.setDescription(uiMessageSource.getToolTip("crudResults.delete.toolTip"));
    deleteButton.setIcon(new ThemeResource("../expressui/icons/16/delete.png"));
    deleteButton.addStyleName("small default");
    crudButtons.addComponent(deleteButton);

    actionContextMenu.addAction("crudResults.view", this, "view");
    actionContextMenu.addAction("crudResults.edit", this, "edit");
    actionContextMenu.addAction("crudResults.delete", this, "delete");

    addSelectionChangedListener(this, "selectionChanged");
    getCrudButtons().addComponent(crudButtons, 0);
    getCrudButtons().setComponentAlignment(crudButtons, Alignment.MIDDLE_LEFT);

    getResultsTable().addListener(new DoubleClickListener());

    addCodePopupButtonIfEnabledForCrudResults();
}

From source file:com.expressui.core.view.results.Results.java

License:Open Source License

@PostConstruct
@Override/*w w w.j  ava  2s  .  c o m*/
public void postConstruct() {
    super.postConstruct();
    resultsFieldSet.setType(getType());
    init(resultsFieldSet);

    resultsTable = new ResultsTable(this);
    configureTable(resultsTable);

    VerticalLayout rootLayout = new VerticalLayout();
    setDebugId(rootLayout, "rootLayout");
    setCompositionRoot(rootLayout);

    crudButtons = new HorizontalLayout();
    HorizontalLayout navigationLine = createNavigationLine();
    addComponent(crudButtons);
    addComponent(navigationLine);

    addComponent(resultsTable);

    rootLayout.setMargin(true);

    setSizeUndefined();

    labelRegistry.registerLabels(resultsFieldSet);
}