com.sibvisions.rad.ui.swing.impl
Class SwingScrollComponent<C extends JComponent,SC extends JComponent>

java.lang.Object
  extended by com.sibvisions.rad.ui.awt.impl.AwtResource<C>
      extended by com.sibvisions.rad.ui.awt.impl.AwtComponent<C>
          extended by com.sibvisions.rad.ui.awt.impl.AwtContainer<C>
              extended by com.sibvisions.rad.ui.swing.impl.SwingComponent<C>
                  extended by com.sibvisions.rad.ui.swing.impl.SwingScrollComponent<C,SC>
Type Parameters:
C - an instance of JComponent
SC - The Sub component JComponent
All Implemented Interfaces:
ComponentListener, FocusListener, KeyListener, MouseListener, EventListener, IAlignmentConstants, IComponent, IContainer, IResource, INamedObject
Direct Known Subclasses:
SwingScrollPanel, SwingTable, SwingTextComponent, SwingTree

public class SwingScrollComponent<C extends JComponent,SC extends JComponent>
extends SwingComponent<C>

The SwingComponent is a component with scrollbars.


Field Summary
protected  SC component
          The component.
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
bComponentListener, bFocusListener, bKeyListener, bMouseListener, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, eventSource, factory, parent
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
resource
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
protected SwingScrollComponent(C pJComponent)
          Creates a new instance of SwingScrollComponent.
 
Method Summary
protected  void addFocusListener()
          Adds a mouse listener for this component, if not already added.
protected  void addKeyListener()
          Adds a key listener for this component, if not already added.
protected  void addMouseListener()
          Adds a mouse listener for this component, if not already added.
 IColor getBackground()
          Gets the background color of this component.
 SC getComponent()
          Gets the Swing Component.
 ICursor getCursor()
          Gets the ICursor set in the component.
 IFont getFont()
          Gets the font of this component.
 IColor getForeground()
          Gets the foreground color of this component.
 String getName()
          Gets the name of the object.
 String getToolTipText()
          Returns the tooltip string that has been set with setToolTipText.
 boolean isBackgroundSet()
          Returns whether the background color has been explicitly set for this Component.
 boolean isCursorSet()
          Returns whether the cursor has been explicitly set for this Component.
 boolean isEnabled()
          Determines whether this component is enabled.
 boolean isFocusable()
          Returns whether this component can be focused.
 boolean isFontSet()
          Returns whether the font has been explicitly set for this Component.
 boolean isForegroundSet()
          Returns whether the foreground color has been explicitly set for this Component.
 void requestFocus()
          Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window.
 void setBackground(IColor pBackground)
          Sets the background color of this component.
 void setCursor(ICursor pCursor)
          Sets the cursor image to the specified cursor.
 void setEnabled(boolean pEnable)
          Enables or disables this component, depending on the value of the parameter pEnable.
 void setFocusable(boolean pFocusable)
          Sets the focusable state of this component to the specified value.
 void setFont(IFont pFont)
          Sets the IFont of this component.
 void setForeground(IColor pForeground)
          Sets the foreground color of this component.
 void setName(String pName)
          Sets the name of the object to the specified string.
 void setTabIndex(Integer pTabIndex)
          Sets the desired tab index.
 void setToolTipText(String pText)
          Registers the text to display in a tool tip.
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.SwingComponent
capture
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtContainer
add, add, add, add, addIntern, checkAdd, getComponent, getComponentCount, getLayout, indexOf, remove, remove, removeAll, removeIntern, setLayout, setLayoutIntern
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
addComponentListener, componentHidden, componentMoved, componentResized, componentShown, createImage, createMouseEvent, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, focusGained, focusLost, getBounds, getEventSource, getFactory, getHorizontalAlignment, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getVerticalAlignment, invalidateLayout, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, setBounds, setEventSource, setFactory, setHorizontalAlignment, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setParent, setPreferredSize, setSize, setStyle, setVerticalAlignment, setVisible, validate
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
equals, getResource, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.IComponent
eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBounds, getEventSource, getFactory, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getStyle, getTabIndex, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, setBounds, setEventSource, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setParent, setPreferredSize, setSize, setStyle, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Field Detail

component

protected SC extends JComponent component
The component.

Constructor Detail

SwingScrollComponent

protected SwingScrollComponent(C pJComponent)
Creates a new instance of SwingScrollComponent.

Parameters:
pJComponent - an instance of JComponent
Method Detail

addMouseListener

protected void addMouseListener()
Adds a mouse listener for this component, if not already added.

Overrides:
addMouseListener in class AwtComponent<C extends JComponent>

addKeyListener

protected void addKeyListener()
Adds a key listener for this component, if not already added.

Overrides:
addKeyListener in class AwtComponent<C extends JComponent>

addFocusListener

protected void addFocusListener()
Adds a mouse listener for this component, if not already added.

Overrides:
addFocusListener in class AwtComponent<C extends JComponent>

setToolTipText

public void setToolTipText(String pText)
Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.

Specified by:
setToolTipText in interface IComponent
Overrides:
setToolTipText in class SwingComponent<C extends JComponent>
Parameters:
pText - the string to display; if the text is null, the tool tip is turned off for this component

getToolTipText

public String getToolTipText()
Returns the tooltip string that has been set with setToolTipText.

Specified by:
getToolTipText in interface IComponent
Overrides:
getToolTipText in class SwingComponent<C extends JComponent>
Returns:
the text of the tool tip
See Also:
IComponent.setToolTipText(String)

getName

public String getName()
Gets the name of the object. Implementing classes need to make sure that no name is set during the creation of the component. A unique name (based on the position of the component in the component tree) will be generated and set when the component is added, but only if the name of the component is null.

Specified by:
getName in interface IComponent
Specified by:
getName in interface INamedObject
Overrides:
getName in class AwtComponent<C extends JComponent>
Returns:
this component's name
See Also:
IComponent.setName(java.lang.String)

setName

public void setName(String pName)
Sets the name of the object to the specified string.

Specified by:
setName in interface IComponent
Specified by:
setName in interface INamedObject
Overrides:
setName in class AwtComponent<C extends JComponent>
Parameters:
pName - the string that is to be this component's name
See Also:
IComponent.getName()

getBackground

public IColor getBackground()
Gets the background color of this component.

Specified by:
getBackground in interface IComponent
Overrides:
getBackground in class AwtComponent<C extends JComponent>
Returns:
this component's background color; if this component does not have a background color, the background color of its parent is returned
See Also:
IComponent.setBackground(javax.rad.ui.IColor)

setBackground

public void setBackground(IColor pBackground)
Sets the background color of this component.

The background color affects each component differently and the parts of the component that are affected by the background color may differ between operating systems.

Specified by:
setBackground in interface IComponent
Overrides:
setBackground in class SwingComponent<C extends JComponent>
Parameters:
pBackground - the color to become this component's color; if this parameter is null, then this component will inherit the background color of its parent
See Also:
IComponent.getBackground()

isBackgroundSet

public boolean isBackgroundSet()
Returns whether the background color has been explicitly set for this Component. If this method returns false, this Component is inheriting its background color from an ancestor.

Specified by:
isBackgroundSet in interface IComponent
Overrides:
isBackgroundSet in class AwtComponent<C extends JComponent>
Returns:
true if the background color has been explicitly set for this Component; false otherwise.

getForeground

public IColor getForeground()
Gets the foreground color of this component.

Specified by:
getForeground in interface IComponent
Overrides:
getForeground in class AwtComponent<C extends JComponent>
Returns:
this component's foreground color; if this component does not have a foreground color, the foreground color of its parent is returned
See Also:
IComponent.setForeground(javax.rad.ui.IColor)

setForeground

public void setForeground(IColor pForeground)
Sets the foreground color of this component.

Specified by:
setForeground in interface IComponent
Overrides:
setForeground in class AwtComponent<C extends JComponent>
Parameters:
pForeground - the color to become this component's foreground color; if this parameter is null then this component will inherit the foreground color of its parent
See Also:
IComponent.getForeground()

isForegroundSet

public boolean isForegroundSet()
Returns whether the foreground color has been explicitly set for this Component. If this method returns false, this Component is inheriting its foreground color from an ancestor.

Specified by:
isForegroundSet in interface IComponent
Overrides:
isForegroundSet in class AwtComponent<C extends JComponent>
Returns:
true if the foreground color has been explicitly set for this Component; false otherwise.

getCursor

public ICursor getCursor()
Gets the ICursor set in the component. If the component does not have a cursor set, the cursor of its parent is returned. If no cursor is set in the entire hierarchy, Cursor.DEFAULT_CURSOR is returned.

Specified by:
getCursor in interface IComponent
Overrides:
getCursor in class AwtComponent<C extends JComponent>
Returns:
the ICursor set in the component
See Also:
IComponent.setCursor(javax.rad.ui.ICursor)

setCursor

