Example usage for com.vaadin.ui HorizontalLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:org.lunifera.example.vaadin.osgi.bootstrap.push.SimplePushUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    HorizontalLayout layout = new HorizontalLayout();
    setContent(layout);/*from  ww  w. ja v  a  2s  .  co m*/
    layout.setStyleName(Reindeer.LAYOUT_BLUE);
    layout.setSizeFull();

    label = new Label();
    label.setContentMode(ContentMode.HTML);
    layout.addComponent(label);
    layout.setComponentAlignment(label, Alignment.TOP_CENTER);

    new Thread(new Runnable() {
        int counter = 0;

        @Override
        public void run() {
            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }
                counter++;

                label.getUI().access(new Runnable() {
                    @Override
                    public void run() {
                        label.setValue(
                                String.format("<h1>Running for %s seconds</h1>", Integer.toString(counter)));
                    }
                });
            }
        }
    }).start();

}

From source file:org.lunifera.example.vaadin.osgi.bootstrap.simple.SimpleUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    HorizontalLayout layout = new HorizontalLayout();
    setContent(layout);//ww  w  .j a v a2s .  c o m
    layout.setStyleName(Reindeer.LAYOUT_BLUE);
    layout.setSizeFull();

    Label label = new Label();
    label.setValue("<h1>Simple OSGi integration</h1>");
    label.setContentMode(ContentMode.HTML);
    layout.addComponent(label);
    layout.setComponentAlignment(label, Alignment.TOP_CENTER);
}

From source file:org.lunifera.examples.ecview.vaadinui.web.PersonUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    currentPerson = persons.get(0);//from ww  w  . j a  va 2  s  . c om

    registerButtonCallbacks();

    HorizontalLayout layout = new HorizontalLayout();
    setContent(layout);
    layout.setStyleName(Reindeer.LAYOUT_BLUE);
    layout.setSizeFull();

    YView yView = findViewModel("org.lunifera.examples.ecview.uimodels.PersonView");
    if (yView == null) {
        Notification.show("PersonView could not be found!", Type.ERROR_MESSAGE);
        return;
    }

    // render the Vaadin UI
    VaadinRenderer renderer = new VaadinRenderer();
    try {
        viewContext = renderer.render(layout, yView, null);
        viewContext.setBean("countryService", countryService);
        viewContext.setBean("ds", currentPerson);
        viewContext.setBean("buttonCallback", buttonCallback);

    } catch (ContextException e) {
        e.printStackTrace();
    }
}

From source file:org.lunifera.examples.kwiee.erp.module.core.presentation.web.vaadin.ui.KwieeUINavigator.java

License:Open Source License

@SuppressWarnings("serial")
protected void createTasksTable() {

    // create layout
    VerticalLayout tableArea = new VerticalLayout();
    tableArea.setSizeFull();//from   w ww  .j av  a2s.  c om
    tabSheet.addTab(tableArea, "Tasks");

    // create table -> expand 1.0
    taskTable = new Table();
    tableArea.addComponent(taskTable);
    tableArea.setExpandRatio(taskTable, 1.0f);
    taskTable.setSizeFull();
    taskTable.setImmediate(true);
    taskTable.setBuffered(false);
    taskTable.setSelectable(true);
    taskTable.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            showTask((Task) event.getProperty().getValue());
        }
    });

    refreshTasks();

    // create button -> 28px
    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSizeFull();
    buttonBar.setMargin(true);
    buttonBar.setSpacing(true);
    buttonBar.setHeight("48px");
    tableArea.addComponent(buttonBar);

    refreshTasksButton = new Button("Refresh");
    buttonBar.addComponent(refreshTasksButton);
    buttonBar.setComponentAlignment(refreshTasksButton, Alignment.MIDDLE_LEFT);
    refreshTasksButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            refreshTasks();
        }
    });
}

From source file:org.lunifera.sharky.m2m.webclient.SimplePushUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    HorizontalLayout layout = new HorizontalLayout();
    setContent(layout);//w  w  w .j av a2 s .com
    layout.setStyleName(Reindeer.LAYOUT_BLUE);
    layout.setSizeFull();

    label = new Label();
    label.setContentMode(ContentMode.HTML);
    layout.addComponent(label);
    layout.setComponentAlignment(label, Alignment.TOP_CENTER);

    new Thread(new Runnable() {
        int counter = 0;

        @Override
        public void run() {
            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }
                counter++;

                label.getUI().access(new Runnable() {
                    @Override
                    public void run() {
                        label.setValue(
                                String.format("<h1>Running for %s seconds</h1>", Integer.toString(counter)));
                    }
                });
            }
        }
    }).start();
}

From source file:org.opencms.ui.apps.CmsFileExplorer.java

License:Open Source License

