Package snap.view

Class TitleView

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable, ViewHost

public class TitleView extends ParentView implements ViewHost
A view to attach a title to another view.
  • Field Details

  • Constructor Details

    • TitleView

      public TitleView()
      Constructor.
    • TitleView

      public TitleView(String aTitle)
      Constructor for given title.
    • TitleView

      public TitleView(String aTitle, View aView)
      Constructor for given title and content view.
  • Method Details

    • getLabel

      public Label getLabel()
      Returns the label.
    • getText

      public String getText()
      Override to get from label.
      Overrides:
      getText in class View
    • setText

      public void setText(String aTitle)
      Override to set to label.
      Overrides:
      setText in class View
    • getContent

      public View getContent()
      Returns the content.
    • setContent

      public void setContent(View aView)
      Sets the content.
    • getTitleStyle

      public TitleView.TitleStyle getTitleStyle()
      Returns the title style.
    • setTitleStyle

      public void setTitleStyle(TitleView.TitleStyle titleStyle)
      Sets the title style.
    • isCollapsible

      public boolean isCollapsible()
      Returns whether title view is collapsible.
    • setCollapsible

      public void setCollapsible(boolean aValue)
      Sets whether title view is collapsible.
    • isExpanded

      public boolean isExpanded()
      Returns whether title view is expanded.
    • setExpanded

      public void setExpanded(boolean aValue)
      Sets whether title view is expanded.
    • setExpandedAnimated

      public void setExpandedAnimated(boolean aValue)
      Sets the expanded animated.
    • toggleExpandedAnimated

      protected void toggleExpandedAnimated(ViewEvent anEvent)
      Called when Label receives a MousePress.
    • getGuestCount

      public int getGuestCount()
      ViewHost method: Override to return 1 if content is present.
      Specified by:
      getGuestCount in interface ViewHost
    • getGuest

      public View getGuest(int anIndex)
      ViewHost method: Override to return content (and complain if index beyond 0).
      Specified by:
      getGuest in interface ViewHost
    • addGuest

      public void addGuest(View aChild, int anIndex)
      ViewHost method: Override to set content.
      Specified by:
      addGuest in interface ViewHost
    • removeGuest

      public View removeGuest(int anIndex)
      ViewHost method: Override to clear content (and complain if index beyond 0).
      Specified by:
      removeGuest in interface ViewHost
    • isContentShowing

      public boolean isContentShowing()
      Returns whether content is showing.
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Override to return preferred width of content.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Override to return preferred height of content.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to layout content.
      Overrides:
      layoutImpl in class ParentView
    • getCollapseGraphic

      public View getCollapseGraphic()
      Returns an image of a down arrow.
    • setPadding

      public void setPadding(Insets theIns)
      Override to forward to area.
      Overrides:
      setPadding in class View
    • getPropValue

      public Object getPropValue(String aPropName)
      Override to handle additional properties.
      Overrides:
      getPropValue in class ParentView
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Override to handle additional properties.
      Overrides:
      setPropValue in class ParentView
    • getValuePropName

      protected String getValuePropName()
      Returns a mapped property name name.
      Overrides:
      getValuePropName in class View
    • toXMLView

      protected XMLElement toXMLView(XMLArchiver anArchiver)
      XML archival.
      Overrides:
      toXMLView in class ParentView
    • fromXMLView

      protected void fromXMLView(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Overrides:
      fromXMLView in class ParentView