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.example.webconsole.extensions.ConfirmDialogExtension.java

License:Open Source License

public ConfirmDialogExtension() {
    setSizeFull();/*from w w w.  java  2  s  .co m*/
    setSpacing(true);
    setMargin(true);

    Link showCodeSource = new Link("Show code source",
            new ExternalResource(GitHubClassURL.getURL(ConfirmDialogExtension.class)));
    showCodeSource.setTargetName("_blank");
    addComponent(showCodeSource);
    setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT);

    Label title = new Label("Drag and drop components from a panel to another");
    title.addStyleName("h1");
    addComponent(title);
    setComponentAlignment(title, Alignment.MIDDLE_CENTER);

    HorizontalLayout row = new HorizontalLayout();
    row.setSizeFull();
    row.setSpacing(true);
    row.setMargin(true);

    VerticalLayout leftPanel = new VerticalLayout();
    leftPanel.setSpacing(true);
    leftPanel.addStyleName("dashed-area");
    leftPanel.addComponent(getDraggableComponent(new Label("Label")));
    leftPanel.addComponent(getDraggableComponent(new Button("Button")));
    DragAndDropWrapper leftPanelWrapper = new DragAndDropWrapper(leftPanel);
    row.addComponent(leftPanelWrapper);
    row.setComponentAlignment(leftPanelWrapper, Alignment.TOP_LEFT);

    VerticalLayout rightPanel = new VerticalLayout();
    rightPanel.setSpacing(true);
    rightPanel.addStyleName("dashed-area");
    DragAndDropWrapper rightPanelWrapper = new DragAndDropWrapper(rightPanel);
    row.addComponent(rightPanelWrapper);
    row.setComponentAlignment(rightPanelWrapper, Alignment.TOP_RIGHT);

    leftPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(rightPanel, leftPanel));
    rightPanelWrapper.setDropHandler(new ConfirmDialogExtensionDropHandler(leftPanel, rightPanel));

    addComponent(row);
    setExpandRatio(row, 1.5f);
}

From source file:com.peergreen.example.webconsole.extensions.CssContributionExtension.java

License:Open Source License

public CssContributionExtension() {
    setSizeFull();//from www  . j  a  va 2s .com
    setSpacing(true);
    setMargin(true);

    Link showCodeSource = new Link("Show code source",
            new ExternalResource(GitHubClassURL.getURL(CssContributionExtension.class)));
    showCodeSource.setTargetName("_blank");
    addComponent(showCodeSource);
    setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT);
}

From source file:com.peergreen.example.webconsole.extensions.DefaultWindowExtension.java

License:Open Source License

public DefaultWindowExtension() {
    setSizeFull();// w ww  .j  a va  2 s  .c  om
    setSpacing(true);
    setMargin(true);

    Link showCodeSource = new Link("Show code source",
            new ExternalResource(GitHubClassURL.getURL(DefaultWindowExtension.class)));
    showCodeSource.setTargetName("_blank");
    addComponent(showCodeSource);
    setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT);

    Button simpleButton = new Button("Click to open a Window");
    simpleButton.setWidth("400px");
    simpleButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            final UI ui = clickEvent.getConnector().getUI();
            String caption = "Default window";
            Label content = new Label("This is a simple window");
            Button close = new Button("Close");
            close.addStyleName("wide");
            close.addStyleName("default");
            final DefaultWindow window = new DefaultWindow(caption, content, close);
            window.center();
            ui.addWindow(window);
            close.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    window.close();
                }
            });
        }
    });
    addComponent(simpleButton);

    setExpandRatio(simpleButton, 1.5f);
}

From source file:com.peergreen.example.webconsole.extensions.NavigatorExtension.java

License:Open Source License

public NavigatorExtension() {
    setSizeFull();/*from   ww w .j  a  v  a  2  s .  co m*/
    setSpacing(true);
    setMargin(true);

    Link showCodeSource = new Link("Show code source",
            new ExternalResource(GitHubClassURL.getURL(NavigatorExtension.class)));
    showCodeSource.setTargetName("_blank");
    addComponent(showCodeSource);
    setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT);
}

From source file:com.peergreen.example.webconsole.extensions.NotifierExtension.java

License:Open Source License

public NotifierExtension() {
    setSizeFull();/*from  w  w w.  j a va2  s  . c  om*/
    setSpacing(true);
    setMargin(true);

    Link showCodeSource = new Link("Show code source",
            new ExternalResource(GitHubClassURL.getURL(NotifierExtension.class)));
    showCodeSource.setTargetName("_blank");
    addComponent(showCodeSource);
    setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT);
}

From source file:com.peergreen.example.webconsole.extensions.SimpleExtension.java

License:Open Source License

