Class SlotHandle
java.lang.Object
org.eclipse.birt.report.model.api.ElementDetailHandle
org.eclipse.birt.report.model.api.SlotHandle
Represents a "slot" within an element. A slot holds a collection of report
items.
-
Field Summary
FieldsFields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle
-
Constructor Summary
ConstructorsConstructorDescriptionSlotHandle
(DesignElementHandle element, int slotID) Constructs a handle for the slot with the given design element handle and the id of the slot. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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) Deprecated.void
add
(org.eclipse.birt.report.model.core.DesignElement content, int newPos) Deprecated.by the methodadd(DesignElementHandle, int)
boolean
canContain
(String type) Determines if the slot can contain an element with the type oftype
.boolean
canContain
(DesignElementHandle content) Determines if the given slot can contain thecontent
.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
drop
(DesignElementHandle content) Drops a content element from the slot, and unresolve 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.void
dropAndClear
(DesignElementHandle content) Drops a content element 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.get
(int posn) Returns a handle to the content element at the given position.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.getDefn()
Returns the definition of the current slot.org.eclipse.birt.report.model.core.ContainerSlot
getSlot()
Returns the internal representation of the slot.int
Returns the numeric identifier of the slot.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.paste
(IDesignElement content) Pastes a report item to the slot.paste
(IDesignElement content, int newPos) Pastes a report item to the slot.paste
(DesignElementHandle content) Pastes a report item to the slot.paste
(DesignElementHandle 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
-
Field Details
-
slotID
protected int slotIDThe numeric identifier of the slot.
-
-
Constructor Details
-
SlotHandle
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 thegetSlot( )
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 elementslotID
- the numeric identifier of the slot
-
-
Method Details
-
add
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 slotNameException
- if the element has a duplicate or illegal name
-
add
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 elementnewPos
- the position index at which the content to be inserted- Throws:
ContentException
- if the element is not allowed in the slotNameException
- if the element has a duplicate or illegal name
-
add
@Deprecated public void add(org.eclipse.birt.report.model.core.DesignElement content) throws ContentException, NameException Deprecated.by the methodadd(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 slotNameException
- if the element has a duplicate or illegal name
-
add
@Deprecated public void add(org.eclipse.birt.report.model.core.DesignElement content, int newPos) throws ContentException, NameException Deprecated.by the methodadd(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 elementnewPos
- the position index at which the content to be inserted.- Throws:
ContentException
- if the element is not allowed in the slotNameException
- if the element has a duplicate or illegal name
-
paste
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 slotNameException
- if the element has a duplicate or illegal name
-
paste
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 slotNameException
- if the element has a duplicate or illegal name
-
paste
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 handlenewPos
- 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 slotNameException
- if the element has a duplicate or illegal name
-
paste
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 elementnewPos
- 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 slotNameException
- if the element has a duplicate or illegal name
-
iterator
Gets an iterator over the items in the slot.- Returns:
- an iterator over the items in the slot. The iterator is of type
SlotIterator
and each item returned by the iterator'sgetNext( )
method is of typeDesignElementHandle
.
-
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
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
Moves the position of a content element within the slot.- Parameters:
content
- handle to the content to movetoPosn
- 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 movenewContainer
- a handle to the new container elementtoSlot
- 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 movenewContainer
- a handle to the new container elementtoSlot
- 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
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
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
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
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
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
Determines if the slot can contain an element with the type oftype
. Even return value istrue
, 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 withtype
type, otherwisefalse
.
-
canContain
Determines if the given slot can contain thecontent
. Even return value istrue
, 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 givenslotId
can contain thecontent
, otherwisefalse
.
-
getDefn
Returns the definition of the current slot.- Returns:
- the definition of the slot
-
add(DesignElementHandle)