Example usage for com.vaadin.ui VerticalLayout setWidth

List of usage examples for com.vaadin.ui VerticalLayout setWidth

Introduction

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

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:by.bigvova.views.HomeView.java

License:Apache License

public HomeView() {
    setSpacing(true);//  ww w .ja v a  2 s  .  c  o  m
    setMargin(true);
    setSizeFull();

    Label header = new Label("   -=FoodNote=-");
    header.addStyleName(ValoTheme.LABEL_H1);
    addComponent(header);
    Label body = new Label(
            "<h3> ?? ? ? <b>CRUD</b> ?  ? <b>enterprise</b> ."
                    + "   ?  ?? ,    ?  ? .</h3>"
                    + "? ?:" + "<ul>"
                    + "<li>?  ?  <b>Spring Boot</b>, ? ? - propertie .</li>"
                    + "<li>? ?  ?? ? ???   <b>Repository</b> - <b>Spring Data JPA</b>, <b>Hibernate</b> (<b>JdbcTemplate</b>  ?).</li>"
                    + "<li> ?? - ?? ,  :</li>"
                    + "<ul>" + "<li>  - <b>PostgreSQL</b></li>"
                    + "<li>connection pool - <b>HikariCP</b></li>" + "</ul>"
                    + "<li>? - <b>EhCache</b>.</li>"
                    + "<li> ? -  <b>EventBus</b>, ? <b>Google Guava</b>.</li>"
                    + "<li>?,  - <b>Spring Security</b>:</li>"
                    + "<ul>"
                    + "<li>    , ? <b>UserDetails</b></li>"
                    + "<li> ??   ? <b>BCrypt</b></li>"
                    + "<li>  <b>Remember Me</b> ??</li>"
                    + "</ul>" + "<li>? - <b>JUnit4</b></li>"
                    + "<li> - <b>slf4j</b>, <b>logback</b></li>"
                    + "<li>Front-end - <b>Vaadin framework</b>, <b>GWT</b></li>"
                    + "<li>   <b>Docker</b>      ? <b>Ubuntu Server 14.04</b></li>"
                    + "</ul>"
                    + "<p>? Spring Boot - Vaadin ?? : <a href=\"https://github.com/peholmst/vaadin4spring\">vaadin4spring</a></p>"
                    + "<p> ? <a href=\"https://github.com/BigVOVA/FoodNote\">github.com/BigVOVA/FoodNote</a></p>");
    body.setContentMode(ContentMode.HTML);
    VerticalLayout bodyLayout = new VerticalLayout();
    bodyLayout.setWidth(100, Unit.PERCENTAGE);
    bodyLayout.setMargin(new MarginInfo(false, true, false, true));
    bodyLayout.addComponent(body);
    Panel panel = new Panel();
    panel.setSizeFull();
    panel.setContent(bodyLayout);
    addComponent(panel);
    setExpandRatio(panel, 1);
}

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

License:Open Source License

