Class ContextBar.Context

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CodeType getCodeType()
      If the current target is a code editor, returns the CodeType of the code being edited.
      Deck getDeck()
      If the target is a page in a deck, returns the Deck.
      StrangeEonsEditor getEditor()
      If the target is within a Strange Eons editor tab, returns the editor.
      Game getGame()
      If the target is part of an editor associated with a particular game, returns the game.
      GameComponent getGameComponent()
      If the target is part of an editor for a game component, returns the game component.
      PageView getPageView()
      If the target is a page in a deck, returns the target as a page view instance.
      ContextBar getSource()
      Returns the context bar that this context information is associated with.
      javax.swing.JComponent getTarget()
      Returns the control that the bar is attached to.
      boolean isMarkupTarget()
      Returns true if the target component is also the current markup target.
      boolean isMultipleLineTextEditor()
      Returns true if the context bar is attached to some kind of text editor, and that editor supports more than a single line of text.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getSource

        public ContextBar getSource()
        Returns the context bar that this context information is associated with.
        Returns:
        the context bar whose context is being described
      • getTarget

        public javax.swing.JComponent getTarget()
        Returns the control that the bar is attached to. In some cases, this may be a child of the component that you expect. For example, the context bar attaches to the editor child component of an editable combo box, not the combo box itself.
        Returns:
        the control the bar is attached to
      • isMarkupTarget

        public boolean isMarkupTarget()
        Returns true if the target component is also the current markup target.
        Returns:
        if the bar is attached to the markup target
      • isMultipleLineTextEditor

        public boolean isMultipleLineTextEditor()
        Returns true if the context bar is attached to some kind of text editor, and that editor supports more than a single line of text. For example, a context bar attached to a JTextField would return false, while a context bar attached to a JTextArea would return true.
        Returns:
        true if the context bar is attached to a multi-line text editor
      • getCodeType

        public CodeType getCodeType()
        If the current target is a code editor, returns the CodeType of the code being edited. Otherwise, returns null. The following code can be used to verify that the target is a valid markup target but is not used to edit code (i.e., that it is used to enter markup for a game component):
         if( context.isMarkupTarget() && context.getCodeType() == null ) {
             // the target is (very likely) a text field for a game component
         }
         
        Returns:
        the type of code being edited, or null; if code is being edited but the type is indeterminate, script code (CodeType.JAVASCRIPT) is assumed
      • getEditor

        public StrangeEonsEditor getEditor()
        If the target is within a Strange Eons editor tab, returns the editor. Otherwise returns null.
        Returns:
        the editor affected by the target, or null
      • getGameComponent

        public GameComponent getGameComponent()
        If the target is part of an editor for a game component, returns the game component. Otherwise, returns null.
        Returns:
        the game component affected by the markup target, or null
      • getGame

        public Game getGame()
        If the target is part of an editor associated with a particular game, returns the game. Otherwise, returns null.
        Returns:
        the game of the game component affected by the markup target, or null
      • getPageView

        public PageView getPageView()
        If the target is a page in a deck, returns the target as a page view instance. Otherwise, returns null.
        Returns:
        the page view represented by the target, or null
      • getDeck

        public Deck getDeck()
        If the target is a page in a deck, returns the Deck. Otherwise returns null.
        Returns:
        the deck represented by the target, or null