Class Command
- java.lang.Object
-
- org.pushingpixels.flamingo.api.common.model.Command
-
- All Implemented Interfaces:
ChangeAware,ContentModel,PropertyChangeAware
- Direct Known Subclasses:
ColorSelectorCommand
public class Command extends java.lang.Object implements ContentModel, ChangeAware, PropertyChangeAware
Encapsulates metadata for a single command. Use a new instance ofCommand.Builderto configure a new command, andCommand.Builder.build()to build a command.A command can be projected to screen (creating a visual representation of that command) using
CommandButtonPresentationModelandCommandButtonProjection. Useproject()for default presentation settings orproject(CommandButtonPresentationModel)to customize presentation settings. Then useProjection.buildComponent()to get an instance ofJCommandButtonthat can be added to the component hierarchy. Note that you can - and should - use the sameCommandinstance and one or moreCommandButtonPresentationModels if you need to have multiple instances (or projections) of the same command in your app UI. That way, changes in the command are propagated and synced across all those projections.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommand.BaseBuilder<T extends Command,B extends Command.BaseBuilder<T,B>>static classCommand.Builderstatic interfaceCommand.CommandActionPreview
-
Constructor Summary
Constructors Modifier Constructor Description protectedCommand()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(javax.swing.event.ChangeListener l)Adds the specified change listener to track changes to the underlying source.voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)static Command.Builderbuilder()CommandActiongetAction()Command.CommandActionPreviewgetActionPreview()RichTooltipgetActionRichTooltip()org.pushingpixels.neon.api.icon.ResizableIcon.FactorygetDisabledIconFactory()java.lang.StringgetExtraText()org.pushingpixels.neon.api.icon.ResizableIcon.FactorygetIconFactory()CommandMenuContentModelgetSecondaryContentModel()RichTooltipgetSecondaryRichTooltip()java.lang.StringgetText()CommandToggleGroupModelgetToggleGroupModel()booleanisActionEnabled()booleanisSecondaryEnabled()booleanisToggle()booleanisToggleSelected()CommandButtonProjection<Command>project()CommandButtonProjection<Command>project(CommandButtonPresentationModel commandPresentation)voidremoveChangeListener(javax.swing.event.ChangeListener l)Removes the specified change listener from tracking changes to the underlying source.voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)voidsetAction(CommandAction actionListener)voidsetActionEnabled(boolean actionEnabled)voidsetActionPreview(Command.CommandActionPreview actionPreview)voidsetActionRichTooltip(RichTooltip actionRichTooltip)voidsetDisabledIconFactory(org.pushingpixels.neon.api.icon.ResizableIcon.Factory disabledIconFactory)voidsetExtraText(java.lang.String extraText)voidsetIconFactory(org.pushingpixels.neon.api.icon.ResizableIcon.Factory iconFactory)voidsetSecondaryEnabled(boolean secondaryEnabled)voidsetSecondaryRichTooltip(RichTooltip secondaryRichTooltip)voidsetText(java.lang.String text)voidsetToggleSelected(boolean isToggleSelected)
-
-
-
Method Detail
-
builder
public static Command.Builder builder()
-
getText
public java.lang.String getText()
-
setText
public void setText(java.lang.String text)
-
getIconFactory
public org.pushingpixels.neon.api.icon.ResizableIcon.Factory getIconFactory()
-
setIconFactory
public void setIconFactory(org.pushingpixels.neon.api.icon.ResizableIcon.Factory iconFactory)
-
getDisabledIconFactory
public org.pushingpixels.neon.api.icon.ResizableIcon.Factory getDisabledIconFactory()
-
setDisabledIconFactory
public void setDisabledIconFactory(org.pushingpixels.neon.api.icon.ResizableIcon.Factory disabledIconFactory)
-
getExtraText
public java.lang.String getExtraText()
-
setExtraText
public void setExtraText(java.lang.String extraText)
-
getAction
public CommandAction getAction()
-
setAction
public void setAction(CommandAction actionListener)
-
getActionRichTooltip
public RichTooltip getActionRichTooltip()
-
setActionRichTooltip
public void setActionRichTooltip(RichTooltip actionRichTooltip)
-
getSecondaryContentModel
public CommandMenuContentModel getSecondaryContentModel()
-
getSecondaryRichTooltip
public RichTooltip getSecondaryRichTooltip()
-
setSecondaryRichTooltip
public void setSecondaryRichTooltip(RichTooltip secondaryRichTooltip)
-
isActionEnabled
public boolean isActionEnabled()
-
setActionEnabled
public void setActionEnabled(boolean actionEnabled)
-
isSecondaryEnabled
public boolean isSecondaryEnabled()
-
setSecondaryEnabled
public void setSecondaryEnabled(boolean secondaryEnabled)
-
isToggle
public boolean isToggle()
-
isToggleSelected
public boolean isToggleSelected()
-
setToggleSelected
public void setToggleSelected(boolean isToggleSelected)
-
getToggleGroupModel
public CommandToggleGroupModel getToggleGroupModel()
-
getActionPreview
public Command.CommandActionPreview getActionPreview()
-
setActionPreview
public void setActionPreview(Command.CommandActionPreview actionPreview)
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface:ChangeAwareAdds the specified change listener to track changes to the underlying source.- Specified by:
addChangeListenerin interfaceChangeAware- Parameters:
l- Change listener to add.- See Also:
ChangeAware.removeChangeListener(ChangeListener)
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Description copied from interface:ChangeAwareRemoves the specified change listener from tracking changes to the underlying source.- Specified by:
removeChangeListenerin interfaceChangeAware- Parameters:
l- Change listener to remove.- See Also:
ChangeAware.removeChangeListener(ChangeListener)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
- Specified by:
addPropertyChangeListenerin interfacePropertyChangeAware
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
- Specified by:
removePropertyChangeListenerin interfacePropertyChangeAware
-
project
public CommandButtonProjection<Command> project()
-
project
public CommandButtonProjection<Command> project(CommandButtonPresentationModel commandPresentation)
-
-