Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * 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.wicket.markup.html.form;
 
A simple text field.

Parameters:
<T> The model object type
Author(s):
Jonathan Locke
 
 public class TextField<T> extends AbstractTextComponent<T>
 {
 	private static final long serialVersionUID = 1L;

See also:
org.apache.wicket.Component.org.apache.wicket.Component.(java.lang.String)
 
 	public TextField(final String id)
 	{
 		super(id);
 	}

Parameters:
id See Component
type Type for field validation
 
 	public TextField(final String idfinal Class<T> type)
 	{
 		super(id);
 		setType(type);
 	}

Parameters:
id
model
See also:
org.apache.wicket.Component.org.apache.wicket.Component.(java.lang.String,org.apache.wicket.model.IModel)
 
 	public TextField(final String idfinal IModel<T> model)
 	{
 		super(idmodel);
 	}

Parameters:
id See Component
model See Component
type The type to use when updating the model for this text field
See also:
org.apache.wicket.Component.org.apache.wicket.Component.(java.lang.String,org.apache.wicket.model.IModel)
 
 	public TextField(final String idIModel<T> modelClass<T> type)
 	{
 		super(idmodel);
 		setType(type);
 	}

Processes the component tag.

 
 	protected void onComponentTag(final ComponentTag tag)
 	{
 		// Must be attached to an input tag
 		checkComponentTag(tag"input");
 
 		// check for text type
 		String inputType = getInputType();
 		if (inputType != null)
 		{
 			checkComponentTagAttribute(tag"type"inputType);
 		}
 		else
 		{
			if (tag.getAttributes().containsKey("type"))
			{
				checkComponentTagAttribute(tag"type""text");
			}
		}
		tag.put("value"getValue());
		// Default handling for component tag
		super.onComponentTag(tag);
	}

Subclass should override this method if this textfield is mapped on a different input type as text. Like PasswordField or HiddenField.

Returns:
The input type of this textfield, default is null
	protected String getInputType()
	{
		return null;
	}
New to GrepCode? Check out our FAQ X