Example usage for com.vaadin.ui CssLayout CssLayout

List of usage examples for com.vaadin.ui CssLayout CssLayout

Introduction

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

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.SubprojectsInfoBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(STYLE_SUBPROJECTS_INFOBOX);
    layout.setSizeFull();//from   www . ja  v  a2 s .co  m

    UUID uuid = project.getUuid();

    List<Project> parents = projectService.getParentChain(uuid);
    SortedSet<Project> subprojects = project.getSubProjects(new SubprojectComparator(templateService));
    int indent = 0;
    StringBuilder sb = new StringBuilder();

    // render the parents of the project as links in reverse order and
    // with increasing indentation; finally render the project
    // itself (just as emphasized text, no link)
    for (int i = parents.size() - 1; i >= 0; --i) {
        renderProject(sb, parents.get(i), templateService, indent, i > 0);
        indent += DELTA_INDENT;
    }

    // render the subprojects as links in alphabetical order
    // and with same indentation
    for (Project subproject : subprojects) {
        renderProject(sb, subproject, templateService, indent, true);
    }

    Label content = new Label(sb.toString(), Label.CONTENT_XHTML);
    content.setSizeUndefined();
    layout.addComponent(content);
    return layout;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java

License:Open Source License

@SuppressWarnings("serial")
public TagComponent(Project project, TaggingService taggingService, ExtensionUtil util) {
    this.project = project;
    this.taggingService = taggingService;
    this.util = util;

    tagListLayout = new CssLayout() {
        @Override//from  w ww.  j  av a2 s .  c om
        protected String getCss(Component c) {
            if (c instanceof Label) {
                return "float: left; line-height: 18px; padding-right: 3px;";
            } else {
                return "float: left";
            }
        }
    };
    tagComboBoxLayout = new CssLayout();
    tagComboBoxLayout.setSizeFull();
    layout = new CssLayout();
    layout.setSizeFull();
    layout.addStyleName(STYLE_TAG_COMPONENT);
    paintTagView();
    setCompositionRoot(layout);
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java

License:Open Source License

@SuppressWarnings({ "deprecation", "serial" })
private void paintTagView() {
    layout.removeAllComponents();/*from  ww w  .  j a  v a 2s  .  c om*/

    Set<String> tags = TaggingUtils.getTags(project);
    if (tags != null && tags.size() > 0) {
        Layout tagListLayout = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                if (c instanceof Label) {
                    return "float: left; line-height:18px; padding-right: 3px;";
                } else {
                    return "float: left; padding-right: 5px";
                }
            }
        };
        tagListLayout.setSizeFull();
        Label tagLabel = new Label("Tags:");
        tagLabel.setSizeUndefined();
        tagListLayout.addComponent(tagLabel);

        for (String tag : tags) {
            Button tagButton = new Button(tag, new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    String tag = event.getButton().getCaption();
                    util.getNavigator().navigateTagView(tag);
                }
            });
            tagButton.setStyleName(Button.STYLE_LINK);
            tagListLayout.addComponent(tagButton);
        }

        Button editButton = new Button("(edit tags)");
        if (util.getLoggedInUser() != null) {
            editButton.addListener(new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    paintTagEdit();
                }
            });
        } else {
            editButton.setEnabled(false);
            editButton.setDescription("Login to tag this project");
        }
        editButton.setStyleName(Button.STYLE_LINK);
        tagListLayout.addComponent(editButton);

        layout.addComponent(tagListLayout);
    } else {
        if (util.getLoggedInUser() != null) {
            Button addTagButton = new Button("(add tags)", new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    paintTagEdit();
                }
            });
            addTagButton.setStyleName(Button.STYLE_LINK);
            layout.addComponent(addTagButton);
        }
    }

}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java

License:Open Source License

@SuppressWarnings({ "deprecation", "serial" })
private void paintEditTagList() {
    tagListLayout.removeAllComponents();
    tagListLayout.setWidth("100%"); //$NON-NLS-1$

    Label tagLabel = new Label("Tags:");
    tagLabel.setSizeUndefined();/*  www .ja  v a 2 s .c o m*/
    tagListLayout.addComponent(tagLabel);

    SortedSet<String> tags = TaggingUtils.getTags(project);
    for (String tag : tags) {
        Layout l = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                if (c instanceof Label) {
                    return "float: left; line-height: 18px; padding-right: 3px"; //$NON-NLS-1$
                } else {
                    return "float: left; line-height: 18px; padding-right: 5px"; //$NON-NLS-1$
                }
            }
        };
        Label label = new Label(tag);
        label.setSizeUndefined();
        l.addComponent(label);

        Button removeButton = new Button("(remove)", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                String tag = (String) event.getButton().getData();
                TaggingUtils.removeTag(project, tag);
                util.persist(project);
                paintTagEdit();
            }
        });
        removeButton.setStyleName(Button.STYLE_LINK);
        removeButton.setData(tag);
        removeButton.setSizeUndefined();
        l.addComponent(removeButton);
        tagListLayout.addComponent(l);
    }
}

