Package com.jalios.jcms.ajax
Class CtxMenuManager
- java.lang.Object
-
- com.jalios.jcms.ajax.CtxMenuManager
-
public class CtxMenuManager extends java.lang.ObjectThis 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description char[]addEntry(char[] letters, java.lang.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, java.lang.Object id, int index)Create a new char array with the letter associated to this id at the given index.char[]addEntry(char[] letters, java.lang.Object id, java.lang.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, java.lang.Object id)Create a new char array with the letter associated to this id at the end.char[]addEntryAtTop(char[] letters, java.lang.Object id)Create a new char array with the letter associated to this id at the top.charcreateMenuEntry(java.lang.Object id, java.lang.Class<? extends AbstractCtxMenu> ctxMenuClazz)Retrieve or create a letter and associates it with the id for this ctx menu.static CtxMenuManagergetInstance()booleanisCurrent(java.lang.Object id, char letter)Tell if the given id corresponds to the given letter in the menu.
-
-
-
Method Detail
-
getInstance
public static CtxMenuManager getInstance()
-
createMenuEntry
public char createMenuEntry(java.lang.Object id, java.lang.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 entryctxMenuClazz- the given ctx menu- Returns:
- the letter that will be used in for this entry
-
isCurrent
public boolean isCurrent(java.lang.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, java.lang.Object id)Create a new char array with the letter associated to this id at the end.- Parameters:
letters- the previous char arrayid-- Returns:
- a new char array
-
addEntryAtTop
public char[] addEntryAtTop(char[] letters, java.lang.Object id)Create a new char array with the letter associated to this id at the top.- Parameters:
letters- the previous char arrayid-- Returns:
- a new char array
-
addEntry
public char[] addEntry(char[] letters, java.lang.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 arrayid-index- the index (from 0 to letters.length) of the new letter- Returns:
- a new char array
-
addEntry
public char[] addEntry(char[] letters, java.lang.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 arrayid-c- the letterafter- to place the new entry after the previous one (otherwise, before)- Returns:
- a new char array
-
addEntry
public char[] addEntry(char[] letters, java.lang.Object id, java.lang.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 arrayid-idPreviousEntry- the id that bounds to the letterafter- to place the new entry after the previous one (otherwise, before)- Returns:
- a new char array
-
-