Class SnapToMappings

java.lang.Object
com.levigo.jadice.web.client.grid.SnapToMappings

public class SnapToMappings extends Object
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 Details

    • SnapToMappings

      public SnapToMappings()
  • Method Details

    • add

      public static void add(Class<? extends Annotation> annoClass, Grid.SnapTo snapTo)
      Adds a new mapping between an Annotation class and a Grid.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 class
      snapTo - The position on the border or at the center of a cell
    • getFor

      public static Grid.SnapTo getFor(Class<? extends Annotation> annoClass)
      Returns the Grid.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 corresponding Cell (which is the top left corner).