Package eu.bandm.tools.message
Class MessageStore_<M extends Message>
java.lang.Object
eu.bandm.tools.message.MessageStore_<M>
- All Implemented Interfaces:
MessageReceiver<M>
- Direct Known Subclasses:
MessageStore
,MessageStoreSorted
Common superclass for the two kinds of message storage,
All messages received are added to an internal sequential storage.
There are two kinds of graphic representations, both in the context of
This class can also be used for collecting, sorting and further processing: all messages currently stored can be propagated explicitly to some
MessageStore
and
MessageStoreSorted
.
All messages received are added to an internal sequential storage.
There are two kinds of graphic representations, both in the context of
javax.swing
, namely MessageStore_<M extends Message>.TableModel
and MessageStore_<M extends Message>.ListModel
.
The user can derive from these classes and provide its own instance by
setTableModel(TableModel)
and setListModel(ListModel)
. If not,
a standard implementation will be provided by
getTableModel()
and getListModel()
.
A standard GUI implementation using the table model is SwingMessageTable
.
This class can also be used for collecting, sorting and further processing: all messages currently stored can be propagated explicitly to some
MessageReceiver
by calling
drainTo(MessageReceiver)
.-
Nested Class Summary
Modifier and TypeClassDescriptionclass
standard specialisation ofAbstractListModel
.class
standard specialisation ofAbstractTableModel
. -
Field Summary
Modifier and TypeFieldDescriptionLocal store of the indentation levels.protected MessageStore_<M>.ListModel
The Swing list model, either user defined or default.All stored messages.protected MessageStore_<M>.TableModel
The Swing table model, either user defined or default. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the internal storage, thus deletes all messages, and notifies GUIs.void
drainAndClear
(MessageReceiver<? super M> receiver) send all currently contained messages to the receiver and clear the storage.void
drainTo
(MessageReceiver<? super M> receiver) Send all currently contained messages (in their stored order) to the receiver.returns the user-defined list model or substitutes the default, cfMessageStore_<M extends Message>.ListModel
.Returns an unmodifiable façade to the current content.int
getSize()
returns the number of currently contained messages.returns the user-defined table model or substitutes the default,MessageStore_<M extends Message>.TableModel
.protected void
notifyGuiAdd
(int i) An item has been inserted at position "i".protected void
Called in case of sort order change byMessageStoreSorted.setOrder(Comparator)
andclear()
.abstract void
Adds the received message to the internal store and notifies all subscribing GUI objects.void
only needed for inserting user-defined list model, cfMessageStore_<M extends Message>.ListModel
.void
only needed for inserting user-defined table model, cfMessageStore_<M extends Message>.TableModel
.
-
Field Details
-
messages
All stored messages. Either ordered by applyingMessageStoreSorted.order
or by arrival. The second item in the stored pair is the nesting level, which can be represented by GUIs. -
tableModel
The Swing table model, either user defined or default. -
listModel
The Swing list model, either user defined or default. -
indents
Local store of the indentation levels. Runs in parallel with the list of messages. Is set to null if no indentation shall be applied, and read byMessageStore_<M extends Message>.TableModel
.
-
-
Constructor Details
-
MessageStore_
-
-
Method Details
-
drainTo
Send all currently contained messages (in their stored order) to the receiver. The contents of the store is not altered.
This method is synchronized, so that a further sending to this store cannot interfer. -
drainAndClear
send all currently contained messages to the receiver and clear the storage.
This method is synchronized, so that a further sending to this store cannot interfer. -
getMessages
Returns an unmodifiable façade to the current content.
This is a "live image", i.e. will reflect also all future changes. -
getSize
public int getSize()returns the number of currently contained messages. -
setTableModel
only needed for inserting user-defined table model, cfMessageStore_<M extends Message>.TableModel
. -
setListModel
only needed for inserting user-defined list model, cfMessageStore_<M extends Message>.ListModel
. -
getTableModel
returns the user-defined table model or substitutes the default,MessageStore_<M extends Message>.TableModel
. -
getListModel
returns the user-defined list model or substitutes the default, cfMessageStore_<M extends Message>.ListModel
. -
clear
public void clear()Clears the internal storage, thus deletes all messages, and notifies GUIs. -
notifyGuiAdd
protected void notifyGuiAdd(int i) An item has been inserted at position "i". -
notifyGuiChanged_ALL
protected void notifyGuiChanged_ALL()Called in case of sort order change byMessageStoreSorted.setOrder(Comparator)
andclear()
. -
receive
Adds the received message to the internal store and notifies all subscribing GUI objects.- Specified by:
receive
in interfaceMessageReceiver<M extends Message>
-