Example usage for com.vaadin.ui HorizontalLayout setComponentAlignment

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

Introduction

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

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DummyRegWithReCaptcha.java

License:Apache License

private void buildContent() {
    content.setMargin(true);//  w  w w  .  j  av a  2  s.com
    content.addComponent(createForm());
    content.addComponent(reCaptcha);
    Button reconfigBtn = createCancelBtn();
    Button submitBtn = new Button("Register", this);
    submitBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    submitBtn.addStyleName(Reindeer.BUTTON_DEFAULT);
    HorizontalLayout actionsLayout = new HorizontalLayout(submitBtn, reconfigBtn);
    actionsLayout.setSpacing(true);
    actionsLayout.setWidth(100, Unit.PERCENTAGE);
    actionsLayout.setComponentAlignment(reconfigBtn, Alignment.MIDDLE_RIGHT);
    content.addComponent(actionsLayout);
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java

private Component buildTitle() {
    Label logo = new Label("PFServer <strong>Dashboard</strong>", ContentMode.HTML);
    logo.setSizeUndefined();//  w w w . j  av a 2  s  .  c  o  m
    HorizontalLayout logoWrapper = new HorizontalLayout(logo);
    logoWrapper.setComponentAlignment(logo, Alignment.MIDDLE_CENTER);
    logoWrapper.addStyleName("valo-menu-title");
    return logoWrapper;
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoadingView.java

public LoadingView() {
    setSizeFull();/*w w w .j ava2 s .  c  o m*/
    VerticalLayout center = new VerticalLayout();
    this.addComponent(center);
    this.setComponentAlignment(center, Alignment.MIDDLE_CENTER);

    center.setHeight("180px");
    HorizontalLayout info = new HorizontalLayout();

    Label title = new Label("PFServer Dashboard");
    title.setSizeUndefined();
    title.addStyleName(ValoTheme.LABEL_H4);
    title.addStyleName(ValoTheme.LABEL_COLORED);
    // center.addComponent(title);
    // center.setComponentAlignment(title, Alignment.BOTTOM_CENTER);
    Label loading = new Label("Initalizing");
    loading.addStyleName(ValoTheme.LABEL_H1);
    loading.addStyleName(ValoTheme.LABEL_LIGHT);
    info.addComponent(loading);
    info.addComponent(title);
    info.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    center.addComponent(info);
    info.setComponentAlignment(loading, Alignment.MIDDLE_LEFT);
    loading.setWidth("160px");

    center.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
    // center.addComponent(loading);
    // center.setComponentAlignment(loading, Alignment.TOP_CENTER);
    ProgressBar indeterminate = new ProgressBar();
    indeterminate.setIndeterminate(true);
    center.addComponent(indeterminate);
    center.setComponentAlignment(indeterminate, Alignment.TOP_CENTER);

}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);//from  w ww .  j av  a  2 s. c  o m
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {

            System.out.println("TRIGGER LOGIN");
            DashboardEventBus.post(new UserLoginRequestedEvent(username.getValue(), password.getValue()));
        }
    });
    return fields;
}

From source file:cz.zcu.pia.social.network.frontend.views.ViewHome.java

/**
 * PostConstruct/*from   www . j  av  a2  s . com*/
 */
