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 interface
the categorized menu itemstatic interface
an action with category info.static interface
an action with category info, which becomes a check-box menu itemstatic class
a check-box menu item version ofPopupCategorized.CategorizedMenuItemActionDelegate
static class
an action wraps another action for supplying category info.static interface
a categorized menu item with a menu-item component.static class
the default impl.static class
aPopupCategorized.CategorizedMenuItemComponent
with custom category and subCategorystatic interface
a label: special categorystatic class
aPopupCategorized.CategorizedMenuItemLabel
with custom category and subCategorystatic class
intermediate state for building itemsstatic class
another menu builder with limiting itemsstatic class
an action for selecting aPopupCategorized.CategorizedMenuItem
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic String
static String
protected Consumer
<PopupCategorized.CategorizedMenuItem> protected Supplier
<? extends Collection<PopupCategorized.CategorizedMenuItem>> protected MenuBuilder
static String
static String
static String
static String
static 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 TypeMethodDescriptionvoid
build
(PopupExtension.PopupMenuFilter filter, Consumer<Object> menu) void
buildCategories
(Consumer<Object> menu, Map<String, List<JComponent>> categorizedMenuItems, int totalSize) protected void
buildCleanEmptyCategories
(Map<String, List<JComponent>> categorizedMenuItems) protected void
buildMergeSubCategories
(Map<String, Map<String, List<JComponent>>> subCategorizedMenuItems, Map<String, List<JComponent>> categorizedMenuItems) protected void
buildNothing
(PopupExtension.PopupMenuFilter filter, Consumer<Object> menu) protected int
buildSubCategories
(List<PopupCategorized.CategorizedMenuItem> items, Map<String, Map<String, List<JComponent>>> subCategorizedMenuItems) protected Object
clone()
createMenuItems
(List<Object> items) Supplier
<? extends Collection<PopupCategorized.CategorizedMenuItem>> static JMenuItem
getMenuItem
(Object item) static Action
getMenuItems
(List<?>... itemsList) static Supplier
<? extends Collection<PopupCategorized.CategorizedMenuItem>> getMenuItemsSupplier
(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>>... itemsList) void
void
setItemSupplier
(Supplier<? extends Collection<PopupCategorized.CategorizedMenuItem>> itemSupplier) void
setMenuBuilder
(MenuBuilder menuBuilder) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
clone
in classObject
- Throws:
CloneNotSupportedException
-
getMenuItems
- Parameters:
itemsList
- array of list of one ofPopupCategorized.CategorizedMenuItem
,Action
orJComponent
- Returns:
- a list of
PopupCategorized.CategorizedMenuItem
converted from arguments
-
getMenuItem
- Parameters:
item
- one ofPopupCategorized.CategorizedMenuItem
,Action
orJComponent
, otherwise, throws an exception- Returns:
- a
PopupCategorized.CategorizedMenuItem
converted from the item
-
getMenuItemAction
-
getJMenuItem
- Parameters:
item
- tested- Returns:
- a
JMenuItem
or 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.PopupMenuBuilder
the Consumer acceptsAction
includingJMenu
andJPopupMenu
JMenuItem
JComponent
- Specified by:
build
in 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
-