quicktime.app.display
Class DirectGroup

java.lang.Object
  |
  +--quicktime.app.spaces.SimpleSpace
        |
        +--quicktime.app.display.GroupDrawable
              |
              +--quicktime.app.display.DirectGroup
All Implemented Interfaces:
Collection, Drawable, DynamicCollection, Listener, QTDisplaySpace, QTDrawable, Space, Ticklish, Transformable

Deprecated. since QTJava 6.1

public class DirectGroup
extends GroupDrawable

A DirectGroup contains a set of QTDrawable objects that present their visual contents directly to the screen.

Items that overlap screen space will draw over each other and the front object will clip the rear object so that the rear object does not draw in the area occupied by the front object.

When the group is resized the group's items will not be resized or moved but clipped to the new viewing area of the DirectGroup. Doing a setMatrix on a DirectGroup will inherit the default behaviour of the GroupDrawable super class which merely repositions the group - it will not scale, rotate or skew the group or its members. As such the DirectGroup's display area reperesents a viewing area for its members and when this viewing area is changed the user will see more or less of the members that are in the DirectGroup.

This behaves different from the SWCompositor group - where a resize of that group will resize and scale the members of that group.

This behaviour of the DirectGroup allows an application to use the DirectGroup as a clipping area for its members, where the members of the group are not resized. This class can be used to implement a scrolling pane for example. For example an application may have a very large image that it wants to presents only portions of it. If the application used the GraphicsImporterDrawer (GID) as the client of the QTCanvas the image presented by the GID would be scaled to the viewing area of the QTCanvas. However if the client of the canvas was a DirectGroup and the group contained the GID then the DirectGroup would represent the viewing area of the GID. The application could define a MouseController and responder for this DirectGroup that allowed the user to click on the GID member and when dragging the mouse around change the part of the image that the user sees. Thus the GID image is not resized, and the DirectGroup acts as a clipping viewing area to only see a part of the GID member.

A DirectGroup can only be a top-level container object. Currently you cannot embed DirectGroups within other (parent) DirectGroups. The isAppropriate() method returns false for a potential DirectGroup member object. In this case the member won't be added, and the addMember methods will return false. If an application wanted to support this capability they should overide the isAppropriate method to allow these kinds of members.


Field Summary
 
Fields inherited from class quicktime.app.display.GroupDrawable
clip, vec
 
Fields inherited from class quicktime.app.spaces.SimpleSpace
containedSpaces, controllersVec, ticklers, timer
 
Fields inherited from interface quicktime.app.time.Ticklish
kScale
 
Constructor Summary
  DirectGroup(java.awt.Dimension initialSize, QDColor bc)
          Deprecated. since QTJava 4.0, replaced by DirectGroup
  DirectGroup(QDDimension initialSize, QDColor bc)
          Deprecated. since QTJava 6.1
protected DirectGroup(QDDimension initialSize, QDColor bc, int scale, int period, Protocol p)
          Deprecated. since QTJava 6.1
 
Method Summary
 boolean addMember(java.lang.Object member)
          Deprecated. since QTJava 6.1
 boolean addMember(java.lang.Object member, int layer)
          Deprecated. since QTJava 6.1
 boolean addMember(java.lang.Object member, int layer, float xAlign, float yAlign)
          Deprecated. since QTJava 6.1
 boolean isAppropriate(java.lang.Object object)
          Deprecated. since QTJava 6.1
 GroupMember memberChanged(QTDrawable d)
          Deprecated. since QTJava 6.1
 void redrawMember(QTDrawable d, Region invalidRgn)
          Deprecated. since QTJava 6.1
 void setClip(Region theClip)
          Deprecated. since QTJava 6.1
 void setDisplayBounds(QDRect bounds)
          Deprecated. since QTJava 6.1
 void setGWorld(QDGraphics cgp)
          Deprecated. since QTJava 6.1
 boolean setMemberAlignment(QTDrawable d, float xAlign, float yAlign)
          Deprecated. since QTJava 6.1
 boolean setMemberLayer(QTDrawable member, int layer)
          Deprecated. since QTJava 6.1
 
