Example usage for com.vaadin.ui HorizontalLayout setSpacing

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

Introduction

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

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java

License:Open Source License

private void createCenterPiece() {
    HorizontalLayout centerpieceLayout = new HorizontalLayout();
    centerpieceLayout.setWidth("100%");
    centerpieceLayout.setSpacing(true);

    VerticalLayout centerpieceSettings = new VerticalLayout();
    centerpieceSettings.setWidth("100%");
    centerpieceSettings.setSpacing(true);

    Field richTextField = listener.createRichTextField();
    richTextField.setCaption("Teaser");
    richTextField.setWidth("100%");
    richTextField.addValueChangeListener(new Property.ValueChangeListener() {
        @Override//from   ww w  .ja v a 2 s.  co  m
        public void valueChange(Property.ValueChangeEvent event) {
            try {
                articleItem.removeItemProperty("siteAlert");
                articleItem.addItemProperty("siteAlert", DefaultPropertyUtil.newDefaultProperty(String.class,
                        event.getProperty().getValue().toString()));
                articleItem.applyChanges();
            } catch (RepositoryException e) {
                e.printStackTrace();
            }
        }
    });

    centerpieceSettings.addComponent(richTextField);

    Label placementLabel = new Label("", ContentMode.HTML);
    placementLabel.setCaption("Placement");
    centerpieceSettings.addComponent(placementLabel);

    CheckBox home = listener.createCheckBox("Home Page");
    centerpieceSettings.addComponent(home);
    CheckBox news = listener.createCheckBox("News Landing");
    centerpieceSettings.addComponent(news);
    CheckBox comm = listener.createCheckBox("Community Landing");
    centerpieceSettings.addComponent(comm);
    CheckBox team = listener.createCheckBox("Team Landing");
    centerpieceSettings.addComponent(team);
    CheckBox cheer = listener.createCheckBox("Cheerleader Landing");
    centerpieceSettings.addComponent(cheer);

    centerpieceLayout.addComponent(centerpieceSettings);

    Label previewLabel = new Label("", ContentMode.HTML);
    previewLabel.setCaption("Centerpiece preview");
    centerpieceLayout.addComponent(previewLabel);

    centerPiece.setContent(centerpieceLayout);
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java

License:Open Source License

private void createAlert() {
    VerticalLayout alertTextLayout = new VerticalLayout();
    alertTextLayout.setSpacing(true);// w  w w  .  j a  va 2 s  . c o  m
    alertTextLayout.setCaption("Alert Text");

    MagnoliaRichTextField textField = (MagnoliaRichTextField) listener.createRichTextField();
    textField.setSizeFull();

    HorizontalLayout periodLayout = new HorizontalLayout();
    periodLayout.setSpacing(true);
    // periodLayout.setWidth("100%");
    DateField startDate = new DateField();
    // startDate.setWidth("100%");
    DateField endDate = new DateField();
    // endDate.setWidth("100%");

    periodLayout.addComponent(new Label("START"));
    periodLayout.addComponent(startDate);
    periodLayout.addComponent(new Label("END"));
    periodLayout.addComponent(endDate);

    alertTextLayout.addComponent(textField);
    alertTextLayout.addComponent(periodLayout);

    HorizontalLayout alertLayout = new HorizontalLayout();
    alertLayout.setSpacing(true);
    alertLayout.setWidth("100%");
    alertLayout.addComponent(alertTextLayout);

    final Label alertPreview = new Label("", ContentMode.HTML);
    alertPreview.setCaption("Alert Preview");
    alertPreview.addStyleName("preview-label");
    textField.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            alertPreview.setValue(String.valueOf(event.getProperty().getValue()));
        }
    });
    alertPreview.setSizeUndefined();
    alertLayout.addComponent(alertPreview);
    alert.setContent(alertLayout);

    textField.setValue(
            "<b>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</b>");
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.tagging.components.SearchEngineMetaDescription.java

License:Open Source License

