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:module.pandabox.presentation.PandaBox.java

License:Open Source License

private void initView() {
    setCompositionRoot(root);//from  w w  w  . j  a  v  a 2  s .  co m
    root.setSizeFull();
    root.setSplitPosition(15);
    root.setStyleName("small previews");

    previewArea.setWidth("100%");
    previewTabs = new VerticalLayout();
    previewTabs.setSizeFull();
    previewTabs.setHeight(null);

    compoundTabs = new VerticalLayout();
    compoundTabs.setSizeFull();
    compoundTabs.setHeight(null);

    bennuStylesTabs = new VerticalLayout();
    bennuStylesTabs.setSizeFull();
    bennuStylesTabs.setHeight(null);

    VerticalLayout menu = new VerticalLayout();
    menu.setSizeFull();
    menu.setStyleName("sidebar-menu");

    Button syncThemes = new Button("Sync Themes", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            syncThemes();
        }
    });
    menu.addComponent(syncThemes);
    menu.addComponent(new Label("Single Components"));
    menu.addComponent(previewTabs);
    menu.addComponent(new Label("Compound Styles"));
    menu.addComponent(compoundTabs);

    menu.addComponent(new Label("Bennu Styles"));
    menu.addComponent(bennuStylesTabs);

    root.setFirstComponent(menu);

    CssLayout toolbar = new CssLayout();
    toolbar.setWidth("100%");
    toolbar.setStyleName("toolbar");
    toolbar.addComponent(editorToggle);

    final Window downloadWindow = new Window("Download Theme");
    GridLayout l = new GridLayout(3, 2);
    l.setSizeUndefined();
    l.setMargin(true);
    l.setSpacing(true);
    downloadWindow.setContent(l);
    downloadWindow.setModal(true);
    downloadWindow.setResizable(false);
    downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null);
    downloadWindow.addStyleName("opaque");
    Label caption = new Label("Theme Name");
    l.addComponent(caption);
    l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
    final TextField name = new TextField();
    name.setValue("my-chameleon");
    name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed"));
    name.setRequired(true);
    name.setRequiredError("Please give a name for the theme");
    downloadWindow.addComponent(name);
    Label info = new Label(
            "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.",
            Label.CONTENT_XHTML);
    info.addStyleName("tiny");
    info.setWidth("200px");
    l.addComponent(info, 1, 1, 2, 1);

    Button download = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().addWindow(downloadWindow);
            name.focus();
        }
    });
    download.setDescription("Donwload the current theme");
    download.setIcon(new ThemeResource("download.png"));
    download.setStyleName("icon-only");
    toolbar.addComponent(download);

    menu.addComponent(toolbar);
    menu.setExpandRatio(toolbar, 1);
    menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER);

}

From source file:org.accelerators.activiti.admin.ui.ConfirmDialog.java

License:Open Source License

/**
 * * Constructor for configuring confirmation dialog. * @param caption the
 * dialog caption. * @param question the question. * @param okLabel the Ok
 * button label. * @param cancelLabel the cancel button label. * @param
 * callback the callback./*  w  ww  .  j  a  v a  2s.c  o  m*/
 */
public ConfirmDialog(final String caption, final String question, final String okLabel,
        final String cancelLabel, final ConfirmationDialogCallback callback) {

    super(caption);
    setWidth(CONFIRMATION_DIALOG_WIDTH, ConfirmDialog.UNITS_PIXELS);
    okButton = new Button(okLabel, this);
    cancelButton = new Button(cancelLabel, this);
    cancelButton.focus();
    setModal(true);

    this.callback = callback;

    Label label = new Label(question, Label.CONTENT_XHTML);

    if (question != null) {
        addComponent(label);
    }

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(okButton);
    buttonLayout.addComponent(cancelButton);
    addComponent(buttonLayout);

    ((VerticalLayout) getContent()).setHeight(ONE_HUNDRED_PERCENT, ConfirmDialog.UNITS_PERCENTAGE);
    ((VerticalLayout) getContent()).setComponentAlignment(buttonLayout, Alignment.BOTTOM_CENTER);
}

From source file:org.accelerators.activiti.admin.ui.MainView.java

License:Open Source License

