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:be.rvponp.build.CommitViewerUI.java

License:Apache License

private HorizontalLayout createBuildDateLayout() {
    HorizontalLayout buildDateLayout = new HorizontalLayout();
    Label labelBuildDate = new Label("Build date: " + getBuildDate());
    buildDateLayout.addComponent(labelBuildDate);
    labelBuildDate.setSizeUndefined();// www.jav a2s.co  m
    buildDateLayout.setSizeUndefined();
    return buildDateLayout;
}

From source file:be.rvponp.build.CommitViewerUI.java

License:Apache License

private HorizontalLayout createFiltersLayout(Table table, VerticalLayout files, VerticalLayout filesLayout) {
    HorizontalLayout filtersLayout = new HorizontalLayout();

    FormLayout formReleaseLayout = new FormLayout();
    fromVersion = new ComboBox("From release");
    toVersion = new ComboBox("To release");
    filtersLayout.addComponent(formReleaseLayout);
    formReleaseLayout.setDescription("formReleaseLayout");

    formReleaseLayout.addComponent(fromVersion);
    formReleaseLayout.addComponent(toVersion);
    formReleaseLayout.setSizeUndefined();

    //        FormLayout jiraTreeLayout = new FormLayout();
    final Tree tree = createTreeComponent();
    //        jiraTreeLayout.addComponent(tree);
    filtersLayout.addComponent(tree);// www .j  a  v  a2  s. c  o m

    CheckBox jiraParsing = new CheckBox("Jira Parsing");
    jiraParsing.setValue(true);
    //        filtersLayout.addComponent(jiraParsing);

    FormLayout buttonsLayout = new FormLayout();
    CompareButton compareButton = new CompareButton(fromVersion, toVersion, table, files, jiraParsing, tree,
            filesLayout);
    RefreshButton refreshButton = new RefreshButton(this, fromVersion, toVersion);
    //        refreshButton.buttonClick(null);
    //        compareButton.buttonClick(null);
    buttonsLayout.addComponent(refreshButton);
    buttonsLayout.addComponent(compareButton);
    buttonsLayout.setSizeUndefined();
    filtersLayout.addComponent(buttonsLayout);
    filtersLayout.setSizeUndefined();
    return filtersLayout;
}

From source file:biz.eelis.translation.EntriesFlowlet.java

License:Apache License

@Override
public void initialize() {
    final List<FieldDescriptor> fieldDescriptors = TranslationSiteFields.getFieldDescriptors(Entry.class);

    final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>();

    filterDefinitions.add(new FilterDescriptor("basename", "basename", "Basename", new TextField(), 200, "like",
            String.class, ""));

    filterDefinitions.add(new FilterDescriptor("language", "language", "Language", new TextField(), 30, "=",
            String.class, ""));

    filterDefinitions.add(/*from  w w  w  . j  a  va2  s .  c  o m*/
            new FilterDescriptor("country", "country", "Country", new TextField(), 30, "=", String.class, ""));

    filterDefinitions
            .add(new FilterDescriptor("key", "key", "Key", new TextField(), 200, "like", String.class, ""));

    final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class);
    container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000,
            new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true },
            "entryId");

    ContainerUtil.addContainerProperties(container, fieldDescriptors);

    final GridLayout gridLayout = new GridLayout(1, 2);
    gridLayout.setSizeFull();
    gridLayout.setMargin(false);
    gridLayout.setSpacing(true);
    gridLayout.setRowExpandRatio(1, 1f);
    setViewContent(gridLayout);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setSizeUndefined();
    gridLayout.addComponent(buttonLayout, 0, 0);

    final Table table = new FormattingTable();
    grid = new Grid(table, container);
    grid.setFields(fieldDescriptors);
    grid.setFilters(filterDefinitions);

    table.setColumnCollapsed("entryId", true);
    table.setColumnCollapsed("path", true);
    table.setColumnCollapsed("created", true);
    table.setColumnCollapsed("modified", true);
    gridLayout.addComponent(grid, 0, 1);

    final Button addButton = getSite().getButton("add");
    buttonLayout.addComponent(addButton);
    addButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Entry entry = new Entry();
            entry.setCreated(new Date());
            entry.setModified(entry.getCreated());
            entry.setOwner((Company) getSite().getSiteContext().getObject(Company.class));
            final EntryFlowlet entryView = getViewSheet().forward(EntryFlowlet.class);
            entryView.edit(entry, true);
        }
    });

    final Button editButton = getSite().getButton("edit");
    buttonLayout.addComponent(editButton);
    editButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Entry entity = container.getEntity(grid.getSelectedItemId());
            final EntryFlowlet entryView = getViewSheet().forward(EntryFlowlet.class);
            entryView.edit(entity, false);
        }
    });

    final Button removeButton = getSite().getButton("remove");
    buttonLayout.addComponent(removeButton);
    removeButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            container.removeItem(grid.getSelectedItemId());
            container.commit();
        }
    });

    final Company company = getSite().getSiteContext().getObject(Company.class);
    container.removeDefaultFilters();
    container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId()));
    grid.refresh();
}