@PostConstruct
@Override
public void postConstruct() {
    super.postConstruct();
    postPaginator = applicationContext.getBean(ComponentPostPaginator.class);

    postsFilter = applicationContext.getBean(ComponentPostsFilter.class, postWrapper, postPaginator);
    //postsFilter.setPostPaginator(postPaginator);
    postPaginator.setFilter(postsFilter);

    addPost = new Button("+");
    if (!securityHelper.isAuthenticated()) {
        addPost.setVisible(false);
    }
    addPost.addClickListener(new Button.ClickListener() {

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

        }
    });
    addPost.setDescription(msgs.getMessage(BUTTON_DESCRIPTION));
    addPost.setWidth(25, Unit.PIXELS);
    HorizontalLayout addButtonWrapper = new HorizontalLayout();

    addButtonWrapper.setWidth(ComponentPost.POST_WIDTH, Unit.PIXELS);

    addButtonWrapper.addComponent(postsFilter);
    addButtonWrapper.addComponent(addPost);
    addButtonWrapper.setComponentAlignment(addPost, Alignment.TOP_RIGHT);

    addButtonWrapper.setExpandRatio(postsFilter, 10);
    addButtonWrapper.setExpandRatio(addPost, 1);
    this.getContentWrapper().addComponent(addButtonWrapper);
    this.getContentWrapper().addComponent(postWrapper);
    this.getContentWrapper().addComponent(postPaginator);
}

From source file:de.catma.CatmaApplication.java

License:Open Source License

@Override
public void init() {

    Properties properties = loadProperties();
    backgroundService = new BackgroundService(this);

    final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION);
    mainWindow.addParameterHandler(this);
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeUndefined();//from  w ww  . j  a va2  s  .co m
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainWindow.addStyleName("catma-mainwindow");

    mainWindow.setContent(mainLayout);
    MenuFactory menuFactory = new MenuFactory();
    try {
        initTempDirectory(properties);
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        defaultProgressIndicator = new ProgressIndicator();
        defaultProgressIndicator.setIndeterminate(true);
        defaultProgressIndicator.setEnabled(false);
        defaultProgressIndicator.setPollingInterval(500);
        progressWindow = new ProgressWindow(defaultProgressIndicator);

        menu = menuFactory.createMenu(mainLayout,
                new MenuFactory.MenuEntryDefinition("Repository Manager",
                        new RepositoryManagerWindow(repositoryManagerView)),
                new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)),
                new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)),
                new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)),
                new MenuFactory.MenuEntryDefinition("Visualizer",
                        new VisualizationManagerWindow(visualizationManagerView)));
        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        mainLayout.addComponent(aboutLink);
        mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
        mainLayout.setExpandRatio(aboutLink, 1.0f);

        Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/"));
        helpLink.setTargetName("_blank");
        mainLayout.addComponent(helpLink);
        mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);

        Label helpLabel = new Label();
        helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this));
        helpLabel.setWidth("20px");
        helpLabel.setDescription(
                "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating "
                        + "through CATMA. They provide useful hints for managing the first "
                        + "steps within a CATMA component.</p>" + "<h4>Login</h4>"
                        + "Once you're logged in, you will see the Repository Manager, "
                        + "which will explain the first steps to you. "
                        + "Just hover your mouse over the question mark icons!");
        VerticalLayout helpWrapper = new VerticalLayout();
        helpWrapper.addComponent(helpLabel);
        helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT);

        Animator helpAnimator = new Animator(helpWrapper);

        helpAnimator.setFadedOut(true);

        mainLayout.addComponent(helpAnimator);
        mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT);
        helpAnimator.fadeIn(2000, 300);

        MenuBar loginLogoutMenu = new MenuBar();
        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this);
        MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand);
        loginLogoutCommand.setLoginLogoutItem(loginLogoutitem);

        mainLayout.addComponent(loginLogoutMenu);
        mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT);
        mainLayout.setWidth("100%");
    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

    setMainWindow(mainWindow);

    setTheme("cleatheme");
}

From source file:de.catma.ui.analyzer.AnalyzerView.java

License:Open Source License

private Component createSearchPanel() {
    HorizontalLayout searchPanel = new HorizontalLayout();
    searchPanel.setSpacing(true);/*www  .  j  a  v a2 s .  c  o m*/
    searchPanel.setWidth("100%");

    searchInput = new TextField();
    searchInput.setCaption("Query");
    searchInput.setWidth("100%");
    searchInput.setImmediate(true);

    searchPanel.addComponent(searchInput);
    searchPanel.setExpandRatio(searchInput, 1.0f);

    btExecSearch = new Button("Execute Query");

    searchPanel.addComponent(btExecSearch);
    searchPanel.setComponentAlignment(btExecSearch, Alignment.BOTTOM_CENTER);

    return searchPanel;
}

