Example usage for com.vaadin.ui Alignment BOTTOM_CENTER

List of usage examples for com.vaadin.ui Alignment BOTTOM_CENTER

Introduction

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

Prototype

Alignment BOTTOM_CENTER

To view the source code for com.vaadin.ui Alignment BOTTOM_CENTER.

Click Source Link

Usage

From source file:probe.com.view.core.exporter.ExportUnit.java

/**
 *
 *///from w  w  w . j  a va2  s  . c om
public ExportUnit() {

    topLayout = new HorizontalLayout();
    bottomLayout = new HorizontalLayout();

    // init layout
    this.addStyleName(Reindeer.LAYOUT_BLUE);
    this.setHeight("120px");
    this.setWidth("200px");
    this.setSpacing(true);
    this.setMargin(false);

    topLayout.setWidth("100%");
    topLayout.setHeight("80px");
    topLayout.setMargin(true);
    this.addComponent(topLayout);
    this.setComponentAlignment(topLayout, Alignment.TOP_CENTER);

    bottomLayout.setWidth("100%");
    bottomLayout.setHeight("40px");
    bottomLayout.setMargin(true);
    this.addComponent(bottomLayout);
    this.setComponentAlignment(bottomLayout, Alignment.MIDDLE_CENTER);

    typeGroup = new OptionGroup("");
    // Use the single selection mode.
    typeGroup.setMultiSelect(false);
    typeGroup.addItem("Validated Only");
    typeGroup.addItem("All");
    typeGroup.select("Validated Only");
    topLayout.addComponent(typeGroup);
    topLayout.setComponentAlignment(typeGroup, Alignment.MIDDLE_CENTER);
    topLayout.setExpandRatio(typeGroup, 0.5f);

    exportGroup = new OptionGroup(""); // Use the single selection mode.       
    exportGroup.setMultiSelect(false);
    exportGroup.addItem("csv");
    exportGroup.addItem("xls");
    exportGroup.select("csv");
    topLayout.addComponent(exportGroup);
    topLayout.setComponentAlignment(exportGroup, Alignment.MIDDLE_CENTER);
    topLayout.setExpandRatio(exportGroup, 0.5f);

    exportBtn = new Button("Export");
    exportBtn.setStyleName(Reindeer.BUTTON_SMALL);
    bottomLayout.addComponent(exportBtn);
    bottomLayout.setComponentAlignment(exportBtn, Alignment.BOTTOM_CENTER);

}

From source file:ru.codeinside.gses.webui.form.TaskForm.java

License:Mozilla Public License

