cdox.gui
Class CDoxFrame

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended bycdox.gui.CDoxFrame
All Implemented Interfaces:
javax.accessibility.Accessible, CDCoverStandards, java.awt.datatransfer.ClipboardOwner, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.lang.Runnable, java.io.Serializable, javax.swing.WindowConstants

public class CDoxFrame
extends javax.swing.JFrame
implements java.awt.datatransfer.ClipboardOwner, CDCoverStandards, java.lang.Runnable

This is the main frame of the CDox graphical application.

Version:
August 21st 2002
Author:
Rutger Bezema, Andreas Schmitz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 java.io.File saveFile
          The file which is currently used to save this project in
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
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 javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CDoxFrame(CDox cdx)
          This is the main constructor of the program, if this works everything works.
CDoxFrame(CDox cdox, java.lang.String filename)
           
 
Method Summary
 void addCovers(Cover[] whichCovers, java.lang.String title)
          This method adds the drawingPanes to the EditPane, it calls the same method in editpane.
 void addCovers(int[] whichCovers)
          This method adds the drawingPanes to the EditPane, it calls the same method in editpane.
 void center(java.awt.Window win)
          Sets the given windows to the center of the screen and packs it.
 int checkCloseable()
          Checks, if the actual document has been saved.
 void checkSaveable()
          This method checks to see whether an opened file have to be saved or not.
 void configure(boolean show)
          If show is true, it shows the configuration dialog, if not, it creates a new one.
 void flipElementHorizontal()
          Sets the specified horizontal flipping of the selected element.
 void flipElementVertical()
          Sets the specified Vertical flipping of the selected element.
 java.awt.Font getActualFont()
          This method returns the actual font.
 int getActualFontSize()
          This method returns the actualfontSize.
 javax.print.PrintService[] getAllPrinters()
          Returns all printers on the System, capable of printing this document.
 javax.swing.JColorChooser getColorChooser()
          This method returns the Colordialog
 Data getData()
          Returns the Data for the current project or null, if none has been set.
 javax.print.PrintService getDefaultPrinter()
          Returns the default printer installed on this system.
 EditPane getEditPane()
          This method returns the editPane
 MyFileChooser getFileDialog()
          This method returns the fileChooser dialog
 javax.swing.JComboBox getFontBox()
          This method returns the fontBox (combobox).
 int getFontIndex(java.lang.String fontFamily)
          Returns the index of the fontfamily, which is coherent with the index of the Font in the fontBox.
 javax.swing.JComboBox getFontSizeBox()
          This method returns the fontSizeBox (combobox).
 java.lang.String getImageDir()
          This method returns the directory of the images.
 javax.swing.JMenu getImageEditPopupMenu()
          Returns the popup imageEditMenu.
 CoverDialog getNewDialog()
          This method returns the newDialog
 javax.swing.JScrollPane getScrollPane()
          This Method returns the ScrollPane for use in other classes.
 javax.swing.JToolBar getStandardToolBar()
          This method returns the toobar
 StatusDrawer getStatusDrawer()
          This method returns the statusDrawer.
 StatusPane getStatusPane()
          This method returns the statusPane.
 boolean getTextBold()
          This method returns true if the text is written in bold.
 java.awt.Color getTextColor()
          This method returns true if the textcolor.
 boolean getTextEnabled()
          This method returns if true if the drawingPane is in TextMode.
 boolean getTextItalic()
          This method returns true if the text is written in italic.
 javax.swing.JToolBar getTextToolBar()
          This method returns the texttoobar
 boolean getTextUnderline()
          This method returns true if the text is written with underline.
 CdoxWizard getWizardInstance()
           
static void handleError(java.lang.Throwable e, boolean writeLog)
          This method should be called from all exceptions, it is able to play a sound and write in the log-file of CDox-errors.
 boolean hasBackground()
          This method is called when the user wants to change the backgroundimage
 boolean isWizardOn()
           
 boolean isWorking()
          This method returns true if the program is calculating something.
static java.awt.image.BufferedImage loadImage(java.io.InputStream in)
          Reads an image out of the stream.
 void lostOwnership(java.awt.datatransfer.Clipboard c, java.awt.datatransfer.Transferable contents)
          This method is inherited from ClipBoardOwner and does nothing.
