Package org.apache.myfaces.tobago.layout

Examples of org.apache.myfaces.tobago.layout.LayoutContainer


    }
  }

  @Override
  public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
    final LayoutContainer container = (LayoutContainer) ((AbstractUISplitLayout) component).getParent();
    if (!((LayoutContainer) container).isLayoutChildren()) {
      return;
    } else {
      final List<LayoutComponent> components = container.getComponents();
      if (components.size() != 2) {
        LOG.warn("Illegal component count in splitLayout: {}", components.size());
      }
      RenderUtils.encode(facesContext, (UIComponent) components.get(0));
      RenderUtils.encode(facesContext, (UIComponent) components.get(1));
View Full Code Here


    writer.endElement(HtmlElements.SPAN);

  }

  private String createDraggableContainment(final AbstractUISplitLayout layout) {
    final LayoutContainer container = (LayoutContainer) ((AbstractUISplitLayout) layout).getParent();
    final LayoutComponent firstComponent = container.getComponents().get(0);
    final LayoutComponent secondComponent = container.getComponents().get(1);

    if (AbstractUISplitLayout.HORIZONTAL.equals(layout.getOrientation())) {
      final int minimumSize1 = firstComponent.getMinimumWidth().getPixel();
      final int minimumSize2 = secondComponent.getMinimumWidth().getPixel();
      final int totalSize = container.getCurrentWidth().getPixel();
      return new StringBuilder("[").append(minimumSize1).append(", 0, ").append(totalSize-minimumSize2).append(", 0]")
          .toString();
    } else {
      final int minimumSize1 = firstComponent.getMinimumHeight().getPixel();
      final int minimumSize2 = secondComponent.getMinimumHeight().getPixel();
      final int totalSize = container.getCurrentHeight().getPixel();
      return new StringBuilder("[0, ").append(minimumSize1).append(", 0, ").append(totalSize-minimumSize2).append("]")
          .toString();
    }
  }
