You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/08/17 23:32:22 UTC
svn commit: r432392 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/renderkit/html/
example/facelets/src/main/webapp/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/tag/
theme/scarboro...
Author: bommel
Date: Thu Aug 17 14:32:20 2006
New Revision: 432392
URL: http://svn.apache.org/viewvc?rev=432392&view=rev
Log:
some minor cleanups
removed renderMain from InRendererBase
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/InRendererBase.java
myfaces/tobago/trunk/example/facelets/src/main/webapp/table.xml
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/tag/MessageRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessageRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/InRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/InRendererBase.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/InRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/InRendererBase.java Thu Aug 17 14:32:20 2006
@@ -16,50 +16,9 @@
* limitations under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
-import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import java.io.IOException;
public abstract class InRendererBase extends InputRendererBase {
- private static final Log LOG = LogFactory.getLog(InRendererBase.class);
-
- public boolean getRendersChildren() {
- return true;
- }
-
- protected abstract void renderMain(FacesContext facesContext, UIInput input,
- TobagoResponseWriter writer) throws IOException;
-
- public void encodeEndTobago(FacesContext facesContext,
- UIComponent component)
- throws IOException {
- super.encodeEndTobago(facesContext, component);
- TobagoResponseWriter writer = (TobagoResponseWriter)
- facesContext.getResponseWriter();
-
-
- renderMain(facesContext, (UIInput) component, writer);
- }
-
- public int getComponentExtraWidth(FacesContext facesContext, UIComponent component) {
- int space = 0;
-// if (component.getFacet(TobagoConstants.FACET_LABEL) != null) {
-// int labelWidht = LayoutUtil.getLabelWidth(component);
-// space += labelWidht != 0 ? labelWidht : getLabelWidth(facesContext, component);
-// space += getConfiguredValue(facesContext, component, "labelSpace");
-// }
-// if (component.getFacet("picker") != null) {
-// int pickerWidth = getConfiguredValue(facesContext, component, "pickerWidth");
-// space += pickerWidth;
-// }
- return space;
- }
}
Modified: myfaces/tobago/trunk/example/facelets/src/main/webapp/table.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/facelets/src/main/webapp/table.xml?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/facelets/src/main/webapp/table.xml (original)
+++ myfaces/tobago/trunk/example/facelets/src/main/webapp/table.xml Thu Aug 17 14:32:20 2006
@@ -2,7 +2,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:tx="http://myfaces.apache.org/tobago/facelet-extension">
- <tc:page label="Tobago Sheet Faclets" width="640px" height="300px" >
+ <tc:page label="Tobago Sheet Facelets" width="640px" height="300px" >
<f:facet name="layout">
<tc:gridLayout margin="10px" rows="1*;2*;2*"/>
</f:facet>
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/tag/MessageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/tag/MessageRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/tag/MessageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/tag/MessageRenderer.java Thu Aug 17 14:32:20 2006
@@ -27,6 +27,7 @@
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.renderkit.MessageRendererBase;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.application.FacesMessage;
@@ -85,11 +86,11 @@
while (iterator.hasNext()) {
FacesMessage message = (FacesMessage) iterator.next();
// MessageFormat detail = new MessageFormat(formatString, tobagoContext.getLocale());
- writer.startElement("label", null);
+ writer.startElement(HtmlConstants.LABEL, null);
writer.writeAttribute("for", clientId, null);
writer.writeAttribute("title", message.getDetail(), null);
writer.writeText(message.getSummary(), null);
- writer.endElement("label");
+ writer.endElement(HtmlConstants.LABEL);
writer.startElement("br", null);
writer.endElement("br");
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DateRenderer.java Thu Aug 17 14:32:20 2006
@@ -23,64 +23,32 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALT;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CALENDAR_DATE_INPUT_ID;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LAYOUT_WIDTH;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
-import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BOX;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BUTTON;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_CALENDAR;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_GRID_LAYOUT;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_HIDDEN;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_IMAGE;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_LINK;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_PANEL;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_POPUP;
-import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_TIME;
import org.apache.myfaces.tobago.component.ComponentUtil;
-import org.apache.myfaces.tobago.component.UIGridLayout;
-import org.apache.myfaces.tobago.component.UIPanel;
-import org.apache.myfaces.tobago.component.UIPopup;
-import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.config.TobagoConfig;
-import org.apache.myfaces.tobago.event.DatePickerController;
import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIGraphic;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
import java.io.IOException;
import java.util.List;
-import java.util.Map;
public class DateRenderer extends InRenderer {
private static final Log LOG = LogFactory.getLog(DateRenderer.class);
- protected void renderMain(FacesContext facesContext, UIInput input, TobagoResponseWriter writer) throws IOException {
-
+ public void encodeEndTobago(FacesContext facesContext,
+ UIComponent component) throws IOException {
final String[] scripts = {
"script/date.js",
"script/dateConverter.js",
"script/calendar.js"};
final List<String> scriptFiles
- = ComponentUtil.findPage(input).getScriptFiles();
+ = ComponentUtil.findPage(component).getScriptFiles();
for (String script : scripts) {
scriptFiles.add(script);
}
@@ -89,166 +57,26 @@
HtmlRendererUtil.writeScriptLoader(facesContext, scripts, null);
}
- String classes = ComponentUtil.getStringAttribute(input, ATTR_STYLE_CLASS);
+ String classes = ComponentUtil.getStringAttribute(component, ATTR_STYLE_CLASS);
classes = classes.replaceAll("tobago-date-", "tobago-in-");
- input.getAttributes().put(ATTR_STYLE_CLASS, classes);
- super.renderMain(facesContext, input, writer);
+ component.getAttributes().put(ATTR_STYLE_CLASS, classes);
+ super.encodeEndTobago(facesContext, component);
- Converter converter = getConverter(facesContext, input);
+ Converter converter = getConverter(facesContext, component);
+ // TODO is this really needed?
if (converter instanceof DateTimeConverter) {
String pattern = ((DateTimeConverter) converter).getPattern();
if (pattern != null) {
- String id = input.getClientId(facesContext);
- writer.startElement("input", input);
+ TobagoResponseWriter writer = (TobagoResponseWriter)
+ facesContext.getResponseWriter();
+ String id = component.getClientId(facesContext);
+ writer.startElement("input", component);
writer.writeAttribute("type", "hidden", null);
writer.writeIdAttribute(id + ":converterPattern");
writer.writeAttribute("value", pattern, null);
writer.endElement("input");
}
}
-
- }
-
- private UIComponent createPicker(UIComponent component) {
-
- // util
- FacesContext facesContext = FacesContext.getCurrentInstance();
- final String idPrefix
- = ComponentUtil.createPickerId(facesContext, component, "");
- DatePickerController datePickerController = new DatePickerController();
-
-
-
- // create link
- UICommand link = (UICommand) ComponentUtil.createComponent(
- facesContext, UICommand.COMPONENT_TYPE, RENDERER_TYPE_LINK);
-// component.getFacets().put(FACET_PICKER, link);
-
- link.setImmediate(true);
- link.setRendered(true);
- link.setImmediate(true);
- Map<String, Object> attributes = link.getAttributes();
- link.setId(idPrefix + DatePickerController.OPEN_POPUP);
- link.setActionListener(datePickerController);
- attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
-
- org.apache.myfaces.tobago.component.UIInput hidden =
- (org.apache.myfaces.tobago.component.UIInput) ComponentUtil.createComponent(facesContext,
- org.apache.myfaces.tobago.component.UIInput.COMPONENT_TYPE, RENDERER_TYPE_HIDDEN);
- link.getChildren().add(hidden);
- hidden.setId(idPrefix + "Dimension");
- // attributes map is still of link
- attributes.put(ATTR_ACTION_ONCLICK, "Tobago.openPickerPopup(event, '"
- + link.getClientId(facesContext) + "', '"
- + hidden.getClientId(facesContext) + "')");
-
- // create popup
- final UIComponent popup = ComponentUtil.createComponent(
- facesContext, UIPopup.COMPONENT_TYPE, RENDERER_TYPE_POPUP);
- link.getFacets().put(FACET_PICKER_POPUP, popup);
- popup.setRendered(false);
- popup.setId(idPrefix + "popup");
- attributes = popup.getAttributes();
- attributes.put(ATTR_POPUP_RESET, Boolean.TRUE);
- attributes.put(ATTR_WIDTH, String.valueOf(
- ThemeConfig.getValue(facesContext, component, "CalendarPopupWidth")));
- attributes.put(ATTR_HEIGHT, String.valueOf(
- ThemeConfig.getValue(facesContext, component, "CalendarPopupHeight")));
- final UIComponent box = ComponentUtil.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_BOX);
- popup.getChildren().add(box);
- box.setId("box");
- box.getAttributes().put(ATTR_LABEL, "datePicker");
- UIComponent layout = ComponentUtil.createComponent(
- facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
- box.getFacets().put(FACET_LAYOUT, layout);
- layout.setId("layout");
- layout.getAttributes().put(ATTR_ROWS, "1*;fixed;fixed;fixed");
-
- final UIComponent calendar = ComponentUtil.createComponent(
- facesContext, UIOutput.COMPONENT_TYPE, RENDERER_TYPE_CALENDAR);
- box.getChildren().add(calendar);
- calendar.setId("calendar");
- calendar.getAttributes().put(ATTR_CALENDAR_DATE_INPUT_ID, component.getClientId(facesContext));
-
- //if (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -1) {
- // add time input
- final UIComponent timePanel = ComponentUtil.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- timePanel.setId("timePanel");
- box.getChildren().add(timePanel);
- layout = ComponentUtil.createComponent(
- facesContext, UIGridLayout.COMPONENT_TYPE, RENDERER_TYPE_GRID_LAYOUT);
- timePanel.getFacets().put(FACET_LAYOUT, layout);
- layout.setId("timePanelLayout");
- layout.getAttributes().put(ATTR_COLUMNS, "1*;fixed;1*");
- UIComponent cell = ComponentUtil.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- cell.setId("cell1");
- timePanel.getChildren().add(cell);
-
- final UIComponent time = ComponentUtil.createComponent(
- facesContext, org.apache.myfaces.tobago.component.UIInput.COMPONENT_TYPE, RENDERER_TYPE_TIME);
- timePanel.getChildren().add(time);
- time.setId("time");
- time.getAttributes().put(ATTR_CALENDAR_DATE_INPUT_ID, component.getClientId(facesContext));
-
-
-
- cell = ComponentUtil.createComponent(
- facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- cell.setId("cell2");
- timePanel.getChildren().add(cell);
-
-
- //} else {
- // add empty cell // TODO: remove if popup height calculation relays on content
- //final UIComponent cell = ComponentUtil.createComponent(
- // facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
- //cell.setId("emptyCell");
- //box.getChildren().add(cell);
- //}
-
- final UICommand okButton = (UICommand) ComponentUtil.createComponent(facesContext,
- org.apache.myfaces.tobago.component.UICommand.COMPONENT_TYPE, RENDERER_TYPE_BUTTON);
- box.getChildren().add(okButton);
- okButton.setId("ok" + DatePickerController.CLOSE_POPUP);
- attributes = okButton.getAttributes();
- attributes.put(ATTR_LABEL, "OK");
- attributes.put(ATTR_ACTION_ONCLICK, "writeIntoField('"
- + popup.getClientId(facesContext) + "', '"
- + component.getClientId(facesContext) + "'); Tobago.closePickerPopup('"
- + popup.getClientId(facesContext) + "')");
- okButton.setActionListener(datePickerController);
-
- final UICommand cancelButton = (UICommand) ComponentUtil.createComponent(facesContext,
- org.apache.myfaces.tobago.component.UICommand.COMPONENT_TYPE, RENDERER_TYPE_BUTTON);
- box.getChildren().add(cancelButton);
- attributes = cancelButton.getAttributes();
- attributes.put(ATTR_LABEL, "Cancel");
- //attributes.put(ATTR_TYPE, COMMAND_TYPE_SCRIPT);
- attributes.put(ATTR_ACTION_ONCLICK, "Tobago.closePickerPopup('" + popup.getClientId(facesContext) + "')");
- cancelButton.setId(DatePickerController.CLOSE_POPUP);
- cancelButton.setActionListener(datePickerController);
-
- // create image
- UIGraphic image = (UIGraphic) ComponentUtil.createComponent(
- facesContext, UIGraphic.COMPONENT_TYPE, RENDERER_TYPE_IMAGE);
- image.setRendered(true);
- image.setValue("image/date.gif");
- image.getAttributes().put(ATTR_ALT, ""); //TODO: i18n
- image.getAttributes().put(ATTR_STYLE_CLASS, "tobago-input-picker");
- image.setId(idPrefix + "image");
-
- // add image
- link.getChildren().add(image);
-
- return link;
}
-
- public int getComponentExtraWidth(FacesContext facesContext, UIComponent component) {
- return getConfiguredValue(facesContext, component, "pickerWidth");
- }
-
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Thu Aug 17 14:32:20 2006
@@ -51,10 +51,11 @@
public class InRenderer extends InRendererBase implements AjaxRenderer {
private static final Log LOG = LogFactory.getLog(InRenderer.class);
- protected void renderMain(FacesContext facesContext, UIInput input,
- TobagoResponseWriter writer) throws IOException {
+ public void encodeEndTobago(FacesContext facesContext,
+ UIComponent component)
+ throws IOException {
Iterator messages = facesContext.getMessages(
- input.getClientId(facesContext));
+ component.getClientId(facesContext));
StringBuffer stringBuffer = new StringBuffer();
while (messages.hasNext()) {
FacesMessage message = (FacesMessage) messages.next();
@@ -67,27 +68,27 @@
}
title = HtmlRendererUtil.addTip(
- title, (String) input.getAttributes().get(ATTR_TIP));
+ title, (String) component.getAttributes().get(ATTR_TIP));
- String currentValue = getCurrentValue(facesContext, input);
+ String currentValue = getCurrentValue(facesContext, component);
if (LOG.isDebugEnabled()) {
LOG.debug("currentValue = '" + currentValue + "'");
}
- String type = ComponentUtil.getBooleanAttribute(input,
+ String type = ComponentUtil.getBooleanAttribute(component,
ATTR_PASSWORD) ? "password" : "text";
// Todo: check for valid binding
boolean renderAjaxSuggest = false;
- if (input instanceof org.apache.myfaces.tobago.component.UIInput) {
+ if (component instanceof org.apache.myfaces.tobago.component.UIInput) {
renderAjaxSuggest =
- ((org.apache.myfaces.tobago.component.UIInput) input).getSuggestMethod() != null;
+ ((org.apache.myfaces.tobago.component.UIInput) component).getSuggestMethod() != null;
}
- String onchange = HtmlUtils.generateOnchange(input, facesContext);
- String id = input.getClientId(facesContext);
-
- writer.startElement("input", input);
+ String id = component.getClientId(facesContext);
+ TobagoResponseWriter writer = (TobagoResponseWriter)
+ facesContext.getResponseWriter();
+ writer.startElement("input", component);
writer.writeAttribute("type", type, null);
writer.writeNameAttribute(id);
writer.writeIdAttribute(id);
@@ -98,17 +99,20 @@
writer.writeAttribute("title", title, null);
}
writer.writeAttribute("readonly",
- ComponentUtil.getBooleanAttribute(input, ATTR_READONLY));
+ ComponentUtil.getBooleanAttribute(component, ATTR_READONLY));
writer.writeAttribute("disabled",
- ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED));
+ ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED));
writer.writeAttribute("style", null, ATTR_STYLE);
writer.writeComponentClass();
if (renderAjaxSuggest) {
writer.writeAttribute("autocomplete", "off", false);
}
- if (onchange != null) {
- // TODO: create and use utility method to write attributes without quoting
-// writer.writeAttribute("onchange", onchange, null);
+ if (component instanceof UIInput) {
+ String onchange = HtmlUtils.generateOnchange((UIInput)component, facesContext);
+ if (onchange != null) {
+ // TODO: create and use utility method to write attributes without quoting
+ // writer.writeAttribute("onchange", onchange, null);
+ }
}
writer.endElement("input");
@@ -117,7 +121,7 @@
String popupId = id + SUBCOMPONENT_SEP + "ajaxPopup";
- final UIPage page = ComponentUtil.findPage(input);
+ final UIPage page = ComponentUtil.findPage(component);
page.getScriptFiles().add("script/effects.js");
page.getScriptFiles().add("script/dragdrop.js");
page.getScriptFiles().add("script/controls.js");
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java Thu Aug 17 14:32:20 2006
@@ -27,10 +27,12 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
+import static org.apache.myfaces.tobago.TobagoConstants.FACET_LABEL;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.util.AccessKeyMap;
import org.apache.myfaces.tobago.util.LayoutUtil;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -58,7 +60,8 @@
private UIComponent findParent(UIComponent component) {
UIComponent parent = component.getParent();
- if (component != parent.getFacet("label")) {
+ if (component != parent.getFacet(FACET_LABEL)) {
+
// try to find belonging component
// this can only success if the component was rendered (created) before this label
parent = ComponentUtil.findFor(component);
@@ -95,7 +98,7 @@
writer.writeAttribute("style", null, ATTR_STYLE);
writer.startElement("a", output);
writer.writeComponentClass();
- writer.startElement("label", output);
+ writer.startElement(HtmlConstants.LABEL, output);
String clientId = output.getClientId(facesContext);
writer.writeIdAttribute(clientId);
if (forValue != null) {
@@ -110,7 +113,7 @@
if (label.getText() != null) {
HtmlRendererUtil.writeLabelWithAccessKey(writer, label);
}
- writer.endElement("label");
+ writer.endElement(HtmlConstants.LABEL);
writer.endElement("a");
if (label.getAccessKey() != null) {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessageRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessageRenderer.java Thu Aug 17 14:32:20 2006
@@ -26,6 +26,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.renderkit.MessageRendererBase;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.application.FacesMessage;
@@ -78,11 +79,11 @@
while (iterator.hasNext()) {
FacesMessage message = (FacesMessage) iterator.next();
// MessageFormat detail = new MessageFormat(formatString, tobagoContext.getLocale());
- writer.startElement("label", null);
+ writer.startElement(HtmlConstants.LABEL, null);
writer.writeAttribute("for", clientId, null);
writer.writeAttribute("title", message.getDetail(), null);
writer.writeText(message.getSummary(), null);
- writer.endElement("label");
+ writer.endElement(HtmlConstants.LABEL);
writer.startElement("br", null);
writer.endElement("br");
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java Thu Aug 17 14:32:20 2006
@@ -26,6 +26,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.renderkit.MessageRendererBase;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.application.FacesMessage;
@@ -100,13 +101,13 @@
private void encodeMessage(ResponseWriter writer, FacesMessage message,
String clientId)
throws IOException {
- writer.startElement("label", null);
+ writer.startElement(HtmlConstants.LABEL, null);
if (clientId != null) {
writer.writeAttribute("for", clientId, null);
}
writer.writeAttribute("title", message.getDetail(), null);
writer.writeText(message.getSummary(), null);
- writer.endElement("label");
+ writer.endElement(HtmlConstants.LABEL);
writer.startElement("br", null);
writer.endElement("br");
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java Thu Aug 17 14:32:20 2006
@@ -27,6 +27,7 @@
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.renderkit.RenderUtil;
import org.apache.myfaces.tobago.renderkit.SelectManyRendererBase;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.NamingContainer;
@@ -102,11 +103,11 @@
// FIXME: use created UIOutput Label
// FIXME: see outcommented part
- writer.startElement("label", null);
+ writer.startElement(HtmlConstants.LABEL, null);
writer.writeClassAttribute("tobago-label-default");
writer.writeAttribute("for", itemId, null);
writer.writeText(item.getLabel(), null);
- writer.endElement("label");
+ writer.endElement(HtmlConstants.LABEL);
// Application application = tobagoContext.getApplication();
// UIOutput label = (UIOutput)
// application.createComponent(TobagoConstants.COMPONENT_TYPE_OUTPUT);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.java Thu Aug 17 14:32:20 2006
@@ -29,6 +29,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.NamingContainer;
@@ -125,11 +126,11 @@
// FIXME: use created UIOutput Label
// FIXME: see outcommented part
- writer.startElement("label", null);
+ writer.startElement(HtmlConstants.LABEL, null);
writer.writeClassAttribute("tobago-label-default");
writer.writeAttribute("for", id, null);
writer.writeText(item.getLabel(), null);
- writer.endElement("label");
+ writer.endElement(HtmlConstants.LABEL);
// Application application = tobagoContext.getApplication();
// UIOutput label = (UIOutput)
// application.createComponent(TobagoConstants.COMPONENT_TYPE_OUTPUT);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java Thu Aug 17 14:32:20 2006
@@ -34,14 +34,17 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIInput;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
import java.util.Iterator;
public class TextAreaRenderer extends InRendererBase {
- protected void renderMain(FacesContext facesContext, UIInput input,
- TobagoResponseWriter writer) throws IOException {
+ public void encodeEndTobago(FacesContext facesContext,
+ UIComponent component) throws IOException {
+
+ UIInput input = (UIInput) component;
Iterator messages = facesContext.getMessages(
input.getClientId(facesContext));
StringBuffer stringBuffer = new StringBuffer();
@@ -61,6 +64,9 @@
String clientId = input.getClientId(facesContext);
String onchange = HtmlUtils.generateOnchange(input, facesContext);
+
+ TobagoResponseWriter writer
+ = (TobagoResponseWriter) facesContext.getResponseWriter();
writer.startElement("textarea", input);
writer.writeNameAttribute(clientId);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java?rev=432392&r1=432391&r2=432392&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java Thu Aug 17 14:32:20 2006
@@ -36,6 +36,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.component.UIInput;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
@@ -50,15 +51,13 @@
private static final Log LOG = LogFactory.getLog(TimeRenderer.class);
-// ----------------------------------------------------------- business methods
+ public void encodeEndTobago(FacesContext facesContext,
+ UIComponent component) throws IOException {
- protected void renderMain(FacesContext facesContext, UIInput input,
- TobagoResponseWriter writer) throws IOException {
-
- List<String> scriptFiles = ComponentUtil.findPage(input).getScriptFiles();
+ List<String> scriptFiles = ComponentUtil.findPage(component).getScriptFiles();
scriptFiles.add("script/dateConverter.js");
scriptFiles.add("script/calendar.js");
-
+ UIInput input = (UIInput) component;
Iterator messages = facesContext.getMessages(
input.getClientId(facesContext));
StringBuffer stringBuffer = new StringBuffer();
@@ -113,7 +112,8 @@
String id = input.getClientId(facesContext);
final String idPrefix = id + SUBCOMPONENT_SEP;
-
+ TobagoResponseWriter writer
+ = (TobagoResponseWriter) facesContext.getResponseWriter();
writer.startElement("div", input);
writer.writeComponentClass();