Gridarta Editor
net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Reference

Model for plugins. More...

+ Inheritance diagram for net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

void addParameter (@NotNull final PluginParameter< G, A, R, ?> pluginParameter)
 Adds a plugin parameter to this plugin. More...
 
void addPluginListener (@NotNull final PluginListener listener)
 Adds a PluginListener to be notified about changes. More...
 
Plugin< G, A, R > clonePlugin ()
 Returns a clone copy of this plugin. More...
 
void convertType (@NotNull final PluginParameter< G, A, R, ?> pluginParameter, @NotNull final String newType) throws NoSuchParameterException
 Changes the type of a plugin parameter. More...
 
String getCode ()
 Returns the executable code of this plugin. More...
 
File getFile ()
 Returns the location to save this plugin to. More...
 
String getName ()
 Returns the name of this plugin. More...
 
int getParameter (@NotNull final String parameterName)
 Returns the index for a plugin parameter name. More...
 
PluginParameter< G, A, R, ?> getParameter (final int index) throws NoSuchParameterException
 Returns the PluginParameter at a given index. More...
 
Filter<?, ?> getPluginAsFilter (@NotNull final PluginParameters pluginParameters)
 
boolean hasParameters ()
 Returns whether this plugin has at least one parameter. More...
 
boolean isAutoBoot ()
 Returns whether this plugin is run whenever the editor starts. More...
 
boolean isFilter ()
 Returns whether this plugin is a filter. More...
 
boolean isModified ()
 Returns whether the plugin contents have been modified since last save. More...
 
boolean isScript ()
 Returns whether this plugin is a stand-alone plugin. More...
 
Iterator< PluginParameter< G, A, R, ?> > iterator ()
 
void newParameter ()
 Creates a new plugin parameter. More...
 
 Plugin (@NotNull final String name, @NotNull final PluginParameterFactory< G, A, R > pluginParameterFactory)
 Creates a new instance. More...
 
void removeParameter (final int index)
 Removes a plugin parameter. More...
 
void removePluginListener (@NotNull final PluginListener listener)
 Removes a PluginListener to be notified about changes. More...
 
void resetModified ()
 Marks the plugin as unmodified since last save. More...
 
void runPlugin (@NotNull final PluginParameters pluginParameters)
 
void setAutoBoot (final boolean autoBoot)
 Sets whether this plugin is run whenever the editor starts. More...
 
void setCode (@NotNull final String code)
 Sets the executable code of this plugin. More...
 
void setFile (@Nullable final File file)
 Sets the location to save this plugin to. More...
 
void setFilter (final boolean filter)
 Sets whether this plugin is a filter. More...
 
void setScript (final boolean script)
 Sets whether this plugin is a stand-alone plugin. More...
 
String toString ()
 
Node toXML (@NotNull final PluginParameter< G, A, R, ?> pluginParameter)
 Returns XML representation for a PluginParameter. More...
 

Private Member Functions

void notifyParametersChangedListeners ()
 Notifies all registered PluginListeners that the parameters have changed. More...
 
void setModified ()
 Marks this plugin a modified since last save. More...
 

Private Attributes

boolean autoBoot
 Whether this plugin is run whenever the editor starts. More...
 
String code = ""
 The executable code. More...
 
final PluginParameterCodec< G, A, R > codec = new PluginParameterCodec<>()
 The PluginParameterCodec for converting PluginParameters to or from XML representation. More...
 
File file
 The location to save this plugin to; set to. More...
 
boolean filter
 Whether this plugin is a filter. More...
 
final Collection< PluginListenerlisteners = new CopyOnWriteArrayList<>()
 The PluginListeners to inform about changes. More...
 
boolean modified
 Whether the plugin contents has been modified since last save. More...
 
final String name
 The plugin name. More...
 
final List< PluginParameter< G, A, R, ?> > parameters = new ArrayList<>()
 The PluginParameters for this plugin. More...
 
final PluginParameterFactory< G, A, R > pluginParameterFactory
 The PluginParameterFactory for creating plugin parameters. More...
 
final PluginParameterListener pluginParameterListener = this::setModified
 The PluginParameterListener that is attached to all {plugin parameters} to detect changes. More...
 
boolean script
 Whether this plugin is a stand-alone plugin. More...
 

Static Private Attributes

static final Category LOG = Logger.getLogger(Plugin.class)
 The Logger for printing log messages. More...
 

Detailed Description

Model for plugins.

Author
tchize
Andreas Kirschbaum

Definition at line 53 of file Plugin.java.

