Package com.levigo.jadice.web.client
Interface ToolManager
- All Known Implementing Classes:
BasicToolManager
public interface ToolManager
Manages the viewer-/page-view-related client-side
Tool
s.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Activates the tool of the given class.com.google.gwt.event.shared.HandlerRegistration
Adds a property change listener.com.google.gwt.event.shared.HandlerRegistration
Adds a tool changed handler.deregister
(Class<? extends Tool> tc) Deregisters the tool of the given class if the tool instance of this class is currently registered as tool.void
Fires aToolChangedEvent
to all listeners.<T> Collection
<T> getCompatibleTools
(Class<T> clazz) Returns all registered Tools which are derived from the given class or which implement the given interface.<T> Collection
<T> getCompatibleTools
(Class<T> clazz, boolean enabledOnly) Return all registered Tools which are derived from the given class or which implement the given interface.Returns theClass
of the current exclusiveTool
ornull
if noTool
has been set tosetExclusive(Class)
(Class) exclusive}Collection
<? extends MenuContributor> Return the current list of tools suitable as menu contributors.Collection
<Class<? extends Tool>> Allows access to all registered tool classes.<T extends Tool>
TReturns the tool instance for the given tool class, ornull
if no such tool is registered.void
handleEditEvent
(Class<?> context, EditEvent e) boolean
Returns whether this tool manager currently manages a tool of the given class.boolean
Return whether the tool of the given class is currently active.boolean
Checks whether the givenTool
is enabled.boolean
Return whether the exclusive tool mode is active, i.e. if the currently active tool is also the exclusive tool.<T extends Tool>
TRegisters the tool of the given class if the tool instance of this class is not currently registered as tool.void
render
(RenderParameters parameters) Render the Tool UIs using the givenRenderControls
.void
setActivationPolicy
(ToolActivationPolicy activationPolicy) void
setCursor
(com.google.gwt.dom.client.Style.Cursor cursor) Deprecated.Use setCursor(String) instead.void
Sets the currently used cursor.void
setEnabled
(Class<? extends Tool> tc, boolean enabled) Change the enabled state of the tool of the given class.void
setExclusive
(Class<? extends Tool> tc) Set the tool of the given class to be the exclusive tool.void
setNonExclusive
(Class<? extends Tool> tc) Leave exclusive mode.void
setStatusFeedback
(String statusFeedback) void
setViewComponent
(ViewComponent viewComponent)
-
Method Details
-
register
Registers the tool of the given class if the tool instance of this class is not currently registered as tool. If a tool of this class is already registered, this method simply returns the registered instance. Otherwise a tool instance will be created, registered and returned.- Type Parameters:
T
- type extending Tool- Parameters:
tc
- The tool classenabled
- Specifies whether the tool will initially be enabled or not- Returns:
- the registered tool instance
-
deregister
Deregisters the tool of the given class if the tool instance of this class is currently registered as tool. The deregistered tool instance will be returned if a matching tool instance was found and deregistered. Otherwise
null
will be returned.- Parameters:
tc
- the tool class- Returns:
- the deregistered tool instance or
null
if available otherwisenull
. Be aware this tool instance is already deregistered when returned and can not be used as tool anymore.
-
activate
Activates the tool of the given class.
- Parameters:
tc
- the tool class- Throws:
IllegalArgumentException
- if no tool of the given class is currently managed by thisToolManager
-
handleEditEvent
-
hasTool
Returns whether this tool manager currently manages a tool of the given class.- Parameters:
cls
- The class to check- Returns:
- True, if a tool of the given class is managed, false else
-
getTool
Returns the tool instance for the given tool class, ornull
if no such tool is registered.- Type Parameters:
T
- A type extending Tool- Parameters:
cls
- The class of the tool to return- Returns:
- The tool if existing, null else
-
isActive
Return whether the tool of the given class is currently active.- Parameters:
tc
- the tool class- Returns:
true
if the tool is active
-
isExclusive
boolean isExclusive()Return whether the exclusive tool mode is active, i.e. if the currently active tool is also the exclusive tool. In exclusive mode no tools except the exclusive one get a chance to render or handle events.- Returns:
true
if exclusive mode is active
-
render
Render the Tool UIs using the givenRenderControls
.This render method is usually called within the context and during the rendering of a single page. It will dispatch the render calls to all active tools.
- Parameters:
parameters
- the render parameters to use
-
setEnabled
Change the enabled state of the tool of the given class.- Parameters:
tc
- the tool classenabled
-true
to enabled the tool, otherwisefalse
- Throws:
IllegalArgumentException
- if no tool of the given class is currently managed by thisToolManager
-
isEnabled
-
setExclusive
Set the tool of the given class to be the exclusive tool.- Parameters:
tc
- The class of the tool to make exclusive- Throws:
IllegalArgumentException
- if no tool of the given class is currently managed by thisToolManager
-
setNonExclusive
Leave exclusive mode. Whatever tool is currently exclusive will loose its exclusive status. If there is currently no exclusive mode tool, this call has no effect.- Parameters:
tc
- The class of the tool to make non-exclusive
-
addPropertyChangeListener
com.google.gwt.event.shared.HandlerRegistration addPropertyChangeListener(PropertyChangeListener listener) Adds a property change listener.- Parameters:
listener
- The listener to add- Returns:
- Registration to remove the listener
- See Also:
-
addToolChangedHandler
com.google.gwt.event.shared.HandlerRegistration addToolChangedHandler(ToolChangedEvent.Handler handler) Adds a tool changed handler.- Parameters:
handler
- the handler to add- Returns:
HandlerRegistration
to remove the handler
-
getCompatibleTools
Returns all registered Tools which are derived from the given class or which implement the given interface. Only tools in the state 'enabled' are considered.- Type Parameters:
T
- type of class or interface in question- Parameters:
clazz
- the class or interface in question- Returns:
- a (possibly empty) collection of tools
-
getCompatibleTools
Return all registered Tools which are derived from the given class or which implement the given interface.- Type Parameters:
T
- type of class or interface in question- Parameters:
clazz
- the class or interface in questionenabledOnly
- whether only enabled tools (true
) or all registered tools shall be considered- Returns:
- a (possibly empty) collection of tools
-
getRegisteredToolClasses
Collection<Class<? extends Tool>> getRegisteredToolClasses()Allows access to all registered tool classes. This method will return active and inactiveTool
s. The returnedCollection
is read-only and does not follow any kind of sorting. (The order is random)- Returns:
- a
Collection
of all registeredTool
classes
-
getMenuContributors
Collection<? extends MenuContributor> getMenuContributors()Return the current list of tools suitable as menu contributors.- Returns:
- a read-only list of tools
-
setActivationPolicy
-
getActivationPolicy
ToolActivationPolicy getActivationPolicy() -
getStatusFeedback
String getStatusFeedback() -
setStatusFeedback
-
getActiveTool
-
getExclusiveTool
Returns theClass
of the current exclusiveTool
ornull
if noTool
has been set tosetExclusive(Class)
(Class) exclusive} -
setViewComponent
-
getViewComponent
ViewComponent getViewComponent() -
setCursor
Deprecated.Use setCursor(String) instead. To convert easily, just add .getCssName() to this method's cursor parameter -
setCursor
Sets the currently used cursor. Examples: setCursor("crosshair") or
setCursor(UIStyler.get().cursorStyle().ZOOM_IN_CURSOR())- Parameters:
cursor
- the css value of the cursor to be set
-
fireToolChangedEvent
Fires aToolChangedEvent
to all listeners.- Parameters:
event
- the ToolChangedEvent which should be fired
-