Methods inherited from class quicktime.app.display.GroupDrawable
getBackgroundClip, getBackgroundColor, getBackLayer, getClip, getDisplayBounds, getFrontLayer, getGroupMember, getGWorld, getInitialSize, getLayerable, getMatrix, getOriginalSize, getTransformable, hitTest, isEmpty, members, redraw, removeMember, setAlignedMemberLocation, setBackgroundColor, setLocation, setMatrix, size
 
Methods inherited from class quicktime.app.spaces.SimpleSpace
addController, addedTo, controllers, finalize, getProtocol, getSource, getTimer, hasMember, memberAdded, memberRemoved, removeAllControllers, removeAllMembers, removeController, removedFrom, tickle, tickleList, timeChanged
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface quicktime.app.spaces.Listener
addedTo, removedFrom
 
Methods inherited from interface quicktime.app.spaces.Space
addController, controllers, getSource, getTimer, removeController, tickleList
 
Methods inherited from interface quicktime.app.spaces.DynamicCollection
getProtocol
 
Methods inherited from interface quicktime.app.spaces.Collection
hasMember
 
Methods inherited from interface quicktime.app.time.Ticklish
tickle, timeChanged
 

Constructor Detail

DirectGroup

public DirectGroup(java.awt.Dimension initialSize,
                   QDColor bc)
            throws QTException
Deprecated. since QTJava 4.0, replaced by DirectGroup

Create a new grouped drawable where the members draw directly to the screen.

Parameters:
initialSize - the size of the display group
bc - the background color of the group
See Also:
DirectGroup(QDDimension,QDColor)

DirectGroup

public DirectGroup(QDDimension initialSize,
                   QDColor bc)
            throws QTException
Deprecated. since QTJava 6.1

Create a new grouped drawable where the members draw directly to the screen.

Parameters:
initialSize - the size of the display group
bc - the background color of the group

DirectGroup

protected DirectGroup(QDDimension initialSize,
                      QDColor bc,
                      int scale,
                      int period,
                      Protocol p)
               throws QTException
Deprecated. since QTJava 6.1

Create a new grouped drawable where the members draw directly to the screen.

Parameters:
initialSize - the size of the display group
bc - the background color of the group
scale - the scale of the space's Timer
period - the period of the space's Timer
p - the default Protocol of members
Method Detail

isAppropriate

public boolean isAppropriate(java.lang.Object object)
Deprecated. since QTJava 6.1

Returns true if the Object object is an appropriate member of the Space. To be an appropriate member the object must pass the passProtocol method of the Protocol object of the Space.

In addition to the requirement that the object be some kind of QTDrawable, the object may also NOT be some kind of GroupDrawable. Thus you cannot embed DirectGroup objects in a parent DirectGroup.

Specified by:
isAppropriate in interface Collection
Overrides:
isAppropriate in class SimpleSpace
Parameters:
object - the Object to test
Returns:
true if the object passes the current protocol of the Protocol object of the Space.
See Also:
DynamicCollection, Protocol

addMember

public boolean addMember(java.lang.Object member,
                         int layer,
                         float xAlign,
                         float yAlign)
                  throws QTException
Deprecated. since QTJava 6.1

Add a QTDrawable object to the group based on the provided alignment and layer parametres. This method is provided as a convenience method to position a member in the current display space of the Group.

Parameters:
layer - the layer where the drawer will be placed
xAlign - the x position of the drawable within the group - 0 is left, 1 is bounds.width - member.width
yAlign - the y position of the drawable within the group - 0 is top, 1 is bounds.height - member.height
Returns:
true if the member is appropriate and was added.
QTException

addMember

public boolean addMember(java.lang.Object member,
                         int layer)
                  throws QTException
Deprecated. since QTJava 6.1

