org.oddjob.arooa.parsing
Class CutAndPasteSupport

java.lang.Object
  extended by org.oddjob.arooa.parsing.CutAndPasteSupport

public class CutAndPasteSupport
extends Object

Provide support for Cutting and Pasting from any form of parsed ArooaConfiguraion.

Author:
rob

Nested Class Summary
static class CutAndPasteSupport.ReplaceResult
          Result for replace.
 
Constructor Summary
CutAndPasteSupport(ArooaContext instanceContext)
          Constructor.
 
Method Summary
static String copy(ArooaContext context)
           
 void cut(ArooaContext childContext)
          Remove the component who's context is given.
static int cut(ArooaContext parentContext, ArooaContext childContext)
          Cut when the parent context is known.
static ConfigurationHandle paste(ArooaContext parentContext, int index, ArooaConfiguration config)
          Add any configuration to the parent context.
 ConfigurationHandle paste(int index, ArooaConfiguration config)
          Paste the ArooaConfiguration.
 CutAndPasteSupport.ReplaceResult replace(ArooaContext childContext, ArooaConfiguration config)
          Replace the childContext with the given configuration.
static CutAndPasteSupport.ReplaceResult replace(ArooaContext parentContext, ArooaContext childContext, ArooaConfiguration config)
          Replaces a child context with the contents of the configuration.
 boolean supportsPaste()
          Does this instance support pasting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CutAndPasteSupport

public CutAndPasteSupport(ArooaContext instanceContext)
Constructor.

Parameters:
instanceContext - The context of the component we are providing the support for.
Method Detail

supportsPaste

public boolean supportsPaste()
Does this instance support pasting.

Returns:

cut

public void cut(ArooaContext childContext)
         throws ArooaConfigurationException
Remove the component who's context is given.

Parameters:
childContext -
Throws:
ArooaConfigurationException

paste

public ConfigurationHandle paste(int index,
                                 ArooaConfiguration config)
                          throws ArooaParseException,
                                 ArooaConfigurationException
Paste the ArooaConfiguration.

Parameters:
index -
config -
Returns:
Throws:
ArooaParseException
ArooaConfigurationException

replace

public CutAndPasteSupport.ReplaceResult replace(ArooaContext childContext,
                                                ArooaConfiguration config)
                                         throws ArooaParseException,
                                                ArooaConfigurationException
Replace the childContext with the given configuration.

Parameters:
childContext -
config -
Returns:
Throws:
ArooaParseException
ArooaConfigurationException

cut

public static int cut(ArooaContext parentContext,
                      ArooaContext childContext)
               throws ArooaConfigurationException
Cut when the parent context is known.

Parameters:
parentContext -
childContext -
Returns:
The index the node was cut from.
Throws:
ArooaConfigurationException

paste

public static ConfigurationHandle paste(ArooaContext parentContext,
                                        int index,
                                        ArooaConfiguration config)
                                 throws ArooaParseException
Add any configuration to the parent context.

Parameters:
parentContext -
index -
Throws:
ArooaParseException

replace

public static CutAndPasteSupport.ReplaceResult replace(ArooaContext parentContext,
                                                       ArooaContext childContext,
                                                       ArooaConfiguration config)
                                                throws ArooaParseException,
                                                       ArooaConfigurationException
Replaces a child context with the contents of the configuration.

Parameters:
parentContext -
childContext -
config -
Throws:
ArooaParseException
ArooaConfigurationException

copy

public static String copy(ArooaContext context)