protected  void processWindowEvent(java.awt.event.WindowEvent we)
          Is overwritten from JFrame, it enables the user to cancel the accidentially close click.
 Cover[] readDocuments(java.io.File f)
          This method will read the contents of the file.
 void reEditTextElement()
          This method is called when a text object needs to be re-edited.
 void removeAllElements()
          Removes all elements from the current Cover.
 void resetSaveFile()
          Sets the default saveFile to null.
 void rotateElement(double deg)
          Rotates the selected element a by the given degrees.
 void run()
          In this run method the printers are searched for at start up.
 void saveAs(java.io.File f)
          Sets the saveFile to f.
 void saveFile(java.io.File file)
          This Method is concerned whith the saving of a modified or not modified(saveAs)file.
 void setActionBorder(java.lang.String actionName)
          This method arranges the borders on the textToolBar buttons.
 void setActionEnabled(java.lang.String name, boolean set)
          This Method is called to toggle the "for files" appropriate Actions on-or-off.
 void setActualFont(java.awt.Font f)
          This method sets the Font to write with.
 void setActualFontSize(int as)
          This method sets fontSize to write with, and updates actualFont.
 void setBackgroundColor(java.awt.Color bc)
          Sets the backgroundColor of the current cover to the Color bc.
 void setBackgroundImage(java.awt.image.BufferedImage bi, java.lang.String id, boolean mode)
          Passes the BufferedImage to the CDrawingPane with its TempFiles-key and the fit-mode
 void setBackgroundImage(java.lang.String id, boolean mode)
          This Method passes the Background image id to the drawPane, and sets the background flag from its parent (activeCover).
 void setCutNWasteable(boolean b)
          Sets whether we can cut'n'waste objects.
 void setData(Data d)
          Sets the data for the current project.
 void setImage(java.lang.String id)
          This Method adds a normal Image to the active cover.
 void setMyTitle(java.lang.String s)
          Sets the title of the frame.
 void setSave(boolean b)
          Sets the saveaction and isSaved variable.
 void setSelectedElement(Element e)
          Sets which element is selected.
 void setTextBold(boolean b)
          This Method sets whether to write in bold or not
 void setTextColor(java.awt.Color tc)
          This method sets Fontcolor to write with.
 void setTextEnabled(boolean te)
          This method is called to set the drawingPane in TextMode.
 void setTextItalic(boolean i)
          This Method sets whether to write in italic or not
 void setTextStylesOff()
          This method sets all textstyles like bold, underline and italic off.
 void setTextUnderline(boolean u)
          This Method sets whether to write in underline or not
 void setUndoAction(DoAction undo)
          Sets the current undo action.
 void setWorking(boolean work)
          This method sets the working-icon on or off.
 void showNewWizard()
          Creates a new ActionEvent with a newAction, and calls its actionperformed method.
 void showPopup(java.awt.Component invoker, int x, int y, java.lang.String title)
          Sets the popup to be used on the selected element.
static int showQuestion(java.lang.String question, int option)
          This method shows a question dialog to the user, and returns the value the user chosen.
 void stop()
          Shuts the application down.
 java.lang.String toString()
          This method returns a String representing this frame.
 void updateTextBar(java.lang.String command)
          This method is called when the user is in textmode, and klicks on the new button, it "fakes" an action event.
 void wizardOn(boolean on, CdoxWizard wiz)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

saveFile

public java.io.File saveFile
The file which is currently used to save this project in

Constructor Detail

CDoxFrame

public CDoxFrame(CDox cdox,
                 java.lang.String filename)

CDoxFrame

public CDoxFrame(CDox cdx)

This is the main constructor of the program, if this works everything works. First we add a windowListener to insure that closing is done properly. Then the cdox-icon is set. After that the menubar and its menus are made. There are four menus:

The actions are initialized menu and the resulting menu-items are added to the menus. Also there are some Actions (line: 186) innitialized for the popupMenus and the TextToolbar (line: 245). The menus are added!

After that the configurable Actions are set(line: 309). Then the fontSizeBox is filled up to 72, and the Fonts are loaded (line: 357). The fonts'actions are added to the font(Size)Box, and some standard stuff for the comboboxes (line: 410).

The Buttons for the textToolBar are created (line: 430), and after that the toolbars are added to an extra panel, which itself will be added together with the statusDrawer (ox) to the NorthPane, which on its turn is added to the contentPane (line: 454).

