Examples of UIComponent


Examples of com.ardor3d.extension.ui.UIComponent

        List<UIComponent> comps = Lists.newArrayList();
        List<UIComponent> compsBack = Lists.newArrayList();
        for (int i = 0; i < content.size(); i++) {
            final Spatial spat = content.get(i);
            if (spat instanceof UIComponent) {
                final UIComponent comp = (UIComponent) spat;
                final Rectangle2 rect = comp.getRelativeComponentBounds(storeA);
                final Rectangle2 minRect = comp.getRelativeMinComponentBounds(storeB);
                if (_horizontal) {
                    comp.fitComponentIn(minRect.getWidth(), rect.getHeight());
                } else {
                    comp.fitComponentIn(rect.getWidth(), minRect.getHeight());
                }
                comps.add(comp);
            }
        }

        // if we have components to layout...
        if (!comps.isEmpty()) {

            // Determine how much space we feel we need.
            final int reqSpace = _horizontal ? getSumOfAllWidths(content) : getSumOfAllHeights(content);

            // How much extra space do we have?
            int freeSpace = (_horizontal ? container.getContentWidth() : container.getContentHeight()) - reqSpace;

            int relaxIndex = 0;
            // cycle through until we've given away all of the space
            while ((freeSpace > 0 || relaxIndex == 0) && !comps.isEmpty() && relaxIndex < RowLayout.MAX_RELAX) {
                final int extraPerComp = freeSpace / comps.size();
                while (!comps.isEmpty()) {
                    final UIComponent comp = comps.remove(0);
                    Rectangle2 rect = comp.getRelativeComponentBounds(storeA);
                    final Rectangle2 origRect = storeB.set(rect);
                    if (freeSpace < 0) {
                        freeSpace = 0;
                    }
                    if (_horizontal) {
                        final int height = _expandsVertically ? container.getContentHeight() : rect.getHeight();
                        final int width = (_expandsHorizontally ? extraPerComp : 0) + rect.getWidth();
                        if (height == rect.getHeight() && width == rect.getWidth()) {
                            continue;
                        }

                        comp.fitComponentIn(width, height);
                        rect = comp.getRelativeComponentBounds(storeA);
                        if (Math.abs(rect.getWidth() - width) <= 1) {
                            compsBack.add(comp);
                        }
                        freeSpace -= rect.getWidth() - origRect.getWidth();
                    } else {
                        final int width = _expandsHorizontally ? container.getContentWidth() : rect.getWidth();
                        final int height = (_expandsVertically ? extraPerComp : 0) + rect.getHeight();
                        if (height == rect.getHeight() && width == rect.getWidth()) {
                            continue;
                        }

                        comp.fitComponentIn(width, height);
                        rect = comp.getRelativeComponentBounds(storeA);
                        if (Math.abs(rect.getHeight() - height) <= 1) {
                            compsBack.add(comp);
                        }
                        freeSpace -= rect.getHeight() - origRect.getHeight();
                    }
                }
                final List<UIComponent> compsTemp = comps;
                comps = compsBack;
                compsBack = compsTemp;
                relaxIndex++;
            }

            int x = 0;
            int y = !_expandsVertically && !_horizontal ? container.getContentHeight() - reqSpace : 0;

            // Now, go through children and set proper location.
            for (int i = 0; i < content.size(); i++) {
                final Spatial spat = _horizontal ? content.get(i) : content.get(content.size() - i - 1);

                if (!(spat instanceof UIComponent)) {
                    continue;
                }
                final UIComponent comp = (UIComponent) spat;
                final Rectangle2 rect = comp.getRelativeComponentBounds(storeA);

                if (_horizontal) {
                    comp.setLocalXY(x - rect.getX(), Math.max(container.getContentHeight() / 2 - rect.getHeight() / 2
                            - rect.getY(), 0));
                    x += rect.getWidth();
                } else {
                    comp.setLocalXY(Math.max(container.getContentWidth() / 2 - rect.getWidth() / 2 - rect.getX(), 0), y
                            - rect.getY());
                    y += rect.getHeight();
                }
            }
        }
View Full Code Here

