cdox.edit
Class CDDrawingPane

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycdox.edit.CDDrawingPane
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class CDDrawingPane
extends javax.swing.JPanel

This class represents the Actual drawing Panel.

Author:
Rutger Bezema, Andreas Schmitz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CDDrawingPane(CDoxFrame c, java.awt.Dimension dim, Cover cover, int template, java.awt.Font theFont, boolean bold, boolean italic, boolean underline, java.awt.Color tColor)
          Constructs new one with the given cover.
CDDrawingPane(CDoxFrame c, java.awt.Dimension dim, int template, java.awt.Font theFont, boolean bold, boolean italic, boolean underline, java.awt.Color tColor)
          The Constructor sets the size, and the background Color.
 
Method Summary
 void addImage(java.lang.String id)
          This method adds a normal Image to this pane.
 java.awt.Color getBackgroundColor()
          This Method returns the current background color.
 Cover getCover()
          This method returns this drawingPane's cover-Object.
 java.awt.Point getCurrentClickPoint()
          Returns the point clicked by the user.
 Element getSelectedElement()
          Returns the current selected element.
 TextPane getTextPane()
          This Method returns the current TextPane.
 boolean isTextEnabled()
          Returns true if this CDDrawingPane is in textMode.
 void paint(java.awt.Graphics g)
          This Method is called when we need to (re)draw on this element.
 void reEditTextElement(Element e)
          This method is called when a text element mus be re-edited.
 void setActive(boolean b)
          This Method sets this panel active or Inactive, if inactive the backgroundImage is painted in grayscale.
 void setBackgroundColor(java.awt.Color bgc)
          This Method sets the specified background color to this Panel.
 void setBackgroundImage(java.awt.image.BufferedImage bi, java.lang.String id, boolean mode)
          This Method sets the specified image as background image to this panel.
 void setBackgroundImage(java.lang.String id, boolean mode)
          This Method sets the specified image as background image to this panel.
 void setBold(boolean b)
          This Method sets whether to write in bold or not
 void setElementSelected(Element e)
          This method keeps track of which Element is selected, should be selected, or should be not selected.
 void setFontSize(int fSize)
          This Method sets the Size of the font in the TextPane
 void setItalic(boolean i)
          This Method sets whether to write in italic or not
 void setScrollPaneDimension(int width, int height)
          This Method is called when the Window is resized, it can than check if it needs to scroll.
 void setTextColor(java.awt.Color tc)
          This method sets the Color of the text.
 void setTextEnabled(boolean b)
          This Method sets whether we're in textMode or not.
 void setTextFont(java.awt.Font f)
          This Method sets the font to write with.
 void setUnderline(boolean u)
          This Method sets whether to write in underline or not
 java.lang.String toString()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CDDrawingPane

public CDDrawingPane(CDoxFrame c,
                     java.awt.Dimension dim,
                     int template,
                     java.awt.Font theFont,
                     boolean bold,
                     boolean italic,
                     boolean underline,
                     java.awt.Color tColor)
The Constructor sets the size, and the background Color.

Parameters:
c - the CDoxFrame.
dim - the Dimension of this CDDrawingPane,
template - the sort of Cover it is,
theFont - the Font currently selected for the TextPane,
bold - true if bold is selected in the cdoxframe false otherwhise
italic - true if italic is selected in the cdoxframe false otherwhise
underline - true if underline is selected in the cdoxframe false otherwhise
tColor - the Color value.

CDDrawingPane

public CDDrawingPane(CDoxFrame c,
                     java.awt.Dimension dim,
                     Cover cover,
                     int template,
                     java.awt.Font theFont,
                     boolean bold,
                     boolean italic,
                     boolean underline,
                     java.awt.Color tColor)
Constructs new one with the given cover. If cover is null, a new, empty Cover of the template type will be created.

Parameters:
c - the CDoxFrame.
dim - the Dimension of this CDDrawingPane,
cover - the cover.
template - the sort of Cover it is,
theFont - the Font currently selected for the TextPane,
bold - true if bold is selected in the cdoxframe false otherwhise
italic - true if italic is selected in the cdoxframe false otherwhise
underline - true if underline is selected in the cdoxframe false otherwhise
tColor - the Color.
Method Detail

toString

public java.lang.String toString()

setActive

public void setActive(boolean b)
This Method sets this panel active or Inactive, if inactive the backgroundImage is painted in grayscale.

Parameters:
b - true for active (not grayscaled)

getCover

public Cover getCover()
This method returns this drawingPane's cover-Object.

Returns:
return this pane's Cover-Object

setScrollPaneDimension

public void setScrollPaneDimension(int width,
                                   int height)
This Method is called when the Window is resized, it can than check if it needs to scroll.

Parameters:
width - the width of the visible part of the ScrollPane
height - the height of the visible part of the ScrollPane

addImage

public void addImage(java.lang.String id)
              throws java.io.IOException
This method adds a normal Image to this pane.

Parameters:
id - the TempFiles id of the image.
Throws:
java.io.IOException - if an error occurs.
See Also:
CDoxFrame.setImage(java.lang.String), EditAction.actionPerformed(java.awt.event.ActionEvent)

setBackgroundImage

public void setBackgroundImage(java.lang.String id,
                               boolean mode)
                        throws java.io.IOException
This Method sets the specified image as background image to this panel. For the mode parameter see the Cover methods.

Parameters:
id - the TempFiles id.
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)
This Method sets the specified image as background image to this panel. For the mode parameter see the Cover methods.

Parameters:
bi - the allready loaded BufferedImage
id - the TempFiles id.
mode - the mode.
Throws:
java.io.IOException - if an error occurs.
See Also:
Cover.setBackground(String,boolean)

setBackgroundColor

public void setBackgroundColor(java.awt.Color bgc)
This Method sets the specified background color to this Panel.

Parameters:
bgc - the Background color

getBackgroundColor

public java.awt.Color getBackgroundColor()
This Method returns the current background color.

Returns:
the current background Color.

setTextEnabled

public void setTextEnabled(boolean b)
This Method sets whether we're in textMode or not.

Parameters:
b - true if in TextMode

isTextEnabled

public boolean isTextEnabled()
Returns true if this CDDrawingPane is in textMode.

Returns:
true if in textMode false otherwhise.

getTextPane

public TextPane getTextPane()
This Method returns the current TextPane.

Returns:
the current TextPane, or null if no tPane is on.

setTextFont

public void setTextFont(java.awt.Font f)
This Method sets the font to write with.

Parameters:
f - the Font to write with.

setFontSize

public void setFontSize(int fSize)
This Method sets the Size of the font in the TextPane

Parameters:
fSize - the float value representing the size of the font.

setBold

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

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

setItalic

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

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

setUnderline

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

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

setTextColor

public void setTextColor(java.awt.Color tc)
This method sets the Color of the text.

Parameters:
tc - the new textColor.

paint

public void paint(java.awt.Graphics g)
This Method is called when we need to (re)draw on this element.

Parameters:
g - the Graphics object to draw with

reEditTextElement

public void reEditTextElement(Element e)
This method is called when a text element mus be re-edited.

Parameters:
e - the textelement that must be re-edited

setElementSelected

public void setElementSelected(Element e)
This method keeps track of which Element is selected, should be selected, or should be not selected.

Parameters:
e - the element to be selected, if e == null the currently selected element, will be deselected.

getSelectedElement

public Element getSelectedElement()
Returns the current selected element.

Returns:
the current selected element.

getCurrentClickPoint

public java.awt.Point getCurrentClickPoint()
Returns the point clicked by the user.