|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdox.edit.Element
This class represents an element that is contained within a document.
Field Summary | |
protected java.awt.image.BufferedImage |
cachedImage
The cached Element. |
protected Cover |
cover
The Cover. |
protected static java.awt.BasicStroke |
dashed
This stroke is updated automatically by the timer. |
protected java.awt.Rectangle |
diagonalResizeRect
Needed for the resizing position cursors. |
protected java.awt.Dimension |
elementSize
The size of the element. |
protected boolean |
flipHorizontal
If true, element is flipped horizontal. |
protected boolean |
flipVertical
If true, element is flipped vertical. |
protected java.awt.Rectangle |
horizontalResizeRect
Needed for the resizing position cursors. |
protected java.awt.Point |
position
The position. |
protected boolean |
quality
If true, the element will be transformed with highest quality. |
protected double |
ratioX
The X ratio. |
protected double |
ratioY
The Y ratio. |
protected double |
rotateBy
Element will be rotated by this number as degrees. |
protected java.awt.Rectangle |
verticalResizeRect
Needed for the resizing position cursors. |
Constructor Summary | |
protected |
Element(java.awt.Dimension size,
java.awt.Point pos)
Some general initialization work is done here. |
Method Summary | |
protected org.w3c.dom.Element |
appendChild(org.w3c.dom.Element root,
java.lang.String type)
Appends an "element" element to the root-element with all required attributes set. |
protected void |
createCachedImage()
Creates an image of the element. |
void |
destroyMe()
This method can be invoked to indicate that this Element is no longer needed. |
protected void |
drawMyself(java.awt.Graphics2D g)
Draws itself on the provided graphics object. |
void |
flipElementHorizontal()
Flips the element horizontal. |
void |
flipElementVertical()
Flips the element vertical. |
protected abstract java.awt.image.BufferedImage |
getBufferedImage()
This method must return an untransformed image of the element. |
java.awt.Rectangle |
getDiagonalResizeRect()
Returns the diagonal resize rectangle. |
boolean |
getHighlight()
Returns whether this Element is highlighted or not. |
java.awt.Rectangle |
getHorizontalResizeRect()
Returns the horizontal resize rectangle. |
protected java.awt.geom.AffineTransform |
getMatrix()
This method creates the matrix that is needed to perform the various transformations such as rotating/flipping. |
java.awt.Point |
getPosition()
Returns the upper left corner of the Element. |
java.awt.geom.AffineTransform |
getPrintableAffineTransform()
Returns the affine transform used for printing. |
java.awt.Dimension |
getSize()
Returns the size of this element. |
java.awt.Rectangle |
getVerticalResizeRect()
Returns the vertical resize rectangle. |
boolean |
isInPlace(java.awt.Point p)
Returns true if the element is at the specified position. |
boolean |
isMaintainingRatio()
Returns whether this element does maintain its ratio. |
static boolean |
isRotating()
Returns whether we are rotating or not. |
boolean |
isSelected()
This Methods returns true if the Element is selected. |
void |
moveToTop()
Moves the element to the top of the list. |
void |
registerDoAction(DoAction da)
Registers a doaction with this element. |
void |
rotateElement(double degrees)
Rotates the element by the given degrees. |
protected abstract void |
saveMyself(org.w3c.dom.Element root,
java.util.zip.ZipOutputStream out)
This method saves its data in the given parameters. |
protected void |
setCover(Cover c)
Sets the cover that owns this element. |
void |
setHighlight()
Toggles highlighting of this element. |
void |
setMaintainRatio(boolean b)
Sets whether the aspect ratio of this element should be maintained or not. |
void |
setPosition(java.awt.Point pos)
Sets the new position of the element. |
void |
setQuality(boolean q)
Sets the quality. |
void |
setRatio(double x,
double y)
Sets the ratio that should be used, if any. |
protected void |
setResizeRects()
Sets the resizing rectangles. |
void |
setSelected(boolean selected)
Sets, if this element is selected. |
void |
setSize(java.awt.Dimension s)
Sets the new size of the element. |
static void |
startRotating(java.awt.Component c,
Element element)
Starts generating rotated borders of selected elements. |
static void |
stopRotating()
Stops the rotating border of selected elements. |
java.lang.String |
toString()
|
void |
unregisterDoAction(DoAction da)
Unregisters a doaction with this element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.datatransfer.Transferable |
getTransferData, getTransferDataFlavors, isDataFlavorSupported |
Field Detail |
protected java.awt.Dimension elementSize
protected java.awt.Point position
protected Cover cover
protected java.awt.Rectangle horizontalResizeRect
protected java.awt.Rectangle verticalResizeRect
protected java.awt.Rectangle diagonalResizeRect
protected java.awt.image.BufferedImage cachedImage
protected double ratioX
protected double ratioY
protected boolean quality
protected double rotateBy
protected boolean flipVertical
protected boolean flipHorizontal
protected static java.awt.BasicStroke dashed
Constructor Detail |
protected Element(java.awt.Dimension size, java.awt.Point pos)
size
- the size.pos
- the position.Method Detail |
public static void startRotating(java.awt.Component c, Element element)
c
- the component whose repaint() method is frequently called.element
- the element whose cover will be notified frequently about changes.public static boolean isRotating()
public static void stopRotating()
public void setQuality(boolean q)
q
- if true, high quality will be used.public void setSelected(boolean selected)
selected
- whether this element should be selected.public boolean isSelected()
public void setHighlight()
public boolean getHighlight()
protected void setCover(Cover c)
c
- the cover owning this element. Note that only one cover can use this
element at the same time.public boolean isInPlace(java.awt.Point p)
p
- the position.
public void moveToTop()
public void setMaintainRatio(boolean b)
b
- if true, the ratio will be maintained.public boolean isMaintainingRatio()
public void setRatio(double x, double y)
x
- the x aspect.y
- the y aspect.public void setSize(java.awt.Dimension s)
s
- the new size.public void setPosition(java.awt.Point pos)
pos
- the new position.public java.awt.Dimension getSize()
public java.awt.Point getPosition()
protected void setResizeRects()
public java.awt.Rectangle getHorizontalResizeRect()
Rectangle
value.public java.awt.Rectangle getVerticalResizeRect()
Rectangle
value.public java.awt.Rectangle getDiagonalResizeRect()
Rectangle
value.public void flipElementVertical()
public void flipElementHorizontal()
public void registerDoAction(DoAction da)
da
- a DoAction
value.public void unregisterDoAction(DoAction da)
da
- a DoAction
value.public void rotateElement(double degrees)
degrees
- the degrees (0-360).protected java.awt.geom.AffineTransform getMatrix()
protected void drawMyself(java.awt.Graphics2D g)
g
- where you like it to be drawn.protected abstract java.awt.image.BufferedImage getBufferedImage()
protected void createCachedImage()
public java.awt.geom.AffineTransform getPrintableAffineTransform()
AffineTransform
value.protected org.w3c.dom.Element appendChild(org.w3c.dom.Element root, java.lang.String type)
root
- the Element to which the child will be appended.type
- the type of the element which will be added (currently one of "text" or
"image").
protected abstract void saveMyself(org.w3c.dom.Element root, java.util.zip.ZipOutputStream out) throws java.io.IOException
root
- the root element to append the child to.out
- the ZipOutputStream to write any files to.
java.io.IOException
- if writing into the ZipStream failed.appendChild(org.w3c.dom.Element, java.lang.String)
public java.lang.String toString()
public void destroyMe()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |