org.oddjob.arooa.parsing
Class DragContext

java.lang.Object
  extended by org.oddjob.arooa.parsing.DragContext
All Implemented Interfaces:
ArooaConfiguration, DragPoint

public class DragContext
extends Object
implements DragPoint

A DragPoint for an ArooaContext.

This implementation of a DragPoint will provide drag and drop support for a component from it's context.

Author:
rob

Constructor Summary
DragContext(ArooaContext context)
          Only constructor.
 
Method Summary
 DragTransaction beginChange(ChangeHow how)
          Begin a change.
 String copy()
          Provide a copy of the configuration at from this DragPoint as XML.
 void cut()
          Remove this DragPoint from it's underlying configuration and remove any components in the configuration from the ComponentPool
 ConfigurationHandle parse(ArooaContext parentContext)
          Parse the encapsulated configuration.
 void paste(int index, String config)
          Parse an XML Text configuration and add the resultant component to this DragPoint with the given index.
 boolean supportsCut()
          True if this DragPoint supports the cut operation.
 boolean supportsPaste()
          True if this DragPoint supports the paste operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DragContext

public DragContext(ArooaContext context)
Only constructor.

Parameters:
context - The context of the component. Must not be null.
Method Detail

beginChange

public DragTransaction beginChange(ChangeHow how)
Description copied from interface: DragPoint
Begin a change. Changes must happen in a transaction because when dragging a component within the same session the cut must be done before the paste otherwise duplicate IDs would occur.

Specified by:
beginChange in interface DragPoint
Parameters:
how - Should an existing transaction be in progress or not.
Returns:
A transaction. Never null.

parse

public ConfigurationHandle parse(ArooaContext parentContext)
                          throws ArooaParseException
Description copied from interface: ArooaConfiguration
Parse the encapsulated configuration.

Specified by:
parse in interface ArooaConfiguration
Parameters:
parentContext - The parent context to use.
Returns:
A ConfigurationHandle.
Throws:
ArooaParseException

supportsPaste

public boolean supportsPaste()
Description copied from interface: DragPoint
True if this DragPoint supports the paste operation.

Specified by:
supportsPaste in interface DragPoint
Returns:
true/false.

supportsCut

public boolean supportsCut()
Description copied from interface: DragPoint
True if this DragPoint supports the cut operation.

Specified by:
supportsCut in interface DragPoint
Returns:
true/false.

copy

public String copy()
Description copied from interface: DragPoint
Provide a copy of the configuration at from this DragPoint as XML.

Specified by:
copy in interface DragPoint
Returns:
Text XML.

cut

public void cut()
Description copied from interface: DragPoint
Remove this DragPoint from it's underlying configuration and remove any components in the configuration from the ComponentPool

This operation must be done within the context of a transaction.

Specified by:
cut in interface DragPoint

paste

public void paste(int index,
                  String config)
Description copied from interface: DragPoint
Parse an XML Text configuration and add the resultant component to this DragPoint with the given index.

This operation must be done within the context of a transaction.

Specified by:
paste in interface DragPoint
Parameters:
index - The index. -1 will append.
config - The configuration.