|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.EventNotifier<GUIAvailabilityListener>
edu.rice.cs.drjava.ui.avail.GUIAvailabilityNotifier
public class GUIAvailabilityNotifier
Keeps track of all listeners to GUI availability.
All methods in this class must use the synchronization methods provided by ReaderWriterLock. This ensures that multiple notifications (reads) can occur simultaneously, but only one thread can be adding or removing listeners (writing) at a time, and no reads can occur during a write.
No methods on this class should be synchronized using traditional Java synchronization!
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface edu.rice.cs.drjava.ui.avail.GUIAvailabilityListener |
|---|
GUIAvailabilityListener.ComponentType |
| Field Summary | |
|---|---|
protected HashMap<GUIAvailabilityListener.ComponentType,Integer> |
_values
The current availabilities of the individual components. |
| Fields inherited from class edu.rice.cs.drjava.model.EventNotifier |
|---|
_listeners, _lock |
| Constructor Summary | |
|---|---|
GUIAvailabilityNotifier()
Create a new notifier with all components available. |
|
| Method Summary | |
|---|---|
void |
availabilityChanged(GUIAvailabilityListener.ComponentType component,
boolean available)
Called to change a components availability. |
void |
available(GUIAvailabilityListener.ComponentType component)
Make a component (more) available. |
void |
ensureAvailabilityIs(GUIAvailabilityListener.ComponentType component,
boolean available)
Make sure the availability of the component is as specified. |
void |
ensureAvailable(GUIAvailabilityListener.ComponentType component)
Make sure a component is available, i.e. |
void |
ensureUnavailable(GUIAvailabilityListener.ComponentType component)
Make sure a component is unavailable, i.e. |
int |
getCount(GUIAvailabilityListener.ComponentType component)
Returns the count for the specified component, where 0 means available, and 1 or greater means unavailable (perhaps nested). |
boolean |
isAvailable(GUIAvailabilityListener.ComponentType component)
Return true if the component is available. |
protected void |
notifyListeners(GUIAvailabilityListener.ComponentType component)
Notify the listeners for the specified component. |
void |
unavailable(GUIAvailabilityListener.ComponentType component)
Make a component (more) unavailable. |
| Methods inherited from class edu.rice.cs.drjava.model.EventNotifier |
|---|
addListener, removeAllListeners, removeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final HashMap<GUIAvailabilityListener.ComponentType,Integer> _values
| Constructor Detail |
|---|
public GUIAvailabilityNotifier()
| Method Detail |
|---|
public boolean isAvailable(GUIAvailabilityListener.ComponentType component)
component - the component to query
public int getCount(GUIAvailabilityListener.ComponentType component)
component - the component to query
public void ensureUnavailable(GUIAvailabilityListener.ComponentType component)
component - the component that needs to be unavailablepublic void unavailable(GUIAvailabilityListener.ComponentType component)
component - the component that is unavailablepublic void ensureAvailable(GUIAvailabilityListener.ComponentType component)
component - the component that needs to be availablepublic void available(GUIAvailabilityListener.ComponentType component)
component - the component that is available
public void ensureAvailabilityIs(GUIAvailabilityListener.ComponentType component,
boolean available)
component - the component that needs to be availableavailable - true to make the component available, false otherwise
public void availabilityChanged(GUIAvailabilityListener.ComponentType component,
boolean available)
availabilityChanged in interface GUIAvailabilityListenercomponent - the component whose availability changedavailable - true if component is availableprotected void notifyListeners(GUIAvailabilityListener.ComponentType component)
component - the component whose listeners should be notified
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||