/**
 * @see org.opencms.ui.apps.I_CmsWorkplaceApp#initUI(org.opencms.ui.apps.I_CmsAppUIContext)
 *///from  w w w.  j  a  v a 2 s .  c o m
public void initUI(I_CmsAppUIContext context) {

    m_appContext = context;
    m_appContext.setMenuDialogContext(
            new CmsExplorerDialogContext(ContextType.appToolbar, m_fileTable, this, null));
    HorizontalSplitPanel sp = new HorizontalSplitPanel();
    sp.setSizeFull();
    sp.setFirstComponent(m_fileTree);
    CmsFileExplorerSettings settings;
    try {
        settings = OpenCms.getWorkplaceAppManager().getAppSettings(A_CmsUI.getCmsObject(),
                CmsFileExplorerSettings.class);

        m_fileTable.setTableState(settings);
    } catch (Exception e) {
        LOG.error("Error while reading file explorer settings from user.", e);
    }
    sp.setSecondComponent(m_fileTable);

    sp.setSplitPosition(LAYOUT_SPLIT_POSITION, Unit.PIXELS);

    context.setAppContent(sp);
    context.showInfoArea(true);
    HorizontalLayout inf = new HorizontalLayout();
    inf.setSizeFull();
    inf.setSpacing(true);
    inf.setMargin(true);
    m_siteSelector.setWidth("379px");
    inf.addComponent(m_siteSelector);
    CssLayout crumbWrapper = new CssLayout();
    crumbWrapper.setSizeFull();
    crumbWrapper.setPrimaryStyleName(OpenCmsTheme.CRUMB_WRAPPER);
    crumbWrapper.addComponent(m_crumbs);

    m_infoPath.setWidth("100%");
    crumbWrapper.addComponent(m_infoPath);
    inf.addComponent(crumbWrapper);
    inf.setExpandRatio(crumbWrapper, 1);

    m_searchField.setWidth("200px");
    inf.addComponent(m_searchField);
    context.setAppInfo(inf);

    initToolbarButtons(context);
    m_fileTable.updateColumnWidths(A_CmsUI.get().getPage().getBrowserWindowWidth() - LAYOUT_SPLIT_POSITION);
}

From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditorOptions.java

License:Open Source License

/**
 * Creates the upper right component of the options grid.
 * Creation includes the initialization of {@link #m_filePathField}.
 *
 * @return the upper right component in the options grid.
 *//* ww  w  . ja va 2s  . c om*/
private Component createUpperRightComponent() {

    HorizontalLayout upperRight = new HorizontalLayout();
    upperRight.setSizeFull();

    FormLayout fileNameDisplay = new FormLayout();
    fileNameDisplay.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    fileNameDisplay.setSizeFull();

    m_filePathField = new TextField();
    m_filePathField.setWidth("100%");
    m_filePathField.setEnabled(true);
    m_filePathField.setReadOnly(true);

    fileNameDisplay.addComponent(m_filePathField);
    fileNameDisplay.setSpacing(true);

    FormLayout filePathDisplay = new FormLayout();
    filePathDisplay.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    filePathDisplay.setSizeFull();
    filePathDisplay.addComponent(m_filePathField);
    filePathDisplay.setSpacing(true);

    upperRight.addComponent(filePathDisplay);
    upperRight.setExpandRatio(filePathDisplay, 2f);

    HorizontalLayout placeHolder = new HorizontalLayout();
    placeHolder.setWidth(CmsMessageBundleEditorTypes.OPTION_COLUMN_WIDTH_PX);
    upperRight.addComponent(placeHolder);

    return upperRight;
}

From source file:org.openeos.services.ui.vaadin.internal.abstractform.UIVaadinButtonField.java

License:Apache License

public UIVaadinButtonField(String caption, UIButtonController buttonController, UIApplicationImpl application) {

    this.buttonController = buttonController;
    this.application = application;
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setMargin(false);//from   w ww . j  a  v  a2s  .c  o m
    mainLayout.setSpacing(false);
    mainLayout.setSizeFull();

    textField = new TextField(caption);
    mainLayout.addComponent(textField);

    button = new Button("...", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            UIVaadinButtonField.this.buttonController.onClick(UIVaadinButtonField.this.application, value);
        }
    });
    ;
    mainLayout.addComponent(button);

    setCompositionRoot(mainLayout);
}

From source file:org.openeos.services.ui.vaadin.internal.abstractform.UIVaadinFormToolkit.java

License:Apache License