From source file:de.catma.ui.analyzer.MarkupResultPanel.java

License:Open Source License

private void initComponents() {
    setSizeFull();//from w  w w  . ja v a  2  s . co m

    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    VerticalLayout leftComponent = new VerticalLayout();
    leftComponent.setSpacing(true);
    leftComponent.setSizeFull();

    resultTable = new TreeTable();
    resultTable.setSelectable(true);
    resultTable.setMultiSelect(true);
    HierarchicalContainer container = new HierarchicalContainer();
    container.setItemSorter(new PropertyDependentItemSorter(TreePropertyName.caption,
            new PropertyToTrimmedStringCIComparator()));

    resultTable.setContainerDataSource(container);

    resultTable.addContainerProperty(TreePropertyName.caption, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.caption, "Tag Definition");

    resultTable.addContainerProperty(TreePropertyName.sourcedocument, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.sourcedocument, "Source Document");

    resultTable.addContainerProperty(TreePropertyName.markupcollection, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.markupcollection, "Markup Collection");

    resultTable.addContainerProperty(TreePropertyName.phrase, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.phrase, "Phrase");

    resultTable.addContainerProperty(TreePropertyName.propertyname, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.propertyname, "Property");

    resultTable.addContainerProperty(TreePropertyName.propertyvalue, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.propertyvalue, "Property value");

    resultTable.addContainerProperty(TreePropertyName.frequency, Integer.class, null);
    resultTable.setColumnHeader(TreePropertyName.frequency, "Frequency");
    resultTable.addContainerProperty(TreePropertyName.visible, AbstractComponent.class, null);
    resultTable.setColumnHeader(TreePropertyName.visible, "Visible in Kwic");

    resultTable.setItemCaptionPropertyId(TreePropertyName.caption);
    resultTable.setPageLength(10); //TODO: config
    resultTable.setSizeFull();
    resultTable.setColumnCollapsingAllowed(true);
    resultTable.setColumnCollapsible(TreePropertyName.caption, false);
    resultTable.setColumnCollapsible(TreePropertyName.sourcedocument, true);
    resultTable.setColumnCollapsible(TreePropertyName.markupcollection, true);
    resultTable.setColumnCollapsible(TreePropertyName.phrase, true);
    resultTable.setColumnCollapsible(TreePropertyName.propertyname, true);
    resultTable.setColumnCollapsible(TreePropertyName.propertyvalue, true);
    resultTable.setColumnCollapsible(TreePropertyName.frequency, false);
    resultTable.setColumnCollapsible(TreePropertyName.visible, false);

    //TODO: a description generator that shows the version of a Tag
    //      resultTable.setItemDescriptionGenerator(generator);

    leftComponent.addComponent(resultTable);
    leftComponent.setExpandRatio(resultTable, 1.0f);

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

    btDist = new Button();
    btDist.setIcon(new ClassResource("ui/analyzer/resources/chart.gif", getApplication()));
    buttonPanel.addComponent(btDist);

    btResultExcelExport = new Button();
    btResultExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btResultExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    buttonPanel.addComponent(btResultExcelExport);

    cbFlatTable = new CheckBox("flat table", false);
    cbFlatTable.setImmediate(true);

    buttonPanel.addComponent(cbFlatTable);
    buttonPanel.setComponentAlignment(cbFlatTable, Alignment.MIDDLE_RIGHT);
    buttonPanel.setExpandRatio(cbFlatTable, 1f);

    btSelectAll = new Button("Select all for Kwic");

    buttonPanel.addComponent(btSelectAll);
    buttonPanel.setComponentAlignment(btSelectAll, Alignment.MIDDLE_RIGHT);
    //      buttonPanel.setExpandRatio(btSelectAll, 1f);
    btDeselectAll = new Button("Deselect all for Kwic");
    buttonPanel.addComponent(btDeselectAll);
    buttonPanel.setComponentAlignment(btDeselectAll, Alignment.MIDDLE_RIGHT);

    leftComponent.addComponent(buttonPanel);

    splitPanel.addComponent(leftComponent);

    VerticalLayout rightComponent = new VerticalLayout();
    rightComponent.setSpacing(true);
    rightComponent.setSizeFull();

    this.kwicPanel = new KwicPanel(repository, relevantUserMarkupCollectionProvider, true);
    rightComponent.addComponent(kwicPanel);
    rightComponent.setExpandRatio(kwicPanel, 1f);

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

    btKwicExcelExport = new Button();
    btKwicExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btKwicExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    kwicButtonPanel.addComponent(btKwicExcelExport);
    kwicButtonPanel.setComponentAlignment(btKwicExcelExport, Alignment.MIDDLE_LEFT);

    btUntagResults = new Button("Untag selected Kwics");
    kwicButtonPanel.addComponent(btUntagResults);
    kwicButtonPanel.setComponentAlignment(btUntagResults, Alignment.MIDDLE_RIGHT);
    kwicButtonPanel.setExpandRatio(btUntagResults, 1f);

    Label helpLabel = new Label();
    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication()));
    helpLabel.setWidth("20px");

    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tagging search results</h4>"
            + "You can tag the search results in the Kwic-view: "
            + "<p>First select one or more rows and then drag the desired "
            + "Tag from the Tag Manager over the Kwic-results.</p>" + "<h4>Take a closer look</h4>"
            + "You can jump to the location in the full text by double "
            + "clicking on a row in the Kwic-view.");
    kwicButtonPanel.addComponent(helpLabel);

    kwicButtonPanel.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    rightComponent.addComponent(kwicButtonPanel);
    rightComponent.setComponentAlignment(kwicButtonPanel, Alignment.MIDDLE_RIGHT);

    splitPanel.addComponent(rightComponent);

    addComponent(splitPanel);
}