public MainView(AdminApp application) {

    // Set application
    this.app = application;

    // Setup main layout
    setStyleName(Reindeer.LAYOUT_WHITE);
    setMargin(false);/*  w  ww  . jav  a 2 s . c om*/
    setSpacing(false);
    setSizeFull();

    // Add header
    GridLayout header = new GridLayout(2, 1);
    header.setWidth("100%");
    header.setHeight("34px");
    addComponent(header);

    // Add header styles
    header.addStyleName(Consts.HEADER);
    header.addStyleName("header");
    header.setSpacing(true);

    // Add title to header
    GridLayout logoGrid = new GridLayout(1, 1);
    header.addComponent(logoGrid, 0, 0);
    header.setComponentAlignment(logoGrid, Alignment.MIDDLE_LEFT);

    Embedded logoImage = new Embedded(null, new ThemeResource("img/header-logo.png"));
    logoImage.setType(Embedded.TYPE_IMAGE);
    logoImage.addStyleName("header-image");
    logoGrid.addComponent(logoImage, 0, 0);
    logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER);

    // Add logout button to header
    GridLayout logoutGrid = new GridLayout(2, 1);
    Label userLabel = new Label("Signed in as: " + app.getUser().toString());
    userLabel.addStyleName("user");
    logout.setStyleName(Reindeer.BUTTON_LINK);
    logout.addStyleName("logout");
    logoutGrid.addComponent(userLabel, 0, 0);
    logoutGrid.addComponent(logout, 1, 0);
    header.addComponent(logoutGrid, 1, 0);
    header.setComponentAlignment(logoutGrid, Alignment.TOP_RIGHT);

    // Create tab sheet
    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();

    // Add tab styles
    tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabs.addStyleName(Reindeer.LAYOUT_WHITE);

    // Add task view tab
    tabs.addTab(new UserTab(app));
    tabs.addTab(new GroupTab(app));

    // Add tab sheet to layout
    addComponent(tabs);
    setExpandRatio(tabs, 1.0F);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    addComponent(footerText);
    setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

}

From source file:org.activiti.administrator.ui.LoginView.java

License:Apache License

@SuppressWarnings("serial")
public LoginView(AdminApp application) {

    // Set application reference
    this.app = application;

    // Init window caption
    app.getMainWindow().setCaption(app.getMessage(Messages.Title));

    // Set style//from   www.j a v  a  2  s  . c o m
    setStyleName(Reindeer.LAYOUT_WHITE);

    // Set layout to full size
    setSizeFull();

    // Create main layout
    VerticalLayout mainLayout = new VerticalLayout();

    // Add layout styles
    mainLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);
    mainLayout.setSpacing(false);

    // Add layout
    addComponent(mainLayout);
    setComponentAlignment(mainLayout, Alignment.TOP_LEFT);

    // Add field and button layout
    VerticalLayout buttonLayout = new VerticalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setMargin(true);
    buttonLayout.setWidth("200px");
    buttonLayout.setStyleName("login-form");

    // Add username field
    username = new TextField(app.getMessage(Messages.Username));
    username.setWidth("100%");
    buttonLayout.addComponent(username);

    // Add password field
    password = new PasswordField(app.getMessage(Messages.Password));
    password.setWidth("100%");
    buttonLayout.addComponent(password);

    // Add Login button
    buttonLayout.addComponent(login);
    buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_LEFT);

    // Add button layout
    mainLayout.addComponent(buttonLayout);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    footerText.addStyleName("footer");
    mainLayout.addComponent(footerText);
    mainLayout.setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

    // Set focus to this component
    username.focus();

    // Add shortcut to login button
    login.setClickShortcut(KeyCode.ENTER);

    login.addListener(new Button.ClickListener() {

        public void buttonClick(Button.ClickEvent event) {
            try {

                // Athenticate the user
                authenticate((String) username.getValue(), (String) password.getValue());

                // Switch to the main view
                app.switchView(MainView.class.getName(), new MainView(app));

            } catch (Exception e) {
                getWindow().showNotification(e.toString());
            }
        }
    });

}

From source file:org.activiti.administrator.ui.MainView.java

License:Apache License

public MainView(AdminApp application) {

    // Set application
    this.app = application;

    // Setup main layout
    setStyleName(Reindeer.LAYOUT_WHITE);
    setMargin(false);//from  w  w w. j ava 2  s .  c  om
    setSpacing(false);
    setSizeFull();

    // Create tab sheet
    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();

    // Add tab styles
    tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabs.addStyleName(Reindeer.LAYOUT_WHITE);

    // Add task view tab
    tabs.addTab(new UserTab(app));
    tabs.addTab(new GroupTab(app));

    // Add tab sheet to layout
    addComponent(tabs);
    setExpandRatio(tabs, 1.0F);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    footerText.addStyleName("footer");
    addComponent(footerText);
    setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

}