@Override
protected AbstractComponent internalBuildField(org.abstractform.core.Field field,
        Map<String, Object> extraObjects) {
    AbstractComponent ret;//from  w  ww.  j  av a2  s. co m
    if (BFUIButton.TYPE_UI_BUTTON.equals(field.getType())) {
        UIVaadinButtonField button = new UIVaadinButtonField(field.getName(),
                (UIButtonController) field.getExtra(BFUIButton.EXTRA_UI_BUTTON_CONTROLLER),
                (UIApplicationImpl) extraObjects.get(EXTRA_OBJECT_APPLICATION));
        ret = button;
    } else if (BFUITable.TYPE_UITABLE.equals(field.getType())) {
        final Table table = (Table) buildTableField(field, extraObjects);
        HorizontalLayout mainLayout = new HorizontalLayout();
        mainLayout.setSizeFull();
        //mainLayout.setSizeFull();
        mainLayout.setMargin(false);
        mainLayout.setSpacing(true);
        mainLayout.addComponent(table);

        VerticalLayout buttonLayout = new VerticalLayout();
        buttonLayout.setMargin(false);
        buttonLayout.setSpacing(true);
        //buttonLayout.setSizeFull();

        final UITableController controller = (UITableController) field
                .getExtra(BFUITable.EXTRA_TABLE_CONTROLLER);
        final UIApplication application = (UIApplication) extraObjects.get(EXTRA_OBJECT_APPLICATION);

        Button buttonNew = new Button("N", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                controller.onNew(application,
                        ((UITableContainer) table.getContainerDataSource()).getFormInstance(),
                        ((TableContainer) table.getContainerDataSource()).getValues());
            }
        });
        buttonNew.setWidth("100%");
        buttonLayout.addComponent(buttonNew);
        Button buttonEdit = new Button("E", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                controller.onEdit(application,
                        ((UITableContainer) table.getContainerDataSource()).getFormInstance(),
                        ((TableContainer) table.getContainerDataSource()).getValues(), table.getValue());
            }
        });
        buttonEdit.setWidth("100%");
        buttonLayout.addComponent(buttonEdit);
        Button buttonDelete = new Button("D", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                controller.onDelete(application,
                        ((UITableContainer) table.getContainerDataSource()).getFormInstance(),
                        ((TableContainer) table.getContainerDataSource()).getValues(), table.getValue());
            }
        });
        buttonDelete.setWidth("100%");
        buttonLayout.addComponent(buttonDelete);

        buttonLayout.setWidth("50px");

        mainLayout.addComponent(buttonLayout);
        mainLayout.setExpandRatio(table, 1.0f);
        ret = mainLayout;

    } else {
        ret = super.internalBuildField(field, extraObjects);
        if (field.getType().equals(Field.TYPE_NUMERIC)) {
            //TODO This normally can be many types of classes and can be with data conversion in binding tier
            ((TextField) ret).setPropertyDataSource(new ObjectProperty<BigDecimal>(null, BigDecimal.class));
        }
    }
    return ret;
}

From source file:org.openeos.services.ui.vaadin.internal.DefaultVaadinERPWindowFactory.java

License:Apache License

@Override
public Component createWindowComponent(IWindowDefinition window,
        final UIApplication<IUnoVaadinApplication> application) {

    final VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();/* w ww  .  ja  v a  2  s . c  o  m*/

    verticalLayout.setMargin(false);

    final VaadinWindow vaadinWindow = createWindowImpl(window, application);
    Component toolbar = createToolBar(vaadinWindow);
    Component entityActionPanel = createEntityActionPanel(vaadinWindow, application);
    if (entityActionPanel != null) {
        verticalLayout.addComponent(toolbar);
        HorizontalLayout horizontal = new HorizontalLayout();
        horizontal.addComponent(vaadinWindow.getComponent());
        horizontal.addComponent(entityActionPanel);
        horizontal.setSizeFull();
        horizontal.setExpandRatio(vaadinWindow.getComponent(), 1.0f);
        verticalLayout.addComponent(horizontal);
        verticalLayout.setExpandRatio(toolbar, 0);
        verticalLayout.setExpandRatio(horizontal, 1);
    } else {
        verticalLayout.addComponent(toolbar);
        verticalLayout.addComponent(vaadinWindow.getComponent());
        verticalLayout.setExpandRatio(toolbar, 0);
        verticalLayout.setExpandRatio(vaadinWindow.getComponent(), 1);
    }

    application.getConcreteApplication().addCloseTabListener(new CloseTabListener() {
        @Override
        public boolean closeTab(final TabSheet tabSheet, final Component c) {
            if (c == verticalLayout && vaadinWindow.getActiveTab().isModified()) {
                application.showConfirmation("The changes will be lost, are you sure?",
                        new ConfirmationCallback() {

                            @Override
                            public void onCloseConfirmation(boolean accepted) {
                                if (accepted) {
                                    tabSheet.removeComponent(c);
                                    removeListener();
                                }
                            }
                        });
                return true;
            }
            return false;
        }

        private void removeListener() {
            application.getConcreteApplication().removeCloseTabListener(this);
        }

    });

    return verticalLayout;

}