Class TableColumnModelState
- All Implemented Interfaces:
SortListener
This class performs a bit of magic to accomplish its goals. Resultingly, some of the code herein may seem a bit odd or of poor quality. These rough spots are documented as best as possible.
The basic outline of how this class works:
This class loads and save table column state via requests made by clients like the GTable
or
the GTableColumnModel
. These requests are in response to direct users actions (like
showing a new column) or to table changes (like column resizing). There are few things that
make this code tricky. Namely, when a change notification comes from the subsystem and not
direct user intervention, we do not know if the change was motived by the user directly or
by programmatic table configuration. We would prefer to only save data when the user makes
changes, but we can not always know the source of the change. For example, column resizing
can happen due to user dragging or due to the table subsystem performing a column layout.
To facilitate this magic, we listen to all changes, attempting to: 1) ignore those that we know are not from the user, and 2) buffer the changes so that they are not excessive and so they happen in the correct order.
For 1, we ignore all changes until the table has been shown for the first time. For 2, we use SwingUpdate managers.
The complicated part is that we allow clients to add columns at any time. If they do so after the table has been made visible, then we cannot ignore the event like we do when the table has not yet been realized. In our world view, the uniqueness of a table is based upon it's class and its columns. Thus, when a column is added or removed, it becomes a different table and thus, saved settings must be applied.
-
Method Summary
-
Method Details
-
modelSorted
- Specified by:
modelSorted
in interfaceSortListener
-