public SimpleExtension() {
    setSizeFull();//  w  ww . j av  a  2  s  .  c  o m
    setSpacing(true);
    setMargin(true);

    Link showCodeSource = new Link("Show code source",
            new ExternalResource(GitHubClassURL.getURL(SimpleExtension.class)));
    showCodeSource.setTargetName("_blank");
    addComponent(showCodeSource);
    setComponentAlignment(showCodeSource, Alignment.TOP_RIGHT);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.components.ExceptionView.java

License:Open Source License

private void showDefaultView() {
    if (messageView == null) {
        messageView = new HorizontalLayout();
        messageView.setWidth("100%");
        StringBuilder sb = new StringBuilder();
        sb.append("<span style=\"color:red\">");
        sb.append(artifactErrorDetail.getMessage());
        sb.append("</span>");
        Label message = new Label(sb.toString(), ContentMode.HTML);
        messageView.addComponent(message);
        messageView.setComponentAlignment(message, Alignment.TOP_LEFT);
        Button details = new Button("Details");
        details.addStyleName("link");
        details.addClickListener(new Button.ClickListener() {
            @Override//from  www .j av a2 s . co  m
            public void buttonClick(Button.ClickEvent event) {
                showDetailsView();
            }
        });
        messageView.addComponent(details);
        messageView.setComponentAlignment(details, Alignment.TOP_RIGHT);
    }

    removeAllComponents();
    addComponent(messageView);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.components.ExceptionView.java

License:Open Source License

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

        StringBuilder sb = new StringBuilder();
        sb.append("<span style=\"color:red\"> Message : ");
        sb.append(artifactErrorDetail.getMessage());
        sb.append("<br />");
        for (StackTraceElement element : artifactErrorDetail.getStackTrace()) {
            sb.append("&nbsp;&nbsp;&nbsp;");
            sb.append(" |- ");
            sb.append(element.getClassName());
            sb.append('.');
            sb.append(element.getMethodName());
            sb.append('(');
            sb.append(element.getFileName());
            sb.append(':');
            sb.append(element.getLineNumber());
            sb.append(')');
            sb.append("<br />");
        }//from w ww  .j  a v  a  2 s  .  c om
        sb.append("</span>");
        Label stackTrace = new Label(sb.toString(), ContentMode.HTML);
        stackTraceView.addComponent(stackTrace);
        stackTraceView.setComponentAlignment(stackTrace, Alignment.TOP_LEFT);

        Button hideDetails = new Button("Hide");
        hideDetails.addStyleName("link");
        hideDetails.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                showDefaultView();
            }
        });
        stackTraceView.addComponent(hideDetails);
        stackTraceView.setComponentAlignment(hideDetails, Alignment.TOP_RIGHT);
    }

    removeAllComponents();
    addComponent(stackTraceView);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.all.AllView.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();//from w  w  w  .  j av  a 2  s .c o  m
    setSpacing(true);
    setMargin(true);

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

    final TextField filter = new TextField();
    filter.setInputPrompt("Type artifact name or maven dependency");
    filter.setWidth("100%");
    filter.addTextChangeListener(new FilterFiles(AbstractDeployableContainer.DEPLOYABLE_NAME,
            directoryContainer.getContainer(), mavenContainer.getContainer()));
    header.addComponent(filter);
    header.setComponentAlignment(filter, Alignment.TOP_LEFT);
    header.setExpandRatio(filter, 3);

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

    TreeTable directoryTable = createDeployableTable(AbstractDeployableContainer.DEPLOYABLE_NAME,
            DIRECTORY_ITEM_ID, directoryContainer.getContainer());
    TreeTable mavenTable = createDeployableTable(AbstractDeployableContainer.DEPLOYABLE_NAME, MAVEN_ITEM_ID,
            mavenContainer.getContainer());
    //mavenTable.addExpandListener(new TreeItemExpandListener(this, mavenRepositoryService));

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

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

    addComponent(directoryTable);
    setExpandRatio(directoryTable, 1.5f);
    addComponent(mavenTable);
    setExpandRatio(mavenTable, 1.5f);
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deployable.directory.DirectoryView.java

License:Open Source License

@PostConstruct
public void init() {
    File deploy = new File(System.getProperty("user.dir") + File.separator + "deploy");
    repositoryManager.addRepository(formatUrl(deploy), "Deploy", RepositoryType.DIRECTORY);

    File m2 = new File(
            System.getProperty("user.home") + File.separator + ".m2" + File.separator + "repository");
    if (m2.exists()) {
        repositoryManager.addRepository(formatUrl(m2), "Local M2 repository", RepositoryType.DIRECTORY);
    }/*  ww  w. ja  va 2s . co  m*/

    File tmp = new File(Constants.STORAGE_DIRECTORY);
    if (!tmp.exists()) {
        tmp.mkdirs();
    }
    repositoryManager.addRepository(formatUrl(tmp), "Temporary directory", RepositoryType.DIRECTORY);

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

    final TextField filter = new TextField();
    filter.setInputPrompt("Filter deployable files");
    filter.setWidth("100%");
    filter.addTextChangeListener(new FilterFiles(DEPLOYABLE_NAME, getContainer()));
    header.addComponent(filter);
    header.setComponentAlignment(filter, Alignment.TOP_LEFT);
    header.setExpandRatio(filter, 3);

    HorizontalLayout actionArea = new HorizontalLayout();
    final NativeSelect actionSelection = new NativeSelect();
    actionSelection.addItem(DeploymentActions.DEPLOY);
    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, getTree(), actionSelection, deploymentViewManager));

    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().addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, getTree(), "Delete",
            ShortcutAction.KeyCode.DELETE, null));
    getTree().addExpandListener(new TreeItemExpandListener(this, getRepositoryService(), repositoryManager));

    addComponent(getTree());
    setExpandRatio(getTree(), 1.5f);
}