private Component createSEOProgressBar() {
    ProgressBar seoProgressBar = new ProgressBar();
    seoProgressBar.setWidth("250px");
    seoProgressBar.setValue(0.5f);/* ww  w  . j a v a 2  s  . co  m*/

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(new Label("SEO Rating:"));
    layout.addComponent(seoProgressBar);
    layout.setSpacing(true);
    layout.setMargin(new MarginInfo(false, false, true, false));

    NativeButton addUpdateButton = new NativeButton("", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            // do nothing
        }
    });
    addUpdateButton.addStyleName("update-button");
    addUpdateButton.setHeight("28px");
    addUpdateButton.setCaption("Update");
    addUpdateButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            updateMetaDescriptionPreview(textArea.getValue());
        }
    });
    layout.addComponent(addUpdateButton);

    return layout;
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.umbrellacontent.UmbrellaContentViewImpl.java

License:Open Source License

private Component createSEOProgressBar() {
    ProgressBar seoProgressBar = new ProgressBar();
    seoProgressBar.setWidth("300px");
    seoProgressBar.setValue(0.5f);/*from  w ww.j a  va 2  s.  co m*/

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(new Label("SEO Rating:"));
    layout.addComponent(seoProgressBar);
    layout.setSpacing(true);
    layout.setMargin(new MarginInfo(false, false, true, false));
    return layout;
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.umbrellacontent.UmbrellaContentViewImpl.java

License:Open Source License

private HorizontalLayout createSeriesLayout() {
    HorizontalLayout seriesLayout = new HorizontalLayout();
    seriesLayout.setSpacing(true);
    seriesLayout.setCaption("Series");
    seriesSelect.addItem("Test");
    Button addSeries = new Button("new series");
    addSeries.addStyleName("link");

    seriesLayout.addComponent(seriesSelect);
    seriesLayout.addComponent(addSeries);
    return seriesLayout;
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.umbrellacontent.UmbrellaContentViewImpl.java

License:Open Source License

private HorizontalLayout createAuthorsLayout() {
    HorizontalLayout authorsLayout = new HorizontalLayout();
    authorsLayout.setSpacing(true);
    authorsLayout.setCaption("Author");
    authorSelect.addItem("Test");
    Button addAuthor = new Button("new author");
    addAuthor.addStyleName("link");
    /*// w  ww  .j  a  v  a  2 s  . co  m
    addAuthor.addClickListener(new Button.ClickListener() {
    @Override
    public void buttonClick(Button.ClickEvent event) {
        try {
            String path = Path.getAbsolutePath(parentItem.applyChanges().getPath(), NEW_NODE_NAME);
            DetailLocation location = new DetailLocation(getDefinition().getAppName(), getDefinition().getSubAppId(), DetailView.ViewType.EDIT, path, "");
            locationController.goTo(location);
        } catch (RepositoryException e) {
            throw new ActionExecutionException(e);
        }
    }
    });
    */

    authorsLayout.addComponent(authorSelect);
    authorsLayout.addComponent(addAuthor);
    return authorsLayout;
}

From source file:com.oodrive.nuage.webui.component.VvrOperationComponent.java

License:Apache License

@Override
public final AbstractComponent createComponent(final VvrModel model, final ModelCreator handler) {

    final HorizontalLayout operationLayout = new HorizontalLayout();
    operationLayout.setMargin(true);//from w ww. j a  v  a  2 s .  c o  m
    operationLayout.setSpacing(true);
    operationLayout.setWidth("100%");

    // Start and description buttons
    // START/STOP
    final Button startStop = new Button();
    startStop.setWidth(BUTTON_WIDTH);
    startStop.addStyleName(Runo.BUTTON_BIG);

    final Resource iconStartStop;
    final String description;
    if (!model.isVvrStarted()) {
        iconStartStop = WebUiResources.getStartIcon();
        description = "Start";
    } else {
        iconStartStop = WebUiResources.getStopIcon();
        description = "Stop";
    }
    startStop.setIcon(iconStartStop);
    startStop.setDescription(description);

    operationLayout.addComponent(startStop);
    operationLayout.setExpandRatio(startStop, 1f);
    operationLayout.setComponentAlignment(startStop, Alignment.MIDDLE_LEFT);

    final UUID vvrUuid = model.getItemUuid();
    startStop.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            final boolean started = model.isVvrStarted();
            // Start/Stop are done in background
            if (!started) {
                WaitingComponent.executeBackground(model, new Background() {
                    @Override
                    public void processing() {
                        model.startVvr();
                    }

                    @Override
                    public void postProcessing() {
                        startStop.setIcon(WebUiResources.getStopIcon());
                        startStop.setDescription("Stop");
                        Notification.show("VVR started ", vvrUuid.toString(),
                                Notification.Type.TRAY_NOTIFICATION);
                    }
                });
            } else {
                WaitingComponent.executeBackground(model, new Background() {
                    @Override
                    public void processing() {
                        model.stopVvr();
                    }

                    @Override
                    public void postProcessing() {
                        startStop.setIcon(WebUiResources.getStartIcon());
                        startStop.setDescription("Start");
                        Notification.show("VVR stopped ", vvrUuid.toString(),
                                Notification.Type.TRAY_NOTIFICATION);
                    }
                });
            }
        }
    });

    // ATTRIBUTES
    final Button attributes = new Button();
    attributes.addStyleName(Runo.BUTTON_BIG);
    attributes.setWidth(BUTTON_WIDTH);

    operationLayout.addComponent(attributes);
    operationLayout.setExpandRatio(attributes, 1f);
    operationLayout.setComponentAlignment(attributes, Alignment.MIDDLE_LEFT);
    attributes.setIcon(WebUiResources.getSettingsIcon());
    attributes.setDescription("Settings");

    attributes.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                final VvrAttributesWindow attributesWindow = new VvrAttributesWindow(vvrUuid);
                attributesWindow.add(model);
            } catch (final Exception e) {
                LOGGER.error("Can not get VVR attributes: ", e);
                final ErrorWindow err = new ErrorWindow("Can not display VVR Attributes: " + e.getMessage());
                err.add(model);
            }
        }
    });

    // DELETE
    final Button delete = new Button();
    delete.addStyleName(Runo.BUTTON_BIG);
    delete.setWidth(BUTTON_WIDTH);
    delete.setIcon(WebUiResources.getTrashIcon());
    delete.setDescription("Delete");

    operationLayout.addComponent(delete);
    operationLayout.setExpandRatio(delete, 12f);
    operationLayout.setComponentAlignment(delete, Alignment.MIDDLE_RIGHT);

    delete.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                final VvrDeleteWindow deleteWindow = new VvrDeleteWindow(vvrUuid);
                deleteWindow.add(vvrManagerModel);
            } catch (final Exception e) {
                LOGGER.error("Can not delete VVR: ", e);
                final ErrorWindow err = new ErrorWindow("Can not delete VVR: " + e.getMessage());
                err.add(model);
            }
        }
    });
    return operationLayout;
}