The ToolbarButtons are added for the textToolBar and the genericToolbar. (line: 365). Actions are set Enabled and some not (line: 501). The File chooser is initialized (so that it recursively can start to go through all disks etc). The EditPane (Which will contain the CDCover's which will contain the CDDrawingPanes, which interact with Cover) is added to a ScrollPane which is added to the ContentPane in the CENTER. The statusPane is added to the SOUTH. The editPane is filled with a front and back-side (line: 539).

All that needs to be done now is the newDialog to initialize and the frame needs to be centered. After this the start-sound is played.

Parameters:
cdx - a CDox value.
See Also:
addCovers(int[]), center(java.awt.Window), ConfigurationDialog, CoverDialog, EditAction, EditBildAction, EditPane, FileAction, HelpAction, InsertAction, MyFileChooser, StatusDrawer, StatusPane, TextAction, ToolBarPane
Method Detail

run

public void run()
In this run method the printers are searched for at start up. This can enhance the speed, especially for network printers, of the printing process significantly.

Specified by:
run in interface java.lang.Runnable

getAllPrinters

public javax.print.PrintService[] getAllPrinters()
Returns all printers on the System, capable of printing this document.

Returns:
the PrintServices (speak:"printers"), installed on this system.

getDefaultPrinter

public javax.print.PrintService getDefaultPrinter()
Returns the default printer installed on this system.

Returns:
the default_PrintService (speak:"default_printer"), installed on this system.

center

public void center(java.awt.Window win)
Sets the given windows to the center of the screen and packs it.

Parameters:
win - the window to center on the screen.

handleError

public static void handleError(java.lang.Throwable e,
                               boolean writeLog)
This method should be called from all exceptions, it is able to play a sound and write in the log-file of CDox-errors.

Parameters:
e - the Trowable that caused the problem
writeLog - true to write the problem in the log, false for a normal error message.

showQuestion

public static int showQuestion(java.lang.String question,
                               int option)
This method shows a question dialog to the user, and returns the value the user chosen. It also plays a sound.

Parameters:
question - the question to be displayed
option - the JOptionPane options for example JOptionPane.YES_NO_OPTION.
Returns:
an the value the user has clicked (YES NO CANCEL)

loadImage

public static java.awt.image.BufferedImage loadImage(java.io.InputStream in)
Reads an image out of the stream. This one creates a BufferedImage WITHOUT a IndexedColorModel.

Parameters:
in - where to read the image.
Returns:
the image.

lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard c,
                          java.awt.datatransfer.Transferable contents)
This method is inherited from ClipBoardOwner and does nothing.

Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner
Parameters:
c - the Clipboard which is this class contains
contents - the content of the Clipboard

setCutNWasteable

public void setCutNWasteable(boolean b)
Sets whether we can cut'n'waste objects. Causes the cut/copy actions to be available, if true.

Parameters:
b - whether we can be cut'n'wasted.

getScrollPane

public javax.swing.JScrollPane getScrollPane()
This Method returns the ScrollPane for use in other classes.

Returns:
the ScrollPane.

getEditPane

public EditPane getEditPane()
This method returns the editPane

Returns:
the editpane

getImageEditPopupMenu

public javax.swing.JMenu getImageEditPopupMenu()
Returns the popup imageEditMenu.

Returns:
the imageEditpopupMenu

getStatusPane

public StatusPane getStatusPane()
This method returns the statusPane.

Returns:
the statuspane.

getStatusDrawer

public StatusDrawer getStatusDrawer()
This method returns the statusDrawer.

Returns:
the statusDrawer.

setWorking

public void setWorking(boolean work)
This method sets the working-icon on or off.

Parameters:
work - true if working false if not.

isWorking

public boolean isWorking()
This method returns true if the program is calculating something.

Returns:
true if calculating false otherwhise.

getStandardToolBar

public javax.swing.JToolBar getStandardToolBar()
This method returns the toobar

Returns:
the toolbar

getTextToolBar

public javax.swing.JToolBar getTextToolBar()
This method returns the texttoobar

Returns:
the toolbar

getFileDialog

public MyFileChooser getFileDialog()
This method returns the fileChooser dialog

Returns:
the fileDialog

getColorChooser

public javax.swing.JColorChooser getColorChooser()
This method returns the Colordialog

Returns:
the ColorDialog

getNewDialog

public CoverDialog getNewDialog()
This method returns the newDialog

Returns:
the newDialog

showNewWizard

public void showNewWizard()
Creates a new ActionEvent with a newAction, and calls its actionperformed method.


wizardOn

public void wizardOn(boolean on,
                     CdoxWizard wiz)

isWizardOn

public boolean isWizardOn()

getWizardInstance

public CdoxWizard getWizardInstance()

getFontBox

public javax.swing.JComboBox getFontBox()
This method returns the fontBox (combobox).

Returns:
the fontbox.

getFontSizeBox

public javax.swing.JComboBox getFontSizeBox()
This method returns the fontSizeBox (combobox).

Returns:
the fontSizebox.

getFontIndex

