public class DataAreasModel extends java.lang.Object
AlignmentArea
.Constructor and Description |
---|
DataAreasModel(AlignmentArea owner)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(DataAreasModelListener listener)
Adds a lister to this object that will be informed about future insertions or deletions
of data areas.
|
protected void |
finishVisibilityUpdate(boolean eventsFromSingleList,
java.util.Collection<? extends DataArea> affectedElements)
Enables
#fireVisibilityChanged(DataAreaList, Collection) again and makes a call of
this method to inform the listeners about previous changes. |
protected void |
fireInsertedRemoved(ListChangeType type,
java.util.Collection<? extends DataArea> affectedElement)
Informs all listeners that a data area has been added or removed.
|
protected void |
fireInsertedRemoved(ListChangeType type,
DataArea affectedElements)
Informs all listeners that a data area has been added or removed.
|
protected void |
fireVisibilityChanged(boolean eventsFromSingleList,
java.util.Collection<? extends DataArea> affectedElements)
Informs all listeners that the visibility of a set of data areas has changed.
|
protected void |
fireVisibilityChanged(boolean eventsFromSingleList,
DataArea affectedElement)
Informs all listeners that the visibility of a data area has changed.
|
DataAreaList |
getBottomAreas()
Returns a list of data areas to be displayed underneath the alignment.
|
double |
getGlobalMaxLengthBeforeStart()
Returns maximum space left of the alignment calculated over all alignment areas in the parent
MultipleAlignmentsContainer of the alignment area using this model. |
double |
getLocalMaxLengthAfterEnd()
Returns maximum space right of the alignment end that is needed by any currently visible data area in
any list contained in this model.
|
double |
getLocalMaxLengthBeforeStart()
Returns maximum space left of the alignment start that is needed by any currently visible data area in
any list contained in this model.
|
AlignmentArea |
getOwner()
Returns the alignment content area that uses this instance.
|
DataAreaList |
getSequenceAreas(java.lang.String sequenceID)
Returns a list of data areas to be displayed underneath the specified sequence.
|
DataAreaSequenceChangeListener |
getSequenceDataChangeListener()
Returns the change listener that forwards events from the associated
AlignmentModel to
all data areas contained in this model. |
DataAreaList |
getTopAreas()
Returns a list of data areas to be displayed on the top of the alignment.
|
int |
getVisibleAreaHeight()
Calculates the sum of the heights of all visible data areas contained in this model (above,
underneath and attached to any sequence).
|
int |
getVisibleSequenceAreaHeight()
Calculates the sum of the heights of all visible data areas contained in this model, that are
attached to any sequence.
|
protected boolean |
isVisibilityUpdateInProgress()
Returns
true if informing listeners about visibility changes of data areas currently
disabled. |
boolean |
removeListener(DataAreasModelListener listener)
Removes the specified listener from this objects list.
|
void |
removeSequence(java.lang.String sequenceName)
Removes the list of data areas attached to the specified sequence from this model.
|
void |
setLocalMaxLengthBeforeAfterRecalculate()
Flags the properties
getLocalMaxLengthBeforeStart() and getLocalMaxLengthAfterEnd() to
be recalculated when they are accessed the next time. |
void |
setSequenceDataAreasVisible(boolean visible)
Fades all data areas associated with any sequence in or out.
|
protected void |
startVisibilityUpdate()
After calling this method
#fireVisibilityChanged(DataAreaList, Collection) will have no effect
until #finishVisibilityUpdate(DataAreaList, Collection) is called. |
public DataAreasModel(AlignmentArea owner)
owner
- the alignment content area that will be using this instancepublic AlignmentArea getOwner()
public DataAreaList getTopAreas()
public DataAreaList getBottomAreas()
public DataAreaList getSequenceAreas(java.lang.String sequenceID)
sequenceName
- the unique identifier of the sequence carrying the data areas
in the returned listpublic void removeSequence(java.lang.String sequenceName)
sequenceName
- the name of the sequence the data areas to be removed are attached topublic void setSequenceDataAreasVisible(boolean visible)
visible
- Specify true
here, if you want the elements to be displayed, false
otherwise.DataAreaList.setAllVisible(boolean)
public int getVisibleSequenceAreaHeight()
public int getVisibleAreaHeight()
public double getLocalMaxLengthBeforeStart()
getGlobalMaxLengthBeforeStart()
.public void setLocalMaxLengthBeforeAfterRecalculate()
getLocalMaxLengthBeforeStart()
and getLocalMaxLengthAfterEnd()
to
be recalculated when they are accessed the next time.
LibrAlign does not recalculate these values on every call for performance reasons. Usually application code will not have to call this method directly.
public double getGlobalMaxLengthBeforeStart()
MultipleAlignmentsContainer
of the alignment area using this model. If that alignment area
is not contained in such a container the return value is equivalent to getLocalMaxLengthBeforeStart()
.public double getLocalMaxLengthAfterEnd()
public boolean addListener(DataAreasModelListener listener)
listener
- the listener object to be notified in the futuretrue
(as specified by Collection.add(Object)
)public boolean removeListener(DataAreasModelListener listener)
listener
- the listener to be removedtrue
if this list contained the specified elementpublic DataAreaSequenceChangeListener getSequenceDataChangeListener()
AlignmentModel
to
all data areas contained in this model.protected void fireInsertedRemoved(ListChangeType type, java.util.Collection<? extends DataArea> affectedElement)
protected void fireInsertedRemoved(ListChangeType type, DataArea affectedElements)
protected void startVisibilityUpdate()
#fireVisibilityChanged(DataAreaList, Collection)
will have no effect
until #finishVisibilityUpdate(DataAreaList, Collection)
is called.
This method can be called before changing the visibility of many data areas in one step.
#finishVisibilityUpdate(DataAreaList, Collection)
can than be used to inform the listeners
about the changed with one single event.
protected boolean isVisibilityUpdateInProgress()
true
if informing listeners about visibility changes of data areas currently
disabled.true
if #fireVisibilityChanged(DataAreaList, Collection)
would currently have
no effect, false
otherwiseprotected void finishVisibilityUpdate(boolean eventsFromSingleList, java.util.Collection<? extends DataArea> affectedElements)
#fireVisibilityChanged(DataAreaList, Collection)
again and makes a call of
this method to inform the listeners about previous changes.e
- the event describing the changes since the previous call of
startVisibilityUpdate()
that will be send to all listenersprotected void fireVisibilityChanged(boolean eventsFromSingleList, java.util.Collection<? extends DataArea> affectedElements)
This method will have no effect if isVisibilityUpdateInProgress()
return true
.
eventsFromSingleList
- Specify true
here if all elements in affectedElements
are contained in the same DataAreaList
.affectedElements
- a list of elements that have been changedprotected void fireVisibilityChanged(boolean eventsFromSingleList, DataArea affectedElement)
#fireVisibilityChanged(DataAreaList, Collection)
internally.)
This method will have no effect if isVisibilityUpdateInProgress()
return true
.
eventsFromSingleList
- Specify true
here if all elements in affectedElements
are contained in the same DataAreaList
.affectedElements
- a list of elements that have been changed