Class CtxMenuManager

java.lang.Object
com.jalios.jcms.ajax.CtxMenuManager

public class CtxMenuManager extends Object
This manager provides a way to generate dynamically letters for specific new entries in contextual menus. Its provides also convenient methods to insert letters at the good place in ctx menu letters array.
Since:
jcms-6.1.0
Author:
dissert
  • Method Summary

    Modifier and Type
    Method
    Description
    char[]
    addEntry(char[] letters, Object id, char c, boolean after)
    Create a new char array with the letter associated to this id the place after or before the one of the letter c.
    char[]
    addEntry(char[] letters, Object id, int index)
    Create a new char array with the letter associated to this id at the given index.
    char[]
    addEntry(char[] letters, Object id, Object idPreviousEntry, boolean after)
    Create a new char array with the letter associated to this id the place after or before the one of the letter bounds to the idPreviousEntry.
    char[]
    addEntryAtBottom(char[] letters, Object id)
    Create a new char array with the letter associated to this id at the end.
    char[]
    addEntryAtTop(char[] letters, Object id)
    Create a new char array with the letter associated to this id at the top.
    char
    createMenuEntry(Object id, Class<? extends AbstractCtxMenu> ctxMenuClazz)
    Retrieve or create a letter and associates it with the id for this ctx menu.
     
    boolean
    isCurrent(Object id, char letter)
    Tell if the given id corresponds to the given letter in the menu.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInstance

      public static CtxMenuManager getInstance()
    • createMenuEntry

      public char createMenuEntry(Object id, Class<? extends AbstractCtxMenu> ctxMenuClazz)
      Retrieve or create a letter and associates it with the id for this ctx menu.
      Parameters:
      id - an object to handle the new entry
      ctxMenuClazz - the given ctx menu
      Returns:
      the letter that will be used in for this entry
    • isCurrent

      public boolean isCurrent(Object id, char letter)
      Tell if the given id corresponds to the given letter in the menu.
      Parameters:
      id -
      letter -
      Returns:
      true if the letter is bounds to this id
    • addEntryAtBottom

      public char[] addEntryAtBottom(char[] letters, Object id)
      Create a new char array with the letter associated to this id at the end.
      Parameters:
      letters - the previous char array
      id -
      Returns:
      a new char array
    • addEntryAtTop

      public char[] addEntryAtTop(char[] letters, Object id)
      Create a new char array with the letter associated to this id at the top.
      Parameters:
      letters - the previous char array
      id -
      Returns:
      a new char array
    • addEntry

      public char[] addEntry(char[] letters, Object id, int index)
      Create a new char array with the letter associated to this id at the given index.
      Parameters:
      letters - the previous char array
      id -
      index - the index (from 0 to letters.length) of the new letter
      Returns:
      a new char array
    • addEntry

      public char[] addEntry(char[] letters, Object id, char c, boolean after)
      Create a new char array with the letter associated to this id the place after or before the one of the letter c.
      Parameters:
      letters - the previous char array
      id -
      c - the letter
      after - to place the new entry after the previous one (otherwise, before)
      Returns:
      a new char array
    • addEntry

      public char[] addEntry(char[] letters, Object id, Object idPreviousEntry, boolean after)
      Create a new char array with the letter associated to this id the place after or before the one of the letter bounds to the idPreviousEntry.
      Parameters:
      letters - the previous char array
      id -
      idPreviousEntry - the id that bounds to the letter
      after - to place the new entry after the previous one (otherwise, before)
      Returns:
      a new char array