From source file:biz.eelis.translation.EntryFlowlet.java

License:Apache License

@Override
public void initialize() {
    entityManager = getSite().getSiteContext().getObject(EntityManager.class);

    final GridLayout gridLayout = new GridLayout(1, 3);
    gridLayout.setSizeFull();/*  w w w.j a va  2s.  c om*/
    gridLayout.setMargin(false);
    gridLayout.setSpacing(true);
    gridLayout.setRowExpandRatio(2, 1f);
    setViewContent(gridLayout);

    entryEditor = new ValidatingEditor(TranslationSiteFields.getFieldDescriptors(Entry.class));
    entryEditor.setCaption("Entry");
    entryEditor.addListener((ValidatingEditorStateListener) this);
    gridLayout.addComponent(entryEditor, 0, 0);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    gridLayout.addComponent(buttonLayout, 0, 1);

    saveButton = new Button("Save");
    saveButton.setImmediate(true);
    buttonLayout.addComponent(saveButton);
    saveButton.addListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            entryEditor.commit();
            entityManager.getTransaction().begin();
            try {
                entity = entityManager.merge(entity);
                entity.setAuthor(getSite().getSecurityProvider().getUser());
                entity.setModified(new Date());
                entityManager.persist(entity);
                entityManager.getTransaction().commit();
                entityManager.detach(entity);
                entryEditor.discard();
                container.refresh();
            } catch (final Throwable t) {
                if (entityManager.getTransaction().isActive()) {
                    entityManager.getTransaction().rollback();
                }
                throw new RuntimeException("Failed to save entity: " + entity, t);
            }
        }
    });

    discardButton = new Button("Discard");
    discardButton.setImmediate(true);
    buttonLayout.addComponent(discardButton);
    discardButton.addListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            entryEditor.discard();
        }
    });

    final List<FieldDescriptor> fieldDescriptors = TranslationSiteFields.getFieldDescriptors(Entry.class);

    final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>();

    container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000,
            new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true },
            "entryId");
    container.getQueryView().getQueryDefinition().setMaxQuerySize(1);

    ContainerUtil.addContainerProperties(container, fieldDescriptors);

    final Table table = new FormattingTable();
    final Grid grid = new Grid(table, container);
    grid.setCaption("All Translations");
    grid.setSizeFull();
    grid.setFields(fieldDescriptors);
    grid.setFilters(filterDefinitions);

    table.setColumnCollapsed("entryId", true);
    table.setColumnCollapsed("path", true);
    table.setColumnCollapsed("created", true);
    table.setColumnCollapsed("modified", true);
    gridLayout.addComponent(grid, 0, 2);

}

From source file:br.com.anteros.mobileserver.app.form.ActionForm.java

License:Apache License

private void createButtons() {
    buttons = new HorizontalLayout();
    buttons.setSpacing(true);/* www  .j a  va 2s  .  co m*/
    buttons.setWidth("715px");

    btnOk = new Button("Ok", this);
    btnOk.addStyleName("default");
    btnOk.setIcon(new ThemeResource("icons/16/ok.png"));
    buttons.addComponent(btnOk);
    buttons.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);
    buttons.setExpandRatio(btnOk, 1);

    btnCancel = new Button("Cancela", this);
    btnCancel.setIcon(new ThemeResource("icons/16/cancel.png"));
    buttons.addComponent(btnCancel);
    buttons.setComponentAlignment(btnCancel, Alignment.MIDDLE_RIGHT);

    actionForm.getFooter().addComponent(buttons);
}

From source file:br.com.anteros.mobileserver.app.form.ApplicationForm.java

License:Apache License

