Skip to content

Commit

Permalink
Faces 1830 - HtmlInputFile#alt, autocomplete, maxlength, readonly, size
Browse files Browse the repository at this point in the history
  • Loading branch information
tandraschko committed Jan 21, 2025
1 parent 1484c6b commit ae7296e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 57 deletions.
36 changes: 8 additions & 28 deletions api/src/main/java/jakarta/faces/component/html/_HtmlInputFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
defaultEventName = "valueChange"
)
abstract class _HtmlInputFile extends UIInput implements _AccesskeyProperty,
_AltProperty, _UniversalProperties, _DisabledReadonlyProperties,
_UniversalProperties,
_FocusBlurProperties, _ChangeProperty, _SelectProperty,
_EventProperties, _StyleProperties, _TabindexProperty, _LabelProperty,
_RoleProperty
Expand All @@ -47,33 +47,6 @@ abstract class _HtmlInputFile extends UIInput implements _AccesskeyProperty,
static public final String COMPONENT_FAMILY = "jakarta.faces.Input";
static public final String COMPONENT_TYPE = "jakarta.faces.HtmlInputFile";

/**
* HTML: The maximum number of characters allowed to be entered.
*
* @JSFProperty
* defaultValue = "Integer.MIN_VALUE"
*/
public abstract int getMaxlength();

/**
* HTML: The initial width of this control, in characters.
*
* @JSFProperty
* defaultValue = "Integer.MIN_VALUE"
*/
public abstract int getSize();

/**
* If the value of this attribute is "off", render "off" as the value of the attribute.
* This indicates that the browser should disable its autocomplete feature for this component.
* This is useful for components that perform autocompletion and do not want the browser interfering.
* If this attribute is not set or the value is "on", render nothing.
*
* @return the new autocomplete value
*/
@JSFProperty
public abstract String getAutocomplete();

/**
* Comma separated string of mime types of files to filter in client side file browse dialog.
* NOTE: this is not validated in server side.
Expand All @@ -83,6 +56,13 @@ abstract class _HtmlInputFile extends UIInput implements _AccesskeyProperty,
@JSFProperty
public abstract String getAccept();

/**
* HTML: When true, this element cannot receive focus.
*
*/
@JSFProperty(defaultValue="false")
public abstract boolean isDisabled();

/**
* Flag indicating that this element must allow multiple file selection. A value
* of false causes no attribute to be rendered, while a value of true causes the attribute to be rendered as
Expand Down
34 changes: 5 additions & 29 deletions api/src/main/resources/META-INF/componentClass20.vm
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,7 @@ $innersource
#set ($deprecatedInFaces40 = '@Deprecated(since = "4.0", forRemoval = true)')

#foreach( $property in $propertyList )
#set ($htmlInputFileDeprecated = "false")
#set ($htmlInputSecretDeprecated = "false")
#if ($component.className.equals("jakarta.faces.component.html.HtmlInputFile") &&
($property.name == "alt" ||
$property.name == "autocomplete" ||
$property.name == "maxlength" ||
$property.name == "readonly" ||
$property.name == "size"))
#set ($htmlInputFileDeprecated = "true")
#elseif ($component.className.equals("jakarta.faces.component.html.HtmlInputSecret") &&
($property.name == "alt"))
#set ($htmlInputSecretDeprecated = "true")
#end
#set ($deprecated = "false")
#set ($field = $property.fieldName)
#set ($type = $utils.getClassFromFullClass($property.className))
#if($utils.getDefaultValueField($property))
Expand Down Expand Up @@ -284,7 +272,7 @@ $innersource
#set ($field = $property.name)
#end

#if ("true" == $htmlInputFileDeprecated || "true" == $htmlInputSecretDeprecated)
#if ("true" == $deprecated)
$deprecatedInFaces40
#end
public $type $utils.getMethodReaderFromProperty($property.name, $type)()
Expand All @@ -309,7 +297,7 @@ $innersource
#end
}

#if ("true" == $htmlInputFileDeprecated || "true" == $htmlInputSecretDeprecated)
#if ("true" == $deprecated)
$deprecatedInFaces40
#end
public void $utils.getPrefixedPropertyName("set", $property.name)($type $utils.getVariableFromName($property.name))
Expand Down Expand Up @@ -399,19 +387,7 @@ $innersource
#set ($comma = "")
#set ($addc = "false")
#foreach( $property in $propertyList )
#set ($htmlInputFileDeprecated = "false")
#set ($htmlInputSecretDeprecated = "false")
#if ($component.className.equals("jakarta.faces.component.html.HtmlInputFile") &&
($property.name == "alt" ||
$property.name == "autocomplete" ||
$property.name == "maxlength" ||
$property.name == "readonly" ||
$property.name == "size"))
#set ($htmlInputFileDeprecated = "true")
#elseif ($component.className.equals("jakarta.faces.component.html.HtmlInputSecret") &&
($property.name == "alt"))
#set ($htmlInputSecretDeprecated = "true")
#end
#set ($deprecated = "false")
#if ($property.name == "for")
#set ($addc = "true")
## To keep compatibility with RI, we should call it forVal
Expand All @@ -437,7 +413,7 @@ $innersource
#if ($property.isPartialStateHolder())
$comma ${field}Set
#else
#if ("true" == $htmlInputFileDeprecated || "true" == $htmlInputSecretDeprecated)
#if ("true" == $deprecated)
$comma $deprecatedInFaces40 $field
#else
$comma $field
Expand Down

0 comments on commit ae7296e

Please sign in to comment.