Package org.omegat.util.gui
Class MenuItemPager
- java.lang.Object
 - 
- org.omegat.util.gui.MenuItemPager
 
 
- 
public class MenuItemPager extends java.lang.ObjectA helper class for creating nested submenus. Usage:- In the constructor provide the target menu to which you want to add items.
 - Optionally set the number of items per page with 
setItemsPerPage(int)(default isDEFAULT_ITEMS_PER_PAGE). - Call 
add(JMenuItem)for each item to add. A new submenu will be created and automatically added to the current (sub)menu as necessary. - Optionally obtain the "first page" of items (the items added directly to the root target menu) with
 
getFirstPage(). 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_ITEMS_PER_PAGE 
- 
Constructor Summary
Constructors Constructor Description MenuItemPager(javax.swing.JMenu menu)MenuItemPager(javax.swing.JPopupMenu menu) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JMenuItemadd(javax.swing.JMenuItem newItem)Add an item to the menu.java.util.List<javax.swing.JMenuItem>getFirstPage()Get the "first page" of items (the items added directly to the provided root menu).voidsetItemsPerPage(int itemsPerPage)Set the size of the page (number of items allowed before a new submenu is created). 
 - 
 
- 
- 
Field Detail
- 
DEFAULT_ITEMS_PER_PAGE
public static final int DEFAULT_ITEMS_PER_PAGE
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
setItemsPerPage
public void setItemsPerPage(int itemsPerPage)
Set the size of the page (number of items allowed before a new submenu is created). The actual number of items added to any (sub)menu isitemsPerPage + 1for the next submenu.- Parameters:
 itemsPerPage- Page size
 
- 
add
public javax.swing.JMenuItem add(javax.swing.JMenuItem newItem)
Add an item to the menu. The item will be added to a submenu as appropriate.- Parameters:
 newItem- The item to add- Returns:
 - The provided item
 
 
- 
getFirstPage
public java.util.List<javax.swing.JMenuItem> getFirstPage()
Get the "first page" of items (the items added directly to the provided root menu). If a second page was added, the list will include the item representing the submenu.- Returns:
 - The first-page items
 
 
 - 
 
 -