Paints the given WMultiTextField.

@param component the WMultiTextField to paint.
@param renderContext the RenderContext to paint to.
346604
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WMultiTextField textField = (WMultiTextField) component;
		XmlStringBuilder xml = renderContext.getWriter();

		boolean readOnly = textField.isReadOnly();

		String[] values = textField.getTextInputs();

		xml.appendTagOpen("ui:multitextfield");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", textField.isHidden(), "true");

		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			int cols = textField.getColumns();
			int minLength = textField.getMinLength();
			int maxLength = textField.getMaxLength();
			int maxInputs = textField.getMaxInputs();
			String pattern = textField.getPattern();
			xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true");
			xml.appendOptionalAttribute("required", textField.isMandatory(), "true");
			xml.appendOptionalAttribute("toolTip", textField.getToolTip());
			xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText());
			xml.appendOptionalAttribute("size", cols > 0, cols);
			xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
			xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
			xml.appendOptionalAttribute("max", maxInputs > 0, maxInputs);
			xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern);
			// NOTE: do not use HtmlRenderUtil.getEffectivePlaceholder for placeholder - we do not want to echo "required" in every field.
			String placeholder = textField.getPlaceholder();
			xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
			xml.appendOptionalAttribute("title", I18nUtilities.format(null, InternalMessages.DEFAULT_MULTITEXTFIELD_TIP));
		}
		xml.appendClose();

		if (values != null) {
			for (String value : values) {
				xml.appendTag("ui:value");
				xml.appendEscaped(value);
				xml.appendEndTag("ui:value");
			}
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(textField, renderContext);
		}
		xml.appendEndTag("ui:multitextfield");
	}
1367313
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPanel panel = (WPanel) component;
		XmlStringBuilder xml = renderContext.getWriter();
		BorderLayout layout = (BorderLayout) panel.getLayout();
		Size hgap = layout.getHorizontalGap();
		String hgapString = hgap == null ? null : hgap.toString();
		Size vgap = layout.getVerticalGap();
		String vgapString = vgap == null ? null : vgap.toString();

		xml.appendTagOpen("ui:borderlayout");

		xml.appendOptionalAttribute("hgap", hgapString);
		xml.appendOptionalAttribute("vgap", vgapString);

		xml.appendClose();

		// Fetch the children and their constraints.
		final int childCount = panel.getChildCount();
		List<Duplet<WComponent, BorderLayoutConstraint>> children = new ArrayList<>(childCount);

		for (int i = 0; i < childCount; i++) {
			WComponent child = panel.getChildAt(i);
			children.add(new Duplet<>(child, getConstraints(panel, child)));
		}

		// Now paint them
		paintChildrenWithConstraint(children, renderContext, BorderLayout.NORTH);
		paintChildrenWithConstraint(children, renderContext, BorderLayout.EAST);
		paintChildrenWithConstraint(children, renderContext, BorderLayout.SOUTH);
		paintChildrenWithConstraint(children, renderContext, BorderLayout.WEST);
		paintChildrenWithConstraint(children, renderContext, BorderLayout.CENTER);

		xml.appendEndTag("ui:borderlayout");
	}
63093
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WSelectToggle toggle = (WSelectToggle) component;
		XmlStringBuilder xml = renderContext.getWriter();

		xml.appendTagOpen("ui:selecttoggle");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");

		State state = toggle.getState();

		if (State.ALL.equals(state)) {
			xml.appendAttribute("selected", "all");
		} else if (State.NONE.equals(state)) {
			xml.appendAttribute("selected", "none");
		} else {
			xml.appendAttribute("selected", "some");
		}

		xml.appendOptionalAttribute("disabled", toggle.isDisabled(), "true");
		xml.appendAttribute("target", toggle.getTarget().getId());
		xml.appendAttribute("renderAs", toggle.isRenderAsText() ? "text" : "control");
		xml.appendOptionalAttribute("roundTrip", !toggle.isClientSide(), "true");
		xml.appendEnd();
	}
