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 2013/08/13 11:30:16 UTC
svn commit: r1513403 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/...
Author: lofwyr
Date: Tue Aug 13 09:30:16 2013
New Revision: 1513403
URL: http://svn.apache.org/r1513403
Log:
TOBAGO-1283: New attribute "placeholder" for input fields
Added:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITextarea.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasPlaceholder.java
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITime.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DateTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/InTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TextareaTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/InExtensionTag.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIInput.java Tue Aug 13 09:30:16 2013
@@ -43,4 +43,6 @@ public abstract class AbstractUIInput ex
public abstract boolean isReadonly();
+ public abstract String getPlaceholder();
+
}
Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITextarea.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITextarea.java?rev=1513403&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITextarea.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITextarea.java Tue Aug 13 09:30:16 2013
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.internal.component;
+
+public abstract class AbstractUITextarea extends AbstractUIInput {
+
+ @Override
+ public String getPlaceholder() {
+ return null;
+ }
+}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITime.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITime.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITime.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITime.java Tue Aug 13 09:30:16 2013
@@ -42,4 +42,9 @@ public abstract class AbstractUITime ext
}
return converter;
}
+
+ @Override
+ public String getPlaceholder() {
+ return null;
+ }
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DateTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DateTagDeclaration.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DateTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/DateTagDeclaration.java Tue Aug 13 09:30:16 2013
@@ -29,6 +29,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasPlaceholder;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
import org.apache.myfaces.tobago.internal.taglib.declaration.InputTagDeclaration;
import org.apache.myfaces.tobago.internal.taglib.declaration.IsDeprecatedInline;
@@ -57,6 +58,6 @@ import javax.faces.component.UIInput;
public interface DateTagDeclaration
extends InputTagDeclaration, HasIdBindingAndRendered, IsReadonly,
IsDisabled, HasConverter, IsDeprecatedInline, HasLabelAndAccessKey,
- HasTip, IsRequired, HasMarkup, HasCurrentMarkup {
+ HasTip, IsRequired, HasMarkup, HasCurrentMarkup, HasPlaceholder {
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/InTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/InTagDeclaration.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/InTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/InTagDeclaration.java Tue Aug 13 09:30:16 2013
@@ -31,6 +31,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasInputLabel;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasPlaceholder;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasSuggestMethod;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
import org.apache.myfaces.tobago.internal.taglib.declaration.InputTagDeclaration;
@@ -64,6 +65,6 @@ import javax.faces.component.UIInput;
public interface InTagDeclaration
extends HasIdBindingAndRendered, HasConverter, IsReadonly, IsDisabled, IsRequired, HasTip, IsPassword,
HasSuggestMethod, HasMarkup, HasCurrentMarkup, InputTagDeclaration, HasInputLabel, IsDeprecatedInline,
- HasAutocomplete {
+ HasAutocomplete, HasPlaceholder {
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TextareaTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TextareaTagDeclaration.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TextareaTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TextareaTagDeclaration.java Tue Aug 13 09:30:16 2013
@@ -43,7 +43,7 @@ import javax.faces.component.UIInput;
@Tag(name = "textarea")
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UITextarea",
- uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUIInput",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUITextarea",
uiComponentFacesClass = "javax.faces.component.UIInput",
componentFamily = UIInput.COMPONENT_FAMILY,
rendererType = RendererTypes.TEXTAREA,
Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasPlaceholder.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasPlaceholder.java?rev=1513403&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasPlaceholder.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasPlaceholder.java Tue Aug 13 09:30:16 2013
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.internal.taglib.declaration;
+
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
+
+public interface HasPlaceholder {
+
+ /**
+ * Displays a short text in the input field, that describes the meaning of this field.
+ * This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
+ * <p/>
+ * The text will not be displayed, when the input field is readonly or disabled.
+ * @param placeholder The text to display
+ */
+ @TagAttribute
+ @UIComponentTagAttribute
+ void setPlaceholder(String placeholder);
+}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java Tue Aug 13 09:30:16 2013
@@ -28,6 +28,8 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.taglib.DateTag;
import org.apache.myfaces.tobago.internal.taglib.FormTag;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
import javax.servlet.jsp.JspException;
/**
@@ -53,32 +55,33 @@ import javax.servlet.jsp.JspException;
faceletHandler = "org.apache.myfaces.tobago.facelets.extension.DateExtensionHandler")
public class DateExtensionTag extends TobagoExtensionBodyTagSupport {
- private static final long serialVersionUID = 2044784791513107420L;
+ private static final long serialVersionUID = 1L;
- private javax.el.ValueExpression binding;
- private javax.el.ValueExpression converter;
- private javax.el.MethodExpression validator;
- private javax.el.ValueExpression disabled;
- private javax.el.ValueExpression focus;
- private javax.el.ValueExpression label;
- private javax.el.ValueExpression readonly;
- private javax.el.ValueExpression rendered;
- private javax.el.ValueExpression required;
- private javax.el.ValueExpression tip;
- private javax.el.ValueExpression value;
- private javax.el.MethodExpression valueChangeListener;
- private javax.el.ValueExpression inline;
- private javax.el.ValueExpression onchange;
- private javax.el.ValueExpression tabIndex;
- private javax.el.ValueExpression markup;
- private javax.el.ValueExpression validatorMessage;
- private javax.el.ValueExpression converterMessage;
- private javax.el.ValueExpression requiredMessage;
+ private ValueExpression binding;
+ private ValueExpression converter;
+ private MethodExpression validator;
+ private ValueExpression disabled;
+ private ValueExpression focus;
+ private ValueExpression label;
+ private ValueExpression readonly;
+ private ValueExpression rendered;
+ private ValueExpression required;
+ private ValueExpression tip;
+ private ValueExpression placeholder;
+ private ValueExpression value;
+ private MethodExpression valueChangeListener;
+ private ValueExpression inline;
+ private ValueExpression onchange;
+ private ValueExpression tabIndex;
+ private ValueExpression markup;
+ private ValueExpression validatorMessage;
+ private ValueExpression converterMessage;
+ private ValueExpression requiredMessage;
private String fieldId;
private String pickerId;
private String formId;
- private javax.el.ValueExpression labelWidth;
+ private ValueExpression labelWidth;
private LabelExtensionTag labelTag;
private DateTag dateTag;
@@ -119,6 +122,9 @@ public class DateExtensionTag extends To
if (valueChangeListener != null) {
dateTag.setValueChangeListener(valueChangeListener);
}
+ if (placeholder != null) {
+ dateTag.setPlaceholder(placeholder);
+ }
if (binding != null) {
dateTag.setBinding(binding);
}
@@ -224,6 +230,7 @@ public class DateExtensionTag extends To
rendered = null;
required = null;
tip = null;
+ placeholder = null;
value = null;
valueChangeListener = null;
onchange = null;
@@ -244,7 +251,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute(type = "java.lang.Object")
- public void setValue(javax.el.ValueExpression value) {
+ public void setValue(ValueExpression value) {
this.value = value;
}
@@ -253,15 +260,13 @@ public class DateExtensionTag extends To
* that will be notified when a new value has been set for this input component.
* The expression must evaluate to a public method that takes a ValueChangeEvent
* parameter, with a return type of void.
- *
- * @param valueChangeListener
*/
@TagAttribute
@UIComponentTagAttribute(
type = {},
expression = DynamicExpression.METHOD_EXPRESSION_REQUIRED,
methodSignature = "javax.faces.event.ValueChangeEvent")
- public void setValueChangeListener(javax.el.MethodExpression valueChangeListener) {
+ public void setValueChangeListener(MethodExpression valueChangeListener) {
this.valueChangeListener = valueChangeListener;
}
@@ -271,16 +276,16 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute()
- public void setLabel(javax.el.ValueExpression label) {
+ public void setLabel(ValueExpression label) {
this.label = label;
}
/**
- * Clientside script function to add to this component's onchange handler.
+ * Client side script function to add to this component's onchange handler.
*/
@TagAttribute
@UIComponentTagAttribute()
- public void setOnchange(javax.el.ValueExpression onchange) {
+ public void setOnchange(ValueExpression onchange) {
this.onchange = onchange;
}
@@ -289,7 +294,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute(type = "boolean", defaultValue = "false")
- public void setFocus(javax.el.ValueExpression focus) {
+ public void setFocus(ValueExpression focus) {
this.focus = focus;
}
@@ -299,7 +304,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute(type = "javax.faces.component.UIComponent")
- public void setBinding(javax.el.ValueExpression binding) {
+ public void setBinding(ValueExpression binding) {
this.binding = binding;
}
@@ -309,7 +314,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute(type = "boolean", defaultValue = "true")
- public void setRendered(javax.el.ValueExpression rendered) {
+ public void setRendered(ValueExpression rendered) {
this.rendered = rendered;
}
@@ -325,7 +330,7 @@ public class DateExtensionTag extends To
@TagAttribute
@UIComponentTagAttribute(type = "javax.faces.convert.Converter",
expression = DynamicExpression.VALUE_EXPRESSION)
- public void setConverter(javax.el.ValueExpression converter) {
+ public void setConverter(ValueExpression converter) {
this.converter = converter;
}
@@ -339,7 +344,7 @@ public class DateExtensionTag extends To
@UIComponentTagAttribute(type = {},
expression = DynamicExpression.METHOD_EXPRESSION,
methodSignature = { "javax.faces.context.FacesContext", "javax.faces.component.UIComponent", "java.lang.Object" })
- public void setValidator(javax.el.MethodExpression validator) {
+ public void setValidator(MethodExpression validator) {
this.validator = validator;
}
@@ -350,7 +355,7 @@ public class DateExtensionTag extends To
@TagAttribute
@UIComponentTagAttribute(type = "boolean", defaultValue = "false")
@Deprecated
- public void setInline(javax.el.ValueExpression inline) {
+ public void setInline(ValueExpression inline) {
this.inline = inline;
}
@@ -359,7 +364,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute(type = "boolean", defaultValue = "false")
- public void setReadonly(javax.el.ValueExpression readonly) {
+ public void setReadonly(ValueExpression readonly) {
this.readonly = readonly;
}
@@ -368,7 +373,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute()
@UIComponentTagAttribute(type = "boolean", defaultValue = "false")
- public void setDisabled(javax.el.ValueExpression disabled) {
+ public void setDisabled(ValueExpression disabled) {
this.disabled = disabled;
}
@@ -379,7 +384,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute(type = "boolean", defaultValue = "false")
- public void setRequired(javax.el.ValueExpression required) {
+ public void setRequired(ValueExpression required) {
this.required = required;
}
@@ -388,10 +393,20 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute()
- public void setTip(javax.el.ValueExpression tip) {
+ public void setTip(ValueExpression tip) {
this.tip = tip;
}
+ /**
+ * Displays a short text in the input field, that describes the meaning of this field.
+ * This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute()
+ public void setPlaceholder(ValueExpression placeholder) {
+ this.placeholder = placeholder;
+ }
+
/**
* The width for the label component. Default: 'auto'.
* This value is used in the gridLayouts columns attribute.
@@ -399,7 +414,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute()
- public void setLabelWidth(javax.el.ValueExpression labelWidth) {
+ public void setLabelWidth(ValueExpression labelWidth) {
this.labelWidth = labelWidth;
}
@@ -409,13 +424,13 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute(type = "java.lang.String[]", defaultValue = "none")
- public void setMarkup(javax.el.ValueExpression markup) {
+ public void setMarkup(ValueExpression markup) {
this.markup = markup;
}
@TagAttribute
@UIComponentTagAttribute(type = "java.lang.Integer")
- public void setTabIndex(javax.el.ValueExpression tabIndex) {
+ public void setTabIndex(ValueExpression tabIndex) {
this.tabIndex = tabIndex;
}
@@ -424,7 +439,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute()
- public void setValidatorMessage(javax.el.ValueExpression validatorMessage) {
+ public void setValidatorMessage(ValueExpression validatorMessage) {
this.validatorMessage = validatorMessage;
}
@@ -433,7 +448,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute()
- public void setConverterMessage(javax.el.ValueExpression converterMessage) {
+ public void setConverterMessage(ValueExpression converterMessage) {
this.converterMessage = converterMessage;
}
@@ -442,7 +457,7 @@ public class DateExtensionTag extends To
*/
@TagAttribute
@UIComponentTagAttribute()
- public void setRequiredMessage(javax.el.ValueExpression requiredMessage) {
+ public void setRequiredMessage(ValueExpression requiredMessage) {
this.requiredMessage = requiredMessage;
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/InExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/InExtensionTag.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/InExtensionTag.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/extension/InExtensionTag.java Tue Aug 13 09:30:16 2013
@@ -67,6 +67,7 @@ public class InExtensionTag extends Toba
private ValueExpression rendered;
private ValueExpression required;
private ValueExpression tip;
+ private ValueExpression placeholder;
private ValueExpression value;
private MethodExpression valueChangeListener;
private ValueExpression onchange;
@@ -122,6 +123,9 @@ public class InExtensionTag extends Toba
if (label != null) {
inTag.setLabel(label);
}
+ if (placeholder != null) {
+ inTag.setPlaceholder(placeholder);
+ }
if (binding != null) {
inTag.setBinding(binding);
}
@@ -207,6 +211,7 @@ public class InExtensionTag extends Toba
rendered = null;
required = null;
tip = null;
+ placeholder = null;
value = null;
valueChangeListener = null;
onchange = null;
@@ -423,6 +428,16 @@ public class InExtensionTag extends Toba
}
/**
+ * Displays a short text in the input field, that describes the meaning of this field.
+ * This is part of HTML 5, the theme should emulate the behaviour, when the browser doesn't support it.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute()
+ public void setPlaceholder(ValueExpression placeholder) {
+ this.placeholder = placeholder;
+ }
+
+ /**
* The width for the label component. Default: 'auto'.
* This value is used in the gridLayouts columns attribute.
* See gridLayout tag for valid values.
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Tue Aug 13 09:30:16 2013
@@ -88,6 +88,7 @@ public final class HtmlAttributes {
@Deprecated
public static final String ONMOUSEOUT = "onmouseout";
public static final String PATTERN = "pattern";
+ public static final String PLACEHOLDER = "placeholder";
public static final String READONLY = "readonly";
public static final String REL = "rel";
public static final String REQUIRED = "required";
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Tue Aug 13 09:30:16 2013
@@ -82,6 +82,8 @@ public class OverviewController implemen
private String suggestInput;
+ private String placeholder;
+
private String basicArea = "";
private Date basicDate = new Date();
@@ -355,6 +357,14 @@ public class OverviewController implemen
this.suggestInput = suggestInput;
}
+ public String getPlaceholder() {
+ return placeholder;
+ }
+
+ public void setPlaceholder(String placeholder) {
+ this.placeholder = placeholder;
+ }
+
public String getBasicArea() {
return basicArea;
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml Tue Aug 13 09:30:16 2013
@@ -58,6 +58,8 @@
</tx:date>
<tx:time label="#{overviewBundle.basic_timeLabel}" tabIndex="5"
value="#{overviewController.basicTime}"/>
+ <tx:in value="#{overviewController.placeholder}" tabIndex="6"
+ label="Placeholder" placeholder="Search..."/>
</tc:panel>
<tx:textarea value="#{overviewController.basicArea}" tabIndex="2"
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml Tue Aug 13 09:30:16 2013
@@ -105,7 +105,7 @@
<tc:gridLayout rows="auto;*;auto"/>
</f:facet>
- <tx:in label="Field" required="true"/>
+ <tx:in label="Field" required="true" placeholder="Search"/>
<tc:panel/>
<tc:panel>
<f:facet name="layout">
Modified: myfaces/tobago/trunk/tobago-theme/tobago-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/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/InRenderer.java Tue Aug 13 09:30:16 2013
@@ -69,9 +69,12 @@ public class InRenderer extends InputRen
+ "'");
}
final String type = password ? HtmlInputTypes.PASSWORD : HtmlInputTypes.TEXT;
-
final String id = input.getClientId(facesContext);
+ final boolean readonly = input.isReadonly();
+ final boolean disabled = input.isDisabled();
+
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+
writer.startElement(HtmlElements.INPUT, input);
writer.writeAttribute(HtmlAttributes.TYPE, type, false);
writer.writeNameAttribute(id);
@@ -101,8 +104,8 @@ public class InRenderer extends InputRen
if (pattern != null) {
writer.writeAttribute(HtmlAttributes.PATTERN, pattern, false);
}
- writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
- writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
+ writer.writeAttribute(HtmlAttributes.READONLY, readonly);
+ writer.writeAttribute(HtmlAttributes.DISABLED, disabled);
Integer tabIndex = input.getTabIndex();
if (tabIndex != null) {
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
@@ -110,6 +113,11 @@ public class InRenderer extends InputRen
Style style = new Style(facesContext, input);
writer.writeStyleAttribute(style);
+ final String placeholder = input.getPlaceholder();
+ if (!disabled && !readonly && StringUtils.isNotBlank(placeholder)) {
+ writer.writeAttribute(HtmlAttributes.PLACEHOLDER, placeholder, true);
+ }
+
if (input instanceof AbstractUIIn && ((AbstractUIIn) input).getSuggest() != null) {
writer.writeAttribute(HtmlAttributes.AUTOCOMPLETE, "off", false);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1513403&r1=1513402&r2=1513403&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Tue Aug 13 09:30:16 2013
@@ -377,6 +377,13 @@ div.tobago-gridLayout-first-column {
border: 2px solid #ff0000;
}
+.tobago-in-placeholder {
+ position: absolute;
+ padding: 3px 4px;
+ color: #aaaaaa;
+ cursor: text;
+}
+
.tobago-in-suggestPopup {
position: absolute;
overflow: hidden;