Class PaletteImpl
- java.lang.Object
-
- javax.swing.AbstractListModel
-
- com.inductiveautomation.factorypmi.designer.palette.model.PaletteImpl
-
- All Implemented Interfaces:
ProjectResourceListener,Palette,java.io.Serializable,javax.swing.ListModel
public class PaletteImpl extends javax.swing.AbstractListModel implements Palette, ProjectResourceListener
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPaletteImpl.SingleObjectSelectionModel<R>Implementation copied (and simplified) from DefaultSingleSelectionModel and modified to handle objects, not ints.
-
Field Summary
Fields Modifier and Type Field Description static ResourceTypePALETTE_RESOURCE_TYPEstatic java.awt.datatransfer.DataFlavorPALETTEITEM_DATAFLAVOR
-
Constructor Summary
Constructors Constructor Description PaletteImpl(VisionDesignerInterface visionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAuxiliaryAction(javax.swing.Action action)An action that may be added to the palette.voidaddGroup(PaletteItemGroup group)PaletteItemGroupaddGroup(java.lang.String name)Adds a plugin palette tabvoidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)voidclearSelection()Clears the selection so that nothing is pending a drop.java.util.List<javax.swing.Action>getAuxiliaryActions()java.util.List<CustomPaletteItemGroup>getCustomPalettes()Retrieves a list of custom palette item groupsjava.lang.ObjectgetElementAt(int index)Returns thePaletteItemGroupat the given locationPaletteItemGroupgetGroup(java.lang.String name)Returns the PaletteItemGroup with the given name, or null if no such group existsPaletteItemGroupgetGroupAt(int index)com.inductiveautomation.factorypmi.designer.palette.model.PaletteImpl.PaletteHandlergetImportExportHandler()ResourceFiltergetResourceFilter()Get theResourceFilterused to filter resources this listener cares about.PaletteItemgetSelectedItem()Get the selected, or "hot" item that is waiting to be dropped.PaletteImpl.SingleObjectSelectionModel<PaletteItem>getSelectionModel()intgetSize()The number of palette item groups.protected voidinitializeStaticPaletteGroups()Loads the static components from palette.xmlbooleanisItemSelected()Returns true if an item is selected.voidremoveGroup(PaletteItemGroup group)voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)voidrename(PaletteItemGroup paletteItemGroup, java.lang.String newName)voidresourcesCreated(java.lang.String projectName, java.util.List<ChangeOperation.CreateResourceOperation> resources)voidresourcesDeleted(java.lang.String projectName, java.util.List<ChangeOperation.DeleteResourceOperation> signatures)voidresourcesModified(java.lang.String projectName, java.util.List<ChangeOperation.ModifyResourceOperation> resources)voidsanitizeName(PaletteItemGroup group)voidsetEnabled(boolean b)Enables/disables all palette item groups en-masse.java.lang.StringtoString()voidupdate(java.util.List<ProjectResource> changed)Updates the custom palettes as according to the given diff-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.ignition.common.project.ProjectResourceListener
manifestChanged, onAfterChanges, onBeforeChanges
-
-
-
-
Field Detail
-
PALETTE_RESOURCE_TYPE
public static final ResourceType PALETTE_RESOURCE_TYPE
-
PALETTEITEM_DATAFLAVOR
public static java.awt.datatransfer.DataFlavor PALETTEITEM_DATAFLAVOR
-
-
Constructor Detail
-
PaletteImpl
public PaletteImpl(VisionDesignerInterface visionContext) throws SerializationException
- Throws:
SerializationException
-
-
Method Detail
-
initializeStaticPaletteGroups
protected void initializeStaticPaletteGroups()
Loads the static components from palette.xml
-
addAuxiliaryAction
public void addAuxiliaryAction(javax.swing.Action action)
Description copied from interface:PaletteAn action that may be added to the palette. Only supported by the collapsible palette- Specified by:
addAuxiliaryActionin interfacePalette
-
getAuxiliaryActions
public java.util.List<javax.swing.Action> getAuxiliaryActions()
-
getElementAt
public java.lang.Object getElementAt(int index)
Returns thePaletteItemGroupat the given location- Specified by:
getElementAtin interfacejavax.swing.ListModel
-
getSize
public int getSize()
The number of palette item groups.- Specified by:
getSizein interfacejavax.swing.ListModel
-
isItemSelected
public boolean isItemSelected()
Returns true if an item is selected. This means that the item is "hot" - waiting to be dropped onto a window.
-
getSelectedItem
public PaletteItem getSelectedItem()
Get the selected, or "hot" item that is waiting to be dropped.
-
clearSelection
public void clearSelection()
Clears the selection so that nothing is pending a drop.- Specified by:
clearSelectionin interfacePalette
-
setEnabled
public void setEnabled(boolean b)
Enables/disables all palette item groups en-masse.
-
getGroup
public PaletteItemGroup getGroup(java.lang.String name)
Description copied from interface:PaletteReturns the PaletteItemGroup with the given name, or null if no such group exists
-
getGroupAt
public PaletteItemGroup getGroupAt(int index)
-
addGroup
public PaletteItemGroup addGroup(java.lang.String name)
Description copied from interface:PaletteAdds a plugin palette tab
-
addGroup
public void addGroup(PaletteItemGroup group)
-
sanitizeName
public void sanitizeName(PaletteItemGroup group)
-
getCustomPalettes
public java.util.List<CustomPaletteItemGroup> getCustomPalettes()
Retrieves a list of custom palette item groups
-
removeGroup
public void removeGroup(PaletteItemGroup group)
-
rename
public void rename(PaletteItemGroup paletteItemGroup, java.lang.String newName)
-
getResourceFilter
@Nonnull public ResourceFilter getResourceFilter()
Description copied from interface:ProjectResourceListenerGet theResourceFilterused to filter resources this listener cares about. Default is to care about all resources.- Specified by:
getResourceFilterin interfaceProjectResourceListener- Returns:
- the
ResourceFilterused to filter resources this listener cares about.
-
resourcesDeleted
public void resourcesDeleted(java.lang.String projectName, java.util.List<ChangeOperation.DeleteResourceOperation> signatures)- Specified by:
resourcesDeletedin interfaceProjectResourceListener
-
resourcesCreated
public void resourcesCreated(java.lang.String projectName, java.util.List<ChangeOperation.CreateResourceOperation> resources)- Specified by:
resourcesCreatedin interfaceProjectResourceListener
-
resourcesModified
public void resourcesModified(java.lang.String projectName, java.util.List<ChangeOperation.ModifyResourceOperation> resources)- Specified by:
resourcesModifiedin interfaceProjectResourceListener
-
update
public void update(java.util.List<ProjectResource> changed)
Updates the custom palettes as according to the given diff
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getSelectionModel
public PaletteImpl.SingleObjectSelectionModel<PaletteItem> getSelectionModel()
-
getImportExportHandler
public com.inductiveautomation.factorypmi.designer.palette.model.PaletteImpl.PaletteHandler getImportExportHandler()
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
-