public void setCursor(ICursor pCursor)
Sets the cursor image to the specified cursor. This cursor image is displayed when the contains method for this component returns true for the current cursor location, and this Component is visible, displayable, and enabled. Setting the cursor of a Container causes that cursor to be displayed within all of the container's subcomponents, except for those that have a non-null cursor.

The method may have no visual effect if the Java platform implementation and/or the native system do not support changing the mouse cursor shape.

Specified by:
setCursor in interface IComponent
Overrides:
setCursor in class AwtComponent<C extends JComponent>
Parameters:
pCursor - One of the constants defined by the Cursor class; if this parameter is null then this component will inherit the cursor of its parent
See Also:
IComponent.isEnabled(), IComponent.getCursor(), Toolkit.createCustomCursor(java.awt.Image, java.awt.Point, java.lang.String), ICursor

isCursorSet

public boolean isCursorSet()
Returns whether the cursor has been explicitly set for this Component. If this method returns false, this Component is inheriting its cursor from an ancestor.

Specified by:
isCursorSet in interface IComponent
Overrides:
isCursorSet in class AwtComponent<C extends JComponent>
Returns:
true if the cursor has been explicitly set for this Component; false otherwise.

getFont

public IFont getFont()
Gets the font of this component.

Specified by:
getFont in interface IComponent
Overrides:
getFont in class AwtComponent<C extends JComponent>
Returns:
this component's font; if a font has not been set for this component, the font of its parent is returned
See Also:
IComponent.setFont(javax.rad.ui.IFont)

setFont

public void setFont(IFont pFont)
Sets the IFont of this component.

Specified by:
setFont in interface IComponent
Overrides:
setFont in class AwtComponent<C extends JComponent>
Parameters:
pFont - the IFont to become this component's font; if this parameter is null then this component will inherit the font of its parent
See Also:
IComponent.getFont()

isFontSet

public boolean isFontSet()
Returns whether the font has been explicitly set for this Component. If this method returns false, this Component is inheriting its font from an ancestor.

Specified by:
isFontSet in interface IComponent
Overrides:
isFontSet in class AwtComponent<C extends JComponent>
Returns:
true if the font has been explicitly set for this Component; false otherwise.

setFocusable

public void setFocusable(boolean pFocusable)
Sets the focusable state of this component to the specified value.

Specified by:
setFocusable in interface IComponent
Overrides:
setFocusable in class AwtComponent<C extends JComponent>
Parameters:
pFocusable - indicates whether this Component is focusable

isFocusable

public boolean isFocusable()
Returns whether this component can be focused.

Specified by:
isFocusable in interface IComponent
Overrides:
isFocusable in class AwtComponent<C extends JComponent>
Returns:
true if this Component is focusable, false otherwise.

setTabIndex

public void setTabIndex(Integer pTabIndex)
Sets the desired tab index. If several editors have the same tab index, or it is null the behaviour is technology dependend.

Specified by:
setTabIndex in interface IComponent
Overrides:
setTabIndex in class SwingComponent<C extends JComponent>
Parameters:
pTabIndex - the desired tab index.

requestFocus

public void requestFocus()
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. This component must be displayable, visible, and focusable for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this Component is the focus owner until this Component receives a FOCUS_GAINED event. If this request is denied because this Component's top-level Window cannot become the focused Window, the request will be remembered and will be granted when the Window is later focused by the user.

This method cannot be used to set the focus owner to no Component at all. Use KeyboardFocusManager.clearGlobalFocusOwner() instead.

Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use requestFocusInWindow when possible.

Specified by:
requestFocus in interface IComponent
Overrides:
requestFocus in class AwtComponent<C extends JComponent>

isEnabled

public boolean isEnabled()
Determines whether this component is enabled. An enabled component can respond to user input and generate events. Components are enabled initially by default. A component may be enabled or disabled by calling its setEnabled method.

Specified by:
isEnabled in interface IComponent
Overrides:
isEnabled in class AwtComponent<C extends JComponent>
Returns:
true if the component is enabled, false otherwise
See Also:
IComponent.setEnabled(boolean)

setEnabled

public void setEnabled(boolean pEnable)
Enables or disables this component, depending on the value of the parameter pEnable. An enabled component can respond to user input and generate events. Components are enabled initially by default.

Specified by:
setEnabled in interface IComponent
Overrides:
setEnabled in class AwtComponent<C extends JComponent>
Parameters:
pEnable - if true, this component is enabled; otherwise this component is disabled
See Also:
IComponent.isEnabled()

getComponent

public SC getComponent()
Gets the Swing Component.

Returns:
the Swing Component.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.