private void addFieldImpl(FormField formField) {
    VerticalLayout fieldLayout = new VerticalLayout();
    fieldLayout.setWidth(SIZE_UNDEFINED, Sizeable.UNITS_PERCENTAGE);
    String id = StringUtil.generateDebugId("e", this, fieldLayout, "fieldLayout");
    fieldLayout.setDebugId(id);/*w w  w  . j  av a 2s.co  m*/
    fieldLayout.addComponent(formField.getFieldLabel());
    fieldLayout.addComponent(formField.getField());
    if (formField.getColumnEnd() != null && formField.getRowEnd() != null) {
        addComponent(fieldLayout, formField.getColumnStart() - 1, formField.getRowStart() - 1,
                formField.getColumnEnd() - 1, formField.getRowEnd() - 1);
    } else {
        addComponent(fieldLayout, formField.getColumnStart() - 1, formField.getRowStart() - 1);
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.admin.agentoperations.pagemode.AgentOperationsOverviewPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override//w w w . ja  va2s.c om
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    LabelFactory.createHeader2Label(content, ADMIN_AGENT_OPERATION);

    final ComboBox targetSelect = new ComboBox(TARGET, Arrays.asList(DataAgentTarget.values()));
    targetSelect.setId(ViewAction.START_AGENT_BUTTON + TARGET2);
    content.addComponent(targetSelect);
    content.setExpandRatio(targetSelect, ContentRatio.SMALL2);

    final ComboBox operationSelect = new ComboBox(OPERATION, Arrays.asList(DataAgentOperation.values()));
    operationSelect.setId(ViewAction.START_AGENT_BUTTON + OPERATION2);
    content.addComponent(operationSelect);
    content.setExpandRatio(operationSelect, ContentRatio.SMALL2);

    final Button startAgentButton = new Button(START,
            new StartAgentClickListener(targetSelect, operationSelect, agentContainer));
    startAgentButton.setId(ViewAction.START_AGENT_BUTTON.name());
    startAgentButton.setIcon(FontAwesome.CROSSHAIRS);
    content.addComponent(startAgentButton);
    content.setExpandRatio(startAgentButton, ContentRatio.SMALL3);

    content.setSizeFull();
    content.setMargin(false);
    content.setSpacing(true);

    content.setWidth(100, Unit.PERCENTAGE);
    content.setHeight(100, Unit.PERCENTAGE);

    return content;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.AbstractView.java

License:Apache License

@Override
public final void enter(final ViewChangeEvent event) {
    try {//from w  w w . java2 s .com

        final String parameters = event.getParameters();
        for (final PageModeContentFactory pageModeContentFactory : pageModeContentFactoryMap.values()) {
            if (pageModeContentFactory.matches(pageName, parameters)) {
                getPanel()
                        .setContent(pageModeContentFactory.createContent(parameters, getBarmenu(), getPanel()));
                return;
            }
        }
    } catch (final AccessDeniedException e) {
        LOGGER.warn("Access denided:" + pageName, e);
        final VerticalLayout panelContent = new VerticalLayout();
        panelContent.setMargin(true);
        panelContent.setWidth(100, Unit.PERCENTAGE);
        panelContent.setHeight(100, Unit.PERCENTAGE);
        LabelFactory.createHeader2Label(panelContent, "Access denided:" + pageName);
        getPanel().setContent(panelContent);
        getPanel().setCaption("Access denied");
    }
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.AbstractView.java

License:Apache License

/**
 * Creates the basic layout with panel and footer.
 *
 * @param panelName/*from w w  w . jav a 2s  . com*/
 *            the panel name
 */
protected final void createBasicLayoutWithPanelAndFooter(final String panelName) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeight(100, Unit.PERCENTAGE);

    final VerticalLayout pageModeContent = new VerticalLayout();
    pageModeContent.setMargin(true);
    pageModeContent.setSpacing(true);
    pageModeContent.setWidth(100, Unit.PERCENTAGE);
    pageModeContent.setHeight(100, Unit.PERCENTAGE);

    layout.addComponent(pageModeContent);

    final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png");

    final Image ciaLogoImage = new Image(null, ciaLogoResource);

    final HorizontalLayout topHeader = new HorizontalLayout();

    topHeader.addComponent(ciaLogoImage);
    ciaLogoImage.setWidth("75px");
    ciaLogoImage.setHeight("75px");
    topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT);
    topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL);

    final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout();

    final Label titleLabel = new Label("Citizen Intelligence Agency");
    titleLabel.setStyleName("Header");
    topTitleHeadertPanel.addComponent(titleLabel);
    topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT);

    final Label sloganLabel = new Label("// Tracking politicians like bugs!");
    sloganLabel.setStyleName("HeaderSlogan");
    topTitleHeadertPanel.addComponent(sloganLabel);
    topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT);

    topHeader.addComponent(topTitleHeadertPanel);
    topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT);
    topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID);

    topHeaderRightPanel.removeAllComponents();
    topHeader.addComponent(topHeaderRightPanel);
    topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT);
    topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE);

    if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN)
            || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) {

        final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink();
        topHeaderRightPanel.addComponent(userHomePageLink);
        topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT);

        final Button logoutButton = new Button(LOGOUT, FontAwesome.SIGN_OUT);

        final LogoutRequest logoutRequest = new LogoutRequest();
        logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
        logoutButton.addClickListener(new LogoutClickListener(logoutRequest, applicationManager));

        topHeaderRightPanel.addComponent(logoutButton);
        topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT);

    } else {
        final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink();
        topHeaderRightPanel.addComponent(createRegisterPageLink);
        topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT);

        final Link createLoginPageLink = pageLinkFactory.createLoginPageLink();
        topHeaderRightPanel.addComponent(createLoginPageLink);
        topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT);
    }

    topHeaderRightPanel.setWidth("100%");
    topHeaderRightPanel.setHeight("60px");

    topHeader.setWidth("100%");
    topHeader.setHeight("60px");

    pageModeContent.addComponent(topHeader);
    pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER);

    pageModeContent.addComponent(getBarmenu());
    pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER);

    panel = new Panel(panelName);

    panel.setSizeFull();
    pageModeContent.addComponent(panel);
    pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE);

    pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink());
    setContent(layout);

    setWidth(100, Unit.PERCENTAGE);
    setHeight(100, Unit.PERCENTAGE);
    setSizeFull();

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.AbstractPageModContentFactoryImpl.java

License:Apache License

/**
 * Creates the panel content./*from  w  ww  . j av a  2 s.  c om*/
 *
 * @return the vertical layout
 */
