Example usage for com.vaadin.ui Alignment TOP_RIGHT

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

Introduction

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

Prototype

Alignment TOP_RIGHT

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

Click Source Link

Usage

From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.maven.MavenView.java

License:Open Source License

@PostConstruct
public void init() throws URISyntaxException {
    repositoryManager.loadRepositoriesInCache();
    addRootItemToContainer("Peergreen Releases",
            new URI("https://forge.peergreen.com/repository/content/repositories/releases/"));
    addRootItemToContainer("Maven Central", new URI("http://repo1.maven.org/maven2/"));

    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setSpacing(true);// w w w.  ja v a2  s.co m
    header.setMargin(true);

    final TextField filterG = new TextField();
    filterG.setInputPrompt("Filter by group id");
    filterG.addTextChangeListener(new FilterFiles(MVN_GROUP_ID, getContainer()));
    header.addComponent(filterG);
    header.setComponentAlignment(filterG, Alignment.TOP_LEFT);

    final TextField filterA = new TextField();
    filterA.setInputPrompt("Filter by artifact id");
    filterA.addTextChangeListener(new FilterFiles(MVN_ARTIFACT_ID, getContainer()));
    header.addComponent(filterA);
    header.setComponentAlignment(filterA, Alignment.TOP_LEFT);

    //        final TextField filterV = new TextField();
    //        filterV.setInputPrompt("Filter by version");
    //        filterV.addTextChangeListener(new FilterFiles(MVN_VERSION, getContainer()));
    //        header.addComponent(filterV);
    //        header.setComponentAlignment(filterV, Alignment.TOP_LEFT);

    HorizontalLayout actionArea = new HorizontalLayout();
    final NativeSelect actionSelection = new NativeSelect();
    actionSelection.addItem(DeploymentActions.DEPLOY);
    actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN);
    actionSelection.addItem(CLEAR_FILTER);
    actionSelection.setWidth("100px");
    actionSelection.setNullSelectionAllowed(false);

    Button doButton = new Button("Do");
    doButton.addStyleName("default");
    doButton.addClickListener(
            new DoClickListener(artifactBuilder, getTree(), actionSelection, deploymentViewManager));
    doButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (CLEAR_FILTER.equals(actionSelection.getValue())) {
                getContainer().removeAllContainerFilters();
            }
        }
    });

    actionArea.addComponent(actionSelection);
    actionArea.addComponent(doButton);
    header.addComponent(actionArea);
    header.setExpandRatio(actionArea, 2);
    header.setComponentAlignment(actionArea, Alignment.TOP_RIGHT);
    addComponent(header);

    HorizontalLayout repositoryInfo = new HorizontalLayout();
    repositoryInfo.setWidth("100%");
    repositoryInfo.addComponent(getFetching());
    repositoryInfo.setComponentAlignment(getFetching(), Alignment.MIDDLE_LEFT);
    addComponent(repositoryInfo);

    getTree().addExpandListener(new TreeItemExpandListener(this, getRepositoryService(), repositoryManager));
    addComponent(getTree());
    setExpandRatio(getTree(), 1.5f);

    updateTree();
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.repository.BaseRepositoryManagerPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();// w  w  w.  j a va 2 s .  c o  m
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    setContent(mainLayout);

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

    TextField filter = new TextField();
    filter.setInputPrompt("Filter repositories");
    filter.setWidth("100%");
    filter.addTextChangeListener(new RepositoryFilter());
    header.addComponent(filter);
    header.setComponentAlignment(filter, Alignment.TOP_LEFT);

    Button createRepository = new Button("Add repository");
    createRepository.addStyleName("wide");
    createRepository.addStyleName("default");
    createRepository.addClickListener(new CreateNewRepositoryListener());
    header.addComponent(createRepository);
    header.setComponentAlignment(createRepository, Alignment.TOP_RIGHT);
    mainLayout.addComponent(header);
    mainLayout.addComponent(contentLayout);
    mainLayout.setExpandRatio(contentLayout, 1.5f);

    updateRepositories();
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.repository.RepositoryEntry.java