From source file:org.eclipse.skalli.view.internal.window.NewProjectPanel.java

License:Open Source License

/**
 * Renders the content of the panel./*  ww  w  . j a  v  a 2  s . c o  m*/
 */
private void renderContent(VerticalLayout content) {

    CssLayout layout = new CssLayout();
    layout.setWidth("600px"); //$NON-NLS-1$
    content.addComponent(layout);
    content.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);

    Label title = new Label("<h2>" + "Available Project Templates" + "</h2>", Label.CONTENT_XHTML); //$NON-NLS-1$//$NON-NLS-3$
    layout.addComponent(title);

    TreeSet<RadioSelect.Entry> entries = new TreeSet<RadioSelect.Entry>();
    for (ProjectTemplate projectTemplate : projectTemplates) {
        entries.add(new RadioSelect.Entry(projectTemplate.getId(), projectTemplate.getDisplayName(),
                projectTemplate.getDescription(), projectTemplate.getRank()));
    }
    select = new RadioSelect("", entries); //$NON-NLS-1$
    layout.addComponent(select);

    renderButtons(content);

    // for ui debugging
    content.setDebugId(DEBUG_ID_CONTENT);
}

From source file:org.eclipse.skalli.view.internal.window.NewProjectPanel.java

License:Open Source License

/**
 * Renders the OK/Cancel button bar./* w  w w .j a v  a2 s  .co  m*/
 */
private void renderButtons(VerticalLayout content) {
    CssLayout buttons = new CssLayout();
    buttons.addStyleName(STYLE_TEMPLATE_SELECT_BUTTONS);

    Button okButton = new Button("Create Project");
    okButton.setIcon(ICON_BUTTON_OK);
    okButton.addListener(new OKButtonListener());
    buttons.addComponent(okButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.setIcon(ICON_BUTTON_CANCEL);
    cancelButton.addListener(new CancelButtonListener());
    buttons.addComponent(cancelButton);

    content.addComponent(buttons);
    content.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);
}

From source file:org.eclipse.skalli.view.internal.window.ProjectDetailsPanel.java

License:Open Source License

public ProjectDetailsPanel(ProjectApplication application, Navigator navigator, Project project) {
    super();/*from w  w  w. j  a v  a  2  s .  c  om*/

    this.application = application;
    this.project = project;
    this.navigator = navigator;

    this.setSizeFull();

    leftLayout = new CssLayout();
    leftLayout.addStyleName(STYLE_EAST_COLUMN);
    leftLayout.setWidth("50%"); //$NON-NLS-1$
    addComponent(leftLayout);

    rightLayout = new CssLayout();
    rightLayout.addStyleName(STYLE_WEST_COLUMN);
    rightLayout.setWidth("50%"); //$NON-NLS-1$
    addComponent(rightLayout);

    renderContent();
}

From source file:org.eclipse.skalli.view.internal.window.ProjectDetailsPanel.java

License:Open Source License

private Component getInternalErrorContent() {
    Layout errorContent = new CssLayout();
    errorContent.setSizeFull();/* w w w.  j a  v a  2s . c o m*/
    Label label = new Label("Internal Error: The extension content cannot be displayed. "
            + "An internal error occurred. Please notify the administrator.", Label.CONTENT_XHTML);
    label.addStyleName("infobox-internalerror");
    errorContent.addComponent(label);
    return errorContent;
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java

License:Open Source License

private void renderProgessIndicator(VerticalLayout layout) {
    indicatorArea = new CssLayout();
    indicatorArea.setVisible(false);//w ww  .  ja  va  2  s . c om
    indicatorArea.setMargin(true);
    indicatorArea.setWidth(PANEL_WIDTH);
    indicatorArea
            .addComponent(new Label("<strong>Project is checked for issues</strong>", Label.CONTENT_XHTML));
    progressIndicator = new ProgressIndicator();
    progressIndicator.setWidth("300px");
    progressIndicator.setIndeterminate(false);
    indicatorArea.addComponent(progressIndicator);
    layout.addComponent(indicatorArea);
    layout.setComponentAlignment(indicatorArea, Alignment.MIDDLE_CENTER);
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java

License:Open Source License

private Label renderMessageArea(VerticalLayout layout) {
    CssLayout messageArea = new CssLayout();
    messageArea.setMargin(true);/*from  ww w .ja va 2  s . c om*/
    messageArea.setWidth(PANEL_WIDTH);
    Label label = new Label("", Label.CONTENT_XHTML); //$NON-NLS-1$
    label.addStyleName(STYLE_ISSUES);
    label.setVisible(false);
    messageArea.addComponent(label);
    layout.addComponent(messageArea);
    layout.setComponentAlignment(messageArea, Alignment.MIDDLE_CENTER);
    return label;
}