Class SectionStack

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, HasMembersChangedHandlers, HasSectionHeaderClickHandlers

public class SectionStack extends VLayout implements HasSectionHeaderClickHandlers
A container that manages a list of sections of widgets, each with a header. Sometimes called an "Accordion".

SectionStack can be configured so that only one section is visible at a time (similar to MS Outlook's left-hand Nav), or to allow multiple sections to be visible and share the available space. For further details, see visibilityMode.

To ensure all sections are accessible, you may need to set overflow to enable scrolling.

  • Constructor Details

    • SectionStack

      public SectionStack()
    • SectionStack

      public SectionStack(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static SectionStack getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class VLayout
    • setAnimateSections

      public SectionStack setAnimateSections(Boolean animateSections)
      If true, sections are animated during expand/collapse and addition/removal of SectionItems is likewise animated.

      If this method is called after the component has been drawn/initialized: setter for animateSections
      Parameters:
      animateSections - Should expand/collapse of section be animated?. Default value is null
      Returns:
      SectionStack instance, for chaining setter calls
      See Also:
    • getAnimateSections

      public Boolean getAnimateSections()
      If true, sections are animated during expand/collapse and addition/removal of SectionItems is likewise animated.
      Returns:
      Current animateSections value. Default value is null
      See Also:
    • setCanCloseSections

      public SectionStack setCanCloseSections(boolean canCloseSections) throws IllegalStateException
      Should sections be closeable if SectionStackSection.canClose is not explicitly specified?

      Closeable sections show a close icon button which will invoke closeSection() when clicked.

      Parameters:
      canCloseSections - New canCloseSections value. Default value is false
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCanCloseSections

      public boolean getCanCloseSections()
      Should sections be closeable if SectionStackSection.canClose is not explicitly specified?

      Closeable sections show a close icon button which will invoke closeSection() when clicked.

      Returns:
      Current canCloseSections value. Default value is false
    • setCanCollapseAll

      public SectionStack setCanCollapseAll(Boolean canCollapseAll)
      In visibilityMode VisibilityMode.MUTEX, whether to allow the last remaining expanded section to be collapsed. If false, collapsing the last open section will open the next one (wrapping around at the end).
      Parameters:
      canCollapseAll - New canCollapseAll value. Default value is true
      Returns:
      SectionStack instance, for chaining setter calls
    • getCanCollapseAll

      public Boolean getCanCollapseAll()
      In visibilityMode VisibilityMode.MUTEX, whether to allow the last remaining expanded section to be collapsed. If false, collapsing the last open section will open the next one (wrapping around at the end).
      Returns:
      Current canCollapseAll value. Default value is true
    • setCanDropComponents

      public SectionStack setCanDropComponents(Boolean canDropComponents) throws IllegalStateException
      SectionStacks provide the same default implementation of drag and drop interactions as Layouts, except that members are added as items into the section over which they're dropped.

      If you want to completely suppress the builtin drag and drop logic, but still receive drag and drop events for your own custom implementation, set Canvas.canAcceptDrop to true and canDropComponents to false on your SectionStack.

      Note : This is an advanced setting

      Overrides:
      setCanDropComponents in class Layout
      Parameters:
      canDropComponents - New canDropComponents value. Default value is true
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getCanDropComponents

      public Boolean getCanDropComponents()
      SectionStacks provide the same default implementation of drag and drop interactions as Layouts, except that members are added as items into the section over which they're dropped.

      If you want to completely suppress the builtin drag and drop logic, but still receive drag and drop events for your own custom implementation, set Canvas.canAcceptDrop to true and canDropComponents to false on your SectionStack.

      Overrides:
      getCanDropComponents in class Layout
      Returns:
      Current canDropComponents value. Default value is true
      See Also:
    • setCanReorderSections

      public SectionStack setCanReorderSections(Boolean canReorderSections) throws IllegalStateException
      Whether sections can be drag reordered by the user dragging the section header.

      Note that, with canReorderSections:true, sections with section.canReorder:false will not be able to be drag-reordered (though their index may still be changed by dropping other sections above or below them in the section stack).

      Note : This is an advanced setting

      Parameters:
      canReorderSections - New canReorderSections value. Default value is false
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCanReorderSections

      public Boolean getCanReorderSections()
      Whether sections can be drag reordered by the user dragging the section header.

      Note that, with canReorderSections:true, sections with section.canReorder:false will not be able to be drag-reordered (though their index may still be changed by dropping other sections above or below them in the section stack).

      Returns:
      Current canReorderSections value. Default value is false
    • setCanResizeSections

      public SectionStack setCanResizeSections(Boolean canResizeSections) throws IllegalStateException
      Whether sections can be drag resized by the user dragging the section header.

      Note that, with canResizeSections:true, not all sections can be resized: sections that contain only autofitting components or that are marked with section.resizeable:false will not be resizeable.

      Note : This is an advanced setting

      Parameters:
      canResizeSections - New canResizeSections value. Default value is true
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCanResizeSections

      public Boolean getCanResizeSections()
      Whether sections can be drag resized by the user dragging the section header.

      Note that, with canResizeSections:true, not all sections can be resized: sections that contain only autofitting components or that are marked with section.resizeable:false will not be resizeable.

      Returns:
      Current canResizeSections value. Default value is true
    • setCanTabToHeaders

      public SectionStack setCanTabToHeaders(Boolean canTabToHeaders) throws IllegalStateException
      If true, the headers for the sections (if shown) will be included in the page's tab order for accessibility. May be overridden at the Section level via SectionStackSection.canTabToHeader

      If unset, section headers will be focusable if SC.setScreenReaderMode() has been called. See Accessibility.

      Note : This is an advanced setting

      Parameters:
      canTabToHeaders - New canTabToHeaders value. Default value is null
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCanTabToHeaders

      public Boolean getCanTabToHeaders()
      If true, the headers for the sections (if shown) will be included in the page's tab order for accessibility. May be overridden at the Section level via SectionStackSection.canTabToHeader

      If unset, section headers will be focusable if SC.setScreenReaderMode() has been called. See Accessibility.

      Returns:
      Current canTabToHeaders value. Default value is null
    • getCloseSectionButton

      public ImgButton getCloseSectionButton()
      Note : This API is non-functional (always returns null) and exists only to make you aware that this MultiAutoChild exists. See Using AutoChildren for details.

      Automatically generated close icon button to show for canClose:true sections.
      This component will be automatically added to the controls for canClose:true sections.

      Icon source is derived from closeSectionIcon or SectionStackSection.closeIcon and related properties.

      Returns:
      null
    • setCloseSectionButtonConstructor

      public SectionStack setCloseSectionButtonConstructor(String closeSectionButtonConstructor) throws IllegalStateException
      Constructor class for closeSectionButton autochildren.
      Parameters:
      closeSectionButtonConstructor - New closeSectionButtonConstructor value. Default value is "ImgButton"
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCloseSectionButtonConstructor

      public String getCloseSectionButtonConstructor()
      Constructor class for closeSectionButton autochildren.
      Returns:
      Current closeSectionButtonConstructor value. Default value is "ImgButton"
    • setCloseSectionButtonDefaults

      public SectionStack setCloseSectionButtonDefaults(ImgButton closeSectionButtonDefaults) throws IllegalStateException
      Default properties for the closeSectionButton.

      The default configuration includes a click handler to invoke closeSection()

      Parameters:
      closeSectionButtonDefaults - New closeSectionButtonDefaults value. Default value is {...}
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getCloseSectionButtonDefaults

      public ImgButton getCloseSectionButtonDefaults()
      Default properties for the closeSectionButton.

      The default configuration includes a click handler to invoke closeSection()

      Returns:
      Current closeSectionButtonDefaults value. Default value is {...}
    • setCloseSectionIcon

      public SectionStack setCloseSectionIcon(String closeSectionIcon) throws IllegalStateException
      Default icon src for the close button for canClose:true sections.

      May be overridden by SectionStackSection.closeIcon.

      Parameters:
      closeSectionIcon - New closeSectionIcon value. Default value is "[SKIN]/actions/close.png"
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getCloseSectionIcon

      public String getCloseSectionIcon()
      Default icon src for the close button for canClose:true sections.

      May be overridden by SectionStackSection.closeIcon.

      Returns:
      Current closeSectionIcon value. Default value is "[SKIN]/actions/close.png"
      See Also:
    • setCloseSectionIconSize

      public SectionStack setCloseSectionIconSize(int closeSectionIconSize) throws IllegalStateException
      Pixel width/height for the closeSectionIcon.
      Parameters:
      closeSectionIconSize - New closeSectionIconSize value. Default value is 16
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCloseSectionIconSize

      public int getCloseSectionIconSize()
      Pixel width/height for the closeSectionIcon.
      Returns:
      Current closeSectionIconSize value. Default value is 16
    • setEditProxyConstructor

      public SectionStack setEditProxyConstructor(String editProxyConstructor) throws IllegalStateException
      Default class used to construct the EditProxy for this component when the component is first placed into edit mode.
      Overrides:
      setEditProxyConstructor in class Layout
      Parameters:
      editProxyConstructor - New editProxyConstructor value. Default value is "SectionStackEditProxy"
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getEditProxyConstructor

      public String getEditProxyConstructor()
      Default class used to construct the EditProxy for this component when the component is first placed into edit mode.
      Overrides:
      getEditProxyConstructor in class Layout
      Returns:
      Current editProxyConstructor value. Default value is "SectionStackEditProxy"
      See Also:
    • setHeaderHeight

      public SectionStack setHeaderHeight(int headerHeight) throws IllegalStateException
      Height of headers for sections.
      Parameters:
      headerHeight - New headerHeight value. Default value is 20
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getHeaderHeight

      public int getHeaderHeight()
      Height of headers for sections.
      Returns:
      Current headerHeight value. Default value is 20
    • setItemEndIndent

      public SectionStack setItemEndIndent(int itemEndIndent)
      Size, in pixels, of indentation of all member items relative to the end of the alignment axis. For instance, for left-aligned members, itemStartIndent specifies indentation for every item from the right side of the section stack.
      Parameters:
      itemEndIndent - New itemEndIndent value. Default value is undefined
      Returns:
      SectionStack instance, for chaining setter calls
      See Also:
    • getItemEndIndent

      public int getItemEndIndent()
      Size, in pixels, of indentation of all member items relative to the end of the alignment axis. For instance, for left-aligned members, itemStartIndent specifies indentation for every item from the right side of the section stack.
      Returns:
      Current itemEndIndent value. Default value is undefined
      See Also:
    • setItemIndent

      public SectionStack setItemIndent(int itemIndent)
      Size, in pixels, of indentation of all member items. Items will be offset and reduced in width by this amount. Overridden by itemStartIndent or itemEndIndent. Setting itemIndent is equivalent to setting itemStartIndent to the same amount and itemEndIndent to 0.
      Parameters:
      itemIndent - New itemIndent value. Default value is 0
      Returns:
      SectionStack instance, for chaining setter calls
      See Also:
    • getItemIndent

      public int getItemIndent()
      Size, in pixels, of indentation of all member items. Items will be offset and reduced in width by this amount. Overridden by itemStartIndent or itemEndIndent. Setting itemIndent is equivalent to setting itemStartIndent to the same amount and itemEndIndent to 0.
      Returns:
      Current itemIndent value. Default value is 0
      See Also:
    • setItemStartIndent

      public SectionStack setItemStartIndent(int itemStartIndent)
      Size, in pixels, of indentation of all member items relative to the start of the alignment axis. For instance, for left-aligned members, itemStartIndent specifies indentation for every item from the left side of the section stack. Overrides itemIndent.
      Parameters:
      itemStartIndent - New itemStartIndent value. Default value is undefined
      Returns:
      SectionStack instance, for chaining setter calls
      See Also:
    • getItemStartIndent

      public int getItemStartIndent()
      Size, in pixels, of indentation of all member items relative to the start of the alignment axis. For instance, for left-aligned members, itemStartIndent specifies indentation for every item from the left side of the section stack. Overrides itemIndent.
      Returns:
      Current itemStartIndent value. Default value is undefined
      See Also:
    • setLocateSectionsBy

      public SectionStack setLocateSectionsBy(LocatorStrategy locateSectionsBy)
      When AutoTest.getElement() is used to parse locator strings generated by AutoTest.getLocator(), how should sections within this stack be identified? By default if a section has a specified Section.name this will always be used. For sections with no name, the following options are available:
      • "title" use the title as an identifier
      • "index" use the index of the section in the sections array as an identifier
      If unset, and the section has no specified name, default behavior is to identify by title (if available), otherwise by index.

      Note : This is an advanced setting

      Parameters:
      locateSectionsBy - New locateSectionsBy value. Default value is null
      Returns:
      SectionStack instance, for chaining setter calls
    • getLocateSectionsBy

      public LocatorStrategy getLocateSectionsBy()
      When AutoTest.getElement() is used to parse locator strings generated by AutoTest.getLocator(), how should sections within this stack be identified? By default if a section has a specified Section.name this will always be used. For sections with no name, the following options are available:
      • "title" use the title as an identifier
      • "index" use the index of the section in the sections array as an identifier
      If unset, and the section has no specified name, default behavior is to identify by title (if available), otherwise by index.
      Returns:
      Current locateSectionsBy value. Default value is null
    • setLocateSectionsType

      public SectionStack setLocateSectionsType(LocatorTypeStrategy locateSectionsType)
      LocatorTypeStrategy to use when finding Sections within this section Stack.

      Note : This is an advanced setting

      Parameters:
      locateSectionsType - New locateSectionsType value. Default value is null
      Returns:
      SectionStack instance, for chaining setter calls
    • getLocateSectionsType

      public LocatorTypeStrategy getLocateSectionsType()
      LocatorTypeStrategy to use when finding Sections within this section Stack.
      Returns:
      Current locateSectionsType value. Default value is null
    • setOverflow

      public SectionStack setOverflow(Overflow overflow)
      Normal Overflow settings can be used on layouts, for example, an overflow:auto Layout will scroll if sections are resized to exceed the specified size, whereas an overflow:visible Layout will grow to accommodate the resized sections.
      Overrides:
      setOverflow in class Layout
      Parameters:
      overflow - New overflow value. Default value is "hidden"
      Returns:
      SectionStack instance, for chaining setter calls
      See Also:
    • getOverflow

      public Overflow getOverflow()
      Normal Overflow settings can be used on layouts, for example, an overflow:auto Layout will scroll if sections are resized to exceed the specified size, whereas an overflow:visible Layout will grow to accommodate the resized sections.
      Overrides:
      getOverflow in class Layout
      Returns:
      Current overflow value. Default value is "hidden"
      See Also:
    • setScrollSectionIntoView

      public SectionStack setScrollSectionIntoView(Boolean scrollSectionIntoView) throws IllegalStateException
      If an expanded or shown section expands past the current viewport and this property is true, then the viewport will auto-scroll to fit as much of the section content into the viewport without scrolling the top of the section out of the viewport.
      Parameters:
      scrollSectionIntoView - New scrollSectionIntoView value. Default value is true
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getScrollSectionIntoView

      public Boolean getScrollSectionIntoView()
      If an expanded or shown section expands past the current viewport and this property is true, then the viewport will auto-scroll to fit as much of the section content into the viewport without scrolling the top of the section out of the viewport.
      Returns:
      Current scrollSectionIntoView value. Default value is true
    • setSectionHeaderClass

      public SectionStack setSectionHeaderClass(String sectionHeaderClass) throws IllegalStateException
      Widget to use for section headers.

      Must be a subclass of either ImgSectionHeader or SectionHeader. The default class used depends on the skin; SectionHeader is the simpler and lighter-weight class and uses CSS styling rather than image-based styling, and is recommended for most use cases.

      If you create a custom section header class in Java, enable Reflection to allow it to be used.

      Alternatively, you can use the SmartClient class system to create a simple SmartClient subclass of either SectionHeader or ImgSectionHeader for use with this API - see the Skinning Guide for details.

      If you override event handlers on your custom SectionHeader or radically change it's structure such that the default event handling no longer works, you can call sectionHeaderClick() to replicate the built-in expand/collapse handling for clicking a section header.

      Note : This is an advanced setting

      Parameters:
      sectionHeaderClass - New sectionHeaderClass value. Default value is "SectionHeader"
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getSectionHeaderClass

      public String getSectionHeaderClass()
      Widget to use for section headers.

      Must be a subclass of either ImgSectionHeader or SectionHeader. The default class used depends on the skin; SectionHeader is the simpler and lighter-weight class and uses CSS styling rather than image-based styling, and is recommended for most use cases.

      If you create a custom section header class in Java, enable Reflection to allow it to be used.

      Alternatively, you can use the SmartClient class system to create a simple SmartClient subclass of either SectionHeader or ImgSectionHeader for use with this API - see the Skinning Guide for details.

      If you override event handlers on your custom SectionHeader or radically change it's structure such that the default event handling no longer works, you can call sectionHeaderClick() to replicate the built-in expand/collapse handling for clicking a section header.

      Returns:
      Current sectionHeaderClass value. Default value is "SectionHeader"
    • setShowExpandControls

      public SectionStack setShowExpandControls(Boolean showExpandControls)
      Whether to show the Expand/Collapse controls in the headers of sections. If false, hides the expand/collapse controls and, instead, treats a click anywhere on the header as if it were a click on the expand control.
      Parameters:
      showExpandControls - New showExpandControls value. Default value is true
      Returns:
      SectionStack instance, for chaining setter calls
    • getShowExpandControls

      public Boolean getShowExpandControls()
      Whether to show the Expand/Collapse controls in the headers of sections. If false, hides the expand/collapse controls and, instead, treats a click anywhere on the header as if it were a click on the expand control.
      Returns:
      Current showExpandControls value. Default value is true
    • setStyleName

      public void setStyleName(String styleName) throws IllegalStateException
      Default CSS style for the SectionStack as a whole.
      Overrides:
      setStyleName in class Canvas
      Parameters:
      styleName - New styleName value. Default value is "sectionStack"
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getStyleName

      public String getStyleName()
      Default CSS style for the SectionStack as a whole.
      Overrides:
      getStyleName in class Canvas
      Returns:
      Current styleName value. Default value is "sectionStack"
      See Also:
    • setUseGlobalSectionIDs

      public SectionStack setUseGlobalSectionIDs(Boolean useGlobalSectionIDs) throws IllegalStateException
      Should any specified SectionStackSection.ID be applied to the generated SectionHeader widget for the section as a widget ID? If set to false, SectionStackSection.ID will behave as a synonym for SectionStackSection.name.
      Parameters:
      useGlobalSectionIDs - New useGlobalSectionIDs value. Default value is false
      Returns:
      SectionStack instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getUseGlobalSectionIDs

      public Boolean getUseGlobalSectionIDs()
      Should any specified SectionStackSection.ID be applied to the generated SectionHeader widget for the section as a widget ID? If set to false, SectionStackSection.ID will behave as a synonym for SectionStackSection.name.
      Returns:
      Current useGlobalSectionIDs value. Default value is false
    • setVisibilityMode

      public SectionStack setVisibilityMode(VisibilityMode visibilityMode)
      Whether multiple sections can be expanded.

      If this method is called after the component has been drawn/initialized: Setter for visibilityMode.
      Parameters:
      visibilityMode - new visibilityMode setting. If this is VisibilityMode.MUTEX then all but the first expanded section is collapsed. Default value is "mutex"
      Returns:
      SectionStack instance, for chaining setter calls
      See Also:
    • getVisibilityMode

      public VisibilityMode getVisibilityMode()
      Whether multiple sections can be expanded.
      Returns:
      Current visibilityMode value. Default value is "mutex"
      See Also:
    • addItem

      public void addItem(String section, Canvas item, int index)
      Add a canvas as an item to a section.
      Parameters:
      section - ID or index of the section to add item to
      item - Item to insert into the section
      index - Index into section to insert item
    • closeSection

      public void closeSection(SectionStackSection section)
      Close a section. This method is invoked from close button click and will remove the section by default.
      Parameters:
      section - section to close
    • collapseSection

      public void collapseSection(int sections)
      Collapse a section or sections. This action hides all the items assigned to the section. Calling this method is equivalent to the user clicking on the SectionHeader of an expanded section.
      Parameters:
      sections - Section(s) to collapse. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section positions / names
      See Also:
    • collapseSection

      public void collapseSection(int sections, CollapseSectionCallback callback)
      Collapse a section or sections. This action hides all the items assigned to the section. Calling this method is equivalent to the user clicking on the SectionHeader of an expanded section.
      Parameters:
      sections - Section(s) to collapse. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section positions / names
      callback - callback to fire when the section has been collapsed
      See Also:
    • expandSection

      public void expandSection(int sections)
      Expands a section or sections. This action shows all the items assigned to the section. If the section is currently hidden, it is shown first and then expanded. Calling this method is equivalent to the user clicking on the SectionHeader of a collapsed section.
      Parameters:
      sections - Section(s) to expand. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names/positions.
      See Also:
    • expandSection

      public void expandSection(int sections, ExpandSectionCallback callback)
      Expands a section or sections. This action shows all the items assigned to the section. If the section is currently hidden, it is shown first and then expanded. Calling this method is equivalent to the user clicking on the SectionHeader of a collapsed section.
      Parameters:
      sections - Section(s) to expand. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names/positions.
      callback - callback to fire when the section has been expanded.
      See Also:
    • getSectionNames

      public List getSectionNames()
      Returns a list of all section names in the order in which they appear in the SectionStack.
      Returns:
      list of all section names in the order in which they appear in the SectionStack.
    • getSectionNumber

      public int getSectionNumber(String sectionName)
      Returns the position of the specified section in the SectionStack. The numbering is zero-based.
      Parameters:
      sectionName - name of a section for which you want to obtain the position.
      Returns:
      Position of the section in the SectionStack or -1 if the specified section is not a member of this SectionStack.
    • hideSection

      public void hideSection(int sections)
      Hides a section or sections. This includes the section header and its items. The space vacated by this action is reassigned to the nearest visible section item above this section. If there are no visible section items above this section, the space is reassigned to the nearest visible section item below this section.
      Parameters:
      sections - Section(s) to hide. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names / positions.
      See Also:
    • hideSection

      public void hideSection(int sections, HideSectionCallback callback)
      Hides a section or sections. This includes the section header and its items. The space vacated by this action is reassigned to the nearest visible section item above this section. If there are no visible section items above this section, the space is reassigned to the nearest visible section item below this section.
      Parameters:
      sections - Section(s) to hide. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names / positions.
      callback - to fire when the section has been hidden
      See Also:
    • moveSection

      public void moveSection(int sections, int position)
      Moves the specified section(s) to a new position in the SectionStack order. If you pass in multiple sections, then each section will be moved to newPosition in the order specified by the sections argument.
      Parameters:
      sections - Section(s) to move. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names/positions.
      position - new position index for the section(s).
    • addSectionHeaderClickHandler

      public HandlerRegistration addSectionHeaderClickHandler(SectionHeaderClickHandler handler)
      Add a SectionHeaderClick handler.

      Notification method fired when the user clicks on a section header. Returning false will cancel the default behavior (expanding / collapsing the section)

      Specified by:
      addSectionHeaderClickHandler in interface HasSectionHeaderClickHandlers
      Parameters:
      handler - the SectionHeaderClick handler
      Returns:
      HandlerRegistration used to remove this handler
    • removeItem

      public void removeItem(String section, Canvas item)
      Remove an item from a section.
      Parameters:
      section - ID or index of the section to remove item from
      item - Item to remove
    • removeSection

      public void removeSection(int sections)
      Remove a section or set of sections from the SectionStack. The removed sections' header and controls (if any) are automatically destroyed. A section's items will also be destroyed if destroyOnRemove is set on the section.
      Parameters:
      sections - Section(s) to remove. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names or indices.
      See Also:
    • sectionForItem

      public SectionStackSection sectionForItem(Canvas item)
      Search for a section that contains passed item.
      Parameters:
      item - item to show
      Returns:
      section that contains passed item.
      See Also:
    • sectionHeaderClick

      public void sectionHeaderClick(Canvas sectionHeader)
      Method intended to be called by the sectionHeader when it is clicked on.
      Parameters:
      sectionHeader - the sectionHeader clicked on
    • sectionIsExpanded

      public boolean sectionIsExpanded(int section)
      Returns true if the specified section is expanded, false if it is collapsed.
      Parameters:
      section - Section for which you want to obtain information. For this parameter, you can pass the position of the section in the SectionStack, or the name of the section.
      Returns:
      true if the section is expanded, false if it is not.
    • sectionIsVisible

      public boolean sectionIsVisible(int section)
      Returns true if the specified section is visible, false if it is not. A section is visible if it shows a header and the header is visible or if it has items and the first item is visible.
      Parameters:
      section - Section for which you want to obtain visibility information. For this parameter, you can pass the position of the section in the SectionStack, or the name of the section.
      Returns:
      true if the section is visible, false if it is not.
    • setItems

      public void setItems(String section, Canvas... items)
      Sets a new list of canvii as items into the specified section by removing the existing items, then adding the new ones. Initial items for a section should be specified using the property SectionStackSection.items.
      Parameters:
      section - ID or index of the section to set items on
      items - new items to add
    • setSectionProperties

      public void setSectionProperties(String section, SectionStackSection properties)
      Set arbitrary properties for a particular section in this SectionStack. Properties will be applied to the sectionHeader for the section.

      Note that where APIs exist to explicitly manipulate section properties these should be used in preference to this method. For example, to add or remove items in a section use addItem() or removeItem(). To change the title of a section, use setSectionTitle().

      Also note that to modify properties of items within a section, call the appropriate setter methods directly on the item you want to modify.

      Parameters:
      section - ID or index of the section to modify
      properties - properties to apply to the section.
    • setSectionTitle

      public void setSectionTitle(String section, String newTitle)
      Changes the title of a SectionHeader.
      Parameters:
      section - ID or index of the section whose title you want to change
      newTitle - new title for the SectionHeader
    • showSection

      public void showSection(int sections)
      Shows a section or sections. This includes the section header and its items. If the section is collapsed, only the header is shown. If the section is expanded, the section header and all items are shown.
      Parameters:
      sections - Section(s) to show. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names / positions.
      See Also:
    • showSection

      public void showSection(int sections, ShowSectionCallback callback)
      Shows a section or sections. This includes the section header and its items. If the section is collapsed, only the header is shown. If the section is expanded, the section header and all items are shown.
      Parameters:
      sections - Section(s) to show. For this parameter, you can pass the position of the section in the SectionStack, the name of the section, or a List of section names / positions.
      callback - callback to fire when the sections have been shown.
      See Also:
    • setDefaultProperties

      public static void setDefaultProperties(SectionStack sectionStackProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      sectionStackProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setSectionHeaderClass

      public void setSectionHeaderClass(Class<? extends Canvas> sectionHeaderClass) throws IllegalStateException
      Throws:
      IllegalStateException
    • setSections

      public void setSections(SectionStackSection... sections)
    • addSection

      public void addSection(SectionStackSection section)
      Add a section to the SectionStack.
      Parameters:
      section - the section to add
    • addSection

      public void addSection(SectionStackSection section, int position)
      Add a section to the SectionStack.
      Parameters:
      section - the section to add
      position - index for the new section
    • removeSection

      public void removeSection(String sectionID)
      Parameters:
      sectionID - the section ID
      See Also:
    • expandSection

      public void expandSection(String sectionID)
      Parameters:
      sectionID - the section ID
      See Also:
    • collapseSection

      public void collapseSection(String sectionID)
      Parameters:
      sectionID - the section ID
      See Also:
    • hideSection

      public void hideSection(String sectionID)
      Parameters:
      sectionID - the section ID
      See Also:
    • showSection

      public void showSection(String sectionID)
      Parameters:
      sectionID - the section ID
      See Also:
    • moveSection

      public void moveSection(String sectionID, int position)
      Parameters:
      sectionID - the section ID
      position - new position index for the section
      See Also:
    • sectionIsExpanded

      public boolean sectionIsExpanded(String sectionID)
      Parameters:
      sectionID - the section ID
      Returns:
      true if the section is expanded, false if it is not.
      See Also:
    • sectionIsVisible

      public boolean sectionIsVisible(String sectionID)
      Parameters:
      sectionID - the section ID
      Returns:
      true if the section is visible, false if it is not
      See Also:
    • setSectionTitle

      public void setSectionTitle(int index, String newTitle)
      Parameters:
      index - index of the section whose title you want to change
      newTitle - new title for the Section Header
      See Also:
    • getSection

      public SectionStackSection getSection(String sectionID)
      Return the SectionStackSection for a section.
      Parameters:
      sectionID - ID of the section for which you want the header
      Returns:
      the section indicated
    • getSection

      public SectionStackSection getSection(int index)
      Return the SectionStackSection for a section.
      Parameters:
      index - index of the section for which you want the header
      Returns:
      the section header indicated
    • getSections

      public SectionStackSection[] getSections()
      Return all the SectionStackSections in this SectionStack.
      Returns:
      an array of the section headers
    • setSectionProperties

      public void setSectionProperties(int index, SectionStackSection properties)
      Parameters:
      section - ID or index of the section to modify
      properties - properties to apply to the section.
      See Also:
    • revealChild

      public void revealChild(String childID)
      Reveals the child Canvas passed in by expanding the section containing that child if it is currently collapsed. If no section in this sectionStack contains the passed-in Canvas, this method has no effect

      NOTE: This is an override point.

      Overrides:
      revealChild in class Layout
      Parameters:
      childID - the global ID of the child Canvas to reveal
    • revealChild

      public void revealChild(Canvas child)
      Reveals the child Canvas passed in by expanding the section containing that child if it is currently collapsed. If no section in this sectionStack contains the passed-in Canvas, this method has no effect

      NOTE: This is an override point.

      Overrides:
      revealChild in class Layout
      Parameters:
      child - the child Canvas to reveal
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(SectionStackLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class VLayout