tabs
Class TabsContainer

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by tabs.TabsContainer
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class TabsContainer
extends org.eclipse.swt.widgets.Composite

Instances of this class that represents the TabFolder to be used by the ProjectWindow


Field Summary
protected  int MAX_UNDO_HISTORY
           
protected  int RESIZED_IMAGE_HEIGHT
           
protected  int RESIZED_IMAGE_WIDTH
          The width and height of the image that will be initialized by the ProjectWindow
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
TabsContainer(ProjectWindow parent, int style, int resizedImageWidth, int resizedImageHeight)
          Constructs a new instance of this class that initializes all the tabs
 
Method Summary
 void changeHairVisibility(boolean selection)
          Hides or unhides the HairTab's hair image
 void clear()
          Method that resets all the changes made to the original's project image
 void createHistoryStep()
          Create a history step for the current active tab
 void createTabFolder()
          This method initializes tabFolder, creates and adds all tabs on tabFolder
 void dispose()
          Dispose all unused resources to reduce memory leaks
 void drawCurrentLayer(java.awt.Graphics2D g2d)
          Calls the current tab to draw it's resulting image on the DrawingContainer using DrawingContainer's given Graphics2D
 java.awt.image.BufferedImage getCurrentLayer()
          Method that returns the selected tab layer
 TabContainer getCurrentTab()
          Method that returns the selected tab layer
 java.awt.image.BufferedImage getLowerLayers()
          Method that returns an image containing all the layers that are below the selected tab layer, including the original image
 java.awt.image.BufferedImage getOriginalImage()
          Returns a copy of the project's original image
 ProjectWindow getParentProject()
          Returns the tabs container associated project
 java.awt.image.BufferedImage getUpperLayers()
          Method that returns an image containing all the layers that are above the selected tab layer
 void originalImageChanged()
          Notify all tabs that the projec't original image was changed (size, rotation, position)
 void redo()
          Method that goes one step forward in the changes history
 void redrawImageArea(TabContainer callerTab)
          Call for a complete redrawing of the project's drawing area
 void setLensPath()
          Opens a dialog that allows the user to trace the eyes path for the lens tab
 void setLipsPath()
          Opens a dialog that allows the user to trace the lips path for the lips tab
 void setOriginalImage(java.awt.image.BufferedImage originalImage)
          Method that initializes the originalImage with the image read from file by the ProjectWindow class
 void setShadowPath()
          Opens a dialog that allows the user to trace the eyes path for the shadow tab
 void undo()
          Method that goes one step back in the changes history
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESIZED_IMAGE_WIDTH

protected final int RESIZED_IMAGE_WIDTH
The width and height of the image that will be initialized by the ProjectWindow


RESIZED_IMAGE_HEIGHT

protected final int RESIZED_IMAGE_HEIGHT

MAX_UNDO_HISTORY

protected final int MAX_UNDO_HISTORY
Constructor Detail

TabsContainer

public TabsContainer(ProjectWindow parent,
                     int style,
                     int resizedImageWidth,
                     int resizedImageHeight)
Constructs a new instance of this class that initializes all the tabs

Parameters:
parent - The parent composite
style - SWT styles
resizedImageWidth - the width of the project's original image
resizedImageHeight - the height of the project's original image
Method Detail

createTabFolder

public void createTabFolder()
This method initializes tabFolder, creates and adds all tabs on tabFolder


getUpperLayers

public java.awt.image.BufferedImage getUpperLayers()
Method that returns an image containing all the layers that are above the selected tab layer

Returns:
BufferedImage with all the layers above the selected tab layer

getCurrentLayer

public java.awt.image.BufferedImage getCurrentLayer()
Method that returns the selected tab layer

Returns:
BufferedImage that contains the selected tab layer

drawCurrentLayer

public void drawCurrentLayer(java.awt.Graphics2D g2d)
Calls the current tab to draw it's resulting image on the DrawingContainer using DrawingContainer's given Graphics2D

Parameters:
g2d - DrawingContainer's Graphics2D

getLowerLayers

public java.awt.image.BufferedImage getLowerLayers()
Method that returns an image containing all the layers that are below the selected tab layer, including the original image

Returns:
BufferedImage with all the layers below the selected tab layer

getCurrentTab

public TabContainer getCurrentTab()
Method that returns the selected tab layer

Returns:
TabContainer with the selected tab

setOriginalImage

public void setOriginalImage(java.awt.image.BufferedImage originalImage)
Method that initializes the originalImage with the image read from file by the ProjectWindow class

Parameters:
originalImage -

undo

public void undo()
Method that goes one step back in the changes history


redo

public void redo()
Method that goes one step forward in the changes history


clear

public void clear()
Method that resets all the changes made to the original's project image


redrawImageArea

public void redrawImageArea(TabContainer callerTab)
Call for a complete redrawing of the project's drawing area

Note that only the current tab has access to this feature. Other tabs calls that are in the background will be ignored

Parameters:
callerTab - the tab that calls for the redrawing

createHistoryStep

public void createHistoryStep()
Create a history step for the current active tab


getParentProject

public ProjectWindow getParentProject()
Returns the tabs container associated project

Returns:
the tabs container associated project

getOriginalImage

public java.awt.image.BufferedImage getOriginalImage()
Returns a copy of the project's original image

Returns:
a copy of the project's original image

setShadowPath

public void setShadowPath()
Opens a dialog that allows the user to trace the eyes path for the shadow tab


setLensPath

public void setLensPath()
Opens a dialog that allows the user to trace the eyes path for the lens tab


setLipsPath

public void setLipsPath()
Opens a dialog that allows the user to trace the lips path for the lips tab


changeHairVisibility

public void changeHairVisibility(boolean selection)
Hides or unhides the HairTab's hair image

Parameters:
selection - true if the hair should be visible, false otherwise

originalImageChanged

public void originalImageChanged()
Notify all tabs that the projec't original image was changed (size, rotation, position)


dispose

public void dispose()
Dispose all unused resources to reduce memory leaks

Overrides:
dispose in class org.eclipse.swt.widgets.Widget