Constructor & Destructor Documentation

◆ Plugin()

net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.Plugin ( @NotNull final String  name,
@NotNull final PluginParameterFactory< G, A, R >  pluginParameterFactory 
)

Creates a new instance.

Parameters
namethe plugin name
pluginParameterFactorythe plugin parameter factory for creating plugin parameters

Definition at line 138 of file Plugin.java.

Member Function Documentation

◆ addParameter()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addParameter ( @NotNull final PluginParameter< G, A, R, ?>  pluginParameter)

Adds a plugin parameter to this plugin.

Parameters
pluginParameterthe plugin parameter to add

Definition at line 289 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.Plugin< G, A, R >.clonePlugin(), and net.sf.gridarta.plugin.PluginModelParser< G, A, R >.fromXML().

+ Here is the caller graph for this function:

◆ addPluginListener()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addPluginListener ( @NotNull final PluginListener  listener)

Adds a PluginListener to be notified about changes.

Parameters
listenerthe change listener

Definition at line 235 of file Plugin.java.

Referenced by net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createParameterTab().

+ Here is the caller graph for this function:

◆ clonePlugin()

Plugin<G, A, R> net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.clonePlugin ( )

Returns a clone copy of this plugin.

The copy include name, executable code, type and a clone of each parameter. The change listeners are not copied.

Returns
a clone of this plugin

Definition at line 264 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.PluginExecutor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.executePlugin(), and net.sf.gridarta.gui.dialog.plugin.PluginController<?, ?, ?>.runPlugin().

+ Here is the caller graph for this function:

◆ convertType()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.convertType ( @NotNull final PluginParameter< G, A, R, ?>  pluginParameter,
@NotNull final String  newType 
) throws NoSuchParameterException

Changes the type of a plugin parameter.

Parameters
pluginParameterthe plugin parameter
newTypethe new type
Exceptions
NoSuchParameterExceptionif the index is invalid

Definition at line 377 of file Plugin.java.

◆ getCode()

String net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getCode ( )

◆ getFile()

File net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getFile ( )

Returns the location to save this plugin to.

Returns
the location to save to, or
null
if the plugin has no associated location

Definition at line 418 of file Plugin.java.

◆ getName()

◆ getParameter() [1/2]

int net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getParameter ( @NotNull final String  parameterName)

Returns the index for a plugin parameter name.

Parameters
parameterNamethe plugin parameter name
Returns
the index or
-1
if the parameter name does not exist

Definition at line 187 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.PluginExecutor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.executePlugin(), and net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.pluginEditorRemoveParameter().

+ Here is the caller graph for this function:

◆ getParameter() [2/2]

PluginParameter<G, A, R, ?> net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getParameter ( final int  index) throws NoSuchParameterException

Returns the PluginParameter at a given index.

Parameters
indexthe index of parameter to return; must be between
0
and
getParametersCount()
Returns
the plugin parameter
Exceptions
NoSuchParameterExceptionif the index is invalid

Definition at line 303 of file Plugin.java.

◆ getPluginAsFilter()

Filter<?, ?> net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getPluginAsFilter ( @NotNull final PluginParameters  pluginParameters)

Definition at line 447 of file Plugin.java.

◆ hasParameters()

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.hasParameters ( )

Returns whether this plugin has at least one parameter.

Returns
whether this plugin has at least one parameter

Definition at line 178 of file Plugin.java.

◆ isAutoBoot()

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isAutoBoot ( )

Returns whether this plugin is run whenever the editor starts.

Returns
whether this plugin is run whenever the editor starts

Definition at line 315 of file Plugin.java.

Referenced by net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isPluginEditorIsAutoRun().

+ Here is the caller graph for this function:

◆ isFilter()

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isFilter ( )

Returns whether this plugin is a filter.

Returns
whether this plugin is a filter

Definition at line 331 of file Plugin.java.

Referenced by net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isPluginIsEditorFilter().

+ Here is the caller graph for this function:

◆ isModified()

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isModified ( )

Returns whether the plugin contents have been modified since last save.

Returns
whether the plugin contents have been modified since last save

Definition at line 394 of file Plugin.java.

◆ isScript()

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isScript ( )

Returns whether this plugin is a stand-alone plugin.

Returns
whether this plugin is a stand-alone plugin

Definition at line 323 of file Plugin.java.

Referenced by net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isPluginIsScript().

+ Here is the caller graph for this function:

◆ iterator()

Iterator<PluginParameter<G, A, R, ?> > net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.iterator ( )