License:Open Source License

private void showDefaultView() {
    if (defaultView == null) {
        defaultView = new HorizontalLayout();
        defaultView.setWidth("100%");
        Label name = new Label(repository.getName());
        defaultView.addComponent(name);//from   ww  w . j  a v  a 2 s  .  co m
        defaultView.setComponentAlignment(name, Alignment.TOP_LEFT);
        Button details = new Button("Details");
        details.addStyleName("link");
        details.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                showDetailsView();
            }
        });
        defaultView.addComponent(details);
        defaultView.setComponentAlignment(details, Alignment.TOP_RIGHT);
    }

    removeAllComponents();
    addComponent(defaultView);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.repository.RepositoryEntry.java

License:Open Source License

private void showDetailsView() {
    if (detailsView == null) {
        detailsView = new VerticalLayout();
        detailsView.setWidth("100%");

        Button hideDetails = new Button("Hide");
        hideDetails.addStyleName("link");
        hideDetails.addClickListener(new Button.ClickListener() {
            @Override/*w w  w  . ja  v a 2  s.  c  o m*/
            public void buttonClick(Button.ClickEvent event) {
                showDefaultView();
            }
        });
        detailsView.addComponent(hideDetails);
        detailsView.setComponentAlignment(hideDetails, Alignment.TOP_RIGHT);

        GridLayout layout = new GridLayout(3, 1);
        layout.addComponent(new Label("<b>Name</b>", ContentMode.HTML));
        layout.addComponent(new Label("&nbsp;", ContentMode.HTML));
        layout.addComponent(new Label(repository.getName()));
        layout.newLine();

        layout.addComponent(new Label("<b>URL</b>", ContentMode.HTML));
        layout.addComponent(new Label("&nbsp;", ContentMode.HTML));
        layout.addComponent(new Label(repository.getUrl()));
        layout.newLine();

        layout.addComponent(new Label("<b>Type</b>", ContentMode.HTML));
        layout.addComponent(new Label("&nbsp;", ContentMode.HTML));
        layout.addComponent(new Label(repository.getType()));

        detailsView.addComponent(layout);
        detailsView.setComponentAlignment(layout, Alignment.TOP_LEFT);
    }

    removeAllComponents();
    addComponent(detailsView);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployed.DeployedPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();/*from  w  w w .j a va  2 s  .  co  m*/
    Table table = new Table();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

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

    // Select all deployed artifacts
    CheckBox selectAll = new CheckBox("All");
    selectAll.addValueChangeListener(new SelectAll(table));
    toolBar.addComponent(selectAll);
    toolBar.setExpandRatio(selectAll, 1);

    // Filter
    TextField filter = new TextField();
    filter.setInputPrompt("Filter deployed artifacts");
    filter.setWidth("100%");
    filter.addTextChangeListener(new FilterFiles(TREE_ITEM_ID, container));
    toolBar.addComponent(filter);
    toolBar.setComponentAlignment(filter, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(filter, 3);

    HorizontalLayout actionArea = new HorizontalLayout();
    final NativeSelect actionSelection = new NativeSelect();
    actionSelection.addItem(DeploymentActions.UNDEPLOY);
    actionSelection.addItem(DeploymentActions.DELETE);
    actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN);
    actionSelection.setWidth("100px");
    actionSelection.setNullSelectionAllowed(false);

    Button doButton = new Button("Do");
    doButton.addStyleName("default");
    doButton.addClickListener(
            new DoClickListener(artifactBuilder, table, actionSelection, deploymentViewManager));

    actionArea.addComponent(actionSelection);
    actionArea.addComponent(doButton);
    toolBar.addComponent(actionArea);
    toolBar.setComponentAlignment(actionArea, Alignment.TOP_RIGHT);
    mainContent.addComponent(toolBar);

    VerticalLayout deployedContainer = new VerticalLayout();
    DragAndDropWrapper deployedContainerWrapper = new DragAndDropWrapper(deployedContainer);
    deployedContainerWrapper
            .setDropHandler(new DeploymentDropHandler(deploymentViewManager, this, notifierService));
    deployedContainerWrapper.setSizeFull();
    mainContent.addComponent(deployedContainerWrapper);
    mainContent.setExpandRatio(deployedContainerWrapper, 1.5f);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED, deploymentManager));
    table.addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, table, "Delete",
            ShortcutAction.KeyCode.DELETE, null));
    table.setItemDescriptionGenerator(new ItemDescription());
    table.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                DeployableEntry deployableEntry = (DeployableEntry) event.getItemId();
                try {
                    ArtifactStatusReport report = deploymentManager
                            .getReport(deployableEntry.getUri().toString());
                    event.getComponent().getUI()
                            .addWindow(new DeployableWindow(deployableEntry, report).getWindow());
                } catch (ArtifactStatusReportException e) {
                    LOGGER.warn("Cannot get artifact status report for ''{0}''", deployableEntry.getUri(), e);
                    event.getComponent().getUI().addWindow(new DeployableWindow(deployableEntry).getWindow());
                }
            }
        }
    });
    deployedContainer.addComponent(table);
    deployedContainer.setExpandRatio(table, 1.5f);

    refresh();
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deploymentplan.DeploymentPlanPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();/*from  ww w .  j a v  a 2  s.c om*/

    TreeTable table = new TreeTable();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

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

    // Deployment Plan name
    Label deploymentPlanNameLabel = new Label("Plan");
    toolBar.addComponent(deploymentPlanNameLabel);
    toolBar.setExpandRatio(deploymentPlanNameLabel, 1);

    deploymentPlanName = new TextField();
    deploymentPlanName.setInputPrompt(getDefaultName());
    deploymentPlanName.setWidth("100%");
    toolBar.addComponent(deploymentPlanName);
    toolBar.setComponentAlignment(deploymentPlanName, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(deploymentPlanName, 3);

    error = new Label("", ContentMode.HTML);
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    toolBar.addComponent(error);
    toolBar.setComponentAlignment(error, Alignment.TOP_RIGHT);
    toolBar.setExpandRatio(error, 1);
    mainContent.addComponent(toolBar);
    mainContent.setComponentAlignment(toolBar, Alignment.TOP_LEFT);
    mainContent.setExpandRatio(toolBar, 1);

    VerticalLayout deploymentPlanContainer = new VerticalLayout();
    DragAndDropWrapper deploymentPlanContainerWrapper = new DragAndDropWrapper(deploymentPlanContainer);
    DropHandler deploymentPlanDropHandler = new DeploymentDropHandler(deploymentViewManager, this,
            notifierService);
    deploymentPlanContainerWrapper.setDropHandler(deploymentPlanDropHandler);
    deploymentPlanContainerWrapper.setSizeFull();
    mainContent.addComponent(deploymentPlanContainerWrapper);
    mainContent.setExpandRatio(deploymentPlanContainerWrapper, 10);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED));
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setDropHandler(new OrderedContainerDropHandler(table, deploymentPlanDropHandler));
    table.addShortcutListener(new ShortcutListener("Delete", ShortcutAction.KeyCode.DELETE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            Table table = (Table) target;
            Collection<DeployableEntry> deployableEntries = (Collection<DeployableEntry>) table.getValue();
            for (DeployableEntry deployableEntry : deployableEntries) {
                removeDeployable(deployableEntry);
            }
        }
    });
    deploymentPlanContainer.addComponent(table);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeFull();
    footer.setSpacing(true);
    footer.setMargin(true);
    footer.addStyleName("footer");
    footer.setWidth("100%");

    deployIt = new CheckBox("Deploy this deployment plan");
    footer.addComponent(deployIt);
    footer.setComponentAlignment(deployIt, Alignment.TOP_LEFT);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    Button cancel = new Button("Cancel");
    cancel.addClickListener(new CancelButtonListener());
    Button create = new Button("Create");
    create.addClickListener(new CreateButtonListener());
    create.addStyleName("wide");
    create.addStyleName("default");
    buttons.addComponent(cancel);
    buttons.addComponent(create);
    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.TOP_RIGHT);

    mainContent.addComponent(footer);
    mainContent.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT);
    mainContent.setExpandRatio(footer, 1);
}

