|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.DockHierarchyLock
public class DockHierarchyLock
The DockHierarchyLock
allows DockStation
s to defend
themselfs against concurrent modifications of the hierarchy. At any time only
one DockStation
or a class working with DockStation
s in the realm
of a DockController
can acquire the lock.
Nested Class Summary | |
---|---|
static class |
DockHierarchyLock.Token
Is acquired from a DockHierarchyLock and releases the lock. |
Constructor Summary | |
---|---|
DockHierarchyLock()
|
Method Summary | |
---|---|
DockHierarchyLock.Token |
acquire(DockStation station)
Acquires a lock describing the entire contents of station . |
static DockHierarchyLock.Token |
acquireFake()
Acquires a fake token which does not lock anything. |
DockHierarchyLock.Token |
acquireLink(DockStation station,
Dockable dockable)
Allows station to become the new parent of dockable . |
static DockHierarchyLock.Token |
acquireLinking(DockStation station,
Dockable dockable)
The same as calling acquireLink(DockStation, Dockable) with the DockHierarchyLock of
the DockController of station . |
DockHierarchyLock.Token |
acquireUnlink(DockStation station,
Dockable dockable)
Allows station to remove itself as parent from dockable . |
static DockHierarchyLock.Token |
acquireUnlinking(DockStation station,
Dockable dockable)
The same as calling acquireUnlink(DockStation, Dockable) with the DockHierarchyLock of
the DockController of station . |
static DockHierarchyLock.Token |
acquiring(DockStation station)
The same as calling acquire(DockStation) with the DockHierarchyLock of
the DockController of station . |
boolean |
isConcurrent()
Whether this lock throws exceptions or is silent. |
boolean |
isHardExceptions()
Tells whether hard exceptions should be thrown or only printed. |
void |
onRelease(Runnable run)
Executes run once no DockHierarchyLock.Token is acquired anymore. |
void |
setConcurrent(boolean concurrent)
Tells this lock whether concurrent modifications are allowed or not. |
void |
setHardExceptions(boolean hardExceptions)
Sets whether exceptions should be thrown or only printed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DockHierarchyLock()
Method Detail |
---|
public void setHardExceptions(boolean hardExceptions)
hardExceptions
- true
if the exceptions should be thrownpublic boolean isHardExceptions()
true
if exceptions should be thrownsetHardExceptions(boolean)
public void setConcurrent(boolean concurrent)
concurrent
- whether to allow concurrent modification or notpublic boolean isConcurrent()
true
, then this lock is silentisConcurrent()
public void onRelease(Runnable run)
run
once no DockHierarchyLock.Token
is acquired anymore. The exact order of how and when
the Runnable
s are executed is:
isConcurrent()
returns true
will be ignored.Runnable
s, run
will be added to the end of that queue. The queue
will be executed from the beginning to the end, this order cannot be changed.run
will never be executed directly.DockHierarchyLock.Token
is acquired, then run
is executed immediatelly.run
is always executed in the EDT, other Thread
s may be blocked until run
is completed
run
- the Runnable
to executed, not null
IllegalArgumentException
- if run
is null
IllegalStateException
- if an InterruptedException
is caoughtpublic static DockHierarchyLock.Token acquireLinking(DockStation station, Dockable dockable)
acquireLink(DockStation, Dockable)
with the DockHierarchyLock
of
the DockController
of station
. Returns a fake DockHierarchyLock.Token
if station
has
no DockController
.
station
- the station which wants to be the new parent of dockable
dockable
- a dockable with no parent
IllegalStateException
- if dockable
has a parent or station
thinks that dockable
is one of its childrenpublic static DockHierarchyLock.Token acquireUnlinking(DockStation station, Dockable dockable)
acquireUnlink(DockStation, Dockable)
with the DockHierarchyLock
of
the DockController
of station
. Returns a fake DockHierarchyLock.Token
if station
has
no DockController
.
station
- the current parent of dockable
dockable
- a dockable with station
as parent
IllegalStateException
- if dockable
is not a child of
station
public static DockHierarchyLock.Token acquiring(DockStation station)
acquire(DockStation)
with the DockHierarchyLock
of
the DockController
of station
. Returns a fake DockHierarchyLock.Token
if station
has
no DockController
.
station
- the station to lock
IllegalStateException
- if a lock has already been acquiredpublic static DockHierarchyLock.Token acquireFake()
public DockHierarchyLock.Token acquireLink(DockStation station, Dockable dockable)
station
to become the new parent of dockable
.
station
- the station which wants to be the new parent of dockable
dockable
- a dockable with no parent
IllegalStateException
- if dockable
has a parent or station
thinks that dockable
is one of its childrenpublic DockHierarchyLock.Token acquireUnlink(DockStation station, Dockable dockable)
station
to remove itself as parent from dockable
.
station
- the current parent of dockable
dockable
- a dockable with station
as parent
IllegalStateException
- if dockable
is not a child of
station
public DockHierarchyLock.Token acquire(DockStation station)
station
. This
method is intended in situations where the layout of station
gets
modified and this modification must not be interrupted.
station
- the station for which a lock is requested
IllegalStateException
- if the lock is already acquired
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |