java.lang.Object
org.autogui.swing.util.PopupCategorized
- All Implemented Interfaces:
Cloneable,PopupExtension.PopupMenuBuilder
- Direct Known Subclasses:
ObjectTableModel.PopupCategorizedForRowsOrCells,PopupCategorized.PopupCategorizedFixed
a menu builder for categorizing items.
[ labelItem1 //PopupCategorized.CategorizedMenuItemLabel,
labelItem2,
...
category1,
[item1_1: icon, name],
[item1_2 ... ],
...
category2,
item2_1,
item2_2,
...,
]
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacethe categorized menu itemstatic interfacean action with category info.static interfacean action with category info, which becomes a check-box menu itemstatic classa check-box menu item version ofPopupCategorized.CategorizedMenuItemActionDelegatestatic classan action wraps another action for supplying category info.static interfacea categorized menu item with a menu-item component.static classthe default impl.static classaPopupCategorized.CategorizedMenuItemComponentwith custom category and subCategorystatic interfacea label: special categorystatic classaPopupCategorized.CategorizedMenuItemLabelwith custom category and subCategorystatic classintermediate state for building itemsstatic classanother menu builder with limiting itemsstatic classan action for selecting aPopupCategorized.CategorizedMenuItem -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic Stringprotected Consumer<PopupCategorized.CategorizedMenuItem> protected Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> protected MenuBuilderstatic Stringstatic Stringstatic Stringstatic Stringstatic String -
Constructor Summary
ConstructorsConstructorDescriptionPopupCategorized(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier) PopupCategorized(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier, Consumer<PopupCategorized.CategorizedMenuItem> itemConsumer) PopupCategorized(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier, Consumer<PopupCategorized.CategorizedMenuItem> itemConsumer, MenuBuilder menuBuilder) -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild(PopupExtension.PopupMenuFilter filter, Consumer<Object> menu) voidbuildCategories(Consumer<Object> menu, Map<String, List<JComponent>> categorizedMenuItems, int totalSize) protected voidbuildCleanEmptyCategories(Map<String, List<JComponent>> categorizedMenuItems) protected voidbuildMergeSubCategories(Map<String, Map<String, List<JComponent>>> subCategorizedMenuItems, Map<String, List<JComponent>> categorizedMenuItems) protected voidbuildNothing(PopupExtension.PopupMenuFilter filter, Consumer<Object> menu) protected intbuildSubCategories(List<PopupCategorized.CategorizedMenuItem> items, Map<String, Map<String, List<JComponent>>> subCategorizedMenuItems) protected Objectclone()createMenuItems(List<Object> items) Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> static JMenuItemgetMenuItem(Object item) static ActiongetMenuItems(List<?>... itemsList) static Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> getMenuItemsSupplier(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>>... itemsList) voidvoidsetItemSupplier(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier) voidsetMenuBuilder(MenuBuilder menuBuilder) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.autogui.swing.util.PopupExtension.PopupMenuBuilder
buildWithClear
-
Field Details
-
itemSupplier
-
itemConsumer
-
CATEGORY_LABEL
-
CATEGORY_ACTION
-
SUB_CATEGORY_LABEL_HEADER
-
SUB_CATEGORY_LABEL_TYPE
-
SUB_CATEGORY_LABEL_VALUE
-
SUB_CATEGORY_LABEL_MISC
-
SUB_CATEGORY_LABEL_ACTION
-
-
Constructor Details
-
PopupCategorized
public PopupCategorized(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier) -
PopupCategorized
public PopupCategorized(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier, Consumer<PopupCategorized.CategorizedMenuItem> itemConsumer) -
PopupCategorized
public PopupCategorized(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier, Consumer<PopupCategorized.CategorizedMenuItem> itemConsumer, MenuBuilder menuBuilder)
-
-
Method Details
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
getMenuItems
- Parameters:
itemsList- array of list of one ofPopupCategorized.CategorizedMenuItem,ActionorJComponent- Returns:
- a list of
PopupCategorized.CategorizedMenuItemconverted from arguments
-
getMenuItem
- Parameters:
item- one ofPopupCategorized.CategorizedMenuItem,ActionorJComponent, otherwise, throws an exception- Returns:
- a
PopupCategorized.CategorizedMenuItemconverted from the item
-
getMenuItemAction
-
getJMenuItem
- Parameters:
item- tested- Returns:
- a
JMenuItemor null, no allocation in the class
-
getMenuItemsSupplier
@SafeVarargs public static Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> getMenuItemsSupplier(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>>... itemsList) -
getItemSupplier
-
setItemSupplier
public void setItemSupplier(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier) -
build
Description copied from interface:PopupExtension.PopupMenuBuilderthe Consumer acceptsActionincludingJMenuandJPopupMenuJMenuItemJComponent
- Specified by:
buildin interfacePopupExtension.PopupMenuBuilder- Parameters:
filter- an item filtermenu- the target for appending menus
-
createPopupCategorizedBuildingItems
protected PopupCategorized.PopupCategorizedBuildingItems createPopupCategorizedBuildingItems(PopupExtension.PopupMenuFilter filter) -
buildSubCategories
protected int buildSubCategories(List<PopupCategorized.CategorizedMenuItem> items, Map<String, Map<String, List<JComponent>>> subCategorizedMenuItems) -
buildMergeSubCategories
protected void buildMergeSubCategories(Map<String, Map<String, List<JComponent>>> subCategorizedMenuItems, Map<String, List<JComponent>> categorizedMenuItems) -
buildCleanEmptyCategories
-
buildNothing
-
createNewCategoryToSubCategoryToItems
-
createNewSubCategoryToItems
-
getPredefinedCategoriesOrder
- Returns:
- always initially added categories. Note: categories which has no items will be removed after adding, and thus there are no separators for the categories
-
getPredefinedSubCategoriesOrder
- Returns:
- always initially added sub-categories for any categories
-
getMenuBuilder
-
setMenuBuilder
-
createMenuItem
-
createMenuItemFromObject
-
createMenuItems
-
buildCategories
-
select
-