Class NewResourceAction
- java.lang.Object
- 
- javax.swing.AbstractAction
- 
- com.inductiveautomation.ignition.designer.tabbedworkspace.NewResourceAction
 
 
- 
- All Implemented Interfaces:
- java.awt.event.ActionListener,- java.io.Serializable,- java.lang.Cloneable,- java.util.EventListener,- javax.swing.Action
 - Direct Known Subclasses:
- ReportingResourceWorkspace.NewReportResourceAction
 
 public abstract class NewResourceAction extends javax.swing.AbstractActionThis action will pop up theCreateResourceDialog. There are two ways that implementations of this abstract class are meant to be used:1. The legacy way: override createPrototype()and return your object. It will be serialized using Ignition's default XML serialization and the resulting bytes will be stored in the resources as data.bin2. The Ignition 8.0 way: Override configureResource(ProjectResourceBuilder)and invoke methods on the resource builder. Don't worry about setting project name, resource path, or scope - these will be set automatically.After the resource is created it will be opened in your workspace. - See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.function.Consumer<ProjectResourceBuilder>builderConsumerprotected booleancanceledprotected ResourceFolderNodefolderprotected TabbedResourceWorkspaceworkspace
 - 
Constructor SummaryConstructors Constructor Description NewResourceAction(TabbedResourceWorkspace workspace, ResourceFolderNode folder)NewResourceAction(TabbedResourceWorkspace workspace, ResourceFolderNode folder, java.util.function.Consumer<ProjectResourceBuilder> builderConsumer)Alternative constructor to avoid to subclassing/overriding configureResource
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent event)protected voidconfigureResource(ProjectResourceBuilder builder)The default implementation of this simply calls putData() with the prototype bytes in order to be backwards compatible with the legacy method of project resources only having one binary file in them.protected java.lang.ObjectcreatePrototype()protected byte[]createPrototypeBytes()protected ResourceFolderNodegetFolder()Provides an opportunity for subclasses to provide the parent folder lazilyprotected abstract java.lang.StringnewResourceName()protected voidonAfterResourceAdded(ProjectResource resource)Do more things after the resource is created here, if you want.- 
Methods inherited from class javax.swing.AbstractActionaddPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
- 
 
- 
- 
- 
Field Detail- 
workspaceprotected final TabbedResourceWorkspace workspace 
 - 
folderprotected final ResourceFolderNode folder 
 - 
canceledprotected boolean canceled 
 - 
builderConsumerprotected final java.util.function.Consumer<ProjectResourceBuilder> builderConsumer 
 
- 
 - 
Constructor Detail- 
NewResourceActionpublic NewResourceAction(TabbedResourceWorkspace workspace, ResourceFolderNode folder) 
 - 
NewResourceActionpublic NewResourceAction(TabbedResourceWorkspace workspace, ResourceFolderNode folder, java.util.function.Consumer<ProjectResourceBuilder> builderConsumer) Alternative constructor to avoid to subclassing/overriding configureResource
 
- 
 - 
Method Detail- 
actionPerformedpublic void actionPerformed(java.awt.event.ActionEvent event) 
 - 
onAfterResourceAddedprotected void onAfterResourceAdded(ProjectResource resource) throws java.lang.Exception Do more things after the resource is created here, if you want.- Throws:
- java.lang.Exception
 
 - 
getFolderprotected ResourceFolderNode getFolder() Provides an opportunity for subclasses to provide the parent folder lazily
 - 
configureResourceprotected void configureResource(ProjectResourceBuilder builder) throws java.lang.Exception The default implementation of this simply calls putData() with the prototype bytes in order to be backwards compatible with the legacy method of project resources only having one binary file in them.To make a more modern project resource with specific named files init, override this method and do not use createPrototype()- Throws:
- java.lang.Exception
 
 - 
createPrototypeBytesprotected byte[] createPrototypeBytes() throws java.lang.Exception- Throws:
- java.lang.Exception
 
 - 
createPrototypeprotected java.lang.Object createPrototype() 
 - 
newResourceNameprotected abstract java.lang.String newResourceName() 
 
- 
 
-