GP-926 - Function Graph - Layouts - Created generic

layout provider to use jung layouts by name
This commit is contained in:
dragonmacher 2021-05-12 14:53:58 -04:00
parent 2da717d56a
commit c8e359ddec
28 changed files with 882 additions and 254 deletions

View file

@ -55,6 +55,7 @@ public abstract class MultiStateDockingAction<T> extends DockingAction {
private MultipleActionDockingToolbarButton multipleButton;
private boolean performActionOnPrimaryButtonClick = true;
private Icon defaultIcon;
private boolean useCheckboxForIcons;
// A listener that will get called when the button (not the popup) is clicked. Toolbar
@ -139,6 +140,17 @@ public abstract class MultiStateDockingAction<T> extends DockingAction {
this.useCheckboxForIcons = useCheckboxForIcons;
}
/**
* Sets the icon to use if the active action state does not supply an icon. This is useful if
* you wish for your action states to not use icon, but desire the action itself to have an
* icon.
*
* @param icon the icon
*/
public void setDefaultIcon(Icon icon) {
this.defaultIcon = icon;
}
@Override
public final void actionPerformed(ActionContext context) {
if (!performActionOnPrimaryButtonClick) {
@ -270,6 +282,11 @@ public abstract class MultiStateDockingAction<T> extends DockingAction {
if (icon != null) {
return icon;
}
if (defaultIcon != null) {
return defaultIcon;
}
return EMPTY_ICON;
}