Example usage for com.vaadin.ui ComponentContainer addStyleName

List of usage examples for com.vaadin.ui ComponentContainer addStyleName

Introduction

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

Prototype

public void addStyleName(String style);

Source Link

Document

Adds one or more style names to this component.

Usage

From source file:com.esofthead.mycollab.mobile.ui.AbstractPreviewItemComp.java

License:Open Source License

public AbstractPreviewItemComp() {

    previewForm = initPreviewForm();//from   www.ja v  a2s .  c  o  m
    previewForm.setStyleName("readview-layout");
    this.setContent(previewForm);

    editBtn = new NavigationBarQuickMenu();
    editBtn.setButtonCaption(null);
    editBtn.setStyleName("edit-btn");
    editBtn.setContent(createButtonControls());
    this.setRightComponent(editBtn);

    initRelatedComponents();

    ComponentContainer toolbarContent = createBottomPanel();
    if (toolbarContent != null) {
        toolbarContent.addStyleName("related-items");
        toolbarContent.setHeight("100%");
        toolbarContent.setWidthUndefined();

        MobileViewToolbar toolbar = new MobileViewToolbar();
        toolbar.setComponent(toolbarContent);
        this.setToolbar(toolbar);
    }
}

From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp.java

License:Open Source License

private void initContent() {
    previewForm = initPreviewForm();/*  ww  w.ja v a  2 s  . com*/
    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        actionControls.addStyleName("control-buttons");
        addHeaderRightContent(actionControls);
    }

    CssLayout contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");

    if (previewLayout == null)
        previewLayout = new DefaultReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    RightSidebarLayout bodyContainer = new RightSidebarLayout();
    bodyContainer.setSizeFull();
    bodyContainer.addStyleName("readview-body-wrap");

    bodyContent = new MVerticalLayout().withSpacing(false).withMargin(false).with(previewForm);
    bodyContainer.setContent(bodyContent);

    sidebarContent = new MVerticalLayout().withWidth("250px").withSpacing(true)
            .withStyleName("readview-sidebar");
    bodyContainer.setSidebar(sidebarContent);

    FloatingComponent floatSidebar = FloatingComponent.floatThis(sidebarContent);
    floatSidebar.setContainerId("main-body");

    previewLayout.addBody(bodyContainer);

    this.addComponent(contentWrapper);
}

From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp2.java

License:Open Source License

public AbstractPreviewItemComp2(String headerText, Resource iconResource) {
    if (iconResource != null)
        this.titleIcon = new Image(null, iconResource);
    this.addComponent(constructHeader(headerText));

    previewForm = initPreviewForm();//from ww w  .j a v  a2s .  c  o  m
    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        actionControls.addStyleName("control-buttons");
        addHeaderRightContent(actionControls);
    }

    CssLayout contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");

    previewLayout = new ReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    bodyContainer = new HorizontalLayout();
    bodyContainer.setSizeFull();
    bodyContainer.setStyleName("readview-body-wrap");

    bodyContent = new VerticalLayout();
    bodyContent.addComponent(previewForm);
    bodyContainer.addComponent(bodyContent);
    bodyContainer.setExpandRatio(bodyContent, 1);

    sidebarContent = new VerticalLayout();
    sidebarContent.setWidth("250px");
    sidebarContent.setSpacing(true);
    sidebarContent.setStyleName("readview-sidebar");
    bodyContainer.addComponent(sidebarContent);

    FloatingComponent floatSidebar = FloatingComponent.floatThis(sidebarContent);
    floatSidebar.setContainerId("main-body");

    previewLayout.addBody(bodyContainer);

    this.addComponent(contentWrapper);
}

From source file:com.esofthead.mycollab.module.project.view.settings.ProjectRoleReadViewImpl.java

License:Open Source License

