Class ScrollGroup
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ScrollGroup

public class netscape.application.ScrollGroup
    extends netscape.application.View
    implements netscape.application.ScrollBarOwner
{
    /* Fields
     */
    public final static int ALWAYS_DISPLAY;
    public final static int AS_NEEDED_DISPLAY;
    public final static int NEVER_DISPLAY;

    /* Constructors
     */
    public ScrollGroup();
    public ScrollGroup(Rect);
    public ScrollGroup(int, int, int, int);

    /* Methods
     */
    public Border border();
    public View contentView();
    protected ScrollBar createScrollBar(boolean);
    protected ScrollView createScrollView();
    public void decode(Decoder);
    public void describeClassInfo(ClassInfo);
    public void drawContents();
    public void drawView(Graphics);
    public void encode(Encoder);
    public boolean hasHorizScrollBar();
    public boolean hasVertScrollBar();
    public ScrollBar horizScrollBar();
    public int horizScrollBarDisplay();
    public boolean horizScrollBarIsVisible();
    public boolean isTransparent();
    public void layoutView(int, int);
    public Size minSize();
    public void scrollBarDidBecomeActive(ScrollBar);
    public void scrollBarDidBecomeInactive(ScrollBar);
    public void scrollBarWasDisabled(ScrollBar);
    public void scrollBarWasEnabled(ScrollBar);
    public ScrollView scrollView();
    public void setBackgroundColor(Color);
    public void setBorder(Border);
    public void setContentView(View);
    public void setHasHorizScrollBar(boolean);
    public void setHasVertScrollBar(boolean);
    public void setHorizScrollBarDisplay(int);
    public void setVertScrollBarDisplay(int);
    public ScrollBar vertScrollBar();
    public int vertScrollBarDisplay();
    public boolean vertScrollBarIsVisible();
}
View subclass that automates the use of a ScrollView and its controlling ScrollBars. You can create a ScrollView and ScrollBars and connect them to each other, or you can create a ScrollGroup that does this work for you. The ScrollGroup places the vertical ScrollBar to the ScrollView's right, and the horizontal ScrollBar below the ScrollView (if configured to have ScrollBars). It draws the specified Border around its ScrollView. If you want to use different ScrollBar positioning, such as different sides of the ScrollView or non-abutting, you can create a ScrollGroup subclass or simply instantiate and position the ScrollView and ScrollBars yourself.
See Also:
ScrollBar, ScrollView

Fields

NEVER_DISPLAY

  public final static int NEVER_DISPLAY
Option for the ScrollGroup to never show a ScrollBar.

ALWAYS_DISPLAY

  public final static int ALWAYS_DISPLAY
Option for the ScrollGroup to always show a ScrollBar.

AS_NEEDED_DISPLAY

  public final static int AS_NEEDED_DISPLAY
Option for the ScrollGroup to only display a ScrollBar if the contentView does not fit within the ScrollView (i.e. if the ScrollBar is active).

Constructors

ScrollGroup

  public ScrollGroup()
Constructs a ScrollGroup with origin (0, 0) and zero width and height.

ScrollGroup

  public ScrollGroup(Rect rect)
Constructs a ScrollGroup with bounds rect.

ScrollGroup

  public ScrollGroup(int x,
                     int y,
                     int width,
                     int height)
Constructs a ScrollGroup with bounds (x, y, width, height).

Methods

minSize

  public Size minSize()
Returns the ScrollGroup's minimum size. Returns the value set by setMinSize(), or computes the minimum size based on the vertScrollBarDisplay() and horizScrollBarDisplay() settings.
Overrides:
minSize in class View

isTransparent

  public boolean isTransparent()
Overridden to return false unless any of the ScrollGroup's subviews are transparent.
Overrides:
isTransparent in class View

setBorder

  public void setBorder(Border newBorder)
Sets the ScrollGroup's interior Border, that is, the Border that surrounds the ScrollView. Calls layoutView() to properly position the ScrollGroup's other Views.
See Also:
Border

border

  public Border border()
Returns the ScrollGroup's interior Border.
See Also:
setInteriorBorder

createScrollView

  protected ScrollView createScrollView()
Creates a new ScrollView.

scrollView

  public ScrollView scrollView()
Returns the ScrollGroup's ScrollView.

createScrollBar

  protected ScrollBar createScrollBar(boolean horizontal)
Creates a new ScrollBar with the correct orientation.

setHasVertScrollBar

  public void setHasVertScrollBar(boolean flag)
Sets the vertical ScrollBar's behavior. This method exists for backward compatibility. Equivalent to the following code:
    if (flag)
        setVertScrollBarDisplay(ALWAYS_DISPLAY);
    else
        setVertScrollBarDisplay(NEVER_DISPLAY);

hasVertScrollBar

  public boolean hasVertScrollBar()
Returns true if the setting for the vertical ScrollBar equals ALWAYS_DISPLAY.
See Also:
vertScrollBarDisplay

setVertScrollBarDisplay

  public void setVertScrollBarDisplay(int flag)
Sets the vertical ScrollBar's behavior. The ScrollBar can be configured to display when needed, to never display, or to always display. Calls layoutView() to properly position the ScrollGroup's other Views.
See Also:
ALWAYS_DISPLAY, NEVER_DISPLAY, AS_NEEDED_DISPLAY, setHorizScrollBarDisplay

vertScrollBarDisplay

  public int vertScrollBarDisplay()
Returns the vertical ScrollBar's behavior setting.
See Also:
setVertScrollBarDisplay

vertScrollBar

  public ScrollBar vertScrollBar()
Returns the ScrollGroup's vertical ScrollBar.

setHasHorizScrollBar

  public void setHasHorizScrollBar(boolean flag)
Sets the horizontal ScrollBar's behavior. This method exists for backward compatibility. Equivalent to the following code:
    if (flag)
        setHorizScrollBarDisplay(ALWAYS_DISPLAY);
    else
        setHorizScrollBarDisplay(NEVER_DISPLAY);

hasHorizScrollBar

  public boolean hasHorizScrollBar()
Returns true if the setting for the horizontal ScrollBar equals ALWAYS_DISPLAY.
See Also:
horizScrollBarDisplay

setHorizScrollBarDisplay

  public void setHorizScrollBarDisplay(int flag)
Sets the horizontal ScrollBar's behavior. The ScrollBar can be configured to display when needed, to never display, or to always display. Calls layoutView() to properly position the ScrollGroup's other Views.
See Also:
ALWAYS_DISPLAY, NEVER_DISPLAY, AS_NEEDED_DISPLAY, setHorizScrollBarDisplay

horizScrollBarDisplay

  public int horizScrollBarDisplay()
Returns the horizontal ScrollBar's behavior setting.
See Also:
setHorizScrollBarDisplay

horizScrollBar

  public ScrollBar horizScrollBar()
Returns the ScrollGroup's horizontal ScrollBar.

drawView

  public void drawView(Graphics g)
Draws the ScrollGroup's interior Border.
Overrides:
drawView in class View

drawContents

  public void drawContents()
Draws the ScrollView portion of the ScrollGroup.

setContentView

  public void setContentView(View aView)
Convenience method for making aView the ScrollView's content View. Calls layoutView() to properly position the ScrollGroup's other Views.
See Also:
setContentView

contentView

  public View contentView()
Convenience method for retrieving the ScrollGroup's ScrollView's contentView.
See Also:
contentView

setBackgroundColor

  public void setBackgroundColor(Color aColor)
Convenience method for setting the ScrollGroup's ScrollView's background Color.
See Also:
setBackgroundColor

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the ScrollGroup class' information.
Overrides:
describeClassInfo in class View
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Encodes the ScrollGroup instance.
Overrides:
encode in class View
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Decodes the ScrollGroup instance.
Overrides:
decode in class View
See Also:
decode

scrollBarDidBecomeActive

  public void scrollBarDidBecomeActive(ScrollBar aScrollBar)
Implemented to catch ScrollBar activation and ensure their proper display.
See Also:
ScrollBarOwner

scrollBarDidBecomeInactive

  public void scrollBarDidBecomeInactive(ScrollBar aScrollBar)
Implemented to catch ScrollBar deactivation and ensure their removal, if necessary.
See Also:
ScrollBarOwner

scrollBarWasEnabled

  public void scrollBarWasEnabled(ScrollBar aScrollBar)
Implemented to catch ScrollBar enabling and ensure their display.
See Also:
ScrollBarOwner

scrollBarWasDisabled

  public void scrollBarWasDisabled(ScrollBar aScrollBar)
Implemented to catch ScrollBar disabling and ensure their removal, if necessary.
See Also:
ScrollBarOwner

vertScrollBarIsVisible

  public boolean vertScrollBarIsVisible()
Returns true if the vertical ScrollBar is visible. Equivalent to
    return vertScrollBar().isInViewHierarchy();

horizScrollBarIsVisible

  public boolean horizScrollBarIsVisible()
Returns true if the horizontal ScrollBar is visible. Equivalent to
    return horizScrollBar().isInViewHierarchy();

layoutView

  public void layoutView(int x,
                         int y)
Overridden to implement special ScrollGroup subview layout behavior.
Overrides:
layoutView in class View

All Packages  Class Hierarchy  This Package  Previous  Next  Index