From source file:com.openhris.calendar.CalendarScheduleWindow.java

VerticalLayout scheduleLayout() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from  w  w w  .  jav a2s  .co  m*/
    layout.setSpacing(true);

    eventType = createEventTypelect();
    layout.addComponent(eventType);

    startDate = createDateField("Start Date: ");
    layout.addComponent(startDate);

    endDate = createDateField("End Date: ");
    layout.addComponent(endDate);

    caption = createTextField("Caption: ");
    layout.addComponent(caption);

    location = createTextField("Where: ");
    layout.addComponent(location);

    description = new TextArea("Description: ");
    description.setWidth("100%");
    description.setRows(3);
    layout.addComponent(description);

    color = createStyleNameSelect();
    layout.addComponent(color);

    saveEventButton = new Button("SAVE", saveEventBtnListener);
    saveEventButton.setWidth("100%");

    deleteEventButton = new Button("DELETE", deleteEventBtnListener);
    deleteEventButton.setWidth("100%");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setWidth("100%");
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(saveEventButton);
    //        buttons.addComponent(editEventButton);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);

    return layout;
}

From source file:com.openhris.calendar.CalendarScheduleWindow.java

VerticalLayout populateSchedule(CalendarComponentEvents.EventClick event) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//from ww  w  . j  ava  2  s  .  c  o  m
    layout.setSpacing(true);

    eventType = createEventTypelect();
    eventType.setValue(basicEvent.getEventType());
    layout.addComponent(eventType);

    startDate = createDateField("Start Date: ");
    startDate.setValue(event.getCalendarEvent().getStart());
    layout.addComponent(startDate);

    endDate = createDateField("End Date: ");
    endDate.setValue(event.getCalendarEvent().getEnd());
    layout.addComponent(endDate);

    caption = createTextField("Caption: ");
    caption.setValue(event.getCalendarEvent().getCaption());
    layout.addComponent(caption);

    location = createTextField("Where: ");
    location.setValue(getBasicEvent().getLocation());
    layout.addComponent(location);

    description = new TextArea("Description: ");
    description.setWidth("100%");
    description.setRows(3);
    description.setValue(event.getCalendarEvent().getDescription());
    layout.addComponent(description);

    color = createStyleNameSelect();
    color.setValue(basicEvent.getStyleName());
    layout.addComponent(color);

    eventDataId = createTextField("id: ");
    eventDataId.setValue(getBasicEvent().getEventId());
    eventDataId.setVisible(false);
    layout.addComponent(eventDataId);

    editEventButton = new Button("EDIT", editEventBtnListener);
    editEventButton.setWidth("100%");

    deleteEventButton = new Button("DELETE", deleteEventBtnListener);
    deleteEventButton.setWidth("100%");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setWidth("100%");
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(editEventButton);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);

    return layout;
}

