Package snap.view

Class Label

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable
Direct Known Subclasses:
ListCell

public class Label extends ParentView
A class to display simple text with associcated image(s).
  • Field Details

  • Constructor Details

    • Label

      public Label()
      Creates a label node.
    • Label

      public Label(String aStr)
      Creates a label node with given text.
    • Label

      public Label(View aGrph, String aStr, View aGrphAfter)
      Creates a label node with given graphic, text, and after graphic.
  • Method Details

    • getText

      public String getText()
      Returns the text.
      Overrides:
      getText in class View
    • setText

      public void setText(String aValue)
      Sets the text.
      Overrides:
      setText in class View
    • getImage

      public Image getImage()
      Returns the image.
    • setImage

      public void setImage(Image anImage)
      Sets the image.
    • getImageAfter

      public Image getImageAfter()
      Returns the image after text.
    • setImageAfter

      public void setImageAfter(Image anImage)
      Sets the image after text.
    • getTextFill

      public Paint getTextFill()
      Returns the text fill.
    • setTextFill

      public void setTextFill(Paint aPaint)
      Sets the text fill.
    • getTextStyle

      public TextStyle getTextStyle()
      Returns the text style.
    • setTextStyle

      public void setTextStyle(TextStyle textStyle)
      Sets the text style.
    • setTextStylePropsString

      public void setTextStylePropsString(String propsString)
      Sets the text style to style updated for props string.
    • isStringViewSet

      public boolean isStringViewSet()
      Returns the StringView.
    • getStringView

      public StringView getStringView()
      Returns the StringView.
    • getGraphic

      public View getGraphic()
      Returns the graphic node.
    • setGraphic

      public void setGraphic(View aGraphic)
      Sets the graphic node.
    • getGraphicAfter

      public View getGraphicAfter()
      Returns the graphic node after the text.
    • setGraphicAfter

      public void setGraphicAfter(View aGraphic)
      Sets the graphic node after the text.
    • getImageName

      public String getImageName()
      Returns the image name, if loaded from local resource.
    • setImageName

      public void setImageName(String aName)
      Sets the image name, if loaded from local resource.
    • isEditable

      public boolean isEditable()
      Returns whether label text is editable.
    • setEditable

      public void setEditable(boolean aValue)
      Sets whether label text is editable.
    • isEditing

      public boolean isEditing()
      Returns whether editable.
    • setEditing

      public void setEditing(boolean aValue)
      Sets editing.
    • getEditor

      public TextField getEditor()
      Returns the editor.
    • editorFiredAction

      protected void editorFiredAction()
      Called when editor fires action.
    • editorFocusChanged

      protected void editorFocusChanged(TextField editor)
      Called when editor focus changes.
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Handle events.
      Overrides:
      processEvent in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Layout children.
      Overrides:
      layoutImpl in class ParentView
    • getValuePropName

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

      public void setAlign(Pos aPos)
      Override to forward to StringView.
      Overrides:
      setAlign in class View
    • toXMLView

      public 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
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class PropObject