org.eclipse.birt.report.model.api
Class SlotHandle

java.lang.Object
  extended by org.eclipse.birt.report.model.api.ElementDetailHandle
      extended by org.eclipse.birt.report.model.api.SlotHandle

public class SlotHandle
extends ElementDetailHandle

Represents a "slot" within an element. A slot holds a collection of report items.


Field Summary
protected  int slotID
          The numeric identifier of the slot.
 
Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle
 
Constructor Summary
SlotHandle(DesignElementHandle element, int slotID)
          Constructs a handle for the slot with the given design element handle and the id of the slot.
 
Method Summary
 void add(org.eclipse.birt.report.model.core.DesignElement content)
          Deprecated. by the method add(DesignElementHandle)
 void add(DesignElementHandle content)
          Adds a report item to the slot with the given element handle.
 void add(DesignElementHandle content, int newPos)
          Adds a report item to the slot at the given position.
 void add(org.eclipse.birt.report.model.core.DesignElement content, int newPos)
          Deprecated. by the method add(DesignElementHandle, int)
 boolean canContain(DesignElementHandle content)
          Determines if the given slot can contain the content.
 boolean canContain(java.lang.String type)
          Determines if the slot can contain an element with the type of type.
 void drop(DesignElementHandle content)
          Drops a content element from the slot, and unresolve any reference property which refers the element to drop.
 void drop(int posn)
          Drops a content element at the given position from the slot, and unresolve any reference property which refers the element to drop.
 void dropAndClear(DesignElementHandle content)
          Drops a content element from the slot, and clear any reference property which refers the element to drop.
 void dropAndClear(int posn)
          Drops a content element at the given position from the slot, and clear any reference property which refers the element to drop.
 int findPosn(DesignElementHandle content)
          Returns the position of the given content in this slot.
 DesignElementHandle get(int posn)
          Returns a handle to the content element at the given position.
 java.util.List getContents()
          Returns the a list with slot contents.Items are handles to the contents and in order by position.
 int getCount()
          Returns the number of elements in the slot.
 ISlotDefn getDefn()
          Returns the definition of the current slot.
 org.eclipse.birt.report.model.core.ContainerSlot getSlot()
          Returns the internal representation of the slot.
 int getSlotID()
          Returns the numeric identifier of the slot.
 java.util.Iterator iterator()
          Gets an iterator over the items in the slot.
 void move(DesignElementHandle content, DesignElementHandle newContainer, int toSlot)
          Moves a content element into a slot in another container element.
 void move(DesignElementHandle content, DesignElementHandle newContainer, int toSlot, int newPos)
          Moves a content element into a slot in another container element at the specified position.
 java.util.List paste(DesignElementHandle content)
          Pastes a report item to the slot.
 java.util.List paste(DesignElementHandle content, int newPos)
          Pastes a report item to the slot.
 java.util.List paste(IDesignElement content)
          Pastes a report item to the slot.
 java.util.List paste(IDesignElement content, int newPos)
          Pastes a report item to the slot.
 void shift(DesignElementHandle content, int toPosn)
          Moves the position of a content element within the slot.
 
Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
getDesign, getElement, getElementHandle, getModule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

slotID

protected int slotID
The numeric identifier of the slot.

Constructor Detail

SlotHandle

public SlotHandle(DesignElementHandle element,
                  int slotID)
Constructs a handle for the slot with the given design element handle and the id of the slot. The application generally does not create a slot handle directly. Instead, it calls the getSlot( ) method on an element handle, or one of the specific methods on the handle for an element that is a container.

Parameters:
element - handle to the report element
slotID - the numeric identifier of the slot
Method Detail

add

public void add(DesignElementHandle content)
         throws ContentException,
                NameException
Adds a report item to the slot with the given element handle. The report item must not be newly created and not yet added to the design.

Parameters:
content - handle to the newly created element
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

add

public void add(DesignElementHandle content,
                int newPos)
         throws ContentException,
                NameException
Adds a report item to the slot at the given position. The item must not be newly created and not yet added to the design.

Parameters:
content - handle to the newly created element
newPos - the position index at which the content to be inserted
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

add

public void add(org.eclipse.birt.report.model.core.DesignElement content)
         throws ContentException,
                NameException
Deprecated. by the method add(DesignElementHandle)

Adds a report item to the slot. The item must not be newly created and not yet added to the design.

Parameters:
content - the newly created element
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

add

public void add(org.eclipse.birt.report.model.core.DesignElement content,
                int newPos)
         throws ContentException,
                NameException
Deprecated. by the method add(DesignElementHandle, int)

Adds a report item to the slot. The item must not be newly created and not yet added to the design.

Parameters:
content - the newly created element
newPos - the position index at which the content to be inserted.
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

paste

public java.util.List paste(DesignElementHandle content)
                     throws ContentException,
                            NameException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
content - the newly created element handle
Returns:
a list containing all errors for the pasted element
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

paste

public java.util.List paste(IDesignElement content)
                     throws ContentException,
                            NameException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
content - the newly created element
Returns:
a list containing all errors for the pasted element
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

paste

public java.util.List paste(DesignElementHandle content,
                            int newPos)
                     throws ContentException,
                            NameException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
content - the newly created element handle
newPos - the position index at which the content to be inserted.
Returns:
a list containing all errors for the pasted element
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

paste

public java.util.List paste(IDesignElement content,
                            int newPos)
                     throws ContentException,
                            NameException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.

Parameters:
content - the newly created element
newPos - the position index at which the content to be inserted.
Returns:
a list containing all errors for the pasted element
Throws:
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name

iterator

public java.util.Iterator iterator()
Gets an iterator over the items in the slot.

Returns:
an iterator over the items in the slot. The iterator is of type SlotIteratorand each item returned by the iterator's getNext( ) method is of type DesignElementHandle.

getContents

public java.util.List getContents()
Returns the a list with slot contents.Items are handles to the contents and in order by position.

Returns:
a list with slot contents, items of the list are handles to the contents.

getCount

public int getCount()
Returns the number of elements in the slot.

Returns:
the count of contents in the slot

get

public DesignElementHandle get(int posn)
Returns a handle to the content element at the given position.

Parameters:
posn - the position within the slot
Returns:
a handle to the content element

shift

public void shift(DesignElementHandle content,
                  int toPosn)
           throws ContentException
Moves the position of a content element within the slot.

Parameters:
content - handle to the content to move
toPosn - the new position
Throws:
ContentException - if the content is not in the slot, or if the to position is not valid.

move

public void move(DesignElementHandle content,
                 DesignElementHandle newContainer,
                 int toSlot)
          throws ContentException
Moves a content element into a slot in another container element.

Parameters:
content - a handle to the element to move
newContainer - a handle to the new container element
toSlot - the target slot ID where the element will be moved to.
Throws:
ContentException - if the content is not in this slot or if the new container is not, in fact, a container, or if the content cannot go into the target slot.

move

public void move(DesignElementHandle content,
                 DesignElementHandle newContainer,
                 int toSlot,
                 int newPos)
          throws ContentException
Moves a content element into a slot in another container element at the specified position.

Parameters:
content - a handle to the element to move
newContainer - a handle to the new container element
toSlot - the target slot ID where the element will be moved to.
newPos - the position to which the content will be moved. If it is greater than the current size of the target slot, the content will be appended at the end of the target slot.
Throws:
ContentException - if the content is not in this slot or if the new container is not, in fact, a container, or if the content cannot go into the target slot.

dropAndClear

public void dropAndClear(DesignElementHandle content)
                  throws SemanticException
Drops a content element from the slot, and clear any reference property which refers the element to drop.

Parameters:
content - a handle to the content to drop
Throws:
SemanticException - if the content is not within the slot

drop

public void drop(DesignElementHandle content)
          throws SemanticException
Drops a content element from the slot, and unresolve any reference property which refers the element to drop.

Parameters:
content - a handle to the content to drop
Throws:
SemanticException - if the content is not within the slot

dropAndClear

public void dropAndClear(int posn)
                  throws SemanticException
Drops a content element at the given position from the slot, and clear any reference property which refers the element to drop.

Parameters:
posn - the position of the content to drop
Throws:
SemanticException - if the position is out of range

drop

public void drop(int posn)
          throws SemanticException
Drops a content element at the given position from the slot, and unresolve any reference property which refers the element to drop.

Parameters:
posn - the position of the content to drop
Throws:
SemanticException - if the position is out of range

getSlot

public org.eclipse.birt.report.model.core.ContainerSlot getSlot()
Returns the internal representation of the slot. Use this object only for reading: make all changes through this handle.

Returns:
the internal representation of the slot

findPosn

public int findPosn(DesignElementHandle content)
Returns the position of the given content in this slot.

Parameters:
content - the content to look up
Returns:
Zero-based index of the element. Returns -1 if the content is not found

getSlotID

public int getSlotID()
Returns the numeric identifier of the slot.

Returns:
The numeric identifier of the slot.

canContain

public boolean canContain(java.lang.String type)
Determines if the slot can contain an element with the type of type. Even return value is true, doesn't mean the element can be added/moved without exceptions.

Parameters:
type - the name of the element type, like "Table", "List", etc.
Returns:
true if the slot can contain the an element with type type, otherwise false.

canContain

public boolean canContain(DesignElementHandle content)
Determines if the given slot can contain the content. Even return value is true, doesn't mean the element can be added/moved without exceptions.

Parameters:
content - the design element handle to check
Returns:
true if the slot with the given slotId can contain the content, otherwise false.

getDefn

public ISlotDefn getDefn()
Returns the definition of the current slot.

Returns:
the definition of the slot


Copyright © 2008 Actuate Corp. All rights reserved.