All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cat.inspiracio.html.HTMLSelectElement Maven / Gradle / Ivy

Go to download

HTML-parser provides a parser for HTML 5 that produces HTML 5 document object model. It aims to be a Java-implementation of http://www.w3.org/TR/html5/. It is for use in the server. It does not implement features that are relevant in the client, like event handling. It is for use from javascript, via Java's scripting library.

The newest version!
/*
Copyright 2015 Alexander Bunkenburg 

Licensed 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 cat.inspiracio.html;

import cat.inspiracio.dom.HTMLCollection;
import cat.inspiracio.dom.ScriptArray;

/**
 * Spec 
 * 
 * The select element should also act as array of option elements:
 * 
 * 		select[index] = option;
 * 		option = select[index]
 * 
 * This interface extends ScriptArray<HTMLOptionElement> in order to 
 * signal that it wants array notation to work. But whether and how
 * array notation works depends in the script engine that one uses,
 * and probably will use classes of the script engine that are not
 * public API. 
 * */
public interface HTMLSelectElement extends LabelableElement, ScriptArray, ResettableElement, ReassociateableElement{
	
	boolean getAutofocus();
	void setAutofocus(boolean auto);
	
	boolean getDisabled();
	void setDisabled(boolean b);
	
	boolean getMultiple();
	void setMultiple(boolean b);
	
	boolean getRequired();
	void setRequired(boolean b);

	int getSize();
	void setSize(int size);

	String getType();
	
	HTMLOptionsCollection getOptions();
	
	@Override int getLength();
	void setLength(int length);
	
	/** Returns the item with index index from the list of options. 
	 * The items are sorted in tree order. 
	 * The same as the getter select[index]. 
	 * @param index the index 
	 * @return the option element */
	HTMLOptionElement item(int index);
	
	HTMLOptionElement namedItem(String name);
	
	void add(HTMLOptionElement option);
	void add(HTMLOptionElement option, HTMLElement before);
	void add(HTMLOptionElement option, int before);
	void add(HTMLOptGroupElement group);
	void add(HTMLOptGroupElement group, HTMLElement before);
	void add(HTMLOptGroupElement group, int before);
	
	/** Removes the element from its parent. 
	 * Spec */
	void remove();
	
	/** Removes an option. 
	 * @param index the index */
	void remove(int index);
	
	/** Inserts an option element, either replacing an existing one or
	 * extending the list of options.
	 * 
	 * setter creator void (unsigned long index, HTMLOptionElement? option); 
	 * @param index the index 
	 * @param option the option */
	@Override void set(int index, HTMLOptionElement option);
	
	@Override boolean has(int index);
	@Override HTMLOptionElement get(int index);
	@Override void delete(int index);
	
	HTMLCollection getSelectedOptions();
	
	int getSelectedIndex();
	void setSelectedIndex(int index);

	String getValue();
	void setValue(String string);

	boolean getWillValidate();
	ValidityState getValidity();
	String getValidationMessage();
	boolean checkValidity();
	void setCustomValidity(String error);
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy