com.sibvisions.rad.ui.qt.impl.menu
Class QtMenuItem<C extends QAction>

java.lang.Object
  extended by com.sibvisions.rad.ui.qt.impl.QtResource<C>
      extended by com.sibvisions.rad.ui.qt.impl.QtComponentBase<C>
          extended by com.sibvisions.rad.ui.qt.impl.menu.QtMenuItem<C>
Type Parameters:
C - a QAction
All Implemented Interfaces:
IActionComponent, IIcon, ILabel, IAlignmentConstants, IComponent, IResource, IMenuItem
Direct Known Subclasses:
QtCheckBoxMenuItem

public class QtMenuItem<C extends QAction>
extends QtComponentBase<C>
implements IMenuItem

The QtMenuItem is the IMenuItem implementation for QT.

See Also:
QAction, IMenuItem

Field Summary
protected  IFactory factory
          The factory that created this component.
protected  IImage image
          the image.
protected  IContainer parent
          Container where the component is added.
 
Fields inherited from class com.sibvisions.rad.ui.qt.impl.QtResource
resource
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
  QtMenuItem()
          Creates a new instance of QtMenuItem.
protected QtMenuItem(QAction pAction)
          Creates a new instance of QtMenuItem for a given QAction.
 
Method Summary
 IImage capture(int pWidth, int pHeight)
          Not supported.
 ActionHandler eventAction()
          The EventHandler for the action event.
 Key getAccelerator()
          Returns the Key which serves as an accelerator for the button.
 String getActionCommand()
          Returns the command name of the action event fired by this action component.
 IColor getBackground()
          Not supported.
 IRectangle getBounds()
          Not supported.
 ICursor getCursor()
          Not supported.
 IFont getFont()
          Gets the font of this component.
 IColor getForeground()
          Not supported.
 int getHorizontalAlignment()
          Not supported.
 IImage getImage()
          Returns the default image.
 IPoint getLocation()
          Not supported.
 IInsets getMargins()
          Not supported.
 IDimension getMaximumSize()
          Not supported.
 IDimension getMinimumSize()
          Not supported.
 String getName()
          Gets the name of the object.
 IContainer getParent()
          Gets the parent of this component.
 IDimension getPreferredSize()
          Not supported.
 IDimension getSize()
          Not supported.
 String getText()
          Returns the text string that the label displays.
 String getToolTipText()
          Returns the tooltip string that has been set with setToolTipText.
 int getVerticalAlignment()
          Not supported.
 boolean isBackgroundSet()
          Not supported.
 boolean isCursorSet()
          Not supported.
 boolean isEnabled()
          Determines whether this component is enabled.
 boolean isFocusable()
          Not supported.
 boolean isFontSet()
          Returns whether the font has been explicitly set for this Component.
 boolean isForegroundSet()
          Not supported.
 boolean isMaximumSizeSet()
          Not supported.
 boolean isMinimumSizeSet()
          Not supported.
 boolean isPreferredSizeSet()
          Not supported.
 void requestFocus()
          Not supported.
 void setAccelerator(Key pKey)
          Sets the key combination which invokes the component's action listeners without selecting.
 void setActionCommand(String pActionCommand)
          Sets the command name for the action event fired by this action component.
 void setBackground(IColor pBackground)
          Not supported.
 void setBounds(IRectangle pBounds)
          Not supported.
 void setCursor(ICursor pCursor)
          Not supported.
 void setEnabled(boolean pEnable)
          Enables or disables this component, depending on the value of the parameter pEnable.
 void setFocusable(boolean pFocusable)
          Not supported.
 void setFont(IFont pFont)
          Sets the IFont of this component.
 void setForeground(IColor pForeground)
          Not supported.
 void setHorizontalAlignment(int pHorizontalAlignment)
          Not supported.
 void setImage(IImage pImage)
          Sets the default image.
 void setLocation(IPoint pLocation)
          Not supported.
 void setMargins(IInsets pInsets)
          Not supported.
 void setMaximumSize(IDimension pMaximumSize)
          Not supported.
 void setMinimumSize(IDimension pMinimumSize)
          Not supported.
 void setName(String pName)
          Sets the name of the object to the specified string.
 void setParent(IContainer pParent)
          Sets the parent of this component.
 void setPreferredSize(IDimension pPreferredSize)
          Not supported.
 void setResourceVisible(boolean pVisible)
          Sets the visibility of the internal resource.
 void setSize(IDimension pSize)
          Not supported.
 void setText(String pText)
          Defines the single line of text this component will display.
 void setToolTipText(String pText)
          Registers the text to display in a tool tip.
 void setVerticalAlignment(int pVerticalAlignment)
          Not supported.
 void triggered()
          Handles the triggered action of the menu item resource.
 
Methods inherited from class com.sibvisions.rad.ui.qt.impl.QtComponentBase
eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getFactory, isVisible, setFactory, setVisible
 
Methods inherited from class com.sibvisions.rad.ui.qt.impl.QtResource
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
eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getFactory, isVisible, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 
Methods inherited from interface javax.rad.ui.IComponent
eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getFactory, isVisible, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Field Detail

factory

protected IFactory factory
The factory that created this component.


parent

protected IContainer parent
Container where the component is added.


image

protected IImage image
the image.

Constructor Detail

QtMenuItem

protected QtMenuItem(QAction pAction)
Creates a new instance of QtMenuItem for a given QAction.

Parameters:
pAction - the menuitem

QtMenuItem

public QtMenuItem()
Creates a new instance of QtMenuItem.

Method Detail

getName

public String getName()
Gets the name of the object.

Specified by:
getName in interface IComponent
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
Parameters:
pName - the string that is to be this component's name
See Also:
IComponent.getName()

getHorizontalAlignment

public int getHorizontalAlignment()
Not supported.

Specified by:
getHorizontalAlignment in interface IAlignmentConstants
Returns:
-1
See Also:
IAlignmentConstants.getHorizontalAlignment()

setHorizontalAlignment

public void setHorizontalAlignment(int pHorizontalAlignment)
Not supported.

Sets the horizontal alignment. Possible values are defined in AlignmentConstants.

Specified by:
setHorizontalAlignment in interface IAlignmentConstants
Parameters:
pHorizontalAlignment - the new vertical alignment

getVerticalAlignment

public int getVerticalAlignment()
Not supported.

Specified by:
getVerticalAlignment in interface IAlignmentConstants
Returns:
-1
See Also:
IAlignmentConstants.getVerticalAlignment()

setVerticalAlignment

public void setVerticalAlignment(int pVerticalAlignment)
Not supported.

Sets the vertical alignment. Possible values are defined in AlignmentConstants.

Specified by:
setVerticalAlignment in interface IAlignmentConstants
Parameters:
pVerticalAlignment - the new vertical alignment

getPreferredSize

public IDimension getPreferredSize()
Not supported.

Specified by:
getPreferredSize in interface IComponent
Returns:
null
See Also:
IComponent.getPreferredSize()

setPreferredSize

public void setPreferredSize(IDimension pPreferredSize)
Not supported.

Sets the preferred size of this component to a constant value. Subsequent calls to getPreferredSize will always return this value. Setting the preferred size to null restores the default behavior.

Specified by:
setPreferredSize in interface IComponent
Parameters:
pPreferredSize - the new preferred size, or null
See Also:
IComponent.getPreferredSize(), IComponent.isPreferredSizeSet()

isPreferredSizeSet

public boolean isPreferredSizeSet()
Not supported.

Specified by:
isPreferredSizeSet in interface IComponent
Returns:
false
See Also:
IComponent.isPreferredSizeSet()

getMinimumSize

public IDimension getMinimumSize()
Not supported.

Specified by:
getMinimumSize in interface IComponent
Returns:
null
See Also:
IComponent.getMinimumSize()

setMinimumSize

public void setMinimumSize(IDimension pMinimumSize)
Not supported.

Sets the minimum size of this component to a constant value. Subsequent calls to getMinimumSize will always return this value. Setting the minimum size to null restores the default behavior.

Specified by:
setMinimumSize in interface IComponent
Parameters:
pMinimumSize - the new minimum size of this component
See Also:
IComponent.getMinimumSize(), IComponent.isMinimumSizeSet()

isMinimumSizeSet

public boolean isMinimumSizeSet()
Not supported.

Specified by:
isMinimumSizeSet in interface IComponent
Returns:
false
See Also:
IComponent.isMinimumSizeSet()

getMaximumSize

public IDimension getMaximumSize()
Not supported.

Specified by:
getMaximumSize in interface IComponent
Returns:
null
See Also:
IComponent.getMaximumSize()

setMaximumSize

public void setMaximumSize(IDimension pMaximumSize)
Not supported.

Sets the maximum size of this component to a constant value. Subsequent calls to getMaximumSize will always return this value. Setting the maximum size to null restores the default behavior.

Specified by:
setMaximumSize in interface IComponent
Parameters:
pMaximumSize - a IDimension containing the desired maximum allowable size
See Also:
IComponent.getMaximumSize(), IComponent.isMaximumSizeSet()

isMaximumSizeSet

public boolean isMaximumSizeSet()
Not supported.

Specified by:
isMaximumSizeSet in interface IComponent
Returns:
false
See Also:
IComponent.isMaximumSizeSet()

getBackground

public IColor getBackground()
Not supported.

Specified by:
getBackground in interface IComponent
Returns:
null
See Also:
IComponent.getBackground()

setBackground

public void setBackground(IColor pBackground)
Not supported.

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
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()
Not supported.

Specified by:
isBackgroundSet in interface IComponent
Returns:
false
See Also:
IComponent.isBackgroundSet()

getForeground

public IColor getForeground()
Not supported.

Specified by:
getForeground in interface IComponent
Returns:
null
See Also:
IComponent.getForeground()

setForeground

public void setForeground(IColor pForeground)
Not supported.

Sets the foreground color of this component.

Specified by:
setForeground in interface IComponent
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()
Not supported.

Specified by:
isForegroundSet in interface IComponent
Returns:
false
See Also:
IComponent.isBackgroundSet()

getCursor

public ICursor getCursor()
Not supported.

Specified by:
getCursor in interface IComponent
Returns:
null
See Also:
IComponent.getCursor()

setCursor

public void setCursor(ICursor pCursor)
Not supported.

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
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()
Not supported.

Specified by:
isCursorSet in interface IComponent
Returns:
null
See Also:
IComponent.isCursorSet()

getFont

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

Specified by:
getFont in interface IComponent
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
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
Returns:
true if the font has been explicitly set for this Component; false otherwise.

getToolTipText

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

Specified by:
getToolTipText in interface IComponent
Returns:
the text of the tool tip
See Also:
IComponent.setToolTipText(String)

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
Parameters:
pText - the string to display; if the text is null, the tool tip is turned off for this component

setFocusable

public void setFocusable(boolean pFocusable)
Not supported.

Sets the focusable state of this component to the specified value.

Specified by:
setFocusable in interface IComponent
Parameters:
pFocusable - indicates whether this Component is focusable

isFocusable

public boolean isFocusable()
Not supported.

Specified by:
isFocusable in interface IComponent
Returns:
false
See Also:
IComponent.isFocusable()

requestFocus

public void requestFocus()
Not supported.

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

getParent

public IContainer getParent()
Gets the parent of this component.

Specified by:
getParent in interface IComponent
Returns:
the parent container of this component

setParent

public void setParent(IContainer pParent)
Sets the parent of this component.

Specified by:
setParent in interface IComponent
Parameters:
pParent - the parent container of this component

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
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
Parameters:
pEnable - if true, this component is enabled; otherwise this component is disabled
See Also:
IComponent.isEnabled()

getLocation

public IPoint getLocation()
Not supported.

Specified by:
getLocation in interface IComponent
Returns:
null
See Also:
IComponent.getLocation()

setLocation

public void setLocation(IPoint pLocation)
Not supported.

Moves this component to a new location. The top-left corner of the new location is specified by point p. Point p is given in the parent's coordinate space.

Specified by:
setLocation in interface IComponent
Parameters:
pLocation - the point defining the top-left corner of the new location, given in the coordinate space of this component's parent
See Also:
IComponent.getLocation(), IComponent.setBounds(IRectangle)

getSize