public int getFontIndex(java.lang.String fontFamily)
Returns the index of the fontfamily, which is coherent with the index of the Font in the fontBox.

Parameters:
fontFamily - the String representing the current used font
Returns:
the index of the fontFamily
See Also:
CaretUpdater.caretUpdate(javax.swing.event.CaretEvent)

addCovers

public void addCovers(int[] whichCovers)
This method adds the drawingPanes to the EditPane, it calls the same method in editpane. The array of ints are defined as: front, booklet, back -> with following values: 0, 1, 2. The not used values should be -1. If for example a project should have a backside and a front the arra would look like [0, -1, 2].

Parameters:
whichCovers - an array of ints decribing the kind of covers to be displayed in this project.

addCovers

public void addCovers(Cover[] whichCovers,
                      java.lang.String title)
This method adds the drawingPanes to the EditPane, it calls the same method in editpane. This one gets already created covers as argument.

Parameters:
whichCovers - the covers allready created.
title - the new title of the frame, apart from the CDFront/.../ stuff.

setSave

public void setSave(boolean b)
Sets the saveaction and isSaved variable.

Parameters:
b - true means the cover has to be saved.

resetSaveFile

public void resetSaveFile()
Sets the default saveFile to null.


checkSaveable

public void checkSaveable()
This method checks to see whether an opened file have to be saved or not. To do so it uses the boolean isSaved which is standardly put on true,and altered to false when a file has been opened and edited. If false, a dialog is opened, asking for a filename, if one has been chosen, it will be saved, otherwise nothing happens.

See Also:
FileAction.actionPerformed(java.awt.event.ActionEvent)

saveAs

public void saveAs(java.io.File f)
Sets the saveFile to f.

Parameters:
f - the file to save_as to.

saveFile

public void saveFile(java.io.File file)
This Method is concerned whith the saving of a modified or not modified(saveAs)file.

Parameters:
file - is the file to save

setMyTitle

public void setMyTitle(java.lang.String s)
Sets the title of the frame. Checks if the frameTitle exists, if not the title is set appropriate to s. If frametitle exists s is checked for the "*" and "" which means not saved and saved. If this is methoc is called with those the Title is updated. If the file is saved, automatically the projects name is entered in the frametitlebar.

Parameters:
s - a String which can be a new file, an "*" a "" or the name of the project.
See Also:
setSave(boolean), saveFile, EditPane.addCoverTemplates(int[], java.awt.Font, boolean, boolean, boolean, java.awt.Color)

readDocuments

public Cover[] readDocuments(java.io.File f)
This method will read the contents of the file. The file must be in the cdox format, meaning that it's a zipfile containing a xml document named documents.cdx and possibly some files containing information about elements (like images), like the one that is created by the saveFile method. Returns the covers that have been in the file.

Parameters:
f - the file to read.
Returns:
the reconstructed covers.

setActionEnabled

public void setActionEnabled(java.lang.String name,
                             boolean set)
This Method is called to toggle the "for files" appropriate Actions on-or-off.

Parameters:
name - the inside-the-program-name for the action
set - is the boolean to set the actions to.

toString

public java.lang.String toString()
This method returns a String representing this frame.

Returns:
a string representing this frame.

getImageDir

public java.lang.String getImageDir()
This method returns the directory of the images.

Returns:
a string representing the directory of the images.

setUndoAction

public void setUndoAction(DoAction undo)
Sets the current undo action.

Parameters:
undo - the action.

setBackgroundImage

public void setBackgroundImage(java.lang.String id,
                               boolean mode)
                        throws java.io.IOException
This Method passes the Background image id to the drawPane, and sets the background flag from its parent (activeCover). For the mode parameter see the Cover methods.

Parameters:
id - the String which is a valid unique id for the File on disk
mode - the mode.
Throws:
java.io.IOException - if an error occurs.
See Also:
Cover.setBackground(String,boolean)

setBackgroundImage

public void setBackgroundImage(java.awt.image.BufferedImage bi,
                               java.lang.String id,
                               boolean mode)
Passes the BufferedImage to the CDrawingPane with its TempFiles-key and the fit-mode

Parameters:
bi - the allready loaded bufferedbackgroundImage
id - the String which is a valid unique id for the File on disk
mode - the mode.

setBackgroundColor

public void setBackgroundColor(java.awt.Color bc)
Sets the backgroundColor of the current cover to the Color bc.

Parameters:
bc - the new backgroundColor

hasBackground

public boolean hasBackground()
This method is called when the user wants to change the backgroundimage

Returns:
true if activeCover has a backgroundImage false otherwhise

setImage

public void setImage(java.lang.String id)
              throws java.io.IOException
