|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
edu.neu.ccs.gui.Laminate
Component used to "laminate" an existing component by mimicing its size and location and always maintaining a higher z-order, in order to impart mouse handling without intervention by the laminated component.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
private boolean |
activated
Whether or not this laminate is activated. |
private MouseActionAdapter |
adapter
The mouse action adapter for this laminate. |
private boolean |
moveable
Whether or not this laminate can be moved. |
private Point |
moveOffset
Point at which a move was initiated. |
private boolean |
resizeable
Whether or not this laminate can be resized. |
private boolean |
resizingX
Whether or not this laminate is resizing on the horizontal axis. |
private boolean |
resizingY
Whether or not this laminate is resizing on the vertical axis. |
private boolean |
selected
Whether or not this laminate is selected. |
private Component |
target
The laminated component. |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
Laminate(Component c,
boolean isActivated)
Constructs a laminate for the given component. |
|
| Method Summary | |
void |
componentHidden(ComponentEvent evt)
Called when the laminated component is hidden. |
void |
componentMoved(ComponentEvent evt)
Called when the laminated component is moved. |
void |
componentResized(ComponentEvent evt)
Called when the laminated component is resized. |
void |
componentShown(ComponentEvent evt)
Called when the laminated component is shown. |
MouseActionAdapter |
getMouseActionAdapter()
Returns the mouse action adapter for this laminate. |
Component |
getTarget()
Returns the component this laminate is covering. |
protected Zoo |
getZoo()
Returns the zoo containing this laminate. |
private Rectangle |
getZooInnerBounds()
Returns the bounds of the parent zoo minus its insets. |
protected boolean |
inE(int x,
int y,
int delta)
Returns true if the given position
is in the right-hand middle of this component
within the given constraint,
and false otherwise. |
protected boolean |
inS(int x,
int y,
int delta)
Returns true if the given position
is in the bottom middle of this component
within the given constraint,
and false otherwise. |
protected boolean |
inSE(int x,
int y,
int delta)
Returns true if the given position
is in the bottom right-hand corner of this component
within the given constraint,
and false otherwise. |
protected void |
installCursorActions()
Installs the mouse actions that affect the mouse cursor for this laminate. |
protected void |
installManipulationActions()
Installs the mouse actions that affect manipulation of this laminate. |
protected void |
installMouseAdapter()
Installs the mouse action adapter for this laminate. |
protected void |
installSelectionActions()
Installs the mouse actions that affect selection of this laminate. |
boolean |
isActivated()
Returns whether or not this laminate is activated. |
boolean |
isMoveable()
Returns true if this laminate
can be moved to another location using direct manipulation
and false if it can not be moved. |
protected boolean |
isResizableX()
Returns true if the target component
is resizeable in the horizontal direction,
and false if it is not. |
protected boolean |
isResizableXY()
Returns true if the target component
is resizeable in both the horizontal and vertical directions,
and false if it is not. |
protected boolean |
isResizableY()
Returns true if the target component
is resizeable in the vertical direction,
and false if it is not. |
boolean |
isResizeable()
Returns true if this laminate
can be resized using direct manipulation
and false if it can not be resized. |
boolean |
isSelected()
Returns whether or not this laminate is selected. |
protected void |
moveTo(MouseEvent evt)
Moves this laminate and its covered component based on the given mouse event. |
protected void |
paintComponent(Graphics g)
Paints a selection box around this laminate, if this laminate is selected. |
protected void |
resizeTo(MouseEvent evt)
Resizes this laminate and its covered component based on the given mouse event. |
protected Rectangle |
restrictBounds(int x,
int y,
int width,
int height)
Restricts the given proposed bounds based on the zoo in which this laminate is contained. |
private void |
revalidateTarget()
Updates the laminated component by revalidating or validating it. |
void |
setActivated(boolean isActivated)
Sets whether or not this laminate handles mouse events targeted for the covered component. |
void |
setBounds(int x,
int y,
int width,
int height)
Sets the bounds of this laminate and its laminated component to the given position, width, and height. |
void |
setBounds(Rectangle bounds)
Sets the bounds of this laminate and its laminated component to the given bounds. |
private void |
setBoundsImpl(int x,
int y,
int width,
int height)
Sets the bounds for this laminate and its laminated component to the given bounds. |
void |
setLocation(int x,
int y)
Sets the location of this laminate and its laminated component to the given position. |
void |
setLocation(Point p)
Sets the location of this laminate and its laminated component to the given point. |
void |
setMoveable(boolean isMoveable)
Sets whether or not this laminate can be moved to another location using direct manipulation to the given value. |
void |
setResizeable(boolean isResizeable)
Sets whether or not this laminate can be resized using direct manipulation, to the given value. |
protected void |
setResizing(boolean xAxis,
boolean yAxis)
Sets on which axis(es) this component is being resized. |
void |
setSelected(boolean isSelected)
Sets whether or not this laminate is selected. |
void |
setSize(Dimension size)
Sets the size of this laminate and its laminated component to the given size. |
void |
setSize(int width,
int height)
Sets the size of this laminate and its laminated component to the given width and height. |
void |
setTarget(Component c)
Sets the target component this laminate is covering to the given component. |
protected void |
startMoveAt(MouseEvent evt)
Sets the point at which a move is initiated based on the given mouse event. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private Component target
private boolean activated
private boolean selected
private Point moveOffset
private MouseActionAdapter adapter
private boolean resizeable
private boolean moveable
private boolean resizingX
private boolean resizingY
| Constructor Detail |
public Laminate(Component c,
boolean isActivated)
c - a component to laminateisActivated - whether or not this laminate is activated| Method Detail |
public void componentHidden(ComponentEvent evt)
componentHidden in interface ComponentListenerpublic void componentMoved(ComponentEvent evt)
componentMoved in interface ComponentListenerpublic void componentResized(ComponentEvent evt)
componentResized in interface ComponentListenerpublic void componentShown(ComponentEvent evt)
componentShown in interface ComponentListenerpublic void setTarget(Component c)
null,
this laminate will not cover a component
c - a component to laminategetTarget()public Component getTarget()
setTarget(Component)public void setActivated(boolean isActivated)
isActivated - whether or not this laminate
should handle mouse eventsisActivated()public boolean isActivated()
setActivated(boolean)public void setSelected(boolean isSelected)
isSelected - whether or not this laminate
is to be selectedisSelected()public boolean isSelected()
setSelected(boolean)public MouseActionAdapter getMouseActionAdapter()
public void setLocation(int x,
int y)
x - the x-coordinate of the position
to which to move this laminatey - the y-coordinate of the position
to which to move this laminatesetLocation(Point)public void setLocation(Point p)
p - the point to which to move this laminatesetLocation(int, int)
public void setSize(int width,
int height)
width - the width to which to size this laminateheight - the height to which to size this laminatesetSize(Dimension)public void setSize(Dimension size)
size - the size for this laminatesetSize(int, int)
public void setBounds(int x,
int y,
int width,
int height)
x - the x-coordinate
for the bounds for this laminatey - the y-coordinate
for the bounds for this laminatewidth - the width for the bounds of this laminateheight - the height for the bounds of this laminatesetBounds(Rectangle)public void setBounds(Rectangle bounds)
bounds - the new bounds for this laminatesetBounds(int, int, int, int)public void setMoveable(boolean isMoveable)
setLocation
method is not affected by this property.
isMoveable - whether or not this laminate can be movedisMoveable()public boolean isMoveable()
true if this laminate
can be moved to another location using direct manipulation
and false if it can not be moved.
The setLocation
method is not affected by this property.
setMoveable(boolean)public void setResizeable(boolean isResizeable)
setSize
are not affected by this property.
isResizeable - whether or not this laminate can be sizedisResizeable()public boolean isResizeable()
true if this laminate
can be resized using direct manipulation
and false if it can not be resized.
Methods such as
setSize
are not affected by this property.
setResizeable(boolean)protected void paintComponent(Graphics g)
g - the graphics context to which to paintprotected Zoo getZoo()
protected void installMouseAdapter()
protected void installSelectionActions()
protected void installCursorActions()
protected void installManipulationActions()
protected void startMoveAt(MouseEvent evt)
evt - the mouse event initiating the move
protected Rectangle restrictBounds(int x,
int y,
int width,
int height)
x - the x-coordinate of the proposed boundsy - the y-coordinate of the proposed boundswidth - the width of the proposed boundsheight - the height of the proposed boundsprotected void moveTo(MouseEvent evt)
evt - the mouse event initiating the moveprotected void resizeTo(MouseEvent evt)
evt - the mouse event initiating the resize
protected void setResizing(boolean xAxis,
boolean yAxis)
xAxis - whether or not it is resizing on the x-axisyAxis - whether or not it is resizing on the y-axisprotected boolean isResizableX()
true if the target component
is resizeable in the horizontal direction,
and false if it is not.
isResizableY(),
isResizableXY()protected boolean isResizableY()
true if the target component
is resizeable in the vertical direction,
and false if it is not.
isResizableX(),
isResizableXY()protected boolean isResizableXY()
true if the target component
is resizeable in both the horizontal and vertical directions,
and false if it is not.
isResizableX(),
isResizableY()
protected boolean inSE(int x,
int y,
int delta)
true if the given position
is in the bottom right-hand corner of this component
within the given constraint,
and false otherwise.
inS(int, int, int),
inE(int, int, int)
protected boolean inS(int x,
int y,
int delta)
true if the given position
is in the bottom middle of this component
within the given constraint,
and false otherwise.
inSE(int, int, int),
inE(int, int, int)
protected boolean inE(int x,
int y,
int delta)
true if the given position
is in the right-hand middle of this component
within the given constraint,
and false otherwise.
inSE(int, int, int),
inS(int, int, int)
private void setBoundsImpl(int x,
int y,
int width,
int height)
x - the x-coordinate for this componenty - the y-coordinate for this componentwidth - the width for this componentheight - the height for this componentprivate void revalidateTarget()
private Rectangle getZooInnerBounds()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||