From source file:org.activiti.editor.ui.DeployModelPopupWindow.java

License:Apache License

protected void initButtons(I18nManager i18nManager) {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);//w  w w.  j a  va2 s.  c om
    buttonLayout.setWidth(100, UNITS_PERCENTAGE);
    addComponent(buttonLayout);

    deployButton = new Button(i18nManager.getMessage(Messages.MODEL_DEPLOY_BUTTON_DEPLOY));
    buttonLayout.addComponent(deployButton);
    buttonLayout.setComponentAlignment(deployButton, Alignment.BOTTOM_CENTER);
}

From source file:org.activiti.explorer.ui.management.processdefinition.ChangeProcessSuspensionStatePopupWindow.java

License:Apache License

protected void addOkButton(final boolean suspend) {
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));

    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
    verticalLayout.addComponent(okButton);
    verticalLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER);

    okButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            RepositoryService repositoryService = ProcessEngines.getDefaultProcessEngine()
                    .getRepositoryService();
            boolean includeProcessInstances = (Boolean) includeProcessInstancesCheckBox.getValue();

            if (suspend) {
                repositoryService.suspendProcessDefinitionById(processDefinitionId, includeProcessInstances,
                        (Date) dateField.getValue());
            } else {
                repositoryService.activateProcessDefinitionById(processDefinitionId, includeProcessInstances,
                        (Date) dateField.getValue());
            }/*from   w  ww  .java 2 s.c o m*/

            close();
            parentPage.refreshSelectNext(); // select next item in list on the left
        }

    });
}

From source file:org.adho.dhconvalidator.ui.ConverterPanel.java

/** Setup GUI. */
private void initComponents() {
    setMargin(true);/*  www . jav a2s .  com*/
    setSizeFull();
    setSpacing(true);
    HeaderPanel headerPanel = new HeaderPanel(null);
    addComponent(headerPanel);

    Label title = new Label(Messages.getString("ConverterPanel.title"));
    title.addStyleName("title-caption");
    addComponent(title);
    setComponentAlignment(title, Alignment.TOP_LEFT);

    Label info = new Label(Messages.getString("ConverterPanel.info"), ContentMode.HTML);
    addComponent(info);

    HorizontalLayout inputPanel = new HorizontalLayout();
    inputPanel.setSpacing(true);
    addComponent(inputPanel);

    upload = new Upload(Messages.getString("ConverterPanel.uploadCaption"), new Receiver() {
        @Override
        public OutputStream receiveUpload(String filename, String mimeType) {
            // we store the uploaded content in the panel instance

            ConverterPanel.this.filename = filename;
            ConverterPanel.this.uploadContent = new ByteArrayOutputStream();

            return ConverterPanel.this.uploadContent;
        }
    });

    inputPanel.addComponent(upload);

    progressBar = new ProgressBar();
    progressBar.setIndeterminate(true);
    progressBar.setVisible(false);
    inputPanel.addComponent(progressBar);
    inputPanel.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);
    progressBar.addStyleName("converterpanel-progressbar");

    resultCaption = new Label(Messages.getString("ConverterPanel.previewTitle2"));
    resultCaption.setWidth("100%");
    resultCaption.addStyleName("converterpanel-resultcaption");
    addComponent(resultCaption);
    setComponentAlignment(resultCaption, Alignment.MIDDLE_CENTER);

    resultPanel = new HorizontalSplitPanel();
    addComponent(resultPanel);
    resultPanel.setSizeFull();
    setExpandRatio(resultPanel, 1.0f);

    preview = new Label("", ContentMode.HTML);
    preview.addStyleName("tei-preview");
    resultPanel.addComponent(preview);
    VerticalLayout rightPanel = new VerticalLayout();
    rightPanel.setMargin(new MarginInfo(false, false, true, true));
    rightPanel.setSpacing(true);
    resultPanel.addComponent(rightPanel);

    logArea = new Label("", ContentMode.HTML);
    logArea.setSizeFull();
    logArea.setReadOnly(true);
    rightPanel.addComponent(logArea);

    downloadInfo = new Label(Messages.getString("ConverterPanel.downloadMsg"));
    rightPanel.addComponent(downloadInfo);
    downloadInfo.setVisible(false);

    btDownloadResult = new Button(Messages.getString("ConverterPanel.downloadBtCaption"));
    btDownloadResult.setVisible(false);
    rightPanel.addComponent(btDownloadResult);
    rightPanel.setComponentAlignment(btDownloadResult, Alignment.BOTTOM_CENTER);
    btDownloadResult.setHeight("50px");

    rightPanel.addComponent(new Label(Messages.getString("ConverterPanel.exampleMsg")));
    Button btExample = new Button(Messages.getString("ConverterPanel.exampleButtonCaption"));
    btExample.setStyleName(BaseTheme.BUTTON_LINK);
    btExample.addStyleName("plain-link");
    rightPanel.addComponent(btExample);

    confToolLabel = new Label(
            Messages.getString("ConverterPanel.gotoConfToolMsg", PropertyKey.conftool_login_url.getValue()),
            ContentMode.HTML);
    confToolLabel.setVisible(false);
    confToolLabel.addStyleName("postDownloadInfoRedAndBold");

    rightPanel.addComponent(confToolLabel);

    new BrowserWindowOpener(DHConvalidatorExample.class).extend(btExample);
}