This Method adds a normal Image to the active cover.

Parameters:
id - the String which is a valid unique id for the File on disk
Throws:
java.io.IOException - if an error occurs.

setTextEnabled

public void setTextEnabled(boolean te)
This method is called to set the drawingPane in TextMode.

Parameters:
te - true if entering text mode, false otherwhise.

getTextEnabled

public boolean getTextEnabled()
This method returns if true if the drawingPane is in TextMode.

Returns:
true if in textMode false otherwhise.

updateTextBar

public void updateTextBar(java.lang.String command)
This method is called when the user is in textmode, and klicks on the new button, it "fakes" an action event.

Parameters:
command - defining what happens, if on one cover in textmode clicked on another cover command will be "cover" else its null.
See Also:
TextAction.actionPerformed(java.awt.event.ActionEvent)

setActionBorder

public void setActionBorder(java.lang.String actionName)
This method arranges the borders on the textToolBar buttons.

Parameters:
actionName - the name of the action to set the Border.

setTextStylesOff

public void setTextStylesOff()
This method sets all textstyles like bold, underline and italic off.


getActualFont

public java.awt.Font getActualFont()
This method returns the actual font.

Returns:
the actual font.

setActualFont

public void setActualFont(java.awt.Font f)
This method sets the Font to write with.

Parameters:
f - the font to write with.

getActualFontSize

public int getActualFontSize()
This method returns the actualfontSize.

Returns:
the actual fontsize.

setActualFontSize

public void setActualFontSize(int as)
This method sets fontSize to write with, and updates actualFont.

Parameters:
as - the font size to write with.

setTextBold

public void setTextBold(boolean b)
This Method sets whether to write in bold or not

Parameters:
b - true to write in bold false otherwhise.

setTextUnderline

public void setTextUnderline(boolean u)
This Method sets whether to write in underline or not

Parameters:
u - true to write in underline false otherwhise.

setTextItalic

public void setTextItalic(boolean i)
This Method sets whether to write in italic or not

Parameters:
i - true to write in italic false otherwhise.

getTextBold

public boolean getTextBold()
This method returns true if the text is written in bold.

Returns:
true if the bold-style is set, false otherwhise.

getTextUnderline

public boolean getTextUnderline()
This method returns true if the text is written with underline.

Returns:
true if the underline-style is set, false otherwhise.

getTextItalic

public boolean getTextItalic()
This method returns true if the text is written in italic.

Returns:
true if the italic-style is set, false otherwhise.

setTextColor

public void setTextColor(java.awt.Color tc)
This method sets Fontcolor to write with.

Parameters:
tc - the fontcolor to write with.

getTextColor

public java.awt.Color getTextColor()
This method returns true if the textcolor.

Returns:
the color of the text.

rotateElement

public void rotateElement(double deg)
Rotates the selected element a by the given degrees. If no element is selected, nothing happens.

Parameters:
deg - the degrees by which to rotate, for example 90.

flipElementHorizontal

public void flipElementHorizontal()
Sets the specified horizontal flipping of the selected element.


flipElementVertical

public void flipElementVertical()
Sets the specified Vertical flipping of the selected element.


reEditTextElement

public void reEditTextElement()
This method is called when a text object needs to be re-edited.(popup menu)


removeAllElements

public void removeAllElements()
Removes all elements from the current Cover.


showPopup

public void showPopup(java.awt.Component invoker,
                      int x,
                      int y,
                      java.lang.String title)
Sets the popup to be used on the selected element.

Parameters:
invoker - the active drawing pane,
x - the x-position of the popup menu,
y - the y-position of the popup menu,
title - the title of the popup.

setSelectedElement

public void setSelectedElement(Element e)
Sets which element is selected.

Parameters:
e - the element, or null, if no element should be selected.

configure

public void configure(boolean show)
If show is true, it shows the configuration dialog, if not, it creates a new one. In either case the actions are configured.

Parameters:
show - whether to show or create a new configuration dialog.

stop

public void stop()
Shuts the application down.


checkCloseable

public int checkCloseable()
Checks, if the actual document has been saved. If not, it asks the user, if it should be saved.

Returns:
the value the user selected as answer (YES NO)

processWindowEvent

protected void processWindowEvent(java.awt.event.WindowEvent we)
Is overwritten from JFrame, it enables the user to cancel the accidentially close click.

Parameters:
we - the WindowEvent.

getData

public Data getData()
Returns the Data for the current project or null, if none has been set.

Returns:
the properties of this project.

setData

public void setData(Data d)
Sets the data for the current project.

Parameters:
d - the new data.