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

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

There is a newer version: 0.0.6
Show 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;

/** Spec */
public interface HTMLOptionsCollection extends HTMLCollection, Iterable{

	/** Returns the item with index index from the collection.
	 * The items are sorted in tree order. */
	@Override HTMLOptionElement item(int index);
	
	/** Returns the number of elements in the collection. */
	@Override int getLength();
	
	/** Sets the number of elements in the collection. 
	 * When set to a smaller number, truncates the number of option elements 
	 * in the corresponding container. When set to a greater number, adds 
	 * new blank option elements to that container.*/
	void setLength(int length);
	
	/** Sets an option element. 
	 * 
	 * May increase the length and thereby create more option elements.
	 * 
	 * setter creator void (unsigned long index, HTMLOptionElement? option); 
	 * 
	 * @param option If null, deletes the option at index. */
	void set(int index, HTMLOptionElement option);
		
	/** Returns the item with ID or name name from the collection.
	 * If there are multiple matching items, then the first is returned.
	 * 
	 * Same as get(name). */
	@Override HTMLOptionElement namedItem(String name);

	/** Returns the item with ID or name name from the collection.
	 * If there are multiple matching items, then the first is returned.
	 * 
	 * Same as namedItem(name). */
	HTMLOptionElement get(String name);
	
	/** Inserts element at the end of the list.
	 * 
	 * This method will throw a HierarchyRequestError exception if element 
	 * is an ancestor of the element into which it is to be inserted.
	 * */
	void add(HTMLOptionElement option);

	/** Inserts element before the node given by before.
	 * 
	 * This method will throw a HierarchyRequestError exception if element 
	 * is an ancestor of the element into which it is to be inserted.
	 * */
	void add(HTMLOptionElement option, HTMLElement before);
	
	/** Inserts element before the node given by before.
	 * 
	 * The before argument can be a number, in which case element is inserted 
	 * before the item with that number.
	 * 
	 * If before is a number out of range, then element 
	 * will be added at the end of the list.
	 * 
	 * This method will throw a HierarchyRequestError exception if element 
	 * is an ancestor of the element into which it is to be inserted.
	 * */
	void add(HTMLOptionElement option, int before);

	/** Inserts element at the end of the list.
	 * 
	 * This method will throw a HierarchyRequestError exception if element 
	 * is an ancestor of the element into which it is to be inserted. */
	void add(HTMLOptGroupElement group);
	
	/** Inserts element before the node given by before.
	 * 
	 * If before is null, then element 
	 * will be added at the end of the list.
	 * 
	 * This method will throw a HierarchyRequestError exception if element 
	 * is an ancestor of the element into which it is to be inserted. */
	void add(HTMLOptGroupElement group, HTMLElement before);
	
	/** Inserts element before the node given by before.
	 * 
	 * The before argument can be a number, in which case element is inserted 
	 * before the item with that number.
	 * 
	 * If before is a number out of range, then element 
	 * will be added at the end of the list.
	 * 
	 * This method will throw a HierarchyRequestError exception if element 
	 * is an ancestor of the element into which it is to be inserted. */
	void add(HTMLOptGroupElement group, int before);
	
	/** Removes an option from the group.
	 * spec
	 * 
	 * @param index If there is no option with this index, does nothing.
	 * */
	void remove(int index);
	
	int getSelectedIndex();
	void setSelectedIndex(int index);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy