Class FoldIndicator

    • Field Detail

      • textArea

        protected RTextArea textArea
        The text area whose lines we are marking with icons.
      • currentLineCount

        protected int currentLineCount
        The number of lines in the text area.
    • Constructor Detail

      • FoldIndicator

        public FoldIndicator​(RTextArea textArea)
    • Method Detail

      • createToolTip

        public JToolTip createToolTip()
        Overridden to use the editor's background if it's detected that the user isn't using white as the editor bg, but the system's tool tip background is yellow-ish.
        Overrides:
        createToolTip in class JComponent
        Returns:
        The tool tip.
      • getFoldIconBackground

        public Color getFoldIconBackground()
        Returns the color to use for the "background" of fold icons. This is be ignored if custom icons are used.
        Returns:
        The background color.
        See Also:
        setFoldIconBackground(Color)
      • getShowCollapsedRegionToolTips

        public boolean getShowCollapsedRegionToolTips()
        Returns whether tool tips are displayed showing the contents of collapsed fold regions when the mouse hovers over a +/- icon.
        Returns:
        Whether these tool tips are displayed.
        See Also:
        setShowCollapsedRegionToolTips(boolean)
      • getToolTipLocation

        public Point getToolTipLocation​(MouseEvent e)
        Positions tool tips to be aligned in the text component, so that the displayed content is shown (almost) exactly where it would be in the editor.
        Overrides:
        getToolTipLocation in class JComponent
        Parameters:
        e - The mouse location.
      • getToolTipText

        public String getToolTipText​(MouseEvent e)
        Overridden to show the content of a collapsed fold on mouse-overs.
        Overrides:
        getToolTipText in class JComponent
        Parameters:
        e - The mouse location.
      • init

        protected void init()
        Called by the constructor before the text area is set. This is a hook to allow subclasses to do any needed initialization. The default implementation does nothing.
      • setFoldIconBackground

        public void setFoldIconBackground​(Color bg)
        Sets the color to use for the "background" of fold icons. This will be ignored if custom icons are used.
        Parameters:
        bg - The new background color.
        See Also:
        getFoldIconBackground()
      • setFoldIcons

        public void setFoldIcons​(Icon collapsedIcon,
                                 Icon expandedIcon)
        Sets the icons to use to represent collapsed and expanded folds.
        Parameters:
        collapsedIcon - The collapsed fold icon. This cannot be null.
        expandedIcon - The expanded fold icon. This cannot be null.
      • setShowCollapsedRegionToolTips

        public void setShowCollapsedRegionToolTips​(boolean show)
        Toggles whether tool tips should be displayed showing the contents of collapsed fold regions when the mouse hovers over a +/- icon.
        Parameters:
        show - Whether to show these tool tips.
        See Also:
        getShowCollapsedRegionToolTips()
      • setTextArea

        public void setTextArea​(RTextArea textArea)
        Overridden so we can track when code folding is enabled/disabled.
        Parameters:
        textArea - The text area.
      • getChildViewBounds

        protected static final Rectangle getChildViewBounds​(View parent,
                                                            int line,
                                                            Rectangle editorRect)
        Returns the bounds of a child view as a rectangle, since Views tend to use Shape.
        Parameters:
        parent - The parent view of the child whose bounds we're getting.
        line - The index of the child view.
        editorRect - Returned from the text area's getVisibleEditorRect method.
        Returns:
        The child view's bounds.
      • getGutter

        protected Gutter getGutter()
        Returns the parent Gutter component.
        Returns:
        The parent Gutter.