public ProjectRoleReadViewImpl() {
    this.headerText = new Label();
    headerText.setCaption(AppContext.getMessage(ProjectRoleI18nEnum.FORM_READ_TITLE));
    headerText.setIcon(FontAwesome.USERS);
    headerText.addStyleName("header-text");

    this.headerText.setSizeUndefined();
    this.addComponent(constructHeader());

    previewForm = initPreviewForm();/*from w  ww.j a  v a  2 s  . c  o  m*/
    ComponentContainer actionControls = createButtonControls();
    if (actionControls != null) {
        actionControls.addStyleName("control-buttons");
    }

    addHeaderRightContent(actionControls);

    CssLayout contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");

    previewLayout = new DefaultReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    previewLayout.addBody(previewForm);

    this.addComponent(contentWrapper);
}

From source file:org.lunifera.examples.vaaclipse.demo1.e4.toolitems.CodeLineToolItem.java

License:Open Source License

@Inject
public CodeLineToolItem(ComponentContainer parent, IEclipseContext context) {
    //the parent - is toolcontrol widget, we must add style for layouting in trimbar to parent widget, not to user control 
    parent.addStyleName("codeline");

    final Label label = new Label("170 : 20");
    parent.addComponent(label);//ww w.  j  a  v  a  2s . c om
}

From source file:org.lunifera.examples.vaaclipse.demo1.e4.toolitems.EditModeToolItem.java

License:Open Source License

@Inject
public EditModeToolItem(ComponentContainer parent, IEclipseContext context) {
    //the parent - is toolcontrol widget, we must add style for layouting in trimbar to parent widget, not to user control
    parent.addStyleName("editmode");

    final Label label = new Label("Readonly");
    parent.addComponent(label);/*from   w w w  .  j av  a 2 s  .co m*/
}

From source file:org.lunifera.examples.vaaclipse.demo1.e4.toolitems.EditStatusToolItem.java

License:Open Source License

@Inject
public EditStatusToolItem(ComponentContainer parent, IEclipseContext context) {
    //the parent - is toolcontrol widget, we must add style for layouting in trimbar to parent widget, not to user control
    parent.addStyleName("editstatus");

    final Label label = new Label("Smart Insert");
    parent.addComponent(label);//from w  w  w .  j a v a  2  s. c o  m
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.ToolControlRenderer.java

License:Open Source License

public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MToolControl))
        return;//from w  w w  . ja va2s.  c o  m

    MToolControl toolControl = (MToolControl) element;

    ComponentContainer toolControlContainer;
    if ((MElementContainer<?>) element.getParent() instanceof MTrimBar) {
        MTrimBar trimBar = (MTrimBar) (MElementContainer<?>) element.getParent();
        if (trimBar.getSide() == SideValue.LEFT || trimBar.getSide() == SideValue.RIGHT)
            toolControlContainer = new VerticalLayout();
        else
            toolControlContainer = new HorizontalLayout();
        //add the drag handler (separator)
        toolControlContainer.addComponent(GuiUtils.createSeparator(toolControl));
    } else
        toolControlContainer = new VerticalLayout();

    IEclipseContext parentContext = modelService.getContainingContext(element);

    // Create a context just to contain the parameters for injection
    IContributionFactory contributionFactory = parentContext.get(IContributionFactory.class);

    IEclipseContext localContext = EclipseContextFactory.create();

    localContext.set(Component.class, toolControlContainer);
    localContext.set(ComponentContainer.class, toolControlContainer);
    localContext.set(MToolControl.class, toolControl);

    Object tcImpl = contributionFactory.create(toolControl.getContributionURI(), parentContext, localContext);
    toolControl.setObject(tcImpl);

    for (String css : toolControl.getTags()) {
        toolControlContainer.addStyleName(css);
    }

    toolControl.setWidget(toolControlContainer);
}

From source file:org.semanticsoft.vaaclipse.presentation.renderers.TrimBarRenderer.java

License:Open Source License

@Override
public void processContents(MElementContainer<MUIElement> container) {
    final MTrimBar trimBar = (MTrimBar) ((MElementContainer<?>) container);
    int orientation = trimBar.getSide().getValue();
    AbstractLayout trimBarWidget = (AbstractLayout) container.getWidget();
    if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE)
        trimBarWidget.setHeight(-1, Unit.PIXELS);
    else//w w w. j a  v a2s.  c o m
        trimBarWidget.setWidth(-1, Unit.PIXELS);

    boolean isFirst = true;
    trimBarWidget.removeAllComponents();
    for (MUIElement element : container.getChildren()) {
        if (element.isToBeRendered()) {
            ComponentContainer subToolbar = (ComponentContainer) element.getWidget();
            subToolbar.setVisible(element.isVisible());
            if (subToolbar != null) {
                if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE)
                    subToolbar.addStyleName("horizontaltrimelement");
                else
                    subToolbar.addStyleName("verticaltrimelement");

                subToolbar.setSizeUndefined();

                trimBarWidget.addComponent(subToolbar);
                isFirst = false;
            }
        }
    }

    //---
    IEclipseContext ctx = getContext(container);
    final ExpressionContext eContext = new ExpressionContext(ctx);

    //visible when support for original trimbar elements (without contributed)
    for (final MTrimElement child : trimBar.getChildren()) {
        if (child.getVisibleWhen() != null) {
            ctx.runAndTrack(new RunAndTrack() {
                @Override
                public boolean changed(IEclipseContext context) {

                    if (!trimBar.isToBeRendered() || !trimBar.isVisible() || trimBar.getWidget() == null) {
                        return false;
                    }

                    final boolean rc = ContributionsAnalyzer.isVisible((MCoreExpression) child.getVisibleWhen(),
                            eContext);
                    execService.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            child.setToBeRendered(rc);
                        }
                    });

                    return true;
                }
            });
        }
    }

    //contributions
    ArrayList<MTrimContribution> toContribute = new ArrayList<MTrimContribution>();
    ContributionsAnalyzer.gatherTrimContributions(trimBar, app.getTrimContributions(), trimBar.getElementId(),
            toContribute, eContext);
    addTrimContributions(trimBar, toContribute, ctx, eContext);

    refreshVisibility(trimBar);
}

From source file:ro.zg.netcell.vaadin.action.application.EntityListHandler.java

License:Apache License

@Override
public void handle(final ActionContext actionContext) throws Exception {

    final UserAction ua = actionContext.getUserAction();
    final OpenGroupsApplication app = actionContext.getApp();

    ComponentContainer targetContainer = actionContext.getTargetContainer();
    targetContainer.removeAllComponents();
    targetContainer.addStyleName(OpenGroupsStyles.LIST_ACTIONS_CONTAINER);

    final Entity entity = actionContext.getEntity();
    /* reset filters */
    entity.resetFilters();//from  w w w. ja  v a  2  s  . com

    // Panel listContainer = new Panel();
    // ((VerticalLayout)listContainer.getContent()).setMargin(false);

    CssLayout refreshButtonContainer = new CssLayout();
    // refreshButtonContainer.setSizeFull();
    //   refreshButtonContainer.setWidth("100%");
    refreshButtonContainer.addStyleName(OpenGroupsStyles.LIST_REFRESH_BAR);

    // final VerticalLayout listContainer = new VerticalLayout();

    final CssLayout listAndPageControlsContainer = new CssLayout();
    //   final VerticalLayout listAndPageControlsContainer = new VerticalLayout();

    listAndPageControlsContainer.addStyleName("list-container");
    // listAndPageControlsContainer.setSizeFull();
    //   listAndPageControlsContainer.setWidth("100%");

    Button refreshButton = new Button();
    refreshButton.setDescription(getMessage("refresh.list"));
    refreshButton.setIcon(OpenGroupsResources.getIcon(OpenGroupsIconsSet.REFRESH, OpenGroupsIconsSet.MEDIUM));
    refreshButton.addStyleName(BaseTheme.BUTTON_LINK + " middle-right");
    refreshButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            refreshList(entity, ua, app, listAndPageControlsContainer, actionContext);
        }
    });

    targetContainer.addComponent(refreshButtonContainer);
    Component searchFilter = getSearchFilter(entity, ua, app, actionContext);
    searchFilter.addStyleName("middle-left");
    refreshButtonContainer.addComponent(searchFilter);
    refreshButtonContainer.addComponent(refreshButton);

    ComponentContainer filtersContainer = initFilters(entity, ua, app, actionContext);
    targetContainer.addComponent(filtersContainer);

    targetContainer.addComponent(listAndPageControlsContainer);
    int itemsCount = refreshList(entity, ua, app, listAndPageControlsContainer, actionContext);
}