Wraps the specified {@link Component} into a UI

@param component the component to wrap
@return an UI displaying that component
@see #wrapLayout(com.vaadin.ui.Layout)
197496
public UI wrap(Component component) {
        if (component instanceof UI) {
            return (UI) component;
        }
        if (component instanceof Window) {
            return wrapWindow((Window) component);
        }
        if (component instanceof Layout) {
            return wrapLayout((Layout) component);
        }

        // Ok it's a component we cannot handle directly
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSizeFull();
        layout.addComponent(component);
        layout.setExpandRatio(component, 1);
        return wrapLayout(layout);
    }
34585
function Panel(options) {
  var panelLayout = options.layoutConfig;
  var viewLayouts = createLayout(panelLayout.view.views);
  this.getPosition = panelLayout.getPosition;
  this.views = _.map(viewLayouts, function (viewLayout) {
    viewLayout.getPosition = wrapGetPosition(viewLayout.getPosition, panelLayout.getPosition);
    return options.creator(viewLayout);
  });
}
205005
public void setRootComponent(final MvcComponent component) {
        if (uiThreadRunner.isOnUiThread()) {
            try {
                graph.setRootComponent(component);
            } catch (Graph.IllegalRootComponentException e) {
                throw new MvcGraphException(e.getMessage(), e);
            }
        } else {
            uiThreadRunner.post(new Runnable() {
                @Override
                public void run() {
                    try {
                        graph.setRootComponent(component);
                    } catch (Graph.IllegalRootComponentException e) {
                        throw new MvcGraphException(e.getMessage(), e);
                    }
                }
            });
        }
    }
1313995
public void setLayout(java.lang.String layout) {
        getStateHelper().put(PropertyKeys.layout, layout);
    }
465549
public UI wrapWindow(Window window) {
        final UI ui = wrapLayout(new VerticalLayout());
        ui.addWindow(window);
        return ui;
    }
659811
public static URI addPathComponent(URI uri, String component) {
        if (uri != null && component != null) try {
            return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
                    Optional.ofNullable(uri.getPath()).map(path -> join(path, component, '/')).orElse(component),
                    uri.getQuery(), uri.getFragment());
        } catch (URISyntaxException use) {
            throw new IllegalArgumentException("Could not add path component \"" + component + "\" to " + uri + ": "
                    + use.getMessage(), use);
        }
        return uri;
    }
479680
public <T> T getComponent(String componentName, Class<T> componentType)
    {
        BeanFactory factory = getBeanFactory();
        T component = factory.getBean(componentName, componentType);
        return component;
    }
108526
public void makeVisible(final WComponent component) {
		if (component.getParent() != getCardContainer()) {
			throw new IllegalArgumentException(
					"Attempted to make a component visible which is not contained in this WCardManager");
		}

		CardManagerModel model = getOrCreateComponentModel();
		model.visibleComponent = component;
	}
1116660
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPanel panel = (WPanel) component;
		XmlStringBuilder xml = renderContext.getWriter();
		ListLayout layout = (ListLayout) panel.getLayout();
		int childCount = panel.getChildCount();
		Size gap = layout.getSpace();
		String gapString = gap != null ? gap.toString() : null;

		xml.appendTagOpen("ui:listlayout");

		switch (layout.getType()) {
			case FLAT:
				xml.appendAttribute("type", "flat");
				break;

			case STACKED:
				xml.appendAttribute("type", "stacked");
				break;

			case STRIPED:
				xml.appendAttribute("type", "striped");
				break;

			default:
				throw new IllegalArgumentException("Invalid type: " + layout.getType());
		}

		switch (layout.getAlignment()) {
			case LEFT:
				// left is assumed if omitted
				break;

			case RIGHT:
				xml.appendAttribute("align", "right");
				break;

			case CENTER:
				xml.appendAttribute("align", "center");
				break;

			default:
				throw new IllegalArgumentException("Invalid alignment: " + layout.getAlignment());
		}

		switch (layout.getSeparator()) {
			case NONE:
				// none is assumed if omitted
				break;

			case BAR:
				xml.appendAttribute("separator", "bar");
				break;

			case DOT:
				xml.appendAttribute("separator", "dot");
				break;

			default:
				throw new IllegalArgumentException("Invalid separator: " + layout.getSeparator());
		}

		xml.appendOptionalAttribute("ordered", layout.isOrdered(), "true");

		xml.appendOptionalAttribute("gap", gapString);

		xml.appendClose();

		// Paint children
		for (int i = 0; i < childCount; i++) {
			xml.appendTag("ui:cell");
			panel.getChildAt(i).paint(renderContext);
			xml.appendEndTag("ui:cell");
		}

		xml.appendEndTag("ui:listlayout");
	}
1020730
public CharSequence newRenderedStatement(final Component component)
	{
		final JsStatement statement = new JsQuery(component).$().chain(statementLabel,
			JsUtils.quotes(statementArgs));
		// $('#component').statementLabel('statementArgs');
		return statement.render();
	}
6490
public static BufferedImage toImage(@javax.annotation.Nonnull final Component component) {
    try {
      com.simiacryptus.util.Util.layout(component);
      @javax.annotation.Nonnull final BufferedImage img = new BufferedImage(component.getWidth(), component.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
      final Graphics2D g = img.createGraphics();
      g.setColor(component.getForeground());
      g.setFont(component.getFont());
      component.print(g);
      return img;
    } catch (@javax.annotation.Nonnull final Exception e) {
      return null;
    }
  }
1306404
protected void buildComponent() {
        addComponent(titleLayout);
        setComponentAlignment(titleLayout, Alignment.TOP_LEFT);
        setWidth(100, Unit.PERCENTAGE);
        setImmediate(true);
        addStyleName("action-history-header");
        addStyleName("bordered-layout");
        addStyleName("no-border-bottom");
    }
1248567
private void callDoLayout(Container container)
    {
        container.doLayout();
        int n = container.getComponentCount();
        for (int i=0; i<n; i++)
        {
            Component component = container.getComponent(i);
            if (component instanceof Container)
            {
                Container subContainer = (Container)component;
                callDoLayout(subContainer);
            }
        }
    }
1131544
public void add(final WComponent component, final Serializable... constraints) {
		add(component);

		if (constraints != null && constraints.length > 0) {
			PanelModel model = getOrCreateComponentModel();

			if (model.layoutConstraints == null) {
				model.layoutConstraints = new HashMap<>();
			}

			model.layoutConstraints.put(component, constraints);
		}
	}
881032
public static Dimension getScreenDimension(Component component)
	{
		int screenID = getScreenID(component);
		Dimension dimension = new Dimension(0, 0);

		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
		GraphicsConfiguration defaultConfiguration = ge.getScreenDevices()[screenID]
			.getDefaultConfiguration();
		Rectangle rectangle = defaultConfiguration.getBounds();
		dimension.setSize(rectangle.getWidth(), rectangle.getHeight());
		return dimension;
	}
14786
public void addToGroup(final T component) {
		ComponentGroupModel model = getOrCreateComponentModel();
		model.components.add(component);
		MemoryUtil.checkSize(model.components.size(), this.getClass().getSimpleName());
	}
1025353
public static JTextComponent textComponentAsLabel(JTextComponent textcomponent) {
        //  Make the text component non editable
        textcomponent.setEditable(false);
        // Make the text area look like a label
        textcomponent.setBackground((Color)UIManager.get("Label.background"));
        textcomponent.setForeground((Color)UIManager.get("Label.foreground"));
        textcomponent.setBorder(null);
        return textcomponent;
    }