|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdox.edit.Cover
This class is the real implementation for the off-screen CDover. All elements are added here, and the printing is done in this class also. Which means it implements the Printable interface, and is called from cdox.print.PrintCover. The upperclass (the class containing this class) is CDDrawingPane.
print(java.awt.Graphics, java.awt.print.PageFormat, int)
,
PrintCover
,
CDDrawingPane
Field Summary | |
protected int[] |
size
Size of this cover (inherited of CDCoverStandards). |
Fields inherited from interface cdox.edit.CDCoverStandards |
ALL, CDBACK_SIDE, CDBACK_SIDE_SIZE, CDBACK_SIZE, CDBOOKLET, CDBOOKLET_SIZE, CDFRONT, CDFRONT_SIZE, CDSIDE_SIZE, CDX, GIF, JPG, PNG |
Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
Cover(int type)
Creates a new cover with no elements. |
Method Summary | |
void |
addElement(Element e)
Adds an element to the cover. |
void |
deleteBackgroundImage()
Deletes the backgroundImage, and all of its sources. |
void |
destroyMe()
This method can be invoked to indicate that this Cover is no longer needed. |
void |
drawMyself(java.awt.Graphics gr)
Draws the whole thing onto the given graphics. |
void |
exportMySelf(java.io.File f)
This method exports this Cover to an image. |
protected void |
fireChanged()
Causes the internal image to be repainted. |
java.awt.Color |
getBackgroundColor()
Returns the background color. |
java.awt.image.BufferedImage |
getBackgroundImage()
Returns the backgroundimage or null im no backgroundImage is present. |
java.awt.image.BufferedImage |
getBufferedImage()
Returns an image with all elements painted. |
boolean |
getDragging()
Determines whether the top element is dragged or not. |
Element |
getElementAtPosition(java.awt.Point p)
Returns the element that is at the top of the specified position. |
boolean |
getGrayscale()
Returns the current gray value, gray is true if the Cover is drawn in gray. |
java.lang.String |
getKey()
Returns the currentKey which loads the image of disk. |
java.awt.RenderingHints |
getRenderingHints()
This method sets a couple of rendering hints depending on the quality set. |
Element |
getSelectedElement()
Returns the selected Element. |
int[] |
getSize()
Returns the size in an int array, size[0] = width, size[1] = height. |
int |
getType()
Returns the type of this cover. |
boolean |
hasBackgroundImage()
Returns whether this cover has a backgroundImage set. |
boolean |
hasElements()
Returns true if this cover has any elements. |
void |
moveToBack(Element e)
Moves an element to the bottom of the list. |
void |
moveToTop(Element e)
Moves an element to the top of the list. |
int |
print(java.awt.Graphics gr,
java.awt.print.PageFormat p,
int index)
Here the printing is done. |
void |
removeAllElements()
Removes all elements from this cover, and destroys them properly. |
void |
removeElement(Element e)
Removes an element from this cover. |
void |
resetBackgroundImage(java.lang.String key)
Resets the backgroundImage to the image represented by the given key. |
void |
saveMemory()
Sets the origBackImage to null and runs the GarbageCollector. |
void |
saveMyself(org.w3c.dom.Document doc,
java.util.zip.ZipOutputStream out)
Writes his properties into the DOM document and causes the elements to write their files into the ZipOutputStream, if any. |
void |
setBackground(java.awt.image.BufferedImage bi,
java.lang.String source,
boolean fit)
Sets the background image. |
void |
setBackground(java.awt.Color c)
Sets the background color for this cover. |
void |
setBackground(java.lang.String source,
boolean fit)
Sets the background image. |
void |
setDragging(boolean dragging)
Sets whether the top element is being dragged. |
void |
setFilteredBackgroundImage(java.awt.image.BufferedImage bi)
Sets the backgroundImage anew, with the (filtered) bufferedImage. |
void |
setGrayscale(boolean gray)
Sets whether the image should be drawn gray or not. |
void |
setPrintCompanion(Cover[] c)
Sets which covers will be printed together with this Cover on the same page. |
void |
setQuality(boolean q)
Sets the quality of the cover. |
protected void |
setSelectedElement(Element e)
Sets the currently selected Element. |
void |
setStrokeSize(float f)
Set the stroke size to draw the coverBorders with. |
java.lang.String |
toString()
Returns a string containing debug information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int[] size
Constructor Detail |
public Cover(int type)
type
- the type of the new Cover.CDCoverStandards
Method Detail |
public java.lang.String toString()
String
value.public java.lang.String getKey()
public int[] getSize()
public int getType()
CDCoverStandards
public void addElement(Element e)
e
- the added element.public Element getSelectedElement()
protected void setSelectedElement(Element e)
e
- the element.public Element getElementAtPosition(java.awt.Point p)
p
- the position.
public void removeElement(Element e)
e
- the element to be removed.public boolean hasElements()
public void removeAllElements()
public void moveToTop(Element e)
e
- the element.public void moveToBack(Element e)
e
- the element.public void setBackground(java.awt.Color c)
c
- the cover.public java.awt.Color getBackgroundColor()
public void setBackground(java.lang.String source, boolean fit) throws java.io.IOException
source
- the TempFiles source id.fit
- if true, the background image will occupy the whole cover. If false, and
the cover type is CDBACK_SIDE the side borders will be left free.
java.io.IOException
- if an error occurs.public void setBackground(java.awt.image.BufferedImage bi, java.lang.String source, boolean fit)
bi
- the allready loaded backgroundImagesource
- the TempFiles source id.fit
- if true, the background image will occupy the whole cover. If false, and
the cover type is CDBACK_SIDE the side borders will be left free.
java.io.IOException
- if an error occurs.public void deleteBackgroundImage()
public boolean hasBackgroundImage()
public java.awt.image.BufferedImage getBackgroundImage()
public void setFilteredBackgroundImage(java.awt.image.BufferedImage bi)
bi
- the new filteredImagegetBackgroundImage()
public void resetBackgroundImage(java.lang.String key)
key
- the key of the oldFile.BackgroundEditAction.undo()
,
BackgroundEditAction.redo()
public java.awt.RenderingHints getRenderingHints()
public void setQuality(boolean q)
q
- if true, the quality will be high, but the performance will significantly
slow down.public void setGrayscale(boolean gray)
gray
- true, if it should be gray. Default is false.public boolean getGrayscale()
protected void fireChanged()
public void setDragging(boolean dragging)
dragging
- whether we are dragging or not.public boolean getDragging()
public void setStrokeSize(float f)
f
- the size of the stroke.public java.awt.image.BufferedImage getBufferedImage()
public void drawMyself(java.awt.Graphics gr)
gr
- the graphics to paint on.public void saveMyself(org.w3c.dom.Document doc, java.util.zip.ZipOutputStream out) throws java.io.IOException
doc
- the DOM document.out
- the ZipOutputStream.
java.io.IOException
- if writing to the zip failed.public void exportMySelf(java.io.File f)
f
- the file to export toFileAction.actionPerformed(java.awt.event.ActionEvent)
public void setPrintCompanion(Cover[] c)
c
- the other covers.public int print(java.awt.Graphics gr, java.awt.print.PageFormat p, int index) throws java.awt.print.PrinterException
print
in interface java.awt.print.Printable
gr
- the graphics object of the printerp
- the pageformat,index
- the x-side to be printed (we only print one side at the time).
java.awt.print.PrinterException
- if an error occurs.PrintCover.run()
public void destroyMe()
public void saveMemory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |