com.togethersoft.openapi.model.extension
Interface PasteProvider


public interface PasteProvider
extends Provider

Provider, which implements this interface is reponsible for realising paste
functionality.

Author:
TogetherSoft

Method Summary
 booleancanPaste(Entity container, Element element, Element anchor, boolean before)
          This method is called when canPaste method of Entity was called
or right before calling paste method of this provider.
 booleanisApplicable(Entity container)
          This method is called before calling any other methods.
 Stringpaste(Entity container, Element element, Element createdElement, Element anchor, boolean before)
          Provider must "paste" specified element into container.

Method Detail

canPaste

public boolean canPaste(Entity container, Element element, Element anchor, boolean before)
This method is called when canPaste method of Entity was called
or right before calling paste method of this provider.
Provider must return true, if it can paste this element.

The result of collaborative invokation of multiple providers, registered in model
is true when at least one of providers returned true and
false otherwise.

isApplicable

public boolean isApplicable(Entity container)
This method is called before calling any other methods. Provider must return
true if it can supply paste operation for this container.
It is guaranteed, that other methods of provider will be called only after
isApplicable was called and returned true.

paste

public String paste(Entity container, Element element, Element createdElement, Element anchor, boolean before)
Provider must "paste" specified element into container.
As there can be a number of applicable providers, two situations can be:

  1. element hasn't been instantiated yet; in this case createdElement will
    be null and provider must return unique name of new element; element
    will be instantiated automatically (if there is applicable UniqueNameProvider,
    which would support this unique name);
  2. element is already instantiated; in this case it will be passed to provider as
    createdElement and value, returned by provider will be ignored.

In both cases, provider must supply pasting of this element. This method is
called for all applicable providers.