921788
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WDataTableRowRenderer renderer = (WDataTableRowRenderer) component;
		XmlStringBuilder xml = renderContext.getWriter();
		WDataTable table = renderer.getTable();
		TableDataModel dataModel = table.getDataModel();
		UIContext uic = UIContextHolder.getCurrent();

		final int numCols = table.getColumnCount();
		int[] columnOrder = table.getColumnOrder();
		int rowIndex = getRowIndex(table, (SubUIContext) uic);
		boolean unselectable = table.getSelectMode() != SelectMode.NONE
				&& !dataModel.isSelectable(rowIndex);

		xml.appendTagOpen("ui:tr");
		xml.appendAttribute("rowIndex", rowIndex);
		xml.appendOptionalAttribute("unselectable", unselectable, "true");
		xml.appendOptionalAttribute("selected", table.getSelectedRows().contains(rowIndex), "true");
		xml.appendOptionalAttribute("filterValues", getFilterValues(dataModel, rowIndex));

		if (table.getExpandMode() != WDataTable.ExpandMode.NONE && dataModel instanceof TreeTableDataModel) {
			TableTreeNode node = ((TreeTableDataModel) dataModel).getNodeAtLine(rowIndex);
			boolean expandable = !node.isLeaf() && !node.isExpanded();
			xml.appendOptionalAttribute("expandable", expandable, "true");
		}

		xml.appendClose();

		if (table.isShowRowHeaders()) {
			xml.appendTag("ui:th");
			renderer.getRowHeader().paint(renderContext);
			xml.appendEndTag("ui:th");
		}

		for (int i = 0; i < numCols; i++) {
			int colIndex = columnOrder == null ? i : columnOrder[i];
			WTableColumn col = table.getColumn(colIndex);

			if (col.isVisible()) {
				xml.appendTag("ui:td");
				renderer.getRenderer(colIndex).paint(renderContext);
				xml.appendEndTag("ui:td");
			}
		}

		if (table.getExpandMode() != WDataTable.ExpandMode.NONE && dataModel instanceof TreeTableDataModel) {
			TreeTableDataModel treeModel = (TreeTableDataModel) dataModel;
			TableTreeNode node = treeModel.getNodeAtLine(rowIndex);

			if (!node.isLeaf()) {
				xml.appendTagOpen("ui:subtr");
				xml.appendOptionalAttribute("open", node.isExpanded(), "true");
				xml.appendClose();

				if (node.isExpanded() || table.getExpandMode() == ExpandMode.CLIENT) {
					WRepeater repeater = table.getRepeater();

					// If there a renderer specified by any child, we only paint content that has a specified renderer
					boolean rendererPresent = false;

					for (Iterator<TreeNode> i = node.children(); !rendererPresent && i.hasNext();) {
						TableTreeNode child = (TableTreeNode) i.next();

						if (child.getRendererClass() != null) {
							rendererPresent = true;
						}
					}

					// Paint immediate children only.
					if (rendererPresent) {
						xml.appendTagOpen("ui:content");
						xml.appendOptionalAttribute("spanAllCols", node.isRendererSpansAllCols(),
								"true");
						xml.appendClose();

						for (Iterator<TreeNode> i = node.children(); i.hasNext();) {
							TableTreeNode child = (TableTreeNode) i.next();
							Integer rowId = child.getRowIndex() - 1;
							UIContext nodeContext = repeater.getRowContext(rowId);

							WComponent expandedRenderer = renderer.getExpandedTreeNodeRenderer(
									child.getRendererClass());

							if (expandedRenderer != null) {
								UIContextHolder.pushContext(nodeContext);

								try {
									expandedRenderer.paint(renderContext);
								} finally {
									UIContextHolder.popContext();
								}
							}
						}

						xml.appendEndTag("ui:content");
					} else {
						for (Iterator<TreeNode> i = node.children(); i.hasNext();) {
							TableTreeNode child = (TableTreeNode) i.next();
							Integer rowId = child.getRowIndex() - 1;
							UIContext nodeContext = repeater.getRowContext(rowId);

							UIContextHolder.pushContext(nodeContext);

							try {
								render(component, renderContext);
							} finally {
								UIContextHolder.popContext();
							}
						}
					}
				}

				xml.appendEndTag("ui:subtr");
			}
		}

		xml.appendEndTag("ui:tr");
	}
