List of usage examples for com.vaadin.ui AbstractLayout setHeight
@Override public void setHeight(float height, Unit unit)
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 a va2 s .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); }