com.guiseframework.prototype
Class AbstractMenuToolCompositeComponentPrototypeProvisionStrategy
java.lang.Object
java.util.concurrent.locks.ReentrantReadWriteLock
com.guiseframework.prototype.AbstractPrototypeProvisionStrategy
com.guiseframework.prototype.AbstractCompositeComponentPrototypeProvisionStrategy
com.guiseframework.prototype.AbstractMenuToolCompositeComponentPrototypeProvisionStrategy
- All Implemented Interfaces:
- java.io.Serializable, java.util.concurrent.locks.ReadWriteLock
- Direct Known Subclasses:
- DefaultMenuToolPrototypeProvisionStrategy, FrameMenuToolPrototypeProvisionStrategy
public abstract class AbstractMenuToolCompositeComponentPrototypeProvisionStrategy
- extends AbstractCompositeComponentPrototypeProvisionStrategy
Abstract strategy for keeping track of prototype providers and working with provisioned prototypes, merging them into a menu and/or a toolbar of a frame.
When the prototype providers change provided prototypes, those provided prototypes are processed.
This version monitors the parent composite component children and automatically uses top-level prototype providers added to or removed from the hierarchy.
Prototype provisions are not processed initially; this strategy should be initialized after construction by calling AbstractPrototypeProvisionStrategy.processPrototypeProvisions().
This class is thread safe based upon its exposed read and write locks.
- Author:
- Garret Wilson
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class java.util.concurrent.locks.ReentrantReadWriteLock |
java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock, java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock |
| Methods inherited from class java.util.concurrent.locks.ReentrantReadWriteLock |
getOwner, getQueuedReaderThreads, getQueuedThreads, getQueuedWriterThreads, getQueueLength, getReadHoldCount, getReadLockCount, getWaitingThreads, getWaitQueueLength, getWriteHoldCount, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isWriteLocked, isWriteLockedByCurrentThread, readLock, toString, writeLock |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AbstractMenuToolCompositeComponentPrototypeProvisionStrategy
public AbstractMenuToolCompositeComponentPrototypeProvisionStrategy(CompositeComponent parentComponent,
PrototypeProvider... defaultPrototypeProviders)
- Parent component and prototype providers constructor.
- Parameters:
parentComponent - The composite component the top-level prototype provider children of which will be monitored.defaultPrototypeProviders - The default prototype providers that will provide prototypes for processing, outside the children of the composite component parent.
- Throws:
java.lang.NullPointerException - if the given parent component, prototype providers, and/or one or more prototype provider is null.
getMenu
protected abstract Menu getMenu()
- Returns:
- The menu being managed, or
null if no menu is being managed.
getToolbar
protected abstract Toolbar getToolbar()
- Returns:
- The toolbar being managed, or
null if no toolbar is being managed.
getLastComponents
public java.util.Set<Component> getLastComponents()
- The weak set of static components in the menu or the toolbar that should be displayed last; all components based upon prototypes will be inserted before the components.
processPrototypeProvisions
protected void processPrototypeProvisions(java.util.Set<PrototypeProvision<?>> prototypeProvisions)
- Processes prototype provisions.
This implementation merges prototype provisions into the given menu and/or toolbar, if any.
- Specified by:
processPrototypeProvisions in class AbstractPrototypeProvisionStrategy
- Parameters:
prototypeProvisions - The mutable set of prototype provisions to be used.- See Also:
getMenu(),
getToolbar()
synchronizePrototypeProvisionMap
protected static void synchronizePrototypeProvisionMap(com.globalmentor.collections.ReverseMap<PrototypeProvision<?>,Component> prototypeProvisionComponentMap,
CompositeComponent parentComponent,
java.util.Set<PrototypeProvision<?>> prototypeProvisionSet)
- Synchronizes the map of prototype provision component associations.
For each prototype provision association, the association is removed if the associated component no longer exists in the component tree, or if the associated prototype provision is not given;
if the latter, the associated component is removed from its parent.
- Parameters:
prototypeProvisionComponentMap - The map from which to remove values.parentComponent - The parent of the component tree in which published prototypes are represented.prototypeProvisionSet - The set to indicate which key entries to retain.
- Throws:
java.lang.NullPointerException - if the given map, parent component, or prototype provision set is null.
add
protected Component add(Container container,
PrototypeProvision<?> prototypeProvision)
- Adds a prototype to a container in the correct order by examining the prototype information of the other components added to the container
The prototype is inserted before the first component that was created from prototype info with a larger order.
The prototype will be inserted before any component present in the set returned by
getLastComponents().
- Parameters:
container - The container to which the prototype should be added.prototypeProvision - The prototype information to add.
- Returns:
- The component that was created to represent the prototype.
- See Also:
PrototypeProvision.getOrder(),
getLastComponents()
Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.