cdox.edit
Class GenericElement

java.lang.Object
  extended bycdox.edit.Element
      extended bycdox.edit.GenericElement
All Implemented Interfaces:
java.awt.datatransfer.Transferable

public class GenericElement
extends Element

This class represents an element that is contained within a document. The GenericElement can contain a java.awt.Component as data.

Author:
Rutger Bezema, Andreas Schmitz

Field Summary
static java.awt.datatransfer.DataFlavor COMPONENT_FLAVOR
          This is the DataFlavor for cut/pasting a generic element.
 
Fields inherited from class cdox.edit.Element
cachedImage, cover, dashed, diagonalResizeRect, elementSize, flipHorizontal, flipVertical, horizontalResizeRect, position, quality, ratioX, ratioY, rotateBy, verticalResizeRect
 
Constructor Summary
GenericElement(java.awt.Point pos, java.awt.Dimension size, javax.swing.JComponent c)
          Creates new element at the specified position.
 
Method Summary
protected  java.awt.image.BufferedImage getBufferedImage()
          This method must return an untransformed image of the element.
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor f)
           
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
           
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor f)
           
protected  void saveMyself(org.w3c.dom.Element root, java.util.zip.ZipOutputStream out)
          Attention: there is no support for saving generic elements yet, so this will do nothing!
 
Methods inherited from class cdox.edit.Element
appendChild, createCachedImage, destroyMe, drawMyself, flipElementHorizontal, flipElementVertical, getDiagonalResizeRect, getHighlight, getHorizontalResizeRect, getMatrix, getPosition, getPrintableAffineTransform, getSize, getVerticalResizeRect, isInPlace, isMaintainingRatio, isRotating, isSelected, moveToTop, registerDoAction, rotateElement, setCover, setHighlight, setMaintainRatio, setPosition, setQuality, setRatio, setResizeRects, setSelected, setSize, startRotating, stopRotating, toString, unregisterDoAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMPONENT_FLAVOR

public static java.awt.datatransfer.DataFlavor COMPONENT_FLAVOR
This is the DataFlavor for cut/pasting a generic element.

Constructor Detail

GenericElement

public GenericElement(java.awt.Point pos,
                      java.awt.Dimension size,
                      javax.swing.JComponent c)
Creates new element at the specified position.

Parameters:
pos - the position.
size - the size.
c - the component aka the content.
Method Detail

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor f)

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor f)
                                 throws java.awt.datatransfer.UnsupportedFlavorException
Throws:
java.awt.datatransfer.UnsupportedFlavorException

getBufferedImage

protected java.awt.image.BufferedImage getBufferedImage()
Description copied from class: Element
This method must return an untransformed image of the element. The various transformations are done on this element, so it is a good idea to base the size of this image on the size of the element to achieve best quality.

Specified by:
getBufferedImage in class Element
Returns:
the BufferedImage.

saveMyself

protected void saveMyself(org.w3c.dom.Element root,
                          java.util.zip.ZipOutputStream out)
Attention: there is no support for saving generic elements yet, so this will do nothing!

Specified by:
saveMyself in class Element
Parameters:
root - the root element to append the child to.
out - the ZipOutputStream to write any files to.
See Also:
Element.appendChild(org.w3c.dom.Element, java.lang.String)