net.xoetrope.html
Class XComboBox

java.lang.Object
  extended by net.xoetrope.html.XHtmlWidget
      extended by net.xoetrope.html.XComboBox
All Implemented Interfaces:
XListHolder

public class XComboBox
extends XHtmlWidget
implements XListHolder

A wrapper for the Swing JComboBox class

Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt


Field Summary
protected  netscape.javascript.JSObject obj
           
 
Fields inherited from class net.xoetrope.html.XHtmlWidget
currentProject, divElement, htmlDoc, imageElement, inputElement, labelElement, metaElement, olElement, selectElement, tableElement, textareaElement, ulElement
 
Constructor Summary
XComboBox()
          Create a new combo box
XComboBox(org.w3c.dom.html.HTMLSelectElement select)
          Create a new XCComboBox based on an existing HTML combobox element.
XComboBox(java.lang.String id, java.lang.String[] elements)
          Create a new combo box with an id and filled with elements.
 
Method Summary
 void addElement(java.lang.String element)
          Add an element at the end of the combo box
 void addItem(java.lang.String s)
          Add an item to the list
 void deleteElement(int index)
          Delete the current XComboBox.
 java.lang.String getBackgroundColor()
          Get the background color of the XComboBox.
 java.lang.String getFontColor()
          Get the font color of the XComboBox's elements.
 int getFontSize()
          Get the size of the XComboBox's text.
 org.w3c.dom.html.HTMLSelectElement getHTMLElement()
          Get the HTML element at which refers the XComboBox.
 int getItemCount()
          Get the number of items in the list
 int getSelectedIndex()
          Get the selected index
 java.lang.Object getSelectedObject()
          Get the selected object
 java.lang.Object[] getSelectedObjects()
          Get the selected objects
 int getSelectionMode()
          Get the list selection mode.
 int getSize()
          Get the size of the combo box, ie the number of elements
 void insertElement(java.lang.String element, int index)
          Insert an element at the specified index.
 void removeAll()
          Remove all items from the list
 void select(int i)
          Select an item in the list
 void select(java.lang.Object object)
          Select an item
 void setBackgroundColor(java.lang.String hexColor)
          Set the background color of the XComboBox.
 void setDefaultSelection()
          Set the list to its default selection state
 void setEnabled(boolean enabled)
          Set the XComboBox enabled or disabled.
 void setFontColor(java.lang.String hexColor)
          Set the font color of the XComboBox's elements.
 void setFontSize(int fontsize)
          Set the size of the XComboBox's text.
 void setSelectedObject(java.lang.Object object)
          Select an item in the list
 void setSelectedObjects(java.lang.Object[] values)
          Set the selected objects
 void setVisible(boolean visible)
          Set the XComboBox visible or invisible.
 
Methods inherited from class net.xoetrope.html.XHtmlWidget
addEvent, setObject, setObject, setObject, setObject, setObject, setObject, setObject, setObject, setObject, setObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obj

protected netscape.javascript.JSObject obj
Constructor Detail

XComboBox

public XComboBox()
Create a new combo box


XComboBox

public XComboBox(java.lang.String id,
                 java.lang.String[] elements)
Create a new combo box with an id and filled with elements.

Parameters:
id - the combo box id
elements - the elements contained in the combo box

XComboBox

public XComboBox(org.w3c.dom.html.HTMLSelectElement select)
Create a new XCComboBox based on an existing HTML combobox element.

Parameters:
select - the HTML select tag the XComboBox refers to
Method Detail

select

public void select(int i)
Select an item in the list

Specified by:
select in interface XListHolder
Parameters:
i - the selected item's index

setDefaultSelection

public void setDefaultSelection()
Set the list to its default selection state

Specified by:
setDefaultSelection in interface XListHolder

setSelectedObject

public void setSelectedObject(java.lang.Object object)
Select an item in the list

Specified by:
setSelectedObject in interface XListHolder
Parameters:
object - the item to select

getSelectedObject

public java.lang.Object getSelectedObject()
Get the selected object

Specified by:
getSelectedObject in interface XListHolder
Returns:
the selection

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Get the selected objects

Specified by:
getSelectedObjects in interface XListHolder
Returns:
the selected object

setSelectedObjects

public void setSelectedObjects(java.lang.Object[] values)
Set the selected objects

Specified by:
setSelectedObjects in interface XListHolder
Parameters:
values - the selected object

getSize

public int getSize()
Get the size of the combo box, ie the number of elements

Returns:
the number of elements

addElement

public void addElement(java.lang.String element)
Add an element at the end of the combo box

Parameters:
element - the element to be added to the list

insertElement

public void insertElement(java.lang.String element,
                          int index)
Insert an element at the specified index. If the index entered is greater than the length of the combo box itself, the item is added at the end of the list.

Parameters:
element - the element to insert in the list
index - the index where to insert the element (starting at 1)

deleteElement

public void deleteElement(int index)
Delete the current XComboBox.


getFontSize

public int getFontSize()
Get the size of the XComboBox's text.

Returns:
the int value of the font size

setFontSize

public void setFontSize(int fontsize)
Set the size of the XComboBox's text.

Parameters:
fontsize - the int value of the font size

getBackgroundColor

public java.lang.String getBackgroundColor()
Get the background color of the XComboBox.

Returns:
the hexadecimal value of the background color

setBackgroundColor

public void setBackgroundColor(java.lang.String hexColor)
Set the background color of the XComboBox.

Parameters:
hexColor - the hexadecimal value of the background color

getFontColor

public java.lang.String getFontColor()
Get the font color of the XComboBox's elements.

Returns:
the hexadecimal value of the font color

setFontColor

public void setFontColor(java.lang.String hexColor)
Set the font color of the XComboBox's elements.

Parameters:
hexColor - the hexadecimal value of the font color

setVisible

public void setVisible(boolean visible)
Set the XComboBox visible or invisible.

Parameters:
visible - true if visible, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Set the XComboBox enabled or disabled.

Parameters:
enabled - true if enabled, false otherwise

getHTMLElement

public org.w3c.dom.html.HTMLSelectElement getHTMLElement()
Get the HTML element at which refers the XComboBox.

Returns:
the HTML element.

getItemCount

public int getItemCount()
Get the number of items in the list

Specified by:
getItemCount in interface XListHolder
Returns:
the number of items

removeAll

public void removeAll()
Remove all items from the list

Specified by:
removeAll in interface XListHolder

addItem

public void addItem(java.lang.String s)
Add an item to the list

Specified by:
addItem in interface XListHolder
Parameters:
s - the new Item

select

public void select(java.lang.Object object)
Select an item

Specified by:
select in interface XListHolder
Parameters:
object - The object to select

getSelectedIndex

public int getSelectedIndex()
Get the selected index

Specified by:
getSelectedIndex in interface XListHolder
Returns:
the selected index

getSelectionMode

public int getSelectionMode()
Get the list selection mode. This method returns 0.

Specified by:
getSelectionMode in interface XListHolder
Returns:
  • 0=ListSelectionModel.SINGLE_SELECTION,
  • 1=ListSelectionModel.SINGLE_INTERVAL_SELECTION,
  • 2=ListSelectionModel.MULTIPLE_INTERVAL_SELECTION