Example usage for com.vaadin.ui ComponentContainer setVisible

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

Introduction

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

Prototype

public void setVisible(boolean visible);

Source Link

Document

Sets the visibility of the component.

Usage

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/*from w w  w.  j  av  a2 s .  c  om*/
        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.OpenSelectedEntityWithHeaderActions.java

License:Apache License

private void showCause(ActionContext context) {
    Entity entity = context.getEntity();
    EntityLink selectedCause = entity.getSelectedCause();
    ComponentContainer causeContainer = entity.getHeaderActionContainer(ActionConstants.SHOW_CAUSE);

    Entity causeEntity = new Entity(selectedCause.getParentId());
    causeEntity.getState().setEntityTypeVisible(true);
    getActionsManager().executeAction(ActionsManager.OPEN_SELECTED_ENTITY_WITH_HEADER_ACTIONS, causeEntity,
            context.getApp(), causeContainer, false, context);
    causeContainer.setVisible(true);
    context.getApp().getActiveWindow().setScrollable(true);
    context.getApp().getActiveWindow().setScrollTop(0);
}

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

License:Apache License

private void hideCause(ActionContext context) {
    Entity entity = context.getEntity();
    ComponentContainer causeContainer = entity.getHeaderActionContainer(ActionConstants.SHOW_CAUSE);
    causeContainer.setVisible(false);
    context.getApp().getActiveWindow().scrollIntoView(context.getTargetContainer());
}