Examples of javax.faces.component.UIComponent

    int i = 0;
    for (UIComponent child : (List<UIComponent>) data.getChildren()) {
      if (child instanceof UIColumnEvent) {
        UIColumnEvent columnEvent = (UIColumnEvent) child;
        if (columnEvent.isRendered()) {
          UIComponent selectionChild = (UIComponent) child.getChildren().get(0);
          if (selectionChild != null && selectionChild instanceof UICommand && selectionChild.isRendered()) {
            UICommand action = (UICommand) selectionChild;
            if ("click".equals(columnEvent.getEvent())) {
              clickAction = action;
            }
            if ("dblclick".equals(columnEvent.getEvent())) {
              dblClickAction = action;
            }
          }
        }
      } else if (child instanceof UIColumnSelector) {
        columnSelectorIndex = i;
      }
      i++;
    }

    renderSheet(facesContext, data, (clickAction != null || dblClickAction != null));

    writer.endElement(HtmlConstants.DIV);

    ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
    UIViewRoot viewRoot = facesContext.getViewRoot();
    String contextPath = facesContext.getExternalContext().getRequestContextPath();

    String unchecked = contextPath + resourceManager.getImage(viewRoot, "image/sheetUnchecked.gif");
    String checked = contextPath + resourceManager.getImage(viewRoot, "image/sheetChecked.gif");
    boolean ajaxEnabled = TobagoConfig.getInstance(facesContext).isAjaxEnabled();

    final String[] styles = new String[]{"style/tobago-sheet.css"};
    final String[] scripts = new String[]{"script/tobago-sheet.js"};
    Integer frequency = null;
    UIComponent facetReload = data.getFacet(TobagoConstants.FACET_RELOAD);
    if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
      UIReload update = (UIReload) facetReload;
      frequency = update.getFrequency();
    }
    final String[] cmds = {
        "new Tobago.Sheet(\"" + sheetId + "\", " + ajaxEnabled
View Full Code Here

Examples of javax.faces.component.UIComponent

     */
    protected UIForm getForm(
        final FacesContext context,
        final UIComponent component)
    {
        UIComponent parent = component.getParent();
        while (parent != null)
        {
            if (parent instanceof UIForm)
            {
                break;
            }
            parent = parent.getParent();
        }
        return (UIForm)parent;
    }
View Full Code Here

Examples of javax.faces.component.UIComponent

        }
        if (event == null)
        {
            throw new NullPointerException();
        }
        UIComponent parent = getParent();
        if (parent == null)
        {
            throw new IllegalStateException();
        }
        parent.queueEvent(event);
    }
View Full Code Here

Examples of javax.faces.component.UIComponent

        }
        if (event == null)
        {
            throw new NullPointerException();
        }
        UIComponent parent = getParent();
        if (parent == null)
        {
            throw new IllegalStateException();
        }
        parent.queueEvent(event);
    }
View Full Code Here

Examples of javax.faces.component.UIComponent

    }

    public static UIComponent findComponent(final FacesContext context, final String componentId)
        throws ValidatorException
    {
        UIComponent component = null;
        final int index = componentId.indexOf(':');
        if (index != -1)
        {
            final String parentId = componentId.substring(0, index);
            UIComponent parent = context.getViewRoot().findComponent(parentId);
            if (parent == null)
            {
                throw new ValidatorException("No component with id: " + parentId + " could be found on view!");
            }
            final String restOfId = componentId.substring(index + 1, componentId.length());
View Full Code Here

Examples of javax.faces.component.UIComponent

    private static final char COMPONENT_NAME_SEPERATOR = ':';

    public static UIComponent findComponent(final FacesContext context, final UIComponent parent, String componentId)
    {
        UIComponent component = null;
        final int index = componentId.indexOf(COMPONENT_NAME_SEPERATOR);
        if (index != -1)
        {
            final String firstId = componentId.substring(0, index);
            component = findChildComponent(parent, firstId);
View Full Code Here

Examples of javax.faces.component.UIComponent

        return component;
    }

    public static UIComponent findChildComponent(final UIComponent component, final String id)
    {
        UIComponent child = null;
        if (component != null && component.getId().equals(id))
        {
            child = component;
        }
        else
View Full Code Here

Examples of javax.faces.component.UIComponent

                }
            }
        }
        for (final Iterator iterator = component.getFacetsAndChildren(); iterator.hasNext();)
        {
            final UIComponent childComponent = (UIComponent)iterator.next();
            this.findValidators(
                childComponent,
                context,
                form);
        }
View Full Code Here

Examples of javax.faces.component.UIComponent

        if (component != null)
        {
            canValidate = component.isRendered();
            if (canValidate)
            {
                final UIComponent parent = component.getParent();
                if (parent != null)
                {
                    canValidate = canValidate(parent);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.