You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2007/08/29 21:18:53 UTC
svn commit: r570902 [2/2] - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/renderkit/html/
core/src/main/java/org/apache/myfac...
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/TimeExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/TimeExtensionTag.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/TimeExtensionTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/TimeExtensionTag.java Wed Aug 29 12:18:48 2007
@@ -17,23 +17,24 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
+import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.taglib.component.TimeTag;
import org.apache.myfaces.tobago.taglib.decl.HasConverter;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasLabel;
+import org.apache.myfaces.tobago.taglib.decl.HasLabelWidth;
+import org.apache.myfaces.tobago.taglib.decl.HasOnchange;
+import org.apache.myfaces.tobago.taglib.decl.HasTabIndex;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.HasValidator;
import org.apache.myfaces.tobago.taglib.decl.HasValue;
+import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
import org.apache.myfaces.tobago.taglib.decl.IsFocus;
import org.apache.myfaces.tobago.taglib.decl.IsInline;
import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
-import org.apache.myfaces.tobago.taglib.decl.HasOnchange;
-import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener;
-import org.apache.myfaces.tobago.taglib.decl.HasLabelWidth;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
@@ -65,8 +66,8 @@
@ExtensionTag(baseClassName = "org.apache.myfaces.tobago.taglib.component.TimeTag")
public class TimeExtensionTag extends BodyTagSupport
implements HasValue, HasValueChangeListener, HasValidator, HasIdBindingAndRendered,
- HasConverter, IsReadonly, IsDisabled, HasOnchange,
- IsRequired, HasTip, HasLabel, HasLabelWidth, IsFocus, IsInline {
+ HasConverter, IsReadonly, IsDisabled, HasOnchange, IsRequired, HasTip,
+ HasLabel, HasLabelWidth, IsFocus, IsInline, HasTabIndex {
private String binding;
private String converter;
@@ -83,6 +84,7 @@
private String inline;
private String onchange;
private String labelWidth;
+ private String tabIndex;
private LabelExtensionTag labelTag;
private TimeTag timeTag;
@@ -145,6 +147,9 @@
if (required != null) {
timeTag.setRequired(required);
}
+ if (tabIndex != null) {
+ timeTag.setTabIndex(tabIndex);
+ }
timeTag.setParent(labelTag);
timeTag.doStartTag();
@@ -176,6 +181,7 @@
value = null;
onchange = null;
valueChangeListener = null;
+ tabIndex = null;
timeTag = null;
labelTag = null;
}
@@ -235,7 +241,12 @@
public void setTip(String tip) {
this.tip = tip;
}
+
public void setLabelWidth(String labelWidth) {
this.labelWidth = labelWidth;
+ }
+
+ public void setTabIndex(String tabIndex) {
+ this.tabIndex = tabIndex;
}
}
Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basic.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basic.jsp?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basic.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/overview/basic.jsp Wed Aug 29 12:18:48 2007
@@ -47,26 +47,26 @@
<%-- row --%>
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout columns="1*;1*" border="0" />
+ <tc:gridLayout columns="*;*" border="0" />
</f:facet>
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout />
+ <tc:gridLayout rows="fixed;fixed;fixed" />
</f:facet>
- <tx:in value="#{overviewController.basicInput}" required="true"
+ <tx:in value="#{overviewController.basicInput}" required="true" tabIndex="1"
label="#{overviewBundle.basic_textboxLabel}" tip="test"
suggestMethod="#{overviewController.getInputSuggestItems}" />
- <tx:date value="#{overviewController.basicDate}"
+ <tx:date value="#{overviewController.basicDate}" tabIndex="3"
label="#{overviewBundle.basic_dateLabel}" required="true" >
<f:convertDateTime pattern="dd/MM/yyyy" />
<tc:validateSubmittedValueLength maximum="10"/>
</tx:date>
- <tx:time label="#{overviewBundle.basic_timeLabel}"
+ <tx:time label="#{overviewBundle.basic_timeLabel}" tabIndex="4"
value="#{overviewController.basicTime}" />
</tc:panel>
- <tx:textarea value="#{overviewController.basicArea}"
+ <tx:textarea value="#{overviewController.basicArea}" tabIndex="2"
label="#{overviewBundle.basic_textareaLabel}" />
</tc:panel>
@@ -83,7 +83,7 @@
<%-- row --%>
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout columns="1*;1*" border="0"/>
+ <tc:gridLayout columns="*;*" border="0"/>
</f:facet>
<tc:selectOneRadio value="#{overviewController.radioValue}"
id="rg0" converter="salutationId">
@@ -121,7 +121,7 @@
<%-- row --%>
<tc:panel>
<f:facet name="layout">
- <tc:gridLayout columns="120px;*;120px;*;120px" border="0"/>
+ <tc:gridLayout columns="120px;*;120px;*;120px" rows="fixed;fixed" border="0"/>
</f:facet>
<tc:link id="link" action="overview/basic"
actionListener="#{overviewController.click}"
@@ -134,6 +134,7 @@
<tc:button id="button" action="overview/basic"
actionListener="#{overviewController.click}"
label="#{overviewBundle.basic_buttonAction}" />
+
<tc:cell spanX="5">
<tx:in value="#{overviewController.lastAction}" readonly="true"
label="#{overviewBundle.basic_lastActionLabel}" />
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java Wed Aug 29 12:18:48 2007
@@ -29,7 +29,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TRANSITION;
import org.apache.myfaces.tobago.component.ComponentUtil;
-import org.apache.myfaces.tobago.component.UICommand;
+import org.apache.myfaces.tobago.component.UIButtonCommand;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
@@ -50,22 +50,31 @@
private static final Log LOG = LogFactory.getLog(ButtonRenderer.class);
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
- String clientId = component.getClientId(facesContext);
- String buttonType = createButtonType(component);
+ if (!(component instanceof UIButtonCommand)) {
+ LOG.error("Wrong type: Need " + UIButtonCommand.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+
+ UIButtonCommand command = (UIButtonCommand) component;
+ String clientId = command.getClientId(facesContext);
+ String buttonType = createButtonType(command);
- CommandRendererHelper helper
- = new CommandRendererHelper(facesContext, (UICommand) component, CommandRendererHelper.Tag.BUTTON);
+ CommandRendererHelper helper = new CommandRendererHelper(facesContext, command, CommandRendererHelper.Tag.BUTTON);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- LabelWithAccessKey label = new LabelWithAccessKey(component);
+ LabelWithAccessKey label = new LabelWithAccessKey(command);
- writer.startElement(HtmlConstants.BUTTON, component);
+ writer.startElement(HtmlConstants.BUTTON, command);
writer.writeAttribute(HtmlAttributes.TYPE, buttonType, false);
writer.writeNameAttribute(clientId);
writer.writeIdAttribute(clientId);
writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
writer.writeAttribute(HtmlAttributes.DISABLED, helper.isDisabled());
+ Integer tabIndex = command.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
if (helper.getOnclick() != null) {
writer.writeAttribute(HtmlAttributes.ONCLICK, helper.getOnclick(), true);
}
@@ -74,7 +83,7 @@
writer.flush(); // force closing the start tag
// image
- String imageName = (String) component.getAttributes().get(ATTR_IMAGE);
+ String imageName = (String) command.getAttributes().get(ATTR_IMAGE);
if (imageName != null) {
String image = null;
if (imageName.startsWith("HTTP:") || imageName.startsWith("FTP:")
@@ -109,7 +118,7 @@
facesContext, clientId, label.getAccessKey());
}
if ("submit".equals(buttonType)) {
- boolean transition = ComponentUtil.getBooleanAttribute(component, ATTR_TRANSITION);
+ boolean transition = ComponentUtil.getBooleanAttribute(command, ATTR_TRANSITION);
HtmlRendererUtil.setDefaultTransition(facesContext, transition);
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java Wed Aug 29 12:18:48 2007
@@ -29,6 +29,7 @@
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.component.UIFileInput;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -39,7 +40,6 @@
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
@@ -67,11 +67,16 @@
}
public void decode(FacesContext facesContext, UIComponent component) {
+ if (!(component instanceof UIFileInput)) {
+ LOG.error("Wrong type: Need " + UIFileInput.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+
if (ComponentUtil.isOutputOnly(component)) {
return;
}
- UIInput input = (UIInput) component;
+ UIFileInput input = (UIFileInput) component;
TobagoMultipartFormdataRequest request = null;
Object requestObject = facesContext.getExternalContext().getRequest();
@@ -104,16 +109,18 @@
}
}
- public void encodeEnd(
- FacesContext facesContext,
- UIComponent uiComponent) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UIFileInput)) {
+ LOG.error("Wrong type: Need " + UIFileInput.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
- UIInput component = (UIInput) uiComponent;
- String clientId = component.getClientId(facesContext);
+ UIFileInput input = (UIFileInput) component;
+ String clientId = input.getClientId(facesContext);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- writer.startElement(HtmlConstants.INPUT, component);
+ writer.startElement(HtmlConstants.INPUT, input);
writer.writeAttribute(HtmlAttributes.TYPE, "file", false);
writer.writeClassAttribute();
if (!ClientProperties.getInstance(facesContext).getUserAgent().isMozilla()) {
@@ -121,11 +128,13 @@
}
writer.writeNameAttribute(clientId);
writer.writeIdAttribute(clientId);
- writer.writeAttribute(HtmlAttributes.READONLY,
- ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED));
+ writer.writeAttribute(HtmlAttributes.READONLY, ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED));
+ Integer tabIndex = input.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
writer.endElement(HtmlConstants.INPUT);
-
}
}
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=570902&r1=570901&r2=570902&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 Wed Aug 29 12:18:48 2007
@@ -33,6 +33,7 @@
import org.apache.myfaces.tobago.ajax.api.AjaxRenderer;
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UIInput;
import org.apache.myfaces.tobago.component.UIPage;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -41,7 +42,6 @@
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
@@ -55,28 +55,27 @@
private static final Log LOG = LogFactory.getLog(InRenderer.class);
@Override
- public void encodeEnd(FacesContext facesContext, UIComponent component)
- throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UIInput)) {
+ LOG.error("Wrong type: Need " + UIInput.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+ UIInput input = (UIInput) component;
- String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, component);
+ String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, input);
- String currentValue = getCurrentValue(facesContext, component);
+ String currentValue = getCurrentValue(facesContext, input);
if (LOG.isDebugEnabled()) {
LOG.debug("currentValue = '" + currentValue + "'");
}
- String type = ComponentUtil.getBooleanAttribute(component,
+ String type = ComponentUtil.getBooleanAttribute(input,
ATTR_PASSWORD) ? "password" : "text";
// Todo: check for valid binding
- boolean renderAjaxSuggest = false;
- if (component instanceof org.apache.myfaces.tobago.component.UIInput) {
- renderAjaxSuggest =
- ((org.apache.myfaces.tobago.component.UIInput) component).getSuggestMethod() != null;
- }
-
- String id = component.getClientId(facesContext);
+ boolean renderAjaxSuggest = input.getSuggestMethod() != null;
+ String id = input.getClientId(facesContext);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- writer.startElement(HtmlConstants.INPUT, component);
+ writer.startElement(HtmlConstants.INPUT, input);
writer.writeAttribute(HtmlAttributes.TYPE, type, false);
writer.writeNameAttribute(id);
writer.writeIdAttribute(id);
@@ -87,28 +86,27 @@
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
int maxLength = 0;
- if (component instanceof EditableValueHolder) {
- EditableValueHolder editableValueHolder = (EditableValueHolder) component;
- for (Validator validator : editableValueHolder.getValidators()) {
- if (validator instanceof LengthValidator) {
- LengthValidator lengthValidator = (LengthValidator) validator;
- maxLength = lengthValidator.getMaximum();
- }
+ for (Validator validator : input.getValidators()) {
+ if (validator instanceof LengthValidator) {
+ LengthValidator lengthValidator = (LengthValidator) validator;
+ maxLength = lengthValidator.getMaximum();
}
}
if (maxLength > 0) {
writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
}
- writer.writeAttribute(HtmlAttributes.READONLY,
- ComponentUtil.getBooleanAttribute(component, ATTR_READONLY));
- writer.writeAttribute(HtmlAttributes.DISABLED,
- ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED));
+ writer.writeAttribute(HtmlAttributes.READONLY, ComponentUtil.getBooleanAttribute(input, ATTR_READONLY));
+ writer.writeAttribute(HtmlAttributes.DISABLED, ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED));
+ Integer tabIndex = input.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeStyleAttribute();
if (currentValue != null && currentValue.length() > 0
- && ComponentUtil.getBooleanAttribute(component, ATTR_REQUIRED)) {
- StyleClasses styleClasses = StyleClasses.ensureStyleClasses(component);
- String rendererName = HtmlRendererUtil.getRendererName(facesContext, component);
+ && ComponentUtil.getBooleanAttribute(input, ATTR_REQUIRED)) {
+ StyleClasses styleClasses = StyleClasses.ensureStyleClasses(input);
+ String rendererName = HtmlRendererUtil.getRendererName(facesContext, input);
styleClasses.removeAspectClass(rendererName, StyleClasses.Aspect.REQUIRED);
}
writer.writeClassAttribute();
@@ -124,26 +122,26 @@
} */
writer.endElement(HtmlConstants.INPUT);
- checkForCommandFacet(component, facesContext, writer);
+ checkForCommandFacet(input, facesContext, writer);
- if (ComponentUtil.getBooleanAttribute(component, ATTR_REQUIRED)) {
- String rendererName = HtmlRendererUtil.getRendererName(facesContext, component);
+ if (ComponentUtil.getBooleanAttribute(input, ATTR_REQUIRED)) {
+ String rendererName = HtmlRendererUtil.getRendererName(facesContext, input);
final String[] cmds = {
- "new Tobago.In(\"" + id + "\", true ,\"" + StyleClasses.PREFIX + rendererName + "\" );"
+ "new Tobago.In(\"" + id + "\", true ,\"" + StyleClasses.PREFIX + rendererName + "\" );"
};
HtmlRendererUtil.writeScriptLoader(facesContext, null, cmds);
}
// focus
- HtmlRendererUtil.renderFocusId(facesContext, component);
+ HtmlRendererUtil.renderFocusId(facesContext, input);
// input suggest
if (renderAjaxSuggest) {
String popupId = id + SUBCOMPONENT_SEP + "ajaxPopup";
- final UIPage page = ComponentUtil.findPage(facesContext, component);
+ final UIPage page = ComponentUtil.findPage(facesContext, input);
page.getScriptFiles().add("script/effects.js");
page.getScriptFiles().add("script/dragdrop.js");
page.getScriptFiles().add("script/controls.js");
@@ -177,13 +175,15 @@
}
- public void encodeAjax(FacesContext context, UIComponent uiComponent) throws IOException {
- AjaxUtils.checkParamValidity(context, uiComponent,
- org.apache.myfaces.tobago.component.UIInput.class);
+ public void encodeAjax(FacesContext context, UIComponent component) throws IOException {
+ if (!(component instanceof UIInput)) {
+ LOG.error("Wrong type: Need " + UIInput.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+ AjaxUtils.checkParamValidity(context, component, UIInput.class);
- org.apache.myfaces.tobago.component.UIInput input =
- (org.apache.myfaces.tobago.component.UIInput) uiComponent;
+ UIInput input = (UIInput) component;
MethodBinding mb;
Object o = input.getSuggestMethod();
@@ -200,7 +200,7 @@
// : DEFAULT_MAX_SUGGESTED_ITEMS;
List suggesteds = (List) mb.invoke(context, new Object[]{
- AjaxPhaseListener.getValueForComponent(context, uiComponent)});
+ AjaxPhaseListener.getValueForComponent(context, component)});
writer.startElement(HtmlConstants.UL, null);
int suggestedCount = 0;
@@ -216,4 +216,3 @@
context.responseComplete();
}
}
-
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java Wed Aug 29 12:18:48 2007
@@ -28,7 +28,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_IMAGE;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
-import org.apache.myfaces.tobago.component.UICommand;
+import org.apache.myfaces.tobago.component.UILinkCommand;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
@@ -49,19 +49,23 @@
private static final Log LOG = LogFactory.getLog(LinkRenderer.class);
public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UILinkCommand)) {
+ LOG.error("Wrong type: Need " + UILinkCommand.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
- String clientId = component.getClientId(facesContext);
- CommandRendererHelper helper
- = new CommandRendererHelper(facesContext, (UICommand) component, CommandRendererHelper.Tag.ANCHOR);
+ UILinkCommand command = (UILinkCommand) component;
+ String clientId = command.getClientId(facesContext);
+ CommandRendererHelper helper = new CommandRendererHelper(facesContext, command, CommandRendererHelper.Tag.ANCHOR);
String href = helper.getHref();
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- LabelWithAccessKey label = new LabelWithAccessKey(component);
+ LabelWithAccessKey label = new LabelWithAccessKey(command);
if (helper.isDisabled()) {
- writer.startElement(HtmlConstants.SPAN, component);
+ writer.startElement(HtmlConstants.SPAN, command);
} else {
- writer.startElement(HtmlConstants.A, component);
+ writer.startElement(HtmlConstants.A, command);
writer.writeAttribute(HtmlAttributes.HREF, href, true);
if (helper.getOnclick() != null) {
writer.writeAttribute(HtmlAttributes.ONCLICK, helper.getOnclick(), true);
@@ -69,6 +73,10 @@
if (helper.getTarget() != null) {
writer.writeAttribute(HtmlAttributes.TARGET, helper.getTarget(), true);
}
+ Integer tabIndex = command.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
}
writer.writeClassAttribute();
writer.writeIdAttribute(clientId);
@@ -78,7 +86,7 @@
writer.flush();
// image
- String image = (String) component.getAttributes().get(ATTR_IMAGE);
+ String image = (String) command.getAttributes().get(ATTR_IMAGE);
if (image != null) {
if (image.startsWith("HTTP:") || image.startsWith("FTP:") || image.startsWith("/")) {
// absolute Path to image : nothing to do
@@ -112,6 +120,11 @@
public void encodeEnd(FacesContext facesContext, UIComponent component)
throws IOException {
+ if (!(component instanceof UILinkCommand)) {
+ LOG.error("Wrong type: Need " + UILinkCommand.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+
ResponseWriter writer = facesContext.getResponseWriter();
if (ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED)) {
writer.endElement(HtmlConstants.SPAN);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectBooleanCheckboxRenderer.java Wed Aug 29 12:18:48 2007
@@ -29,6 +29,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UISelectBoolean;
import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
import org.apache.myfaces.tobago.renderkit.RenderUtil;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -38,7 +39,6 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
-import javax.faces.component.UISelectBoolean;
import javax.faces.context.FacesContext;
import java.io.IOException;
@@ -61,8 +61,7 @@
LOG.debug("new value = '" + newValue + "'");
}
-// input.setSubmittedValue("true".equals(newValue) ? Boolean.TRUE : Boolean.FALSE);
- input.setSubmittedValue("true".equals(newValue) ? "true": "false");
+ input.setSubmittedValue("true".equals(newValue) ? "true" : "false");
}
// public Object getConvertedValue(
@@ -71,21 +70,25 @@
//
// return Boolean.valueOf((String)submittedValue);
// }
-//
- public void encodeEnd(FacesContext facesContext,
- UIComponent uiComponent) throws IOException {
- UISelectBoolean component = (UISelectBoolean) uiComponent;
+ //
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UISelectBoolean)) {
+ LOG.error("Wrong type: Need " + UISelectBoolean.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+
+ UISelectBoolean selectBoolean = (UISelectBoolean) component;
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- UIComponent label = ComponentUtil.provideLabel(facesContext, component);
+ UIComponent label = ComponentUtil.provideLabel(facesContext, selectBoolean);
- boolean inline = ComponentUtil.getBooleanAttribute(component, ATTR_INLINE);
+ boolean inline = ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_INLINE);
if (label != null && !inline) {
- writer.startElement(HtmlConstants.TABLE, component);
+ writer.startElement(HtmlConstants.TABLE, selectBoolean);
writer.writeAttribute(HtmlAttributes.BORDER, 0);
writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
@@ -96,26 +99,30 @@
writer.startElement(HtmlConstants.TD, null);
}
- String currentValue = getCurrentValue(facesContext, component);
+ String currentValue = getCurrentValue(facesContext, selectBoolean);
boolean checked = "true".equals(currentValue);
- writer.startElement(HtmlConstants.INPUT, component);
+ writer.startElement(HtmlConstants.INPUT, selectBoolean);
writer.writeAttribute(HtmlAttributes.TYPE, "checkbox", false);
writer.writeAttribute(HtmlAttributes.VALUE, "true", false);
writer.writeAttribute(HtmlAttributes.CHECKED, checked);
- if (ComponentUtil.getBooleanAttribute(component, ATTR_READONLY)) {
+ if (ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_READONLY)) {
if (checked) {
writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=true", false);
} else {
writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=false", false);
}
}
- writer.writeNameAttribute(component.getClientId(facesContext));
+ writer.writeNameAttribute(selectBoolean.getClientId(facesContext));
writer.writeClassAttribute();
- writer.writeIdAttribute(component.getClientId(facesContext));
+ writer.writeIdAttribute(selectBoolean.getClientId(facesContext));
writer.writeAttribute(HtmlAttributes.DISABLED,
- ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED));
- String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, component);
+ ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_DISABLED));
+ Integer tabIndex = selectBoolean.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
+ String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectBoolean);
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
@@ -136,7 +143,7 @@
writer.endElement(HtmlConstants.TR);
writer.endElement(HtmlConstants.TABLE);
}
- checkForCommandFacet(component, facesContext, writer);
+ checkForCommandFacet(selectBoolean, facesContext, writer);
}
}
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=570902&r1=570901&r2=570902&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 Wed Aug 29 12:18:48 2007
@@ -26,6 +26,7 @@
import org.apache.commons.logging.LogFactory;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INLINE;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UISelectMany;
import org.apache.myfaces.tobago.renderkit.RenderUtil;
import org.apache.myfaces.tobago.renderkit.SelectManyRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -36,7 +37,6 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
-import javax.faces.component.UISelectMany;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import java.io.IOException;
@@ -48,25 +48,28 @@
private static final Log LOG = LogFactory.getLog(SelectManyCheckboxRenderer.class);
- public void encodeEnd(FacesContext facesContext,
- UIComponent uiComponent) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UISelectMany)) {
+ LOG.error("Wrong type: Need " + UISelectMany.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
- UISelectMany component = (UISelectMany) uiComponent;
+ UISelectMany selectMany = (UISelectMany) component;
- List<SelectItem> items = ComponentUtil.getItemsToRender(component);
+ List<SelectItem> items = ComponentUtil.getItemsToRender(selectMany);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- Object[] values = component.getSelectedValues();
+ Object[] values = selectMany.getSelectedValues();
if (LOG.isDebugEnabled()) {
LOG.debug("values = '" + Arrays.toString(values) + "'");
}
- String id = component.getClientId(facesContext);
+ String id = selectMany.getClientId(facesContext);
- boolean inline = ComponentUtil.getBooleanAttribute(component, ATTR_INLINE);
- String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, component);
+ boolean inline = ComponentUtil.getBooleanAttribute(selectMany, ATTR_INLINE);
+ String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectMany);
if (!inline) {
- writer.startElement(HtmlConstants.TABLE, component);
+ writer.startElement(HtmlConstants.TABLE, selectMany);
// TODO writer.writeComponentClass();
writer.writeAttribute(HtmlAttributes.BORDER, 0);
writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
@@ -88,16 +91,20 @@
+ NamingContainer.SEPARATOR_CHAR + NamingContainer.SEPARATOR_CHAR
+ item.getValue().toString();
clientIds.add(itemId);
- writer.startElement(HtmlConstants.INPUT, component);
+ writer.startElement(HtmlConstants.INPUT, selectMany);
writer.writeAttribute(HtmlAttributes.TYPE, "checkbox", false);
writer.writeClassAttribute();
writer.writeAttribute(HtmlAttributes.CHECKED, RenderUtil.contains(values, item.getValue()));
writer.writeNameAttribute(id);
writer.writeIdAttribute(itemId);
- String formattedValue = RenderUtil.getFormattedValue(facesContext, component, item.getValue());
+ String formattedValue = RenderUtil.getFormattedValue(facesContext, selectMany, item.getValue());
writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
writer.writeAttribute(HtmlAttributes.DISABLED, item.isDisabled());
+ Integer tabIndex = selectMany.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.endElement(HtmlConstants.INPUT);
if (LOG.isDebugEnabled()) {
@@ -141,15 +148,22 @@
if (!inline) {
writer.endElement(HtmlConstants.TABLE);
}
- checkForCommandFacet(component, clientIds, facesContext, writer);
+ checkForCommandFacet(selectMany, clientIds, facesContext, writer);
}
public int getFixedHeight(FacesContext facesContext, UIComponent component) {
- int heightPerRow = super.getFixedHeight(facesContext, component);
- if (ComponentUtil.getBooleanAttribute(component, ATTR_INLINE)) {
+ if (!(component instanceof UISelectMany)) {
+ LOG.error("Wrong type: Need " + UISelectMany.class.getName() + ", but was " + component.getClass().getName());
+ return 100;
+ }
+
+ UISelectMany selectMany = (UISelectMany) component;
+
+ int heightPerRow = super.getFixedHeight(facesContext, selectMany);
+ if (ComponentUtil.getBooleanAttribute(selectMany, ATTR_INLINE)) {
return heightPerRow;
} else {
- List<SelectItem> items = ComponentUtil.getItemsToRender((UISelectMany) component);
+ List<SelectItem> items = ComponentUtil.getItemsToRender(selectMany);
return items.size() * heightPerRow;
}
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyListboxRenderer.java Wed Aug 29 12:18:48 2007
@@ -27,6 +27,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UISelectMany;
import org.apache.myfaces.tobago.renderkit.SelectManyRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -34,12 +35,11 @@
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
-import javax.faces.component.UISelectMany;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import java.io.IOException;
-import java.util.List;
import java.util.Arrays;
+import java.util.List;
public class SelectManyListboxRenderer extends SelectManyRendererBase {
@@ -74,39 +74,45 @@
return fixedHeight;
}
- public void encodeEnd(FacesContext facesContext,
- UIComponent uiComponent) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UISelectMany)) {
+ LOG.error("Wrong type: Need " + UISelectMany.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
- UISelectMany component = (UISelectMany) uiComponent;
+ UISelectMany selectMany = (UISelectMany) component;
- List<SelectItem> items = ComponentUtil.getSelectItems(component);
+ List<SelectItem> items = ComponentUtil.getSelectItems(selectMany);
if (LOG.isDebugEnabled()) {
LOG.debug("items.size() = '" + items.size() + "'");
}
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, component);
- writer.startElement(HtmlConstants.SELECT, component);
- String clientId = component.getClientId(facesContext);
+ String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectMany);
+ writer.startElement(HtmlConstants.SELECT, selectMany);
+ String clientId = selectMany.getClientId(facesContext);
writer.writeNameAttribute(clientId);
writer.writeIdAttribute(clientId);
- writer.writeAttribute(HtmlAttributes.DISABLED,
- ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED));
+ writer.writeAttribute(HtmlAttributes.DISABLED, ComponentUtil.getBooleanAttribute(selectMany, ATTR_DISABLED));
+ Integer tabIndex = selectMany.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeStyleAttribute();
writer.writeClassAttribute();
writer.writeAttribute(HtmlAttributes.MULTIPLE, HtmlAttributes.MULTIPLE, false);
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
- Object[] values = component.getSelectedValues();
+ Object[] values = selectMany.getSelectedValues();
if (LOG.isDebugEnabled()) {
LOG.debug("values = '" + Arrays.toString(values) + "'");
}
- HtmlRendererUtil.renderSelectItems(component, items, values, writer, facesContext);
+ HtmlRendererUtil.renderSelectItems(selectMany, items, values, writer, facesContext);
writer.endElement(HtmlConstants.SELECT);
- checkForCommandFacet(component, facesContext, writer);
+ checkForCommandFacet(selectMany, facesContext, writer);
}
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneChoiceRenderer.java Wed Aug 29 12:18:48 2007
@@ -27,6 +27,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UISelectOne;
import org.apache.myfaces.tobago.renderkit.HtmlUtils;
import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -35,7 +36,6 @@
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
-import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import java.io.IOException;
@@ -49,45 +49,53 @@
return true;
}
- public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UISelectOne)) {
+ LOG.error("Wrong type: Need " + UISelectOne.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- UISelectOne component = (UISelectOne) uiComponent;
- List<SelectItem> items = ComponentUtil.getSelectItems(component);
+ UISelectOne selectOne = (UISelectOne) component;
+ List<SelectItem> items = ComponentUtil.getSelectItems(selectOne);
if (LOG.isDebugEnabled()) {
LOG.debug("items.size() = '" + items.size() + "'");
}
- String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, component);
+ String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectOne);
boolean disabled = items.size() == 0
- || ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED)
- || ComponentUtil.getBooleanAttribute(component, ATTR_READONLY);
+ || ComponentUtil.getBooleanAttribute(selectOne, ATTR_DISABLED)
+ || ComponentUtil.getBooleanAttribute(selectOne, ATTR_READONLY);
- writer.startElement(HtmlConstants.SELECT, component);
- writer.writeNameAttribute(component.getClientId(facesContext));
- writer.writeIdAttribute(component.getClientId(facesContext));
+ writer.startElement(HtmlConstants.SELECT, selectOne);
+ writer.writeNameAttribute(selectOne.getClientId(facesContext));
+ writer.writeIdAttribute(selectOne.getClientId(facesContext));
writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
+ Integer tabIndex = selectOne.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeStyleAttribute();
writer.writeClassAttribute();
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
- String onchange = HtmlUtils.generateOnchange(component, facesContext);
+ String onchange = HtmlUtils.generateOnchange(selectOne, facesContext);
if (onchange != null) {
writer.writeAttribute(HtmlAttributes.ONCHANGE, onchange, true);
}
- Object[] values = {component.getValue()};
+ Object[] values = {selectOne.getValue()};
- HtmlRendererUtil.renderSelectItems(component, items, values, writer, facesContext);
+ HtmlRendererUtil.renderSelectItems(selectOne, items, values, writer, facesContext);
writer.endElement(HtmlConstants.SELECT);
- super.encodeEnd(facesContext, component);
- checkForCommandFacet(component, facesContext, writer);
+ super.encodeEnd(facesContext, selectOne);
+ checkForCommandFacet(selectOne, facesContext, writer);
}
public int getComponentExtraWidth(FacesContext facesContext, UIComponent component) {
return 0;
}
}
-
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneListboxRenderer.java Wed Aug 29 12:18:48 2007
@@ -29,6 +29,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_REQUIRED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UISelectOne;
import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -36,7 +37,6 @@
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
-import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import java.io.IOException;
@@ -71,34 +71,42 @@
return fixedHeight;
}
- public void encodeEnd(FacesContext facesContext, UIComponent input) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UISelectOne)) {
+ LOG.error("Wrong type: Need " + UISelectOne.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
+
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- UISelectOne component = (UISelectOne) input;
- List<SelectItem> items = ComponentUtil.getSelectItems(component);
+ UISelectOne selectOne = (UISelectOne) component;
+ List<SelectItem> items = ComponentUtil.getSelectItems(selectOne);
- writer.startElement(HtmlConstants.SELECT, component);
- String clientId = component.getClientId(facesContext);
+ writer.startElement(HtmlConstants.SELECT, selectOne);
+ String clientId = selectOne.getClientId(facesContext);
writer.writeNameAttribute(clientId);
writer.writeIdAttribute(clientId);
- writer.writeAttribute(HtmlAttributes.DISABLED,
- ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED));
+ writer.writeAttribute(HtmlAttributes.DISABLED, ComponentUtil.getBooleanAttribute(selectOne, ATTR_DISABLED));
+ Integer tabIndex = selectOne.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeStyleAttribute();
writer.writeClassAttribute();
writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
writer.writeAttribute(HtmlAttributes.SIZE, 2); // should be greater 1
- if (!ComponentUtil.getBooleanAttribute(component, ATTR_REQUIRED)) {
+ if (!ComponentUtil.getBooleanAttribute(selectOne, ATTR_REQUIRED)) {
writer.writeAttribute(HtmlAttributes.ONCHANGE, "Tobago.selectOneListboxChange(this)", false);
writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.selectOneListboxClick(this)", false);
}
- Object[] values = {component.getValue()};
+ Object[] values = {selectOne.getValue()};
- HtmlRendererUtil.renderSelectItems(component, items, values, writer, facesContext);
+ HtmlRendererUtil.renderSelectItems(selectOne, items, values, writer, facesContext);
writer.endElement(HtmlConstants.SELECT);
- super.encodeEnd(facesContext, component);
- checkForCommandFacet(component, facesContext, writer);
+ super.encodeEnd(facesContext, selectOne);
+ checkForCommandFacet(selectOne, facesContext, writer);
}
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=570902&r1=570901&r2=570902&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 Wed Aug 29 12:18:48 2007
@@ -28,6 +28,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_REQUIRED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TIP;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UISelectOne;
import org.apache.myfaces.tobago.renderkit.RenderUtil;
import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -39,7 +40,6 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectItems;
-import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import java.io.IOException;
@@ -50,17 +50,20 @@
private static final Log LOG = LogFactory.getLog(SelectOneRadioRenderer.class);
- public void encodeEnd(FacesContext facesContext,
- UIComponent uiComponent) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UISelectOne)) {
+ LOG.error("Wrong type: Need " + UISelectOne.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
- UISelectOne component = (UISelectOne) uiComponent;
- String clientId = component.getClientId(facesContext);
+ UISelectOne selectOne = (UISelectOne) component;
+ String clientId = selectOne.getClientId(facesContext);
- ComponentUtil.findPage(facesContext, component)
+ ComponentUtil.findPage(facesContext, selectOne)
.getOnloadScripts().add("Tobago.selectOneRadioInit('" + clientId + "')");
if (LOG.isDebugEnabled()) {
- for (Object o : component.getChildren()) {
+ for (Object o : selectOne.getChildren()) {
LOG.debug("ITEMS " + o);
if (o instanceof UISelectItems) {
UISelectItems uiitems = (UISelectItems) o;
@@ -73,14 +76,14 @@
}
}
- List<SelectItem> items = ComponentUtil.getItemsToRender(component);
+ List<SelectItem> items = ComponentUtil.getItemsToRender(selectOne);
- boolean inline = ComponentUtil.getBooleanAttribute(component, ATTR_INLINE);
- String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, component);
+ boolean inline = ComponentUtil.getBooleanAttribute(selectOne, ATTR_INLINE);
+ String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectOne);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
if (!inline) {
- writer.startElement(HtmlConstants.TABLE, component);
+ writer.startElement(HtmlConstants.TABLE, selectOne);
// TODO writer.writeComponentClass();
writer.writeAttribute(HtmlAttributes.BORDER, 0);
writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
@@ -92,7 +95,7 @@
}
}
- Object value = component.getValue();
+ Object value = selectOne.getValue();
List<String> clientIds = new ArrayList<String>();
for (SelectItem item : items) {
@@ -104,7 +107,7 @@
String id = clientId + NamingContainer.SEPARATOR_CHAR
+ NamingContainer.SEPARATOR_CHAR + item.getValue().toString();
clientIds.add(id);
- writer.startElement(HtmlConstants.INPUT, component);
+ writer.startElement(HtmlConstants.INPUT, selectOne);
writer.writeAttribute(HtmlAttributes.TYPE, "radio", false);
writer.writeClassAttribute();
if (item.getValue().equals(value)) {
@@ -113,11 +116,15 @@
writer.writeNameAttribute(clientId);
writer.writeIdAttribute(id);
- String formattedValue = RenderUtil.getFormattedValue(facesContext, component, item.getValue());
+ String formattedValue = RenderUtil.getFormattedValue(facesContext, selectOne, item.getValue());
writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
writer.writeAttribute(HtmlAttributes.DISABLED, item.isDisabled());
+ Integer tabIndex = selectOne.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);
- if (!ComponentUtil.getBooleanAttribute(component, ATTR_REQUIRED)) {
+ if (!ComponentUtil.getBooleanAttribute(selectOne, ATTR_REQUIRED)) {
writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.selectOneRadioClick(this, '" + clientId + "')", false);
}
writer.endElement(HtmlConstants.INPUT);
@@ -163,7 +170,7 @@
writer.endElement(HtmlConstants.TABLE);
}
- checkForCommandFacet(component, clientIds, facesContext, writer);
+ checkForCommandFacet(selectOne, clientIds, facesContext, writer);
}
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=570902&r1=570901&r2=570902&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 Wed Aug 29 12:18:48 2007
@@ -22,10 +22,13 @@
* $Id$
*/
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.component.UIInput;
import org.apache.myfaces.tobago.renderkit.HtmlUtils;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -34,15 +37,19 @@
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 class TextAreaRenderer extends InputRendererBase {
+ private static final Log LOG = LogFactory.getLog(TextAreaRenderer.class);
+
@Override
- public void encodeEnd(FacesContext facesContext,
- UIComponent component) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UIInput)) {
+ LOG.error("Wrong type: Need " + UIInput.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
UIInput input = (UIInput) component;
String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, component);
@@ -62,6 +69,10 @@
ComponentUtil.getBooleanAttribute(input, ATTR_READONLY));
writer.writeAttribute(HtmlAttributes.DISABLED,
ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED));
+ Integer tabIndex = input.getTabIndex();
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeStyleAttribute();
writer.writeClassAttribute();
if (onchange != null) {
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=570902&r1=570901&r2=570902&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 Wed Aug 29 12:18:48 2007
@@ -30,6 +30,7 @@
import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIPage;
+import org.apache.myfaces.tobago.component.UITimeInput;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
@@ -39,12 +40,12 @@
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
import java.io.IOException;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
@@ -57,14 +58,15 @@
"script/dateConverter.js"
};
- public void encodeEnd(FacesContext facesContext,
- UIComponent component) throws IOException {
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ if (!(component instanceof UITimeInput)) {
+ LOG.error("Wrong type: Need " + UITimeInput.class.getName() + ", but was " + component.getClass().getName());
+ return;
+ }
UIPage page = ComponentUtil.findPage(facesContext, component);
- for (String script : SCRIPTS) {
- page.getScriptFiles().add(script);
- }
- UIInput input = (UIInput) component;
+ page.getScriptFiles().addAll(Arrays.asList(SCRIPTS));
+ UITimeInput input = (UITimeInput) component;
// TODO title??
/*
@@ -130,12 +132,13 @@
writer.writeClassAttribute("tobago-time-borderDiv"
+ (hasSeconds ? " tobago-time-borderDiv-seconds" : ""));
- writeInput(writer, idPrefix + "hour", hour, true);
+ Integer tabIndex = input.getTabIndex();
+ writeInput(writer, idPrefix + "hour", tabIndex, hour, true);
writeInputSeparator(writer, ":");
- writeInput(writer, idPrefix + "minute", minute, false);
+ writeInput(writer, idPrefix + "minute", tabIndex, minute, false);
if (hasSeconds) {
writeInputSeparator(writer, ":");
- writeInput(writer, idPrefix + "second", second, false);
+ writeInput(writer, idPrefix + "second", tabIndex, second, false);
}
writer.endElement(HtmlConstants.DIV);
@@ -207,11 +210,14 @@
writer.endElement(HtmlConstants.SPAN);
}
- private void writeInput(TobagoResponseWriter writer, String id, String hour, boolean hourMode)
+ private void writeInput(TobagoResponseWriter writer, String id, Integer tabIndex, String hour, boolean hourMode)
throws IOException {
writer.startElement(HtmlConstants.INPUT, null);
writer.writeAttribute(HtmlAttributes.TYPE, "text", false);
writer.writeIdAttribute(id);
+ if (tabIndex != null) {
+ writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
+ }
writer.writeClassAttribute("tobago-time-input");
writer.writeAttribute(HtmlAttributes.ONFOCUS, "tbgTimerInputFocus(this, " + hourMode + ")", false);
writer.writeAttribute(HtmlAttributes.ONBLUR, "tbgTimerInputBlur(this)", false);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeOldNodeRenderer.java Wed Aug 29 12:18:48 2007
@@ -309,7 +309,7 @@
// open folder icon (not implemented)
writer.writeText("null", null);
- writer.writeText(", '", null);
+ writer.writeText(",'", null);
// width
Integer width = null;
@@ -322,8 +322,16 @@
} else {
writer.writeText("100%", null);
}
+ writer.writeText("',", null);
- writer.writeText("');\n", null);
+ // tabIndex
+ if (root.getTabIndex() != null) {
+ writer.writeText(root.getTabIndex(), null);
+ } else {
+ writer.writeText("null", null);
+ }
+
+ writer.writeText(");\n", null);
/*
if (jsParentClientId != null) { // if not the root node
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js?rev=570902&r1=570901&r2=570902&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tree.js Wed Aug 29 12:18:48 2007
@@ -305,7 +305,7 @@
hideRoot, treeHiddenId, selectable, mutable,
formId, selected, marked,
expanded, required, disabled, treeResources,
- action, onclick, parent, icon, openIcon, width) {
+ action, onclick, parent, icon, openIcon, width, tabIndex) {
this.label = label;
this.tip = tip;
this.id = id;
@@ -333,6 +333,8 @@
this.openIcon = openIcon
|| treeResources.getImage("openfoldericon.gif");
this.width = width;
+ this.tabIndex = tabIndex;
+
this.childNodes = [];
this.onfocus = "storeMarker(this.parentNode, '" + treeHiddenId + "')";
@@ -453,6 +455,9 @@
str += ' title="' + this.tip + '"';
}
if (!this.disabled) {
+ if (this.tabIndex != null) {
+ str += ' tabindex="' + this.tabIndex + "'";
+ }
str += ' href="' + Tobago.EMPTY_HREF + '"'
+ ' onclick="Tobago.TreeOld.onClick(this)"'
+ ' ondblclick="Tobago.TreeOld.onDblClick(this)"'