}
Color background = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_BACKGROUND);
if (background != null) {
initElement.setAttribute("background", ColorRender.renderCssAttributeValue(background));
}
FillImage backgroundImage = (FillImage) windowPane.getRenderProperty(WindowPane.PROPERTY_BACKGROUND_IMAGE);
if (backgroundImage != null) {
CssStyle backgroundImageCssStyle = new CssStyle();
FillImageRender.renderToStyle(backgroundImageCssStyle, rc, this, windowPane, IMAGE_ID_BACKGROUND,
backgroundImage, 0);
initElement.setAttribute("background-image", backgroundImageCssStyle.renderInline());
}
Color foreground = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_FOREGROUND);
if (foreground != null) {
initElement.setAttribute("foreground", ColorRender.renderCssAttributeValue(foreground));
}
Font font = (Font) windowPane.getRenderProperty(WindowPane.PROPERTY_FONT);
if (font != null) {
CssStyle fontCssStyle = new CssStyle();
FontRender.renderToStyle(fontCssStyle, font);
initElement.setAttribute("font", fontCssStyle.renderInline());
}
// Positioning
renderPixelProperty(windowPane, WindowPane.PROPERTY_POSITION_X, initElement, "position-x");
renderPixelProperty(windowPane, WindowPane.PROPERTY_POSITION_Y, initElement, "position-y");
renderPixelProperty(windowPane, WindowPane.PROPERTY_WIDTH, initElement, "width");
renderPixelProperty(windowPane, WindowPane.PROPERTY_HEIGHT, initElement, "height");
renderPixelProperty(windowPane, WindowPane.PROPERTY_MINIMUM_WIDTH, initElement, "minimum-width");
renderPixelProperty(windowPane, WindowPane.PROPERTY_MINIMUM_HEIGHT, initElement, "minimum-height");
renderPixelProperty(windowPane, WindowPane.PROPERTY_MAXIMUM_WIDTH, initElement, "maximum-width");
renderPixelProperty(windowPane, WindowPane.PROPERTY_MAXIMUM_HEIGHT, initElement, "maximum-height");
int fillImageRenderFlags = ((Boolean) windowPane.getRenderProperty(PROPERTY_IE_ALPHA_RENDER_BORDER,
Boolean.FALSE)).booleanValue() ? FillImageRender.FLAG_ENABLE_IE_PNG_ALPHA_FILTER : 0;
// Title-related
if (windowPane.getRenderProperty(WindowPane.PROPERTY_ICON) != null) {
initElement.setAttribute("icon", ImageTools.getUri(rc, this, windowPane, IMAGE_ID_ICON));
Insets iconInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_ICON_INSETS);
if (iconInsets != null) {
initElement.setAttribute("icon-insets", InsetsRender.renderCssAttributeValue(iconInsets));
}
}
String title = (String) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE);
if (title != null) {
initElement.setAttribute("title", title);
Insets titleInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_INSETS);
Color titleForeground = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_FOREGROUND);
if (titleForeground != null) {
initElement.setAttribute("title-foreground", ColorRender.renderCssAttributeValue(titleForeground));
}
if (titleInsets != null) {
initElement.setAttribute("title-insets", InsetsRender.renderCssAttributeValue(titleInsets));
}
Font titleFont = (Font) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_FONT);
if (titleFont != null) {
CssStyle fontCssStyle = new CssStyle();
FontRender.renderToStyle(fontCssStyle, titleFont);
initElement.setAttribute("title-font", fontCssStyle.renderInline());
}
}
Insets titleBarInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_BAR_INSETS);
if (titleBarInsets != null) {
initElement.setAttribute("title-bar-insets", InsetsRender.renderCssAttributeValue(titleBarInsets));
}
renderPixelProperty(windowPane, WindowPane.PROPERTY_TITLE_HEIGHT, initElement, "title-height");
Color titleBackground = (Color) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_BACKGROUND);
if (titleBackground != null) {
initElement.setAttribute("title-background", ColorRender.renderCssAttributeValue(titleBackground));
}
FillImage titleBackgroundImage = (FillImage) windowPane.getRenderProperty(WindowPane.PROPERTY_TITLE_BACKGROUND_IMAGE);
if (titleBackgroundImage != null) {
CssStyle titleBackgroundImageCssStyle = new CssStyle();
FillImageRender.renderToStyle(titleBackgroundImageCssStyle, rc, this, windowPane, IMAGE_ID_TITLE_BACKGROUND,
titleBackgroundImage, fillImageRenderFlags);
initElement.setAttribute("title-background-image", titleBackgroundImageCssStyle.renderInline());
}
// Move/Close/Resize
Boolean resizableBoolean = (Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_RESIZABLE);
boolean resizable = resizableBoolean == null ? true : resizableBoolean.booleanValue();
initElement.setAttribute("resizable", resizable ? "true" : "false");
Boolean closableBoolean = (Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_CLOSABLE);
boolean closable = closableBoolean == null ? true : closableBoolean.booleanValue();
initElement.setAttribute("closable", closable ? "true" : "false");
if (closable) {
if (getImage(windowPane, IMAGE_ID_CLOSE_ICON) != null) {
initElement.setAttribute("close-icon", ImageTools.getUri(rc, this, windowPane, IMAGE_ID_CLOSE_ICON));
Insets closeIconInsets = (Insets) windowPane.getRenderProperty(WindowPane.PROPERTY_CLOSE_ICON_INSETS);
if (closeIconInsets != null) {
initElement.setAttribute("close-icon-insets", InsetsRender.renderCssAttributeValue(closeIconInsets));
}
}
}
Boolean movableBoolean = (Boolean) windowPane.getRenderProperty(WindowPane.PROPERTY_MOVABLE);
boolean movable = movableBoolean == null ? true : movableBoolean.booleanValue();
initElement.setAttribute("movable", movable ? "true" : "false");
// Border
FillImageBorder border = (FillImageBorder) windowPane.getRenderProperty(WindowPane.PROPERTY_BORDER);
if (border != null && border.getBorderInsets() != null && border.getContentInsets() != null) {
Element borderElement = serverMessage.getDocument().createElement("border");
if (border.getColor() != null) {
borderElement.setAttribute("color", ColorRender.renderCssAttributeValue(border.getColor()));
}
borderElement.setAttribute("border-insets", InsetsRender.renderCssAttributeValue(border.getBorderInsets()));
borderElement.setAttribute("content-insets", InsetsRender.renderCssAttributeValue(border.getContentInsets()));
for (int i = 0; i < 8; ++i) {
FillImage fillImage = border.getFillImage(i);
if (fillImage != null) {
Element imageElement = serverMessage.getDocument().createElement("image");
imageElement.setAttribute("name", FILL_IMAGE_NAMES[i]);
CssStyle fillImageCssStyle = new CssStyle();
FillImageRender.renderToStyle(fillImageCssStyle, rc, this, windowPane, FILL_IMAGE_IDS[i], fillImage,