private void createButtons() {
    buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*  w ww.  j  a v a  2 s .com*/
    buttons.setWidth("640px");

    btnOk = new Button("Ok", this);
    btnOk.addStyleName("default");
    btnOk.setIcon(new ThemeResource("icons/16/ok.png"));
    buttons.addComponent(btnOk);
    buttons.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);
    buttons.setExpandRatio(btnOk, 1);

    btnCancel = new Button("Cancela", this);
    btnCancel.setIcon(new ThemeResource("icons/16/cancel.png"));
    buttons.addComponent(btnCancel);
    buttons.setComponentAlignment(btnCancel, Alignment.MIDDLE_RIGHT);

    applicationForm.getFooter().addComponent(buttons);
}

From source file:br.com.anteros.mobileserver.app.form.ExecuteForm.java

License:Apache License

private void createForm() {
    if (actionSynchronism.getItems() != null) {

        Label lblTitle = new Label("Parmetros de execuo Ao " + actionSynchronism.getName() + " ("
                + actionSynchronism.getId() + ")");
        lblTitle.setStyleName("h2 color");
        lblTitle.setImmediate(false);/*from w  w w  .  j  a  v a2  s.  c  o  m*/
        addComponent(lblTitle);
        setComponentAlignment(lblTitle, Alignment.TOP_LEFT);

        Synchronism synchronism = actionSynchronism.getItems().iterator().next();
        executeForm = new Form();
        fields.clear();
        ParameterSynchronism[] parameters = null;
        if (synchronism instanceof TableSynchronism)
            parameters = ((TableSynchronism) synchronism).getParameters();
        if (synchronism instanceof ProcedureSynchronism)
            parameters = ((ProcedureSynchronism) synchronism).getParameters();
        for (ParameterSynchronism param : parameters) {
            if (param.getParameterType().intValue() == ParameterSynchronism.INPUT
                    || param.getParameterType().intValue() == ParameterSynchronism.SUBSTITUITION) {
                String value = FieldTypes.getFieldTypes().get(param.getParameterDataType().intValue() + "");
                if (value != null) {
                    if (FieldTypes.UNKNOW.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("400px");
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.INTEGER.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.VARCHAR.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("400px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.FLOAT.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.NUMERIC.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.DATE.equalsIgnoreCase(value)) {
                        PopupDateField field = new PopupDateField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        field.setResolution(PopupDateField.RESOLUTION_DAY);
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.TIME.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    } else if (FieldTypes.TIMESTAMP.equalsIgnoreCase(value)) {
                        TextField field = new TextField();
                        field.setCaption(param.getName());
                        field.setWidth("150px");
                        field.setRequired(true);
                        field.setRequiredError("Informe o valor para o campo " + param.getName());
                        executeForm.addField(param.getName(), field);
                        fields.add(field);
                    }
                }
            }
        }

        panelForm = new Panel();
        panelForm.setHeight("100%");
        panelForm.setWidth("100%");
        panelForm.setScrollable(true);
        addComponent(panelForm);
        executeForm.setImmediate(true);
        executeForm.setWidth("100%");
        panelForm.addComponent(executeForm);

        executeCommit = new CheckBox("Executar COMMIT no final do processo?");
        addComponent(executeCommit);

        HorizontalLayout buttons = new HorizontalLayout();
        buttons.setImmediate(false);
        buttons.setWidth("600px");
        buttons.setHeight("-1px");
        buttons.setMargin(false);
        buttons.setSpacing(true);
        addComponent(buttons);

        btnExecute = new Button();
        btnExecute.setCaption("Executar");
        btnExecute.setIcon(new ThemeResource("icons/16/run.png"));
        btnExecute.addListener(clickListener);
        buttons.addComponent(btnExecute);
        buttons.setComponentAlignment(btnExecute, Alignment.MIDDLE_RIGHT);
        buttons.setExpandRatio(btnExecute, 1);

        btnClose = new Button();
        btnClose.setCaption("Fechar");
        btnClose.setIcon(new ThemeResource("icons/16/doorOut.png"));
        btnClose.addListener(clickListener);
        buttons.addComponent(btnClose);

        buttons.setComponentAlignment(btnClose, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(true, false, true, false);
        addComponent(buttons);

        pageControl = new TabSheet();
        pageControl.setImmediate(true);
        pageControl.setWidth("100.0%");
        pageControl.setHeight("100.0%");

        textPanel = new Panel();
        textPanel.setImmediate(true);
        textPanel.setWidth("100%");
        textPanel.setHeight("100%");
        pageControl.addTab(textPanel, "Resultado", null);
        addComponent(pageControl);
        setExpandRatio(pageControl, 1.0f);
    }
}

From source file:br.com.anteros.mobileserver.app.form.FieldForm.java

License:Apache License

private void createButtons() {
    buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*from   w w  w .  j av a  2  s  . c  o m*/
    buttons.setWidth("640px");

    btnOk = new Button("Ok", this);
    btnOk.addStyleName("default");
    btnOk.setIcon(new ThemeResource("icons/16/ok.png"));
    buttons.addComponent(btnOk);
    buttons.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);
    buttons.setExpandRatio(btnOk, 1);

    btnCancel = new Button("Cancela", this);
    btnCancel.setIcon(new ThemeResource("icons/16/cancel.png"));
    buttons.addComponent(btnCancel);
    buttons.setComponentAlignment(btnCancel, Alignment.MIDDLE_RIGHT);
    fieldForm.getFooter().addComponent(buttons);
}

From source file:br.com.anteros.mobileserver.app.form.ParameterForm.java

License:Apache License

private void createButtons() {
    buttons = new HorizontalLayout();
    buttons.setSpacing(true);//  w w w.jav  a 2  s.  com
    buttons.setWidth("640px");

    btnOk = new Button("Ok", this);
    btnOk.addStyleName("default");
    btnOk.setIcon(new ThemeResource("icons/16/ok.png"));
    buttons.addComponent(btnOk);
    buttons.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);
    buttons.setExpandRatio(btnOk, 1);

    btnCancel = new Button("Cancela", this);
    btnCancel.setIcon(new ThemeResource("icons/16/cancel.png"));
    buttons.addComponent(btnCancel);
    buttons.setComponentAlignment(btnCancel, Alignment.MIDDLE_RIGHT);

    parameterForm.getFooter().addComponent(buttons);
}