Definition at line 432 of file Plugin.java.

◆ newParameter()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.newParameter ( )

◆ notifyParametersChangedListeners()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.notifyParametersChangedListeners ( )
private

◆ removeParameter()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.removeParameter ( final int  index)

Removes a plugin parameter.

Parameters
indexthe plugin parameter's index

Definition at line 225 of file Plugin.java.

Referenced by net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.pluginEditorRemoveParameter().

+ Here is the caller graph for this function:

◆ removePluginListener()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.removePluginListener ( @NotNull final PluginListener  listener)

Removes a PluginListener to be notified about changes.

Parameters
listenerthe change listener

Definition at line 243 of file Plugin.java.

◆ resetModified()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.resetModified ( )

Marks the plugin as unmodified since last save.

Definition at line 401 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.PluginModelParser< G, A, R >.fromXML().

+ Here is the caller graph for this function:

◆ runPlugin()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.runPlugin ( @NotNull final PluginParameters  pluginParameters)

Definition at line 436 of file Plugin.java.

◆ setAutoBoot()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setAutoBoot ( final boolean  autoBoot)

Sets whether this plugin is run whenever the editor starts.

Parameters
autoBootwhether this plugin is run whenever the editor starts

Definition at line 339 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.PluginModelParser< G, A, R >.fromXML(), and net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setPluginEditorIsAutoRun().

+ Here is the caller graph for this function:

◆ setCode()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setCode ( @NotNull final String  code)

Sets the executable code of this plugin.

Parameters
codethe executable code of this plugin

Definition at line 165 of file Plugin.java.

Referenced by net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createCode(), net.sf.gridarta.plugin.PluginModelParser< G, A, R >.fromXML(), and net.sf.gridarta.plugin.PluginModel< G, A, R >.newPlugin().

+ Here is the caller graph for this function:

◆ setFile()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setFile ( @Nullable final File  file)

Sets the location to save this plugin to.

Parameters
filethe save location or
null

Definition at line 426 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.PluginModelLoader< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.loadXML().

+ Here is the caller graph for this function:

◆ setFilter()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setFilter ( final boolean  filter)

Sets whether this plugin is a filter.

Parameters
filterwhether this plugin is a filter

Definition at line 363 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.PluginModelParser< G, A, R >.fromXML(), and net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setPluginIsEditorFilter().

+ Here is the caller graph for this function:

◆ setModified()

◆ setScript()

void net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setScript ( final boolean  script)

Sets whether this plugin is a stand-alone plugin.

Parameters
scriptwhether this plugin is a stand-alone plugin

Definition at line 351 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.PluginModelParser< G, A, R >.fromXML(), and net.sf.gridarta.gui.dialog.plugin.PluginEditor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setPluginIsScript().

+ Here is the caller graph for this function:

◆ toString()

String net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.toString ( )

Definition at line 200 of file Plugin.java.

◆ toXML()

Node net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.toXML ( @NotNull final PluginParameter< G, A, R, ?>  pluginParameter)

Returns XML representation for a PluginParameter.

Parameters
pluginParameterthe plugin parameter
Returns
the plugin parameter in XML representation

Definition at line 466 of file Plugin.java.

Member Data Documentation

◆ autoBoot

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.autoBoot
private

◆ code

◆ codec

final PluginParameterCodec<G, A, R> net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.codec = new PluginParameterCodec<>()
private

The PluginParameterCodec for converting PluginParameters to or from XML representation.

Definition at line 90 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.Plugin< G, A, R >.clonePlugin(), and net.sf.gridarta.plugin.Plugin< G, A, R >.toXML().

◆ file

File net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.file
private

The location to save this plugin to; set to.

null

if the plugin has no associated location.

Definition at line 118 of file Plugin.java.

Referenced by net.sf.gridarta.plugin.Plugin< G, A, R >.clonePlugin(), net.sf.gridarta.plugin.Plugin< G, A, R >.getFile(), and net.sf.gridarta.plugin.Plugin< G, A, R >.setFile().

◆ filter

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.filter
private

◆ listeners

final Collection<PluginListener> net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.listeners = new CopyOnWriteArrayList<>()
private

◆ LOG

final Category net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.LOG = Logger.getLogger(Plugin.class)
staticprivate

◆ modified

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.modified
private

◆ name

◆ parameters

◆ pluginParameterFactory

◆ pluginParameterListener

◆ script

boolean net.sf.gridarta.plugin.Plugin< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.script
private

The documentation for this class was generated from the following file: