Sunday, March 11, 2012

TTSGrid

Today, I worked on the TTSGrid.

They are generalized ListGrid, smart-gwt. This class is used to make building a grid easier and less nasty than having to implement all different kinds of ListGridField and ListGridRecord.

They take a TTSRecord<D>.
Param <D> is any object, so we can display an image or text,
when the grid has been made to expand as a drop down.

These TTSRecords have a map of Attributes to Values.

Attributes is a special class, with 2 strings.

the first string, is a special NO-WHITESPACE key needed for the ListGridRecord's
own internal workings. The second, is the "column name" for that Key.

TTSRecords add Attributes and map them to a value.

When it comes time to displaying the info, the underlying ListGridRecord()
is populated by

setAttribute(attributeName, TTSRecord.getAttributeValue(attributeName)).


TTSGrid has a getAsListRecord(), method
which returns a
ListGrid
with the fields and records already set.

For now, they are only expandable if we do some outside magic (requires making a new ListGrid and overriding stuff).

I might make a default getAsExpandableListRecord(),
which sets the detailField upon expansion to be the param D.

It seems only reasonable to have this feature...


No comments:

Post a Comment