From source file:de.catma.ui.analyzer.PhraseResultPanel.java

License:Open Source License

private void initComponents() {
    setSizeFull();//from   w w  w . j  a v a2 s  . c  om

    HorizontalSplitPanel splitPanel = new HorizontalSplitPanel();
    splitPanel.setSizeFull();
    VerticalLayout leftComponent = new VerticalLayout();
    leftComponent.setSpacing(true);
    leftComponent.setSizeFull();

    resultTable = new TreeTable();
    resultTable.setSelectable(true);
    resultTable.setMultiSelect(true);
    HierarchicalContainer container = new HierarchicalContainer();
    container.setItemSorter(new PropertyDependentItemSorter(TreePropertyName.caption,
            new PropertyToTrimmedStringCIComparator()));

    resultTable.setContainerDataSource(container);

    resultTable.addContainerProperty(TreePropertyName.caption, String.class, null);
    resultTable.setColumnHeader(TreePropertyName.caption, "Phrase");
    resultTable.addContainerProperty(TreePropertyName.frequency, Integer.class, null);
    resultTable.setColumnHeader(TreePropertyName.frequency, "Frequency");
    resultTable.addContainerProperty(TreePropertyName.visibleInKwic, AbstractComponent.class, null);
    resultTable.setColumnHeader(TreePropertyName.visibleInKwic, "Visible in Kwic");

    resultTable.setItemCaptionPropertyId(TreePropertyName.caption);
    resultTable.setPageLength(10); //TODO: config
    resultTable.setSizeFull();

    leftComponent.addComponent(resultTable);
    leftComponent.setExpandRatio(resultTable, 1.0f);

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

    btDist = new Button();
    btDist.setIcon(new ClassResource("ui/analyzer/resources/chart.gif", getApplication()));
    btDist.setDescription("Show selected phrases as a distribution trend in a " + "chart like visualization.");

    buttonPanel.addComponent(btDist);

    btDoubleTree = new Button();
    btDoubleTree.setIcon(new ClassResource("ui/analyzer/resources/doubletree.gif", getApplication()));
    btDoubleTree.setDescription("Show a selected phrase with a doubletree kwic visualization.");

    buttonPanel.addComponent(btDoubleTree);

    btExcelExport = new Button();
    btExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    buttonPanel.addComponent(btExcelExport);

    btSelectAll = new Button("Select all for Kwic");

    buttonPanel.addComponent(btSelectAll);
    buttonPanel.setComponentAlignment(btSelectAll, Alignment.MIDDLE_RIGHT);
    buttonPanel.setExpandRatio(btSelectAll, 1f);
    btDeselectAll = new Button("Deselect all for Kwic");
    buttonPanel.addComponent(btDeselectAll);
    buttonPanel.setComponentAlignment(btDeselectAll, Alignment.MIDDLE_RIGHT);

    leftComponent.addComponent(buttonPanel);
    splitPanel.addComponent(leftComponent);

    VerticalLayout rightComponent = new VerticalLayout();
    rightComponent.setSpacing(true);
    rightComponent.setSizeFull();

    this.kwicPanel = new KwicPanel(repository, relevantUserMarkupCollectionProvider);
    rightComponent.addComponent(kwicPanel);
    rightComponent.setExpandRatio(kwicPanel, 1f);

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

    btKwicExcelExport = new Button();
    btKwicExcelExport.setIcon(new ThemeResource("../images/table-excel.png"));
    btKwicExcelExport.setDescription("Export all Query result data as an Excel spreadsheet.");
    kwicButtonPanel.addComponent(btKwicExcelExport);

    Label helpLabel = new Label();
    helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", getApplication()));

    helpLabel.setDescription("<h3>Hints</h3>" + "<h4>Tagging search results</h4>"
            + "You can tag the search results in the Kwic-view: "
            + "<p>First select one or more rows and then drag the desired "
            + "Tag from the Tag Manager over the Kwic-results.</p>" + "<h4>Take a closer look</h4>"
            + "You can jump to the location in the full text by double " + "clicking on a row in the Kwic-view."
            + "<h4>Untag search results</h4>" + "The \"Results by markup\" tab gives you the opportunity "
            + "to untag markup for selected search results in the Kwic-view.");

    kwicButtonPanel.addComponent(helpLabel);
    kwicButtonPanel.setExpandRatio(helpLabel, 1f);
    kwicButtonPanel.setComponentAlignment(helpLabel, Alignment.MIDDLE_RIGHT);

    rightComponent.addComponent(kwicButtonPanel);
    rightComponent.setComponentAlignment(kwicButtonPanel, Alignment.MIDDLE_RIGHT);

    splitPanel.addComponent(rightComponent);
    addComponent(splitPanel);
}

From source file:de.catma.ui.analyzer.querybuilder.PhrasePanel.java

License:Open Source License

private Component createSearchPanel() {
    VerticalLayout searchPanel = new VerticalLayout();
    searchPanel.setSpacing(true);/*from  w  w  w  .j  av  a 2s. co  m*/

    wordSequencePanel = new Panel(new HorizontalLayout());
    searchPanel.addComponent(wordSequencePanel);

    WordPanel firstWordPanel = new WordPanel(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            showInPreviw();
        }
    });
    addWordPanel(firstWordPanel);

    HorizontalLayout buttonPanel = new HorizontalLayout();

    Label addWordPanelLabel = new Label("If your phrase contains more words you can");
    buttonPanel.addComponent(addWordPanelLabel);
    buttonPanel.setComponentAlignment(addWordPanelLabel, Alignment.MIDDLE_CENTER);

    btAddWordPanel = new Button("add another word!");
    buttonPanel.addComponent(btAddWordPanel);
    searchPanel.addComponent(buttonPanel);

    return searchPanel;
}