protected final VerticalLayout createPanelContent() {
    final VerticalLayout panelContent = new VerticalLayout();
    panelContent.setMargin(true);
    panelContent.setWidth(100, Unit.PERCENTAGE);
    panelContent.setHeight(100, Unit.PERCENTAGE);
    panelContent.setStyleName("Header");
    return panelContent;
}

From source file:com.hivesys.dashboard.view.repository.RepositoryUpload.java

public RepositoryUpload()

{
    final Label infoLabel = new Label("asasasasasasasxasx");

    final VerticalLayout dropPane = new VerticalLayout(infoLabel);

    dropPane.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER);
    dropPane.setWidth(280.0f, Unit.PIXELS);
    dropPane.setHeight(200.0f, Unit.PIXELS);
    dropPane.addStyleName("drop-area");

    progress = new ProgressBar();
    progress.setIndeterminate(true);/*from  w w  w.j  av  a 2 s . c  o m*/
    progress.setVisible(false);
    dropPane.addComponent(progress);

    final DragAndDropBox dropBox = new DragAndDropBox(dropPane, progress) {

        @Override
        void processFile(String name, String type, ByteArrayOutputStream bas) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    };
    dropBox.setSizeUndefined();
}

From source file:com.jorambarrez.PropertyPanel.java

License:Apache License

protected void initTrashIcon() {
    Embedded trashIcon = new Embedded(null, Images.MODELER_TRASH);
    trashIcon.setWidth(63, UNITS_PIXELS);
    trashIcon.setHeight(61, UNITS_PIXELS);
    trashIcon.setType(Embedded.TYPE_IMAGE);

    VerticalLayout trashLayout = new VerticalLayout();
    trashLayout.setWidth(120, UNITS_PIXELS);
    trashLayout.setHeight(120, UNITS_PIXELS);
    trashLayout.addComponent(trashIcon);
    trashLayout.setComponentAlignment(trashIcon, Alignment.MIDDLE_CENTER);

    DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(trashLayout);
    dragAndDropWrapper.setDragStartMode(DragStartMode.NONE);
    dragAndDropWrapper.setSizeUndefined();
    addComponent(dragAndDropWrapper);/*  ww w .  ja v a  2 s .  com*/
    setComponentAlignment(dragAndDropWrapper, Alignment.BOTTOM_CENTER);

    dragAndDropWrapper.setDropHandler(new DropHandler() {
        private static final long serialVersionUID = 1L;

        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }

        public void drop(DragAndDropEvent event) {
            WrapperTransferable wrapperTransferable = (WrapperTransferable) event.getTransferable();
            Node srcNode = (Node) wrapperTransferable.getSourceComponent();

            // TODO: use eventrouter!
            ModelerApp.get().getFlowEditor().removeNode(srcNode);
        }
    });
}

From source file:com.klwork.explorer.ui.custom.DetailPanel.java

License:Apache License

public DetailPanel() {
    setSizeFull();/*from   w ww  .j ava2  s .  com*/
    addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    setMargin(true);

    CssLayout cssLayout = new CssLayout(); // Needed for rounded corners,
    cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    cssLayout.setSizeFull();
    super.addComponent(cssLayout);

    mainPanel = new Panel();
    mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
    mainPanel.setSizeFull();
    cssLayout.addComponent(mainPanel);

    // Use default layout
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth(100, Unit.PERCENTAGE);
    verticalLayout.setMargin(true);
    mainPanel.setContent(verticalLayout);
}

From source file:com.liferay.vaadin.poc.ui.PortletUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);
    setContent(layout);//from   ww  w  . j  a  v a  2  s .  c  o  m
    notes = new BeanItemContainer<Note>(Note.class);

    notes.addBean(new Note(noteCounter++, new Date(), "example note"));

    table = new Table("Notes", notes);
    table.setVisibleColumns(new Object[] { "time", "text" });
    table.setPageLength(7);
    table.setBuffered(false);
    table.setSelectable(true);
    table.setWidth(100, Unit.PERCENTAGE);

    textField = new TextField("Text");
    textField.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(textField);

    Button addButton = new Button("Add");
    addButton.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(addButton);
    removeButton = new Button("Remove");
    removeButton.setWidth(100, Unit.PERCENTAGE);
    removeButton.setEnabled(false);
    layout.addComponent(removeButton);

    layout.addComponent(table);

    addButton.addClickListener((event) -> {
        notes.addBean(new Note(noteCounter++, new Date(), textField.getValue()));
    });

    removeButton.addClickListener((event) -> {
        if (selectedNote != null) {
            notes.removeItem(selectedNote);
            selectedNote = null;
        }
        removeButton.setEnabled(selectedNote != null);
    });

    // Handle selection change.
    table.addValueChangeListener((event) -> {
        selectedNote = (Note) table.getValue();
        removeButton.setEnabled(selectedNote != null);
    });
}