Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pietschy.command.face
Class RenderContext

    java.lang.Object
      com.pietschy.command.face.RenderContext

    public class RenderContext

extends java.lang.Object

Contains information the commands and groups that created specific buttons. This information is then used by `FaceRenderer` to configure the button.

Version:
  $Revision: 1.7 $
Author:
  andrewp

Method Summary
`static void` | `bind(javax.swing.JComponent component, Command parent, java.lang.String faceName)` Binds this context to the specified component.
`static RenderContext` | `get(java.awt.Component component)` Gets the rendering context for the specified component, or `null` if it doesn't have one.
`Face` | `getBestFace()` Gets the best face to use for this render context.
`Command` | `getCommand()` Gets the command that created the context.
`java.lang.String` | `getFaceContext()` Gets the face context.
`CommandGroup` | `getGroup()` Gets the group associated with this context.
`boolean` | `isFirstMember()` Checks if this context is for the first member of the group.
`boolean` | `isLastMember()` Checks if this context is for the last member of the group.
`void` | `setGroupContext(CommandGroup group, int groupIndex)` Configures the group information of the context.
`static void` | `unbind(javax.swing.JComponent component, Command command)` Removes the context of the specified command from the specified component.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### get

    public static RenderContext get(java.awt.Component component)

  Gets the rendering context for the specified component, or `null` if it doesn't have one. Only instances of `JComponent` support render contexts.

  Parameters:
    `component` - the component with the renderering context.
  Returns:
    the rendering context or `null` if the component doesn't have one.

### bind

    public static void bind(javax.swing.JComponent component,
                            Command parent,
                            java.lang.String faceName)

  Binds this context to the specified component.

  Parameters:
    `component` - the component to bind to.
  See Also:
    `get(Component)`

### unbind

    public static void unbind(javax.swing.JComponent component,
                              Command command)

  Removes the context of the specified command from the specified component.

  Parameters:
    `component` - the component.
    `command` - the command.
  Throws:
    `java.lang.IllegalStateException` - if the command is not attached to the component.

### setGroupContext

    public void setGroupContext(CommandGroup group,
                                int groupIndex)

  Configures the group information of the context.

  Parameters:
    `group` - the to which the button belongs.
    `groupIndex` - the index of the button within the group.

### getCommand

    public Command getCommand()

  Gets the command that created the context.

  Returns:
    the command that created the context.

### getFaceContext

    public java.lang.String getFaceContext()

  Gets the face context.

  Returns:
    the face context.

### getBestFace

    public Face getBestFace()
                     throws FaceNotFoundException

  Gets the best face to use for this render context.

  Returns:
    the best face to use for this render context.
  Throws:
    `FaceNotFoundException`

### getGroup

    public CommandGroup getGroup()

  Gets the group associated with this context.

  Returns:
    the group associated with this context or `null` if this is a stand alone button.

### isFirstMember

    public boolean isFirstMember()

  Checks if this context is for the first member of the group.

  Returns:
    `true` if this context is for the first member of the group, `false` otherwise.

### isLastMember

    public boolean isLastMember()

  Checks if this context is for the last member of the group.

  Returns:
    `true` if this context is for the last member of the group, `false` otherwise.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 - 2007 Andrew Pietsch