1235936
@Override
	public void paint(final RenderContext renderContext) {
		getBackingComponent().paint(renderContext);

		// We don't want to remember the focus for the next render because on
		// a multi portlet page, we'd end up with multiple portlets trying to
		// set the focus.
		UIContext uic = UIContextHolder.getCurrent();

		if (uic.isFocusRequired()) {
			boolean sticky = ConfigurationProperties.getStickyFocus();

			if (!sticky) {
				uic.setFocussed(null, null);
				uic.setFocusRequired(false);
			}
		}
	}
1251232
@Override
	public void paint(final RenderContext renderContext) {

		if (!doTransform) {
			super.paint(renderContext);
			return;
		}

		if (!(renderContext instanceof WebXmlRenderContext)) {
			LOG.warn("Unable to transform a " + renderContext);
			super.paint(renderContext);
			return;
		}
		LOG.debug("Transform XML Interceptor: Start");

		UIContext uic = UIContextHolder.getCurrent();

		// Set up a render context to buffer the XML payload.
		StringWriter xmlBuffer = new StringWriter();
		PrintWriter xmlWriter = new PrintWriter(xmlBuffer);

		WebXmlRenderContext xmlContext = new WebXmlRenderContext(xmlWriter, uic.getLocale());

		super.paint(xmlContext);  // write the XML to the buffer

		// Get a handle to the true PrintWriter.
		WebXmlRenderContext webRenderContext = (WebXmlRenderContext) renderContext;
		PrintWriter writer = webRenderContext.getWriter();

		/*
		 * Switch the response content-type to HTML.
		 * In theory the transformation could be to ANYTHING (not just HTML) so perhaps it would make more sense to
		 *    write a new interceptor "ContentTypeInterceptor" which attempts to sniff payloads and choose the correct
		 *    content-type. This is exactly the kind of thing IE6 loved to do, so perhaps it's a bad idea.
		 */
		Response response = getResponse();
		response.setContentType(WebUtilities.CONTENT_TYPE_HTML);

		String xml = xmlBuffer.toString();
		if (isAllowCorruptCharacters() && !Util.empty(xml)) {
			// Remove illegal HTML characters from the content before transforming it.
			xml = removeCorruptCharacters(xml);
		}
		// Double encode template tokens in the XML
		xml = WebUtilities.doubleEncodeBrackets(xml);
		// Setup temp writer
		StringWriter tempBuffer = new StringWriter();
		PrintWriter tempWriter = new PrintWriter(tempBuffer);
		// Perform the transformation and write the result.
		transform(xml, uic, tempWriter);
		// Decode Double Encoded Brackets
		String tempResp = tempBuffer.toString();
		tempResp = WebUtilities.doubleDecodeBrackets(tempResp);
		// Write response
		writer.write(tempResp);

		LOG.debug("Transform XML Interceptor: Finished");
	}
