Examples of LayoutBase


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

    } else if (parent.getAttributes().get("tobago.panel") != null
         && parent.getAttributes().get("tobago.panel") instanceof UIExtensionPanel) {
       parent = (UIComponent) parent.getAttributes().get("tobago.panel");
    }
    if (parent instanceof LayoutBase) {
      final LayoutBase component = (LayoutBase) parent;

      if (parent instanceof LayoutComponent && columnSpan != null) {
        if (columnSpan.isLiteral()) {
          ((LayoutComponent) component).setColumnSpan(Integer.valueOf(columnSpan.getValue()));
        } else {
          parent.setValueExpression(Attributes.COLUMN_SPAN,
              columnSpan.getValueExpression(faceletContext, Integer.TYPE));
        }
      }

      if (parent instanceof LayoutComponent && rowSpan != null) {
        if (rowSpan.isLiteral()) {
          ((LayoutComponent) component).setRowSpan(Integer.valueOf(rowSpan.getValue()));
        } else {
          parent.setValueExpression(Attributes.ROW_SPAN,
              rowSpan.getValueExpression(faceletContext, Integer.TYPE));
        }
      }

      if (width != null) {
        if (width.isLiteral()) {
          component.setWidth(Measure.valueOf(width.getValue()));
        } else {
          parent.setValueExpression(Attributes.WIDTH,
              width.getValueExpression(faceletContext, Object.class));
        }
      }

      if (height != null) {
        if (height.isLiteral()) {
          component.setHeight(Measure.valueOf(height.getValue()));
        } else {
          parent.setValueExpression(Attributes.HEIGHT,
              height.getValueExpression(faceletContext, Object.class));
        }
      }

      if (minimumWidth != null) {
        if (minimumWidth.isLiteral()) {
          component.setMinimumWidth(Measure.valueOf(minimumWidth.getValue()));
        } else {
          parent.setValueExpression(Attributes.MINIMUM_WIDTH,
              minimumWidth.getValueExpression(faceletContext, Object.class));
        }
      }

      if (minimumHeight != null) {
        if (minimumHeight.isLiteral()) {
          component.setMinimumHeight(Measure.valueOf(minimumHeight.getValue()));
        } else {
          parent.setValueExpression(Attributes.MINIMUM_HEIGHT,
              minimumHeight.getValueExpression(faceletContext, Object.class));
        }
      }

      if (preferredWidth != null) {
        if (preferredWidth.isLiteral()) {
          component.setPreferredWidth(Measure.valueOf(preferredWidth.getValue()));
        } else {
          parent.setValueExpression(Attributes.PREFERRED_WIDTH,
              preferredWidth.getValueExpression(faceletContext, Object.class));
        }
      }

      if (preferredHeight != null) {
        if (preferredHeight.isLiteral()) {
          component.setPreferredHeight(Measure.valueOf(preferredHeight.getValue()));
        } else {
          parent.setValueExpression(Attributes.PREFERRED_HEIGHT,
              preferredHeight.getValueExpression(faceletContext, Object.class));
        }
      }

      if (maximumWidth != null) {
        if (maximumWidth.isLiteral()) {
          component.setMaximumWidth(Measure.valueOf(maximumWidth.getValue()));
        } else {
          parent.setValueExpression(Attributes.MAXIMUM_WIDTH,
              maximumWidth.getValueExpression(faceletContext, Object.class));
        }
      }

      if (maximumHeight != null) {
        if (maximumHeight.isLiteral()) {
          component.setMaximumHeight(Measure.valueOf(maximumHeight.getValue()));
        } else {
          parent.setValueExpression(Attributes.MAXIMUM_HEIGHT,
              maximumHeight.getValueExpression(faceletContext, Object.class));
        }
      }

      if (marginLeft != null) {
        if (marginLeft.isLiteral()) {
          component.setMarginLeft(Measure.valueOf(marginLeft.getValue()));
        } else {
          parent.setValueExpression(Attributes.MARGIN_LEFT,
              marginLeft.getValueExpression(faceletContext, Object.class));
        }
      }

      if (marginRight != null) {
        if (marginRight.isLiteral()) {
          component.setMarginRight(Measure.valueOf(marginRight.getValue()));
        } else {
          parent.setValueExpression(Attributes.MARGIN_RIGHT,
              marginRight.getValueExpression(faceletContext, Object.class));
        }
      }

      if (marginTop != null) {
        if (marginTop.isLiteral()) {
          component.setMarginTop(Measure.valueOf(marginTop.getValue()));
        } else {
          parent.setValueExpression(Attributes.MARGIN_TOP,
              marginTop.getValueExpression(faceletContext, Object.class));
        }
      }

      if (marginBottom != null) {
        if (marginBottom.isLiteral()) {
          component.setMarginBottom(Measure.valueOf(marginBottom.getValue()));
        } else {
          parent.setValueExpression(Attributes.MARGIN_BOTTOM,
              marginBottom.getValueExpression(faceletContext, Object.class));
        }
      }
View Full Code Here

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

    // XXX need a better solution
    if (component.getParent() != null && component.getParent().getClass().getName().endsWith("UIExtensionPanel")) {
      component = component.getParent();
    }

    final LayoutBase layoutBase = (LayoutBase) component;
    final boolean isLayoutContainer = component instanceof LayoutContainer;
    final boolean isLayoutComponent = component instanceof LayoutComponent;
    final LayoutContainer layoutContainer = isLayoutContainer ? (LayoutContainer) component : null;
    final ELContext elContext = FacesContext.getCurrentInstance().getELContext();

    if (columnSpan != null) {
      if (isLayoutComponent) {
        component.setValueExpression(Attributes.COLUMN_SPAN, columnSpan);
      } else {
        LOG.warn("Ignoring '" + Attributes.COLUMN_SPAN + "', because the parent is not a LayoutComponent!");
      }
    }

    if (rowSpan != null) {
      if (isLayoutComponent) {
        component.setValueExpression(Attributes.ROW_SPAN, rowSpan);
      } else {
        LOG.warn("Ignoring '" + Attributes.ROW_SPAN + "', because the parent is not a LayoutComponent!");
      }
    }

    if (width != null) {
      if (width.isLiteralText()) {
        layoutBase.setWidth(Measure.valueOf(width.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.WIDTH, width);
      }
    }

    if (height != null) {
      if (height.isLiteralText()) {
        layoutBase.setHeight(Measure.valueOf(height.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.HEIGHT, height);
      }
    }

    if (minimumWidth != null) {
      if (minimumWidth.isLiteralText()) {
        layoutBase.setMinimumWidth(Measure.valueOf(minimumWidth.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MINIMUM_WIDTH, minimumWidth);
      }
    }

    if (minimumHeight != null) {
      if (minimumHeight.isLiteralText()) {
        layoutBase.setMinimumHeight(Measure.valueOf(minimumHeight.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MINIMUM_HEIGHT, minimumHeight);
      }
    }

    if (preferredWidth != null) {
      if (preferredWidth.isLiteralText()) {
        layoutBase.setPreferredWidth(Measure.valueOf(preferredWidth.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.PREFERRED_WIDTH, preferredWidth);
      }
    }

    if (preferredHeight != null) {
      if (preferredHeight.isLiteralText()) {
        layoutBase.setPreferredHeight(Measure.valueOf(preferredHeight.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.PREFERRED_HEIGHT, preferredHeight);
      }
    }

    if (maximumWidth != null) {
      if (maximumWidth.isLiteralText()) {
        layoutBase.setMaximumWidth(Measure.valueOf(maximumWidth.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MAXIMUM_WIDTH, maximumWidth);
      }
    }

    if (maximumHeight != null) {
      if (maximumHeight.isLiteralText()) {
        layoutBase.setMaximumHeight(Measure.valueOf(maximumHeight.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MAXIMUM_HEIGHT, maximumHeight);
      }
    }

    if (marginLeft != null) {
      if (marginLeft.isLiteralText()) {
        layoutBase.setMarginLeft(Measure.valueOf(marginLeft.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MARGIN_LEFT, marginLeft);
      }
    }

    if (marginRight != null) {
      if (marginRight.isLiteralText()) {
        layoutBase.setMarginRight(Measure.valueOf(marginRight.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MARGIN_RIGHT, marginRight);
      }
    }

    if (marginTop != null) {
      if (marginTop.isLiteralText()) {
        layoutBase.setMarginTop(Measure.valueOf(marginTop.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MARGIN_TOP, marginTop);
      }
    }

    if (marginBottom != null) {
      if (marginBottom.isLiteralText()) {
        layoutBase.setMarginBottom(Measure.valueOf(marginBottom.getValue(elContext)));
      } else {
        component.setValueExpression(Attributes.MARGIN_BOTTOM, marginBottom);
      }
    }
View Full Code Here

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

          for (final UIComponent grandKid : children) {
            // set height to 0 to prevent use of layoutheight from parent
            grandKid.getAttributes().put(Attributes.LAYOUT_HEIGHT, HEIGHT_0);
            // XXX hotfix
            if (grandKid instanceof LayoutBase) {
              final LayoutBase base = (LayoutBase) grandKid;
              if (base.getLeft() != null) {
                base.setLeft(null);
              }
              if (base.getTop() != null) {
                base.setTop(null);
              }
            }
            EncodeUtils.prepareRendererAll(facesContext, grandKid);
            RenderUtils.encode(facesContext, grandKid);
          }
View Full Code Here

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

          for (UIComponent grandKid : children) {
            // set height to 0 to prevent use of layoutheight from parent
            grandKid.getAttributes().put(Attributes.LAYOUT_HEIGHT, HEIGHT_0);
            // XXX hotfix
            if (grandKid instanceof LayoutBase) {
              LayoutBase base = (LayoutBase) grandKid;
              if (base.getLeft() != null) {
                base.setLeft(null);
              }
              if (base.getTop() != null) {
                base.setTop(null);
              }
            }
            RenderUtils.prepareRendererAll(facesContext, grandKid);
            RenderUtils.encode(facesContext, grandKid);
          }
View Full Code Here

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

    } else if (parent.getAttributes().get("tobago.panel") != null
         && parent.getAttributes().get("tobago.panel") instanceof UIExtensionPanel) {
       parent = (UIComponent) parent.getAttributes().get("tobago.panel");
    }
    if (parent instanceof LayoutBase) {
      LayoutBase component = (LayoutBase) parent;

      if (parent instanceof LayoutComponent && columnSpan != null) {
        if (columnSpan.isLiteral()) {
          ((LayoutComponent) component).setColumnSpan(Integer.valueOf(columnSpan.getValue()));
        } else {
          parent.setValueBinding(Attributes.COLUMN_SPAN,
              faceletContext.getFacesContext().getApplication().createValueBinding(columnSpan.getValue()));
        }
      }

      if (parent instanceof LayoutComponent && rowSpan != null) {
        if (rowSpan.isLiteral()) {
          ((LayoutComponent) component).setRowSpan(Integer.valueOf(rowSpan.getValue()));
        } else {
          parent.setValueBinding(Attributes.ROW_SPAN,
              faceletContext.getFacesContext().getApplication().createValueBinding(rowSpan.getValue()));
        }
      }

      if (width != null) {
        if (width.isLiteral()) {
          component.setWidth(Measure.parse(width.getValue()));
        } else {
          parent.setValueBinding(Attributes.WIDTH,
              faceletContext.getFacesContext().getApplication().createValueBinding(width.getValue()));
        }
      }

      if (height != null) {
        if (height.isLiteral()) {
          component.setHeight(Measure.parse(height.getValue()));
        } else {
          parent.setValueBinding(Attributes.HEIGHT,
              faceletContext.getFacesContext().getApplication().createValueBinding(height.getValue()));
        }
      }

      if (minimumWidth != null) {
        if (minimumWidth.isLiteral()) {
          component.setMinimumWidth(Measure.parse(minimumWidth.getValue()));
        } else {
          parent.setValueBinding(Attributes.MINIMUM_WIDTH,
              faceletContext.getFacesContext().getApplication().createValueBinding(minimumWidth.getValue()));
        }
      }

      if (minimumHeight != null) {
        if (minimumHeight.isLiteral()) {
          component.setMinimumHeight(Measure.parse(minimumHeight.getValue()));
        } else {
          parent.setValueBinding(Attributes.MINIMUM_HEIGHT,
              faceletContext.getFacesContext().getApplication().createValueBinding(minimumHeight.getValue()));
        }
      }

      if (preferredWidth != null) {
        if (preferredWidth.isLiteral()) {
          component.setPreferredWidth(Measure.parse(preferredWidth.getValue()));
        } else {
          parent.setValueBinding(Attributes.PREFERRED_WIDTH,
              faceletContext.getFacesContext().getApplication().createValueBinding(preferredWidth.getValue()));
        }
      }

      if (preferredHeight != null) {
        if (preferredHeight.isLiteral()) {
          component.setPreferredHeight(Measure.parse(preferredHeight.getValue()));
        } else {
          parent.setValueBinding(Attributes.PREFERRED_HEIGHT,
              faceletContext.getFacesContext().getApplication().createValueBinding(preferredHeight.getValue()));
        }
      }

      if (maximumWidth != null) {
        if (maximumWidth.isLiteral()) {
          component.setMaximumWidth(Measure.parse(maximumWidth.getValue()));
        } else {
          parent.setValueBinding(Attributes.MAXIMUM_WIDTH,
              faceletContext.getFacesContext().getApplication().createValueBinding(maximumWidth.getValue()));
        }
      }

      if (maximumHeight != null) {
        if (maximumHeight.isLiteral()) {
          component.setMaximumHeight(Measure.parse(maximumHeight.getValue()));
        } else {
          parent.setValueBinding(Attributes.MAXIMUM_HEIGHT,
              faceletContext.getFacesContext().getApplication().createValueBinding(maximumHeight.getValue()));
        }
      }

      if (marginLeft != null) {
        if (marginLeft.isLiteral()) {
          component.setMarginLeft(Measure.parse(marginLeft.getValue()));
        } else {
          parent.setValueBinding(Attributes.MARGIN_LEFT,
              faceletContext.getFacesContext().getApplication().createValueBinding(marginLeft.getValue()));
        }
      }

      if (marginRight != null) {
        if (marginRight.isLiteral()) {
          component.setMarginRight(Measure.parse(marginRight.getValue()));
        } else {
          parent.setValueBinding(Attributes.MARGIN_RIGHT,
              faceletContext.getFacesContext().getApplication().createValueBinding(marginRight.getValue()));
        }
      }

      if (marginTop != null) {
        if (marginTop.isLiteral()) {
          component.setMarginTop(Measure.parse(marginTop.getValue()));
        } else {
          parent.setValueBinding(Attributes.MARGIN_TOP,
              faceletContext.getFacesContext().getApplication().createValueBinding(marginTop.getValue()));
        }
      }

      if (marginBottom != null) {
        if (marginBottom.isLiteral()) {
          component.setMarginBottom(Measure.parse(marginBottom.getValue()));
        } else {
          parent.setValueBinding(Attributes.MARGIN_BOTTOM,
              faceletContext.getFacesContext().getApplication().createValueBinding(marginBottom.getValue()));
        }
      }
View Full Code Here

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

          for (UIComponent grandKid : children) {
            // set height to 0 to prevent use of layoutheight from parent
            grandKid.getAttributes().put(Attributes.LAYOUT_HEIGHT, HEIGHT_0);
            // XXX hotfix
            if (grandKid instanceof LayoutBase) {
              LayoutBase base = (LayoutBase) grandKid;
              if (base.getLeft() != null) {
                base.setLeft(null);
              }
              if (base.getTop() != null) {
                base.setTop(null);
              }
            }
            RenderUtils.prepareRendererAll(facesContext, grandKid);
            RenderUtils.encode(facesContext, grandKid);
          }
View Full Code Here

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

          for (UIComponent grandKid : children) {
            // set height to 0 to prevent use of layoutheight from parent
            grandKid.getAttributes().put(Attributes.LAYOUT_HEIGHT, HEIGHT_0);
            // XXX hotfix
            if (grandKid instanceof LayoutBase) {
              LayoutBase base = (LayoutBase) grandKid;
              if (base.getLeft() != null) {
                base.setLeft(null);
              }
              if (base.getTop() != null) {
                base.setTop(null);
              }
            }
            RenderUtils.prepareRendererAll(facesContext, grandKid);
            RenderUtils.encode(facesContext, grandKid);
          }
View Full Code Here

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

          for (UIComponent grandKid : children) {
            // set height to 0 to prevent use of layoutheight from parent
            grandKid.getAttributes().put(Attributes.LAYOUT_HEIGHT, HEIGHT_0);
            // XXX hotfix
            if (grandKid instanceof LayoutBase) {
              LayoutBase base = (LayoutBase) grandKid;
              if (base.getLeft() != null) {
                base.setLeft(null);
              }
              if (base.getTop() != null) {
                base.setTop(null);
              }
            }
            RenderUtils.prepareRendererAll(facesContext, grandKid);
            RenderUtils.encode(facesContext, grandKid);
          }
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.