public TaskForm(final FormDescription formDesc, final CloseListener closeListener,
        final DataAccumulator accumulator) {
    this.closeListener = closeListener;
    flow = formDesc.flow;//w  ww .  j av  a2 s .  co  m
    id = formDesc.id;
    formFlow = new FormFlow(id);
    this.accumulator = accumulator;

    header = new HorizontalLayout();
    header.setWidth(100, UNITS_PERCENTAGE);
    header.setSpacing(true);
    addComponent(header);

    editorIcon = new Embedded(null, EDITOR_ICON);
    editorIcon.setDescription("");
    editorIcon.setStyleName("icon-inactive");
    editorIcon.setHeight(32, UNITS_PIXELS);
    editorIcon.setWidth(32, UNITS_PIXELS);
    editorIcon.setImmediate(true);
    header.addComponent(editorIcon);
    header.setComponentAlignment(editorIcon, Alignment.BOTTOM_CENTER);

    if (flow.get(0) instanceof FormDataSource) {
        viewIcon = new Embedded(null, VIEW_ICON);
        viewIcon.setDescription(" ?");
        viewIcon.setStyleName("icon-inactive");
        viewIcon.setHeight(32, UNITS_PIXELS);
        viewIcon.setWidth(32, UNITS_PIXELS);
        viewIcon.setImmediate(true);
        header.addComponent(viewIcon);
        header.setComponentAlignment(viewIcon, Alignment.BOTTOM_CENTER);

        editorIcon.addListener(new MouseEvents.ClickListener() {
            @Override
            public void click(MouseEvents.ClickEvent event) {
                if (mainContent != wizard) {
                    TaskForm.this.replaceComponent(mainContent, wizard);
                    TaskForm.this.setExpandRatio(wizard, 1f);
                    mainContent = wizard;
                    editorIcon.setStyleName("icon-inactive");
                    viewIcon.setStyleName("icon-active");
                }
            }
        });

        viewIcon.addListener(new MouseEvents.ClickListener() {
            @Override
            public void click(MouseEvents.ClickEvent event) {
                if (mainContent == wizard && flow.get(0) instanceof FormDataSource) {
                    FormDataSource dataSource = (FormDataSource) flow.get(0);

                    Map<String, String> response = null;
                    String serviceLocation = AdminServiceProvider.get()
                            .getSystemProperty(API.PRINT_TEMPLATES_SERVICELOCATION);
                    String json = buildJsonStringWithFormData(dataSource);

                    boolean responseContainsTypeKey = false;
                    if (serviceLocation != null && !serviceLocation.isEmpty() && json != null
                            && !json.isEmpty()) {

                        response = callPrintService(serviceLocation, json);
                        if (response != null && response.containsKey("type")) {
                            responseContainsTypeKey = true;
                            log.info("PRINT SERVICE. Response type: " + response.get("type"));
                        } else {
                            log.info("PRINT SERVICE. Response type: null");
                        }
                    }

                    PrintPanel printPanel;
                    if (responseContainsTypeKey && response.get("type").equals("success")
                            && response.get("content") != null && !response.get("content").isEmpty()) {
                        printPanel = new PrintPanel(response.get("content"), getApplication());
                    } else {
                        printPanel = new PrintPanel(dataSource, getApplication(), formDesc.procedureName,
                                id.taskId);
                    }

                    TaskForm.this.replaceComponent(wizard, printPanel);
                    TaskForm.this.setExpandRatio(printPanel, 1f);
                    mainContent = printPanel;

                    editorIcon.setStyleName("icon-active");
                    viewIcon.setStyleName("icon-inactive");
                    editorIcon.setVisible(true);
                }
            }
        });
        viewIcon.setStyleName("icon-active");
        viewIcon.setVisible(true);
    } else {
        viewIcon = null;
    }

    VerticalLayout labels = new VerticalLayout();
    labels.setSpacing(true);
    header.addComponent(labels);
    header.setComponentAlignment(labels, Alignment.MIDDLE_LEFT);
    header.setExpandRatio(labels, 1f);
    addLabel(labels, formDesc.procedureName, "h1");
    addLabel(labels, formDesc.processDefinition.getDescription(), null);
    if (formDesc.task != null) {
        addLabel(labels, formDesc.task.getName(), "h2");
        addLabel(labels, formDesc.task.getDescription(), null);
    }

    wizard = new Wizard(accumulator);
    wizard.setImmediate(true);
    wizard.addListener(new ProgressActions());
    for (FormSeq seq : flow) {
        wizard.addStep(new FormStep(seq, formFlow, wizard));
    }
    mainContent = wizard;
    addComponent(wizard);
    setExpandRatio(wizard, 1f);
    if (formDesc.task != null) {
        setMargin(true);
    } else {
        //  ??  ? 
        setMargin(true, false, false, false);
    }
    setImmediate(true);
    setSpacing(true);
    setSizeFull();
    setExpandRatio(wizard, 1f);
}

From source file:sph.vaadin.ui.videojs.VideojsFrame.java

License:Apache License

private void doLayout() {
    this.controlsLayout.setWidth(100, Sizeable.Unit.PERCENTAGE);
    this.controlsLayout.setDefaultComponentAlignment(Alignment.BOTTOM_CENTER);
    this.controlsLayout.addComponents(this.vjsSL, this.vjsSTC, this.vjsDC);
    //this.compositionRoot.addComponent(this.controlsLayout);
    this.compositionRoot.addComponents(this.controlsLayout, this.player);
    this.setCompositionRoot(this.compositionRoot);
}

From source file:sph.vaadin.ui.videojs.VideojsSeekToController.java

License:Apache License

/**
 * Creates and sets up all UI components.
 *///from www .  ja v a 2s. co  m
private void doLayout() {
    HorizontalLayout compositionRoot = new HorizontalLayout();
    compositionRoot.setMargin(true);
    compositionRoot.setSpacing(true);
    compositionRoot.setDefaultComponentAlignment(Alignment.BOTTOM_CENTER);
    hoursField = createTextField("00", 2);
    minutesField = createTextField("00", 2);
    secondsField = createTextField("00", 2);
    //hoursField.addValidator(new IntegerRangeValidator("Virheellinen aika tunnit", 0, 2));
    minutesField.addValidator(new IntegerRangeValidator("Requires an integer between 0-59", 0, 59));
    secondsField.addValidator(new IntegerRangeValidator("Requires an integer between 0-59", 0, 59));
    compositionRoot.addComponents(hoursField, new Label(":"), minutesField, new Label(":"), secondsField,
            seekBtn);
    compositionRoot.setCaption("Seekto");
    this.setCompositionRoot(compositionRoot);
}