From source file:com.purebred.core.view.layout.LeftLabelGridLayout.java

License:Open Source License

private void addFieldImpl(FormField formField) {
    Label label = formField.getFieldLabel();

    HorizontalLayout fieldLayout = new HorizontalLayout();
    fieldLayout.setSizeUndefined();//  ww  w  .jav a  2 s .co m
    Field field = formField.getField();
    fieldLayout.addComponent(field);

    Label spacer = new Label();
    spacer.setWidth("1em");

    if (formField.getColumnEnd() != null && formField.getRowEnd() != null) {
        addComponent(label, getLabelColumn(formField), getRowStart(formField), getLabelColumn(formField),
                getRowEnd(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField), getColumnEnd(formField),
                getRowEnd(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField), getSpacerColumn(formField),
                getRowEnd(formField));
    } else {
        addComponent(label, getLabelColumn(formField), getRowStart(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField));
    }
    setComponentAlignment(fieldLayout, Alignment.TOP_LEFT);
    setComponentAlignment(label, Alignment.TOP_RIGHT);
    setComponentAlignment(spacer, Alignment.TOP_LEFT);
}

From source file:com.purebred.core.view.MainEntryPoint.java

License:Open Source License

@PostConstruct
@Override/*  w w w  .j  a  v a2s.  c  om*/
public void postConstruct() {
    super.postConstruct();

    labelDepot.putEntityLabel(getEntityType().getName(), getEntityCaption());

    HorizontalLayout searchAndLogout = new HorizontalLayout();
    searchAndLogout.setSizeFull();
    searchAndLogout.addComponent(getSearchForm());

    logoutButton = new Button(null);
    logoutButton.setDescription(uiMessageSource.getMessage("mainApplication.logout"));
    logoutButton.setSizeUndefined();
    logoutButton.addStyleName("borderless");
    logoutButton.setIcon(new ThemeResource("icons/16/logout.png"));

    searchAndLogout.addComponent(logoutButton);
    searchAndLogout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT);

    addComponent(searchAndLogout);
    addComponent(getResults());
}