public IDimension getSize()
Not supported.

Specified by:
getSize in interface IComponent
Returns:
null
See Also:
IComponent.getSize()

setSize

public void setSize(IDimension pSize)
Not supported.

Resizes this component so that it has width d.width and height d.height.

Specified by:
setSize in interface IComponent
Parameters:
pSize - the IDimension specifying the new size of this component
See Also:
IComponent.setSize(javax.rad.ui.IDimension), IComponent.setBounds(javax.rad.ui.IRectangle)

getBounds

public IRectangle getBounds()
Not supported.

Specified by:
getBounds in interface IComponent
Returns:
null
See Also:
IComponent.getBounds()

setBounds

public void setBounds(IRectangle pBounds)
Not supported.

Moves and resizes this component to conform to the new bounding rectangle pBounds. This component's new position is specified by pBounds.x and pBounds.y, and its new size is specified by pBounds.width and pBounds.height

Specified by:
setBounds in interface IComponent
Parameters:
pBounds - the new bounding rectangle for this component
See Also:
IComponent.getBounds(), IComponent.setLocation(IPoint), IComponent.setSize(IDimension)

capture

public IImage capture(int pWidth,
                      int pHeight)
Not supported.

Specified by:
capture in interface IComponent
Parameters:
pWidth - the expected width
pHeight - the expected height
Returns:
null
See Also:
IComponent.capture(int, int)

setAccelerator

public void setAccelerator(Key pKey)
Sets the key combination which invokes the component's action listeners without selecting. It is the UI's responsibility to install the correct action.

Specified by:
setAccelerator in interface IActionComponent
Parameters:
pKey - the Key which will serve as an accelerator

getAccelerator

public Key getAccelerator()
Returns the Key which serves as an accelerator for the button.

Specified by:
getAccelerator in interface IActionComponent
Returns:
a Key object identifying the accelerator key

setActionCommand

public void setActionCommand(String pActionCommand)
Sets the command name for the action event fired by this action component. By default this action command is set to match the label of the button.

Specified by:
setActionCommand in interface IActionComponent
Parameters:
pActionCommand - a string used to set the action command. If the string is null then the action command is set to match the text of the action component.
See Also:
ActionEvent

getActionCommand

public String getActionCommand()
Returns the command name of the action event fired by this action component. If the command name is null (default) then this method returns the label of the button.

Specified by:
getActionCommand in interface IActionComponent
Returns:
the action command.

setImage

public void setImage(IImage pImage)
Sets the default image.

Specified by:
setImage in interface IIcon
Parameters:
pImage - the image
See Also:
IIcon.getImage()

getImage

public IImage getImage()
Returns the default image.

Specified by:
getImage in interface IIcon
Returns:
the default image
See Also:
IIcon.setImage(IImage)

setText

public void setText(String pText)
Defines the single line of text this component will display. If the value of text is null or empty string, nothing is displayed.

Specified by:
setText in interface ILabel
Parameters:
pText - the text

getText

public String getText()
Returns the text string that the label displays.

Specified by:
getText in interface ILabel
Returns:
a String
See Also:
ILabel.setText(java.lang.String)

eventAction

public ActionHandler eventAction()
The EventHandler for the action event.

Specified by:
eventAction in interface IActionComponent
Returns:
the EventHandler for the action event.

setMargins

public void setMargins(IInsets pInsets)
Not supported.

Sets space for margin between the button's border and the text. Setting to null will cause the action component to use the default margin.

Specified by:
setMargins in interface IActionComponent
Parameters:
pInsets - the space between the border and the test

getMargins

public IInsets getMargins()
Not supported.

Specified by:
getMargins in interface IActionComponent
Returns:
null an IInsets object specifying the margin between the component's border and the text
See Also:
IActionComponent.setMargins(IInsets)

setResourceVisible

public void setResourceVisible(boolean pVisible)
Sets the visibility of the internal resource.

Specified by:
setResourceVisible in class QtComponentBase<C extends QAction>
Parameters:
pVisible - true to set visible, otherwise false

triggered

public void triggered()
Handles the triggered action of the menu item resource.



Copyright © 2009 SIB Visions GmbH. All Rights Reserved.