From source file:br.com.anteros.mobileserver.app.form.ProcedureForm.java

License:Apache License

private void createButtons() {
    buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*  w  w w .  jav  a  2  s.  co  m*/
    buttons.setWidth("100%");

    btnAddParameter = new Button("Adicionar", this);
    btnAddParameter.setIcon(new ThemeResource("icons/16/parameterAdd.png"));
    buttons.addComponent(btnAddParameter);
    buttons.setComponentAlignment(btnAddParameter, Alignment.MIDDLE_LEFT);

    btnRemoveParameter = new Button("Remover", this);
    btnRemoveParameter.setIcon(new ThemeResource("icons/16/parameterRemove.png"));
    buttons.addComponent(btnRemoveParameter);
    buttons.setComponentAlignment(btnRemoveParameter, Alignment.MIDDLE_LEFT);

    btnEditParameter = new Button("Editar", this);
    btnEditParameter.setIcon(new ThemeResource("icons/16/parameterEdit.png"));
    buttons.addComponent(btnEditParameter);
    buttons.setComponentAlignment(btnEditParameter, Alignment.MIDDLE_LEFT);

    btnImport = new Button("Importar parmetros", this);
    btnImport.setIcon(new ThemeResource("icons/16/import.png"));
    buttons.addComponent(btnImport);
    buttons.setComponentAlignment(btnImport, Alignment.MIDDLE_LEFT);

    btnMoveUp = new Button("Mover p/cima", this);
    btnMoveUp.setIcon(new ThemeResource("icons/16/moveUp.png"));
    buttons.addComponent(btnMoveUp);
    buttons.setComponentAlignment(btnMoveUp, Alignment.MIDDLE_LEFT);

    btnMoveDown = new Button("Mover p/baixo", this);
    btnMoveDown.setIcon(new ThemeResource("icons/16/moveDown.png"));
    buttons.addComponent(btnMoveDown);
    buttons.setComponentAlignment(btnMoveDown, Alignment.MIDDLE_LEFT);

    btnOk = new Button("Ok", this);
    btnOk.addStyleName("default");
    btnOk.setIcon(new ThemeResource("icons/16/ok.png"));
    buttons.addComponent(btnOk);
    buttons.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT);
    buttons.setExpandRatio(btnOk, 1);

    btnCancel = new Button("Cancela", this);
    btnCancel.setIcon(new ThemeResource("icons/16/cancel.png"));
    buttons.addComponent(btnCancel);
    buttons.setComponentAlignment(btnCancel, Alignment.MIDDLE_RIGHT);
    buttons.setMargin(true, false, true, false);
}