View Full Code Here

          .toString();
    }
  }

  private Style calculateHandleStyle(final AbstractUISplitLayout layout) {
    final LayoutContainer container = (LayoutContainer) ((AbstractUISplitLayout) layout).getParent();
    final LayoutComponent secondComponent = container.getComponents().get(1);
    final Style style = new Style();
    if (AbstractUISplitLayout.HORIZONTAL.equals(layout.getOrientation())) {
      style.setWidth(Measure.valueOf(5));
      style.setHeight(container.getCurrentHeight());
      style.setLeft(Measure.valueOf(secondComponent.getLeft().subtract(5)));
      style.setTop(Measure.valueOf(0));
    } else {
      style.setWidth(container.getCurrentWidth());
      style.setHeight(Measure.valueOf(5));
      style.setLeft(Measure.valueOf(0));
      style.setTop(Measure.valueOf(Measure.valueOf(secondComponent.getTop().subtract(5))));
    }
    style.setDisplay(Display.BLOCK);
View Full Code Here

  public static final String HORIZONTAL = Orientation.HORIZONTAL.name();

  private String submittedLayout;

  public void updateLayout(final int position) {
    final LayoutContainer container = (LayoutContainer) getParent();
    final LayoutComponent firstComponent = container.getComponents().get(0);
    final LayoutComponent secondComponent = container.getComponents().get(1);
    final int oldPosition;

    final int currentSize1;
    final int currentSize2;
    if (HORIZONTAL.equals(getOrientation())) {
View Full Code Here

        factorList.add(((RelativeLayoutToken) head.getToken()).getFactor());
      }
    }
    if (!factorList.isEmpty()) {
      // find rest
      LayoutContainer container = getLayoutContainer();
      Measure available = LayoutUtils.getCurrentSize(orientation, container);
      if (available != null) {
        for (BankHead head : heads) {
          available = available.subtractNotNegative(head.getCurrent());
        }
View Full Code Here

             return;
           }
         }
      }
      if (component instanceof LayoutContainer) {
        LayoutContainer layoutContainer = (LayoutContainer) component;
        Measure width = layoutContainer.getCurrentWidth();
        Measure height = layoutContainer.getCurrentHeight();
        Measure oldWidth = layoutContainer.getWidth();
        Measure oldHeight = layoutContainer.getHeight();
        layoutContainer.setWidth(width);
        layoutContainer.setHeight(height);
        new LayoutContext(layoutContainer).layout();
        layoutContainer.setWidth(oldWidth);
        layoutContainer.setHeight(oldHeight);
      }
      prepareRendererAll(facesContext, component);
      encodeAll(facesContext, component);
    } catch (IOException e) {
      throw new FacesException(e);
View Full Code Here

    // find *
    if (orientation == Orientation.HORIZONTAL && !horizontalAuto
        || orientation == Orientation.VERTICAL && !verticalAuto) {

      final FacesContext facesContext = FacesContext.getCurrentInstance();
      final LayoutContainer container = getLayoutContainer();
      final AbstractUISheet sheet = (AbstractUISheet) container;

      if (orientation == Orientation.HORIZONTAL) {

        ensureColumnWidthList(facesContext, sheet);
View Full Code Here

    // find *
    if (orientation == Orientation.HORIZONTAL && !horizontalAuto
        || orientation == Orientation.VERTICAL && !verticalAuto) {
      // find rest
      LayoutContainer container = getLayoutContainer();
      Measure available = LayoutUtils.getCurrentSize(orientation, container);
      if (available != null) {
        for (LayoutComponent component : getLayoutContainer().getComponents()) {
          LayoutUtils.setCurrentSize(orientation, component, available);
        }
View Full Code Here

    // find *
    if (orientation == Orientation.HORIZONTAL && !horizontalAuto
        || orientation == Orientation.VERTICAL && !verticalAuto) {

      final FacesContext facesContext = FacesContext.getCurrentInstance();
      final LayoutContainer container = getLayoutContainer();
      final AbstractUISheet sheet = (AbstractUISheet) container;

      if (orientation == Orientation.HORIZONTAL) {

        ensureColumnWidthList(facesContext, sheet);
View Full Code Here

    } else {
      LOG.warn("Layout Constraints inside of a non LayoutBase component!");
    }

    if (parent instanceof LayoutContainer) {
      LayoutContainer container = (LayoutContainer) parent;

      if (borderLeft != null) {
        if (borderLeft.isLiteral()) {
          container.setBorderLeft(Measure.parse(borderLeft.getValue()));
        } else {
          parent.setValueBinding(Attributes.BORDER_LEFT,
              faceletContext.getFacesContext().getApplication().createValueBinding(borderLeft.getValue()));
        }
      }

      if (borderRight != null) {
        if (borderRight.isLiteral()) {
          container.setBorderRight(Measure.parse(borderRight.getValue()));
        } else {
          parent.setValueBinding(Attributes.BORDER_RIGHT,
              faceletContext.getFacesContext().getApplication().createValueBinding(borderRight.getValue()));
        }
      }

      if (borderTop != null) {
        if (borderTop.isLiteral()) {
          container.setBorderTop(Measure.parse(borderTop.getValue()));
        } else {
          parent.setValueBinding(Attributes.BORDER_TOP,
              faceletContext.getFacesContext().getApplication().createValueBinding(borderTop.getValue()));
        }
      }

      if (borderBottom != null) {
        if (borderBottom.isLiteral()) {
          container.setBorderBottom(Measure.parse(borderBottom.getValue()));
        } else {
          parent.setValueBinding(Attributes.BORDER_BOTTOM,
              faceletContext.getFacesContext().getApplication().createValueBinding(borderBottom.getValue()));
        }
      }

      if (paddingLeft != null) {
        if (paddingLeft.isLiteral()) {
          container.setPaddingLeft(Measure.parse(paddingLeft.getValue()));
        } else {
          parent.setValueBinding(Attributes.PADDING_LEFT,
              faceletContext.getFacesContext().getApplication().createValueBinding(paddingLeft.getValue()));
        }
      }

      if (paddingRight != null) {
        if (paddingRight.isLiteral()) {
          container.setPaddingRight(Measure.parse(paddingRight.getValue()));
        } else {
          parent.setValueBinding(Attributes.PADDING_RIGHT,
              faceletContext.getFacesContext().getApplication().createValueBinding(paddingRight.getValue()));
        }
      }

      if (paddingTop != null) {
        if (paddingTop.isLiteral()) {
          container.setPaddingTop(Measure.parse(paddingTop.getValue()));
        } else {
          parent.setValueBinding(Attributes.PADDING_TOP,
              faceletContext.getFacesContext().getApplication().createValueBinding(paddingTop.getValue()));
        }
      }

      if (paddingBottom != null) {
        if (paddingBottom.isLiteral()) {
          container.setPaddingBottom(Measure.parse(paddingBottom.getValue()));
        } else {
          parent.setValueBinding(Attributes.PADDING_BOTTOM,
              faceletContext.getFacesContext().getApplication().createValueBinding(paddingBottom.getValue()));
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.layout.LayoutContainer

Copyright © 2018 www.massapicom. 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.