com.f1j.ss.datarange
Interface AbstractSection

All Known Subinterfaces:
Section, Section, SectionSet

public interface AbstractSection
extends Lockable

This interface defines the API for the sections that can be created in the row and column areas of a DataRange. This interface may represent either a single section or a set of adjacent sections.

Since:
12.0
See Also:
DataRange

Method Summary
 Section createParent(java.lang.String name)
          Creates a new section as a parent of this section.
 void delete()
          Deletes this section and the cells it contains.
 int getEnd()
          Returns the location of the last row or column in this section.
 Section getParent()
          Returns the parent section of this section.
 int getSize()
          Returns the number or rows or columns that make up this section.
 int getStart()
          Returns the location of the first row or column in this section.
 Section insertAfter()
          Inserts a new row or column after this section.
 Section insertBefore()
          Inserts a new row or column before this section.
 boolean isDeleted()
          Returns whether this section has been deleted from the DataRange.
 boolean isInRowArea()
          Returns whether this section is in the row area.
 boolean isLeaf()
          Returns whether this section is a leaf, or inner-most anonymous section.
 boolean isRoot()
          Returns whether this section is a root, or outer-most, section.
 void remove(boolean promoteChildren)
          Removes this section from its parent.
 
Methods inherited from interface com.f1j.util.Lockable
getLock, releaseLock
 

Method Detail

createParent

public Section createParent(java.lang.String name)
                     throws SelectionException,
                            com.f1j.util.InvalidNameException

Creates a new section as a parent of this section. The new section will be the same size as this child section.

If this child section is named, then a name must be specified for the new section or an InvalidNameException will be thrown.

Parameters:
name - The name of the new parent section.
Returns:
the new parent section.
Throws:
SelectionException - if a parent section cannot be created for this object--for example, if this object represents a root section.
com.f1j.util.InvalidNameException - if the specified name is invalid or the specified name conflicts with another section name at the same level.
Since:
12.0

delete

public void delete()
            throws AccessDeniedException,
                   DataConflictException

Deletes this section and the cells it contains. This section and its children are then no longer valid within the DataRange.

If this is a row section, this method causes cells below this section to be moved upward to fill the space this section occupied. If this is a column section, this method causes cells to the right of this section to be moved leftward.

Throws:
AccessDeniedException - if the operation is disallowed due to sheet protection.
DataConflictException - if the operation would conflict with existing data on the sheet.
Since:
12.0

getEnd

public int getEnd()
Returns the location of the last row or column in this section. This location is an offset from the left side of the DataRange for sections within the column area. This location is an offset from the top of the DataRange for sections within the row area.
Returns:
the location of the last row or column in this section, or -1 if this object represents a set of zero sections.
Since:
12.0

getParent

public Section getParent()
Returns the parent section of this section. If this section is the root section, then null is returned.
Returns:
the parent Section of this section.
Since:
12.0

getSize

public int getSize()
Returns the number or rows or columns that make up this section. This value is equivalent to getEnd() - getStart() + 1.
Returns:
the number or rows or columns that make up this section, or 0 if this object represents a set of zero sections.
Since:
12.0

getStart

public int getStart()
Returns the location of the first row or column in this section. For sections within the column area, this location is an offset from the left side of the DataRange. For sections within the row area, this location is an offset from the top of the DataRange.
Returns:
the location of the first row or column in this section, or 0 if this object represents a set of zero sections.
Since:
12.0

insertBefore

public Section insertBefore()
                     throws InvalidStateException
Inserts a new row or column before this section. This has the effect of inserting a new leaf section before this section.
Throws:
SelectionException - if a new section cannot be insert before this object--for example, if this object represents a root section.
DataConflictException - if this operation would conflict with the layout of other data on the sheet.
Since:
12.0

insertAfter

public Section insertAfter()
                    throws InvalidStateException
Inserts a new row or column after this section. This has the effect of inserting a new leaf section after this section.
Throws:
SelectionException - if a new section cannot be inserted after this object--for example, if this object represents a root section.
DataConflictException - if this operation would conflict with the layout of other data on the sheet.
Since:
12.0

isDeleted

public boolean isDeleted()
Returns whether this section has been deleted from the DataRange.
Returns:
true if this section has been deleted.
Since:
12.0

isInRowArea

public boolean isInRowArea()
Returns whether this section is in the row area. If not, then it MUST be in the column area.
Returns:
boolean. true = if section is in the row area.
Since:
12.0
See Also:
DataRange

isLeaf

public boolean isLeaf()
Returns whether this section is a leaf, or inner-most anonymous section.
Since:
12.0

isRoot

public boolean isRoot()
Returns whether this section is a root, or outer-most, section.
Returns:
boolean. true = if section is a root.
Since:
12.0
See Also:
DataRange

remove

public void remove(boolean promoteChildren)
            throws SelectionException,
                   DuplicateNameException

Removes this section from its parent. The section is then no longer valid within the DataRange.

If this is a root section, then this will remove the DataRange from the sheet and the DataRange is no longer valid.

Parameters:
promoteChildren - Specifies whether children of the removed section will be retained and promoted to the removed section's level.
Throws:
SelectionException - if the requested operation is not valid for this section. For example, this method does not apply to leaf sections, and promoteChildren cannot be true for a root section.
DuplicateNameException - if promoteChildren is true but promoting the children would cause a duplicate name.
Since:
12.0