From source file:com.purebred.core.view.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();//from  w w w . j  a v a 2 s  . co m
    previousButtonLayout.addComponent(spaceLabel);

    previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getMessage("entityForm.previous.description"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getMessage("entityForm.next.description"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.save.client.promodeals.PromoUI.java

public PromoUI(int clientId) {
    this.clientId = clientId;

    setWidth("90%");
    setHeight("100%");
    setMargin(new MarginInfo(true, true, false, false));

    PDDataGridProperties dataGrid = new PDDataGridProperties(getClientId());

    Button button = new Button("Acknowledgement Form");
    button.setWidthUndefined();/*  www .j av a  2s.  c o  m*/
    button.setIcon(FontAwesome.OPENID);
    button.addStyleName(ValoTheme.BUTTON_LINK);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener((Button.ClickEvent event) -> {
        Window sub = new com.save.clients.AcknowledgementPromoForm(getClientId());
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }

        sub.addCloseListener((Window.CloseEvent e) -> {
            dataGrid.getContainerDataSource().removeAllItems();
            dataGrid.setContainerDataSource(new PDDataContainer(getClientId()));
        });
    });
    addComponent(button);
    setComponentAlignment(button, Alignment.TOP_RIGHT);

    addComponent(dataGrid);
    setExpandRatio(dataGrid, 2);
}