742701
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WCheckBox checkBox = (WCheckBox) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = checkBox.isReadOnly();

		xml.appendTagOpen(TAG_NAME);
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", checkBox.isHidden(), "true");
		xml.appendOptionalAttribute("selected", checkBox.isSelected(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
			xml.appendEnd();
			return;
		}

		WComponent submitControl = checkBox.getDefaultSubmitButton();
		String submitControlId = submitControl == null ? null : submitControl.getId();
		WComponentGroup<WCheckBox> group = checkBox.getGroup();
		String groupName = group == null ? null : group.getId();
		xml.appendOptionalAttribute("groupName", groupName);
		xml.appendOptionalAttribute("disabled", checkBox.isDisabled(), "true");
		xml.appendOptionalAttribute("required", checkBox.isMandatory(), "true");
		xml.appendOptionalAttribute("submitOnChange", checkBox.isSubmitOnChange(), "true");
		xml.appendOptionalAttribute("toolTip", checkBox.getToolTip());
		xml.appendOptionalAttribute("accessibleText", checkBox.getAccessibleText());
		xml.appendOptionalAttribute("buttonId", submitControlId);

		List<Diagnostic> diags = checkBox.getDiagnostics(Diagnostic.ERROR);
		if (diags == null || diags.isEmpty()) {
			xml.appendEnd();
			return;
		}
		xml.appendClose();
		DiagnosticRenderUtil.renderDiagnostics(checkBox, renderContext);
		xml.appendEndTag(TAG_NAME);
	}
513508
@Override
	public void render(final WComponent component, final RenderContext renderContext) {
		if (renderContext instanceof WebXmlRenderContext) {
			doRender(component, (WebXmlRenderContext) renderContext);
		} else {
			throw new SystemException("Unable to render web xml output to " + renderContext);
		}
	}
1341234
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WComponentGroup group = (WComponentGroup) component;
		XmlStringBuilder xml = renderContext.getWriter();
		List<WComponent> components = group.getComponents();

		if (components != null && !components.isEmpty()) {
			xml.appendTagOpen("ui:componentGroup");
			xml.appendAttribute("id", component.getId());
			xml.appendOptionalAttribute("track", component.isTracking(), "true");
			xml.appendClose();

			for (WComponent comp : components) {
				xml.appendTagOpen("ui:component");
				xml.appendAttribute("id", comp.getId());
				xml.appendEnd();
			}

			xml.appendEndTag("ui:componentGroup");
		}
	}
769881
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WImage imageComponent = (WImage) component;
		XmlStringBuilder xml = renderContext.getWriter();

		// No image set
		if (imageComponent.getImage() == null && imageComponent.getImageUrl() == null) {
			return;
		}

		renderTagOpen(imageComponent, xml);
		xml.appendEnd();
	}
244548
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WSuggestions suggestions = (WSuggestions) component;
		XmlStringBuilder xml = renderContext.getWriter();

		// Cache key for a lookup table
		String dataKey = suggestions.getListCacheKey();
		// Use AJAX if not using a cached list and have a refresh action
		boolean useAjax = dataKey == null && suggestions.getRefreshAction() != null;

		// Start tag
		xml.appendTagOpen("ui:suggestions");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("min", suggestions.getMinRefresh() > 0, suggestions.
				getMinRefresh());
		xml.appendOptionalAttribute("ajax", useAjax, "true");
		xml.appendOptionalAttribute("data", dataKey);
		WSuggestions.Autocomplete autocomplete = suggestions.getAutocomplete();
		if (autocomplete == WSuggestions.Autocomplete.LIST) {
			xml.appendOptionalAttribute("autocomplete", "list");
		}
		xml.appendClose();

		// Check if this is the current AJAX trigger
		boolean isTrigger = useAjax && AjaxHelper.isCurrentAjaxTrigger(suggestions);

		// Render suggestions
		if (isTrigger || (dataKey == null && !useAjax)) {
			for (String suggestion : suggestions.getSuggestions()) {
				xml.appendTagOpen("ui:suggestion");
				xml.appendAttribute("value", suggestion);
				xml.appendEnd();
			}
		}

		// End tag
		xml.appendEndTag("ui:suggestions");
	}
