net.sf.latexdraw.actions
Class Export

java.lang.Object
  extended by org.malai.action.Action
      extended by net.sf.latexdraw.actions.Export

public class Export
extends Action

This action allows to export a drawing in different formats.
This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

LaTeXDraw is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Since:
3.0
Author:
Arnaud Blouin

Nested Class Summary
static class Export.ExportFormat
          The enumeration defines the different formats managed to export drawing.
 
Nested classes/interfaces inherited from class org.malai.action.Action
Action.ActionStatus
 
Field Summary
protected  ICanvas canvas
          The canvas that contains views.
protected  ExportDialog dialogueBox
          The dialogue chooser used to select the targeted file.
protected  boolean exported
          Defines if the shapes have been successfully exported.
protected  Export.ExportFormat format
          The format with which the drawing must be exported.
 
Fields inherited from class org.malai.action.Action
status
 
Constructor Summary
Export()
          Creates the action.
 
Method Summary
 boolean canDo()
           
protected  java.awt.image.BufferedImage createRenderedImage()
           
protected  void doActionBody()
          This method contains the core code to execute when the action is executed.
protected  boolean export(java.io.File file)
           
protected  boolean exportAsBMP(java.io.File file)
          Exports the drawing as a BMP picture.
protected  boolean exportAsJPG(java.io.File file)
          Exports the drawing as a JPG picture.
protected  boolean exportAsPDF(java.io.File file)
          Creates a pdf document of the given views (compiled using latex).
protected  boolean exportAsPNG(java.io.File file)
          Exports the drawing as a PNG picture.
protected  boolean exportAsPS(java.io.File file)
          Creates a ps document of the given views (compiled using latex).
protected  boolean exportAsPST(java.io.File file)
          Exports the drawing as a PST document.
 void flush()
          When an action is no more useful it can be flushes to release the used data.
 boolean hadEffect()
           
 boolean isRegisterable()
          Specifies if the action must be saved in the action register.
 void setCanvas(ICanvas canvas)
           
 void setDialogueBox(ExportDialog dialogueBox)
           
 void setFormat(Export.ExportFormat format)
           
 
Methods inherited from class org.malai.action.Action
abort, cancelledBy, doIt, done, getStatus, isDone, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

format

protected Export.ExportFormat format
The format with which the drawing must be exported.


canvas

protected ICanvas canvas
The canvas that contains views.


exported

protected boolean exported
Defines if the shapes have been successfully exported.


dialogueBox

protected ExportDialog dialogueBox
The dialogue chooser used to select the targeted file.

Constructor Detail

Export

public Export()
Creates the action.

Since:
3.0
Method Detail

flush

public void flush()
Description copied from class: Action
When an action is no more useful it can be flushes to release the used data. Should be overridden.

Overrides:
flush in class Action

isRegisterable

public boolean isRegisterable()
Description copied from class: Action
Specifies if the action must be saved in the action register. For instance, some actions, such as a scroll of the scroll bars, should not be saved nor put in the undo/redo manager. Thus, they must not be registrable.

Specified by:
isRegisterable in class Action
Returns:
True: the action is registrable.

doActionBody

protected void doActionBody()
Description copied from class: Action
This method contains the core code to execute when the action is executed.

Specified by:
doActionBody in class Action

export

protected boolean export(java.io.File file)

canDo

public boolean canDo()
Specified by:
canDo in class Action
Returns:
True if the action can be executed.

hadEffect

public boolean hadEffect()
Overrides:
hadEffect in class Action
Returns:
True if the execution of the action had effects on the target. By default this function return the result of isDone. Should be overridden.

exportAsPNG

protected boolean exportAsPNG(java.io.File file)
Exports the drawing as a PNG picture.

Parameters:
file - The targeted location.
Returns:
true if the picture was well created.

exportAsJPG

protected boolean exportAsJPG(java.io.File file)
Exports the drawing as a JPG picture.

Parameters:
file - The targeted location.
Returns:
true if the picture was well created.

exportAsPS

protected boolean exportAsPS(java.io.File file)
Creates a ps document of the given views (compiled using latex).

Parameters:
file - The targeted location.
Returns:
True: the file has been created.
Since:
3.0

exportAsPDF

protected boolean exportAsPDF(java.io.File file)
Creates a pdf document of the given views (compiled using latex).

Parameters:
file - The targeted location.
Returns:
True: the file has been created.
Since:
3.0

exportAsPST

protected boolean exportAsPST(java.io.File file)
Exports the drawing as a PST document.

Parameters:
file - The targeted location.
Returns:
true if the PST document was been successfully created.

exportAsBMP

protected boolean exportAsBMP(java.io.File file)
Exports the drawing as a BMP picture.

Parameters:
file - The targeted location.
Returns:
true if the picture was successfully created.

createRenderedImage

protected java.awt.image.BufferedImage createRenderedImage()
Returns:
A buffered image that contains given views (not null).
Since:
3.0

setDialogueBox

public void setDialogueBox(ExportDialog dialogueBox)
Parameters:
dialogueBox - The file chooser to set.
Since:
3.0

setFormat

public void setFormat(Export.ExportFormat format)
Parameters:
format - The format to set.
Since:
3.0

setCanvas

public void setCanvas(ICanvas canvas)
Parameters:
canvas - The canvas to set.
Since:
3.0