Add a QTDrawable object to the group based on the current location of the member and the specified layer parametre.

Parameters:
layer - the layer where the drawer will be placed
member - the member to add to the Display Space
Returns:
true if the member is appropriate and was added.
QTException

addMember

public boolean addMember(java.lang.Object member)
                  throws QTException
Deprecated. since QTJava 6.1

Add a QTDrawable object to the group with the current location of the QTDrawable. If the member implements the Layerable interface it will get the layer and assign the layer appropriately. Otherwise, the member will be added with a layer of 1.

Specified by:
addMember in interface Collection
Specified by:
addMember in class SimpleSpace
Parameters:
member - the member to add
Returns:
true if the member is appropriate and was added.
QTException

setGWorld

public void setGWorld(QDGraphics cgp)
               throws QTException
Deprecated. since QTJava 6.1

QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing. If the incoming QDGraphics is the QDGraphics.scratch then the drawable will not be visible and can disable itself. If a client is unable to set the graphics world it should throw an exception.

Specified by:
setGWorld in interface QTDrawable
Overrides:
setGWorld in class GroupDrawable
Parameters:
cgp - a QDGraphics object
QTException

setDisplayBounds

public void setDisplayBounds(QDRect bounds)
                      throws QTException
Deprecated. since QTJava 6.1

This method is called automatically via the QTCanvas object associated with this client to set its boundary.

Specified by:
setDisplayBounds in interface Drawable
Overrides:
setDisplayBounds in class GroupDrawable
Parameters:
bounds - a QDRect object describing the boundary
QTException

redrawMember

public void redrawMember(QTDrawable d,
                         Region invalidRgn)
                  throws QTException
Deprecated. since QTJava 6.1

This is an optimized drawing method that will only reset the clipping of those objects that are behind the supplied member. It will call memberChanged to do this. It will then only redraw those members who are behind the specified member if and only if the members behind were effected by the changed location of the specified member. The supplied invalidRgn should specify the area that the supplied QTDrawble was located at as this enables this method to determine which members are effected by the changed location of the member.

Specified by:
redrawMember in class GroupDrawable
Parameters:
d - the drawable from which to recalculate.
invalidRgn - the invalidRgn that the DirectGroup should redraw
QTException

setClip

public void setClip(Region theClip)
             throws QTException
Deprecated. since QTJava 6.1

This method allows you to set a Transformable's clipping region.

Specified by:
setClip in interface QTDrawable
Specified by:
setClip in class GroupDrawable
Parameters:
theClip - a Region that defines the new clipping region.
QTException

memberChanged

public GroupMember memberChanged(QTDrawable d)
                          throws QTException
Deprecated. since QTJava 6.1

This tells the group that the position or display size of the drawer has changed and it should recalculate its alignment and clipping based on the new position. If the drawer is not a member of the group then null is returned, if it is a member then a GroupMember object is returned that contains the layout characteristics of the drawer.

Specified by:
memberChanged in class GroupDrawable
Parameters:
d - the drawer that has changed
Returns:
the GroupMember object that is associated with that drawer.
QTException

setMemberAlignment

public boolean setMemberAlignment(QTDrawable d,
                                  float xAlign,
                                  float yAlign)
                           throws QTException
Deprecated. since QTJava 6.1

This will reset an item's alignment and redraw the group.

Overrides:
setMemberAlignment in class GroupDrawable
Parameters:
d - the drawer to reposition the alignment
xAlign - the new x alignment value for the member
yAlign - the new y alignemen value for the member
Returns:
true if the drawer is a member of the group
QTException

setMemberLayer

public boolean setMemberLayer(QTDrawable member,
                              int layer)
                       throws QTException
Deprecated. since QTJava 6.1

This sets the layer of the incoming drawable to the new layer. It returns true if the drawable is a member of the group and was reset, false otherwise.

Overrides:
setMemberLayer in class GroupDrawable
Parameters:
layer - the new layer
Returns:
true if d is a member of the group
QTException