From source file:com.openhris.employee.EmployeeSummaryUI.java

public EmployeeSummaryUI(int branchId) {
    this.branchId = branchId;

    setSizeFull();//from w  ww  . ja va  2 s.c  om
    setSpacing(true);
    setMargin(new MarginInfo(true, true, false, false));

    HorizontalLayout h = new HorizontalLayout();
    h.setWidth("100%");
    h.setMargin(true);
    h.setSpacing(true);

    final ComboBox employeeStatus = new ComboBox("Status: ");
    employeeStatus.setWidth("150px");
    employeeStatus.setNullSelectionAllowed(false);
    employeeStatus.addItem("employed");
    employeeStatus.addItem("resigned");
    h.addComponent(employeeStatus);

    Button generateBtn = new Button("GENERATE EMPLOYEE SUMMARY");
    generateBtn.setWidth("250px");
    generateBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (employeeStatus.getValue() == null) {
                getWindow().showNotification("Employee Status!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            tradeId = cs.getTradeIdByBranchId(getBranchId());
            corporateId = cs.getCorporateIdByTradeId(tradeId);

            summary.setContainerDataSource(
                    new EmployeeSummaryDataContainer(corporateId, employeeStatus.getValue().toString()));
        }
    });
    h.addComponent(generateBtn);
    h.setComponentAlignment(generateBtn, Alignment.BOTTOM_LEFT);

    Button exportTableToExcel = new Button("EXPORT TO EXCEL");
    exportTableToExcel.setWidth("250px");
    exportTableToExcel.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = -73954695086117200L;
        private ExcelExport excelExport;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            excelExport = new ExcelExport(summary, "EMPLOYEE SUMMARY");
            excelExport.excludeCollapsedColumns();
            excelExport.setReportTitle(cs.getCorporateById(corporateId).toUpperCase() + " Employee Summary");
            excelExport.setExportFileName(cs.getCorporateById(corporateId).replace(",", " ").toUpperCase()
                    + "-Employee-Summary-" + ".xls");
            excelExport.export();
        }
    });
    h.addComponent(exportTableToExcel);
    h.setComponentAlignment(exportTableToExcel, Alignment.BOTTOM_LEFT);
    h.setExpandRatio(exportTableToExcel, 3);

    addComponent(h);
    addComponent(summary);
    setExpandRatio(summary, 2);
}