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 class
PaletteImpl.SingleObjectSelectionModel<R>
Implementation copied (and simplified) from DefaultSingleSelectionModel and modified to handle objects, not ints.
-
Field Summary
Fields Modifier and Type Field Description static ResourceType
PALETTE_RESOURCE_TYPE
static java.awt.datatransfer.DataFlavor
PALETTEITEM_DATAFLAVOR
-
Constructor Summary
Constructors Constructor Description PaletteImpl(VisionDesignerInterface visionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAuxiliaryAction(javax.swing.Action action)
An action that may be added to the palette.void
addGroup(PaletteItemGroup group)
PaletteItemGroup
addGroup(java.lang.String name)
Adds a plugin palette tabvoid
addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
void
clearSelection()
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.Object
getElementAt(int index)
Returns thePaletteItemGroup
at the given locationPaletteItemGroup
getGroup(java.lang.String name)
Returns the PaletteItemGroup with the given name, or null if no such group existsPaletteItemGroup
getGroupAt(int index)
com.inductiveautomation.factorypmi.designer.palette.model.PaletteImpl.PaletteHandler
getImportExportHandler()
ResourceFilter
getResourceFilter()
Get theResourceFilter
used to filter resources this listener cares about.PaletteItem
getSelectedItem()
Get the selected, or "hot" item that is waiting to be dropped.PaletteImpl.SingleObjectSelectionModel<PaletteItem>
getSelectionModel()
int
getSize()
The number of palette item groups.protected void
initializeStaticPaletteGroups()
Loads the static components from palette.xmlboolean
isItemSelected()
Returns true if an item is selected.void
removeGroup(PaletteItemGroup group)
void
removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
void
rename(PaletteItemGroup paletteItemGroup, java.lang.String newName)
void
resourcesCreated(java.lang.String projectName, java.util.List<ChangeOperation.CreateResourceOperation> resources)
void
resourcesDeleted(java.lang.String projectName, java.util.List<ChangeOperation.DeleteResourceOperation> signatures)
void
resourcesModified(java.lang.String projectName, java.util.List<ChangeOperation.ModifyResourceOperation> resources)
void
sanitizeName(PaletteItemGroup group)
void
setEnabled(boolean b)
Enables/disables all palette item groups en-masse.java.lang.String
toString()
void
update(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:Palette
An action that may be added to the palette. Only supported by the collapsible palette- Specified by:
addAuxiliaryAction
in interfacePalette
-
getAuxiliaryActions
public java.util.List<javax.swing.Action> getAuxiliaryActions()
-
getElementAt
public java.lang.Object getElementAt(int index)
Returns thePaletteItemGroup
at the given location- Specified by:
getElementAt
in interfacejavax.swing.ListModel
-
getSize
public int getSize()
The number of palette item groups.- Specified by:
getSize
in 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:
clearSelection
in 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:Palette
Returns 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:Palette
Adds 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:ProjectResourceListener
Get theResourceFilter
used to filter resources this listener cares about. Default is to care about all resources.- Specified by:
getResourceFilter
in interfaceProjectResourceListener
- Returns:
- the
ResourceFilter
used to filter resources this listener cares about.
-
resourcesDeleted
public void resourcesDeleted(java.lang.String projectName, java.util.List<ChangeOperation.DeleteResourceOperation> signatures)
- Specified by:
resourcesDeleted
in interfaceProjectResourceListener
-
resourcesCreated
public void resourcesCreated(java.lang.String projectName, java.util.List<ChangeOperation.CreateResourceOperation> resources)
- Specified by:
resourcesCreated
in interfaceProjectResourceListener
-
resourcesModified
public void resourcesModified(java.lang.String projectName, java.util.List<ChangeOperation.ModifyResourceOperation> resources)
- Specified by:
resourcesModified
in 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:
toString
in 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)
-
-