From source file:org.apache.ace.webui.vaadin.LoginWindow.java

License:Apache License

/**
 * Creates a new {@link LoginWindow} instance.
 * /*from   www  . ja  v a  2s  . co  m*/
 * @param log
 *            the log service to use;
 * @param loginFunction
 *            the login callback to use.
 */
public LoginWindow(LogService log, LoginFunction loginFunction) {
    super("Apache ACE Login");

    m_log = log;
    m_loginFunction = loginFunction;

    setResizable(false);
    setClosable(false);
    setModal(true);
    setWidth("20em");

    m_additionalInfo = new Label("");
    m_additionalInfo.setImmediate(true);
    m_additionalInfo.setStyleName("alert");
    m_additionalInfo.setHeight("1.2em");
    // Ensures the information message disappears when starting typing...
    FieldEvents.TextChangeListener changeListener = new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(TextChangeEvent event) {
            m_additionalInfo.setValue("");
        }
    };

    final TextField nameField = new TextField("Name", "");
    nameField.addListener(changeListener);
    nameField.setImmediate(true);
    nameField.setWidth("100%");

    final PasswordField passwordField = new PasswordField("Password", "");
    passwordField.addListener(changeListener);
    passwordField.setImmediate(true);
    passwordField.setWidth("100%");

    Button loginButton = new Button("Login");
    loginButton.setImmediate(true);
    // Allow enter to be used to login directly...
    loginButton.setClickShortcut(KeyCode.ENTER);
    // Highlight this button as the default one...
    loginButton.addStyleName(Reindeer.BUTTON_DEFAULT);

    loginButton.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            Button button = event.getButton();
            button.setEnabled(false);

            try {
                String username = (String) nameField.getValue();
                String password = (String) passwordField.getValue();

                if (m_loginFunction.login(username, password)) {
                    m_log.log(LogService.LOG_INFO, "Apache Ace WebUI succesfull login by user: " + username);

                    closeWindow();
                } else {
                    m_log.log(LogService.LOG_WARNING, "Apache Ace WebUI invalid username or password entered.");

                    m_additionalInfo.setValue("Invalid username or password!");

                    nameField.focus();
                    nameField.selectAll();
                }
            } finally {
                button.setEnabled(true);
            }
        }
    });

    final VerticalLayout content = (VerticalLayout) getContent();
    content.setSpacing(true);
    content.setMargin(true);
    content.setSizeFull();

    content.addComponent(nameField);
    content.addComponent(passwordField);
    content.addComponent(m_additionalInfo);
    content.addComponent(loginButton);

    content.setComponentAlignment(loginButton, Alignment.BOTTOM_CENTER);

    nameField.focus();
}

From source file:org.apache.openaz.xacml.admin.view.windows.PIPConfigurationEditorWindow.java

License:Apache License

protected void initializeButtons() {
    this.grid.setComponentAlignment(this.buttonSave, Alignment.BOTTOM_CENTER);
    this.buttonSave.setImmediate(true);
    this.buttonSave.setEnabled(false);
    this.buttonSave.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from  www  .ja  v a 2s  .  com
        public void buttonClick(ClickEvent event) {
            try {
                //
                // Commit changes
                //
                self.fieldGroup.commit();
                //
                // Save
                //
                self.isSaved = true;
                //
                // We can close
                //
                self.close();
            } catch (CommitException e) {
                logger.warn("Couldn't commit, the save button should NOT be enabled.");
            }
        }
    });
}