|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.object.control.MutableAbout
An implementation of the About interface whereby the
Permission returned from canUse() and
canAccess can change over time.
For simplicity, this about does not allow the use and access
permissions to vary independently. In other words, if the
Permission from one is a veto, then it will be from the other
also.
Whenever the state of the about is changed (using the
makeAvailable and makeUnavailable methods), any
installed listeners are notified.
Implementation note: factory methods are provided to create these objects. See Joshua Bloch's Effective Java for further discussion.
makeAvailable(),
makeAvailable(String),
makeUnavailable(String),
AboutListener,
TODO: Needs to be reviewed. The use of events within this class is potential
problem. It must be remembered that the object that is suppose to be listening
(if it is a naked object) might not actually be in memory.,
Serialized Form| Method Summary | |
java.util.Enumeration |
aboutListeners()
Returns enumeration of all registered listeners. |
void |
addAboutListener(AboutListener l)
Registers an AboutListener. |
Permission |
canAccess()
Whether the feature is "accessible" (presumably from the GUI) always returns the same as canUse(). |
Permission |
canUse()
Whether the feature is "usable", for example is editable. |
static MutableAbout |
create()
Factory method; creates an About (no name or description)
whose permissions allow access and use.
|
static MutableAbout |
create(MutableAbout mutableAbout)
Factory method; clones supplied MutableAbout. |
static MutableAbout |
create(java.lang.String name,
java.lang.String description)
Factory method; creates an About whose permissions allow
access and use. |
protected void |
fireAboutAvailable()
Notifies all listeners that the about is now available. |
protected void |
fireAboutUnavailable()
Notifies all listeners that the about is now unavailable. |
java.lang.String |
getDescription()
Returns the description of the about. |
java.lang.String |
getName()
Returns the name of the about. |
MutableAbout |
makeAvailable()
Changes the permission (as returned by both canAccess()
and canUse()) to be an Allow. |
MutableAbout |
makeAvailable(java.lang.String reason)
Changes the permission (as returned by both canAccess()
and canUse()) to be an Allow, with the
specified reason. |
MutableAbout |
makeUnavailable(java.lang.String reason)
Changes the permission (as returned by both canAccess()
and canUse()) to be a Veto, with the specified
reason. |
void |
removeAboutListener(AboutListener l)
Removes an AboutListener from the collection of registered
listeners. |
void |
setDescription(java.lang.String description)
Sets the description of the about. |
void |
setName(java.lang.String name)
Sets the description of the about. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static MutableAbout create()
About (no name or description)
whose permissions allow access and use.
The makeUnavailable and makeAvailable methods
can be used to subsequently change those permissions.
The name and description fields can also be
subsequently set.
makeUnavailable(String),
makeAvailable(),
makeAvailable(String),
setName(String),
setDescription(String)
public static MutableAbout create(java.lang.String name,
java.lang.String description)
About whose permissions allow
access and use.
makeUnavailable(String),
makeAvailable(),
makeAvailable(String),
Aboutpublic static MutableAbout create(MutableAbout mutableAbout)
MutableAbout. The
name, description and permissions are all
copied over.
public final java.util.Enumeration aboutListeners()
public final void addAboutListener(AboutListener l)
AboutListener. This will be notified if the
about subsequently changes its state.
public Permission canAccess()
canUse().
canAccess in interface AboutcanUse()public Permission canUse()
isAllowed() or isVetoed() methods should then
be invoked to determine if the feature is usable.
canUse in interface AboutPermission.isAllowed(),
Permission.isVetoed()public MutableAbout makeAvailable()
canAccess()
and canUse()) to be an Allow. No reason is required (don't
usually have to explain why something can be done, only why it
can't.
makeAvailable(String),
makeUnavailable(String)public MutableAbout makeAvailable(java.lang.String reason)
canAccess()
and canUse()) to be an Allow, with the
specified reason.
makeAvailable(),
makeUnavailable(String),
Allowpublic MutableAbout makeUnavailable(java.lang.String reason)
canAccess()
and canUse()) to be a Veto, with the specified
reason.
makeAvailable(),
Vetopublic final void removeAboutListener(AboutListener l)
AboutListener from the collection of registered
listeners. This will no longer be notified if the about
subsequently changes its state.
public void setDescription(java.lang.String description)
getDescription()public java.lang.String getDescription()
getDescription in interface Aboutpublic void setName(java.lang.String name)
getName()public java.lang.String getName()
getName in interface Aboutprotected final void fireAboutAvailable()
fireAboutAvailable()protected final void fireAboutUnavailable()
fireAboutAvailable()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||