net.xoetrope.xui.data
Class XListModelAdapter

java.lang.Object
  extended by net.xoetrope.xui.data.XListModelAdapter
All Implemented Interfaces:
XModelAdapter

public class XListModelAdapter
extends java.lang.Object
implements XModelAdapter

Adapts an XModel to provide access to child nodes as a list in a way that is more convenient for use with UI components and so that some state information can be maintained.

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


Field Summary
protected  int columnIdx
           
protected  java.lang.String columnName
           
protected  XModel model
           
 
Constructor Summary
XListModelAdapter()
          Constructs a new adapter.
XListModelAdapter(XModel src)
          Constructs a new adapter for the specified model node.
 
Method Summary
 int find(java.lang.String key, int columnIdx)
          Locate a key value in the underlying data source
 java.lang.Object get(int i)
          Gets the individual list item value
 XModel getModel()
          Get the model being used by this adapter
 int getNumChildren()
          Get the number of children belong to the model node that this object adapts
 java.lang.Object getSelected()
          Gets the value of the selected item from the list.
 java.lang.String getTagName()
          Gets the name of the model node
 void set(java.lang.Object o)
          Set the value of the listitem
 void setKeyColumn(int colIdx)
          Set the index of the column to use when getting values from this adapter
 void setKeyColumn(java.lang.String colName)
          Set the name of the column to use when getting values from this adapter
 void setModel(XModel src)
          Set the adapter source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected XModel model

columnIdx

protected int columnIdx

columnName

protected java.lang.String columnName
Constructor Detail

XListModelAdapter

public XListModelAdapter(XModel src)
Constructs a new adapter for the specified model node.

Parameters:
src - The model for which this adapter is working

XListModelAdapter

public XListModelAdapter()
Constructs a new adapter.

Method Detail

setKeyColumn

public void setKeyColumn(int colIdx)
Set the index of the column to use when getting values from this adapter

Parameters:
colIdx - the (zero based) column index.

setKeyColumn

public void setKeyColumn(java.lang.String colName)
Set the name of the column to use when getting values from this adapter

Parameters:
colName - the column name.

getNumChildren

public int getNumChildren()
Get the number of children belong to the model node that this object adapts

Specified by:
getNumChildren in interface XModelAdapter
Returns:
the number of children

get

public java.lang.Object get(int i)
Gets the individual list item value

Specified by:
get in interface XModelAdapter
Parameters:
i - The index of the listitem
Returns:
The value of the listitem

set

public void set(java.lang.Object o)
Set the value of the listitem

Specified by:
set in interface XModelAdapter
Parameters:
o - The new value

getSelected

public java.lang.Object getSelected()
Gets the value of the selected item from the list.

Specified by:
getSelected in interface XModelAdapter
Returns:
the selected list item/node

setModel

public void setModel(XModel src)
Set the adapter source

Specified by:
setModel in interface XModelAdapter
Parameters:
src - the model

getModel

public XModel getModel()
Get the model being used by this adapter

Specified by:
getModel in interface XModelAdapter
Returns:
The model being used by this adapter

getTagName

public java.lang.String getTagName()
Gets the name of the model node

Returns:
the name

find

public int find(java.lang.String key,
                int columnIdx)
Locate a key value in the underlying data source

Parameters:
key - the key to locate
columnIdx - the index of the key column
Returns:
the row/record index taht contains the first instance of the key, or -1 if the key is not found