11767
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WTextArea textArea = (WTextArea) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = textArea.isReadOnly();
		xml.appendTagOpen("ui:textarea");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", textArea.isHidden(), "true");

		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			int cols = textArea.getColumns();
			int rows = textArea.getRows();
			int minLength = textArea.getMinLength();
			int maxLength = textArea.getMaxLength();
			WComponent submitControl = textArea.getDefaultSubmitButton();
			String submitControlId = submitControl == null ? null : submitControl.getId();

			xml.appendOptionalAttribute("disabled", textArea.isDisabled(), "true");
			xml.appendOptionalAttribute("required", textArea.isMandatory(), "true");
			xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
			xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
			xml.appendOptionalAttribute("toolTip", textArea.getToolTip());
			xml.appendOptionalAttribute("accessibleText", textArea.getAccessibleText());
			xml.appendOptionalAttribute("rows", rows > 0, rows);
			xml.appendOptionalAttribute("cols", cols > 0, cols);
			xml.appendOptionalAttribute("buttonId", submitControlId);
			String placeholder = textArea.getPlaceholder();
			xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);

			String autocomplete = textArea.getAutocomplete();
			xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
		}
		xml.appendClose();

		if (textArea.isRichTextArea()) {
			/*
			 * This is a nested element instead of an attribute to cater for future enhancements
			 * such as turning rich text features on or off, or specifying JSON config either as
			 * a URL attribute or a nested CDATA section.
			 */
			xml.append("<ui:rtf />");
		}

		String textString = textArea.getText();
		if (textString != null) {
			if (textArea.isReadOnly() && textArea.isRichTextArea()) {
				// read only we want to output unescaped, but it must still be XML valid.
				xml.write(HtmlToXMLUtil.unescapeToXML(textString));
			} else {
				xml.appendEscaped(textString);
			}
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(textArea, renderContext);
		}
		xml.appendEndTag("ui:textarea");
	}
1001255
@Override
	public void paint(final RenderContext renderContext) {
		if (windowId == null) {
			super.paint(renderContext);
		} else {
			// Get the window component
			ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
			if (target == null) {
				throw new SystemException("No window component for id " + windowId);
			}

			UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
			Environment originalEnvironment = uic.getEnvironment();
			uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));

			UIContextHolder.pushContext(target.getContext());
			try {
				super.paint(renderContext);
			} finally {
				uic.setEnvironment(originalEnvironment);
				UIContextHolder.popContext();
			}
		}
	}
1311268
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WDropdown dropdown = (WDropdown) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = dropdown.isReadOnly();
		String dataKey = dropdown.getListCacheKey();

		// Start tag
		xml.appendTagOpen("ui:dropdown");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", dropdown.isHidden(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			xml.appendOptionalAttribute("data", dataKey != null, dataKey);
			xml.appendOptionalAttribute("disabled", dropdown.isDisabled(), "true");
			xml.appendOptionalAttribute("required", dropdown.isMandatory(), "true");
			xml.appendOptionalAttribute("submitOnChange", dropdown.isSubmitOnChange(), "true");
			xml.appendOptionalAttribute("toolTip", dropdown.getToolTip());
			xml.appendOptionalAttribute("accessibleText", dropdown.getAccessibleText());
			int optionWidth = dropdown.getOptionWidth();
			xml.appendOptionalAttribute("optionWidth", optionWidth > 0, optionWidth);
			String autocomplete = dropdown.getAutocomplete();
			xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
			xml.appendOptionalAttribute("type", getTypeAsString(dropdown.getType()));
		}
		xml.appendClose();

		// Options
		List<?> options = dropdown.getOptions();
		Object selectedOption = dropdown.getSelected();

		// For an editable dropdown (combo box), the selected option may not be in the list.
		if (dropdown.getType() == WDropdown.DropdownType.COMBO
				&& selectedOption != null
				&& (options == null || !options.contains(selectedOption))) {
			xml.appendTagOpen("ui:option");
			xml.appendAttribute("value", selectedOption.toString());
			xml.appendAttribute("selected", "true");
			xml.appendClose();
			xml.appendEscaped(selectedOption.toString());
			xml.appendEndTag("ui:option");
		}

		if (options != null) {
			int optionIndex = 0;
			boolean renderSelectionsOnly = readOnly || dataKey != null;

			for (Object option : options) {
				if (option instanceof OptionGroup) {
					xml.appendTagOpen("ui:optgroup");
					xml.appendAttribute("label", ((OptionGroup) option).getDesc());
					xml.appendClose();

					for (Object nestedOption : ((OptionGroup) option).getOptions()) {
						renderOption(dropdown, nestedOption, optionIndex++, xml, selectedOption,
								renderSelectionsOnly);
					}

					xml.appendEndTag("ui:optgroup");
				} else {
					renderOption(dropdown, option, optionIndex++, xml, selectedOption,
							renderSelectionsOnly);
				}
			}
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(dropdown, renderContext);
		}
		// End tag
		xml.appendEndTag("ui:dropdown");
	}
367942
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPartialDateField dateField = (WPartialDateField) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = dateField.isReadOnly();

		String date = formatDate(dateField);

		xml.appendTagOpen("ui:datefield");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", dateField.isHidden(), "true");
		xml.appendOptionalAttribute("date", date);
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			xml.appendAttribute("allowPartial", "true");
			xml.appendOptionalAttribute("disabled", dateField.isDisabled(), "true");
			xml.appendOptionalAttribute("required", dateField.isMandatory(), "true");
			xml.appendOptionalAttribute("toolTip", dateField.getToolTip());
			xml.appendOptionalAttribute("accessibleText", dateField.getAccessibleText());
			WComponent submitControl = dateField.getDefaultSubmitButton();
			String submitControlId = submitControl == null ? null : submitControl.getId();
			xml.appendOptionalAttribute("buttonId", submitControlId);
		}

		xml.appendClose();

		if (date == null) {
			xml.appendEscaped(dateField.getText());
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(dateField, renderContext);
		}
		xml.appendEndTag("ui:datefield");
	}
544510
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPanel panel = (WPanel) component;
		XmlStringBuilder xml = renderContext.getWriter();
		GridLayout layout = (GridLayout) panel.getLayout();
		Size hgap = layout.getHorizontalGap();
		String hgapString = hgap == null ? null : hgap.toString();
		Size vgap = layout.getVerticalGap();
		String vgapString = vgap == null ? null : vgap.toString();
		int rows = layout.getRows();
		int cols = layout.getCols();

		xml.appendTagOpen("ui:gridlayout");

		xml.appendAttribute("rows", rows > 0 ? String.valueOf(rows) : "0");
		xml.appendAttribute("cols", cols > 0 ? String.valueOf(cols) : "0");
		xml.appendOptionalAttribute("hgap", hgapString);
		xml.appendOptionalAttribute("vgap", vgapString);

		xml.appendClose();

		int size = panel.getChildCount();

		for (int i = 0; i < size; i++) {
			xml.appendTag("ui:cell");
			WComponent child = panel.getChildAt(i);
			child.paint(renderContext);
			xml.appendEndTag("ui:cell");
		}

		xml.appendEndTag("ui:gridlayout");
	}
700989
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WFileWidget fileWidget = (WFileWidget) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = fileWidget.isReadOnly();

		xml.appendTagOpen(TAG_NAME);
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
			xml.appendEnd();
			return;
		}
		xml.appendOptionalAttribute("disabled", fileWidget.isDisabled(), "true");
		xml.appendOptionalAttribute("required", fileWidget.isMandatory(), "true");
		xml.appendOptionalAttribute("toolTip", fileWidget.getToolTip());
		xml.appendOptionalAttribute("accessibleText", fileWidget.getAccessibleText());
		xml.appendOptionalAttribute("acceptedMimeTypes", typesToString(fileWidget.getFileTypes()));
		long maxFileSize = fileWidget.getMaxFileSize();
		xml.appendOptionalAttribute("maxFileSize", maxFileSize > 0, maxFileSize);

		List<Diagnostic> diags = fileWidget.getDiagnostics(Diagnostic.ERROR);
		if (diags == null || diags.isEmpty()) {
			xml.appendEnd();
			return;
		}
		xml.appendClose();
		DiagnosticRenderUtil.renderDiagnostics(fileWidget, renderContext);
		xml.appendEndTag(TAG_NAME);
	}