Class SnapToMappings
java.lang.Object
com.levigo.jadice.web.client.grid.SnapToMappings
Stores mappings of
Annotation
classes to Grid.SnapTo
locations. Each mapping
determines on which location of the Cell
bounds annotations of the given class will be
aligned to when creating, moving or resizing an annotation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
add
(Class<? extends Annotation> annoClass, Grid.SnapTo snapTo) Adds a new mapping between anAnnotation
class and aGrid.SnapTo
location.static void
clear()
Removes all registered mappings.static Grid.SnapTo
getFor
(Class<? extends Annotation> annoClass) Returns theGrid.SnapTo
of a previously added mapping.
-
Constructor Details
-
SnapToMappings
public SnapToMappings()
-
-
Method Details
-
add
Adds a new mapping between anAnnotation
class and aGrid.SnapTo
location. The given SnapTo is used when creating, moving or resizing annotations meaning that the annotation is aligned at the corresponding position on a cell.- Parameters:
annoClass
- The annotation classsnapTo
- The position on the border or at the center of a cell
-
getFor
Returns theGrid.SnapTo
of a previously added mapping. The SnapTo is used when creating, moving or resizing annotations meaning that the annotation is aligned at the corresponding position on grid elements.Defaults to the nearest corner when no specific mapping for the given
Annotation
class is found.- Parameters:
annoClass
- The annotation class- Returns:
- The position on the border or at the center of a cell
-
clear
public static void clear()Removes all registered mappings. After this method is called all annotations will be aligned to the default position on the correspondingCell
(which is the top left corner).
-