com.dhtmlx.connector
Class DataItem

java.lang.Object
  extended by com.dhtmlx.connector.DataItem
Direct Known Subclasses:
ComboDataItem, CommonDataItem, FormDataItem, GridDataItem, JSONCommonDataItem, SchedulerDataItem, SelectOptionsDataItem, TreeDataItem

public class DataItem
extends java.lang.Object

The Class DataItem. Wrapper around the fetched data. Controls how the data transforms into the xml string.


Constructor Summary
DataItem(java.util.HashMap<java.lang.String,java.lang.String> data, DataConfig config, int index)
          Instantiates a new data item.
 
Method Summary
 java.lang.String get_id()
          Gets the id of the record
 int get_index()
          Gets the index of the record
 java.lang.String get_value(java.lang.String name)
          Gets the value of the field
 int has_kids()
          Gets the count of child items
 void set_id(java.lang.String value)
          Sets the new id for the record
 void set_kids(int count)
          Sets the count of child items
 void set_userdata(java.lang.String name, java.lang.String value)
           
 void set_value(java.lang.String name, java.lang.String value)
          Sets value of the field
 void skip()
          Mark current record to be skipped ( not included in xml response )
 void to_json(JSONArray output)
          Convert data item to json representation
 void to_xml_end(java.lang.StringBuffer out)
          Ending part of xml representation.
 void to_xml_start(java.lang.StringBuffer out)
          Starting part of xml representation
 void to_xml(java.lang.StringBuffer out)
          Convert data item to xml representation
 java.lang.String xmlentities(java.lang.String str)
          replace xml unsafe characters
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataItem

public DataItem(java.util.HashMap<java.lang.String,java.lang.String> data,
                DataConfig config,
                int index)
Instantiates a new data item.

Parameters:
data - the hash of data
config - the config
index - the index of record
Method Detail

get_value

public java.lang.String get_value(java.lang.String name)
Gets the value of the field

Parameters:
name - the name of the field
Returns:
the value of the field

set_value

public void set_value(java.lang.String name,
                      java.lang.String value)
Sets value of the field

Parameters:
name - the name of the field
value - the value of the field

get_id

public java.lang.String get_id()
Gets the id of the record

Returns:
the id of the record

set_id

public void set_id(java.lang.String value)
Sets the new id for the record

Parameters:
value - the new id for the record

get_index

public int get_index()
Gets the index of the record

Returns:
the index of the record

has_kids

public int has_kids()
Gets the count of child items

Returns:
the count of child items

set_kids

public void set_kids(int count)
Sets the count of child items

Parameters:
count - the count of child items

skip

public void skip()
Mark current record to be skipped ( not included in xml response )


to_xml

public void to_xml(java.lang.StringBuffer out)
Convert data item to xml representation

Parameters:
out - the output buffer

to_xml_start

public void to_xml_start(java.lang.StringBuffer out)
Starting part of xml representation

Parameters:
out - the output buffer

to_xml_end

public void to_xml_end(java.lang.StringBuffer out)
Ending part of xml representation.

Parameters:
out - the output buffer

to_json

public void to_json(JSONArray output)
Convert data item to json representation

Parameters:
JSON - object

xmlentities

public java.lang.String xmlentities(java.lang.String str)
replace xml unsafe characters

Parameters:
string - string to be escaped
Returns:
escaped string

set_userdata

public void set_userdata(java.lang.String name,
                         java.lang.String value)