}
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);
}
}
if (borderLeft != null) {
if (isLayoutContainer) {
if (borderLeft.isLiteralText()) {
layoutContainer.setBorderLeft(Measure.valueOf(borderLeft.getValue(elContext)));
} else {
component.setValueExpression(Attributes.BORDER_LEFT, borderLeft);
}
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_LEFT + "', because the parent is not a LayoutContainer!");
}
}
if (borderRight != null) {
if (isLayoutContainer) {
if (borderRight.isLiteralText()) {
layoutContainer.setBorderRight(Measure.valueOf(borderRight.getValue(elContext)));
} else {
component.setValueExpression(Attributes.BORDER_RIGHT, borderRight);
}
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_RIGHT + "', because the parent is not a LayoutContainer!");
}
}
if (borderTop != null) {
if (isLayoutContainer) {
if (borderTop.isLiteralText()) {
layoutContainer.setBorderTop(Measure.valueOf(borderTop.getValue(elContext)));
} else {
component.setValueExpression(Attributes.BORDER_TOP, borderTop);
}
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_TOP + "', because the parent is not a LayoutContainer!");
}
}
if (borderBottom != null) {
if (isLayoutContainer) {
if (borderBottom.isLiteralText()) {
layoutContainer.setBorderBottom(Measure.valueOf(borderBottom.getValue(elContext)));
} else {
component.setValueExpression(Attributes.BORDER_BOTTOM, borderBottom);
}
} else {
LOG.warn("Ignoring '" + Attributes.BORDER_BOTTOM + "', because the parent is not a LayoutContainer!");
}
}
if (paddingLeft != null) {
if (isLayoutContainer) {
if (paddingLeft.isLiteralText()) {
layoutContainer.setPaddingLeft(Measure.valueOf(paddingLeft.getValue(elContext)));
} else {
component.setValueExpression(Attributes.PADDING_LEFT, paddingLeft);
}
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_LEFT + "', because the parent is not a LayoutContainer!");
}
}
if (paddingRight != null) {
if (isLayoutContainer) {
if (paddingRight.isLiteralText()) {
layoutContainer.setPaddingRight(Measure.valueOf(paddingRight.getValue(elContext)));
} else {
component.setValueExpression(Attributes.PADDING_RIGHT, paddingRight);
}
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_RIGHT + "', because the parent is not a LayoutContainer!");
}
}
if (paddingTop != null) {
if (isLayoutContainer) {
if (paddingTop.isLiteralText()) {
layoutContainer.setPaddingTop(Measure.valueOf(paddingTop.getValue(elContext)));
} else {
component.setValueExpression(Attributes.PADDING_TOP, paddingTop);
}
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_TOP + "', because the parent is not a LayoutContainer!");
}
}
if (paddingBottom != null) {
if (isLayoutContainer) {
if (paddingBottom.isLiteralText()) {
layoutContainer.setPaddingBottom(Measure.valueOf(paddingBottom.getValue(elContext)));
} else {
component.setValueExpression(Attributes.PADDING_BOTTOM, paddingBottom);
}
} else {
LOG.warn("Ignoring '" + Attributes.PADDING_BOTTOM + "', because the parent is not a LayoutContainer!");