Example usage for com.vaadin.ui Alignment TOP_LEFT

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

Introduction

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

Prototype

Alignment TOP_LEFT

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

Click Source Link

Usage

From source file:net.gvcc.jgoffice.components.FooterBar.java

private VerticalLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new VerticalLayout();
    mainLayout.setImmediate(false);//from  ww w.j  ava2  s .  c o m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);

    // top-level component properties
    setWidth("100.0%");
    setHeight("-1px");

    fBar = new HorizontalLayout();
    mainLayout.setStyleName("g-footer");

    hint = new Label("jGOffice Version 0.1 - 2013");
    fBar.addComponent(hint);

    mainLayout.addComponent(fBar);
    mainLayout.setComponentAlignment(fBar, Alignment.TOP_LEFT);

    return mainLayout;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.component.LoginDialog.java

License:Apache License

public void init() {
    //Layout/*from  www .  j  a v  a  2 s . c  om*/
    FormLayout layout = new FormLayout();
    setContent(layout);
    HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.addComponent(loginButton);
    hlayout.addComponent(cancelButton);
    layout.addComponent(name);
    layout.addComponent(password);
    name.focus();
    name.setWidth(100, Unit.PERCENTAGE);
    StringLengthValidator nameVal = new StringLengthValidator(Lookup.getDefault()
            .lookup(InternationalizationProvider.class).translate("password.length.message"));
    nameVal.setMinLength(5);
    name.addValidator(nameVal);
    name.setImmediate(true);
    StringLengthValidator passVal = new StringLengthValidator(
            Lookup.getDefault().lookup(InternationalizationProvider.class).translate("password.empty.message"));
    passVal.setMinLength(3);
    password.addValidator(passVal);
    password.setImmediate(true);
    password.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(hlayout);
    layout.setComponentAlignment(name, Alignment.TOP_LEFT);
    layout.setComponentAlignment(password, Alignment.MIDDLE_LEFT);
    layout.setComponentAlignment(hlayout, Alignment.BOTTOM_LEFT);
    layout.setSpacing(true);
    layout.setMargin(true);

    // Keyboard navigation - enter key is a shortcut to login
    addActionHandler(new Handler() {
        @Override
        public Action[] getActions(Object target, Object sender) {
            return new Action[] { enterKey };
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            tryToLogIn();
        }
    });
}

From source file:nl.amc.biolab.nsg.display.component.ViewerForm.java

License:Open Source License

private void addButtons(final List<Component> buttonList) {
    if (buttonList != null && buttonList.size() != 0) {
        HorizontalLayout buttons = new HorizontalLayout();
        //         buttons.setWidth("100%");
        buttons.setHeight("50px");
        buttons.setSpacing(true);//from   ww  w  .  j  a va 2s  . com
        layout.addComponent(buttons);

        for (Component b : buttonList) {
            buttons.addComponent(b);
            buttons.setComponentAlignment(b, Alignment.TOP_LEFT);
        }

        getLayout().addComponent(buttons);
    }
}

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

License:Open Source License

public GroupTab(AdminApp application) {

    // Set application reference
    this.app = application;

    // Set tab name
    setCaption(app.getMessage(Messages.Groups));

    // Add main layout
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from  w  w w . j av  a 2s  .com*/
    layout.setSpacing(true);
    layout.setSizeFull();

    // Add toolbar layout
    GridLayout toolbar = new GridLayout(2, 1);
    toolbar.setWidth("100%");
    layout.addComponent(toolbar);

    // Add create button
    create = new Button(app.getMessage(Messages.Create), (ClickListener) this);
    create.setDescription(app.getMessage(Messages.CreateGroup));
    create.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
    toolbar.addComponent(create, 0, 0);
    toolbar.setComponentAlignment(create, Alignment.TOP_LEFT);

    // Add refresh button
    refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this);
    refresh.setDescription(app.getMessage(Messages.RefreshTable));
    refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png"));
    toolbar.addComponent(refresh, 1, 0);
    toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT);

    // Add table
    table = new GroupTable(app);
    table.setSizeFull();
    layout.addComponent(table);

    // Set table to expand
    layout.setExpandRatio(table, 1.0f);

    // Root
    setCompositionRoot(layout);
}

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

License:Open Source License

public UserTab(AdminApp application) {

    // Set application reference
    this.app = application;

    // Set tab name
    setCaption(app.getMessage(Messages.Users));

    // Add main layout
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*  w w w.j a  v a2s.com*/
    layout.setSpacing(true);
    layout.setSizeFull();

    // Add toolbar layout
    GridLayout toolbar = new GridLayout(2, 1);
    toolbar.setWidth("100%");
    layout.addComponent(toolbar);

    // Add create button
    create = new Button(app.getMessage(Messages.Create), (ClickListener) this);
    create.setDescription(app.getMessage(Messages.CreateUser));
    create.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
    toolbar.addComponent(create, 0, 0);
    toolbar.setComponentAlignment(create, Alignment.TOP_LEFT);

    // Add refresh button
    refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this);
    refresh.setDescription(app.getMessage(Messages.RefreshTable));
    refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png"));
    toolbar.addComponent(refresh, 1, 0);
    toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT);

    // Add table
    table = new UserTable(app);
    table.setSizeFull();
    layout.addComponent(table);

    // Set table to expand
    layout.setExpandRatio(table, 1.0f);

    // Root
    setCompositionRoot(layout);
}

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 ww  w  .  j  ava2  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.adho.dhconvalidator.ui.CenterPanel.java

private void initComponents(boolean showHeader, ServicesViewName backstepService) {
    center = new VerticalLayout();
    center.setSpacing(true);//  ww  w  . ja va  2s .co m
    setSizeFull();
    addComponent(center);
    center.setSizeUndefined();
    setComponentAlignment(center, Alignment.MIDDLE_CENTER);
    if (showHeader) {
        headerPanel = new HeaderPanel(backstepService);
        center.addComponent(headerPanel);
        Label title = new Label(getTitle());
        title.addStyleName("title-caption");
        center.addComponent(title);
        center.setComponentAlignment(title, Alignment.TOP_LEFT);
    }
}

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

/** Setup GUI. */
private void initComponents() {
    setMargin(true);//from  w  ww  .j  a va 2s  .  c o  m
    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.adho.dhconvalidator.ui.HeaderPanel.java

/**
 * Setup UI./* w w  w.j a  va 2s  .  c  o m*/
 *
 * @param backstepService
 */
private void initComponents(ServicesViewName backstepService) {
    setSpacing(true);

    setWidth("100%");

    backLink = new BackLink(backstepService);
    addComponent(backLink);
    setComponentAlignment(backLink, Alignment.TOP_LEFT);

    AboutLink aboutLink = new AboutLink();
    addComponent(aboutLink);
    setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
    setExpandRatio(aboutLink, 1.0f);

    LogoutLink logoutLink = new LogoutLink();
    addComponent(logoutLink);
    setComponentAlignment(logoutLink, Alignment.TOP_RIGHT);
}

From source file:org.apache.tamaya.ui.internal.VerticalSpacedLayout.java

License:Apache License

public VerticalSpacedLayout() {
    setMargin(true);
    setSpacing(true);
    setDefaultComponentAlignment(Alignment.TOP_LEFT);
}