From source file:sph.vaadin.ui.videojs.VideojsSourceLoader.java

License:Apache License

/**
 * Builds the loader part of the Video component
 *///w  w w.j  a v  a2 s.c  o  m
private void doLayout() {
    this.videoUrlField.setInputPrompt("The URL of the video");
    this.videoUrlField.addValidator(new VideojsUrlValidator());
    this.videoUrlField.setNullRepresentation("");
    this.videoUrlField.setWidth("300px");
    this.compositionRoot.setSpacing(true);
    this.compositionRoot.addComponents(videoUrlField, loadBtn);
    this.compositionRoot.setComponentAlignment(videoUrlField, Alignment.BOTTOM_CENTER);
    this.compositionRoot.setComponentAlignment(loadBtn, Alignment.BOTTOM_CENTER);
    this.compositionRoot.setMargin(true);
    this.setCompositionRoot(compositionRoot);
}

From source file:sph.vaadin.ui.videojs.VideojsTimeJumper.java

License:Apache License

private void doLayout() {
    this.compositionRoot.setDefaultComponentAlignment(Alignment.BOTTOM_CENTER);
    this.compositionRoot.setMargin(true);
    this.compositionRoot.setSpacing(true);
    this.secondsField.setInputPrompt("1 second");
    this.secondsField.addStyleName(SPH_Theme.TEXTFIELD_SMALL);
    this.secondsField.setColumns(8);
    this.secondsField.setConverter(new StringToIntegerConverter());
    this.secondsField.setConverter(new StringToDoubleConverter());
    this.secondsField.addFocusListener(new TextSelector());
    this.secondsField.addBlurListener(new TextFieldValidator());
    this.secondsField.setNullRepresentation("");
    this.secondsField.setConversionError("A decimal number required");
    this.rewind.setDescription("Rewind the video");
    this.forward.setDescription("Forward the video");
    this.compositionRoot.addComponents(rewind, secondsField, forward);
    this.setCompositionRoot(this.compositionRoot);
}

From source file:trader.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    setLocale(Locale.ENGLISH);/*from  w  w w.j  a  v a2 s  .  c  om*/

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();

    loginForm.addComponent(userName = new TextField("Username"));
    loginForm.addComponent(passwordField = new PasswordField("Password"));
    loginForm.addComponent(rememberMe = new CheckBox("Remember me"));
    loginForm.addComponent(login = new Button("Login"));
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        /**
        * 
        */
        private static final long serialVersionUID = 7813011112417170727L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            login();
        }
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();
}

From source file:uk.q3c.krail.testapp.view.PushView.java

License:Apache License

@Override
public void doBuild() {
    super.doBuild();
    groupInput = new TextField("Group");
    groupInput.setWidth("100px");
    messageInput = new TextField("Message");

    sendButton = new Button("Send message");
    sendButton.addClickListener(new ClickListener() {

        @Override//from  w  ww.  j a  v a  2s  . co m
        public void buttonClick(ClickEvent event) {
            broadcaster.broadcast(groupInput.getValue(), messageInput.getValue(), getRootComponent());
        }
    });

    inputLayout = new HorizontalLayout(groupInput, messageInput, sendButton);
    inputLayout.setComponentAlignment(sendButton, Alignment.BOTTOM_CENTER);

    pushEnabled = new CheckBox("Push enabled");
    pushEnabled.addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {

        @Override
        public void valueChange(HasValue.ValueChangeEvent event) {
            //                applicationConfiguration.setProperty(PushModule.SERVER_PUSH_ENABLED, event.getValue());
        }

    });
    pushEnabled.setValue(Boolean.TRUE);

    infoArea = new Label();
    infoArea.setContentMode(ContentMode.HTML);
    infoArea.setSizeFull();
    infoArea.setValue("Test using multiple browser tabs or instances");

    setTopCentreCell(pushEnabled);
    setCentreCell(inputLayout);
    setTopLeftCell(infoArea);
    setBottomCentreCell(messageLog);
    setMiddleLeftCell(newTab);

    getGrid().setComponentAlignment(pushEnabled, Alignment.MIDDLE_CENTER);
    getGrid().setComponentAlignment(inputLayout, Alignment.MIDDLE_CENTER);

    prepareTabOpener();
}