org.diamondspin
Class DSView

java.lang.Object
  extended by org.diamondspin.DSView
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener
Direct Known Subclasses:
DSDefaultView

public class DSView
extends Object
implements MouseListener, MouseMotionListener

DSView is an class the different views must customize. By default this one is an empty view. It's in this object you have to implement a data structure to store the DSElement (a list or a tree, for instance). If you want to have a different background for multiple views, you can store them here, but you will have to call the setBackground(...) of DSTabletopPane to show them.

Copyright 2002-2009 DiamondSpin project. All Rights Reserved.

Permission to use, copy, modify and distribute this software and its documentation for educational, research and non-profit purposes, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and the following three paragraphs appear in all copies.

To request Permission to incorporate this software into commercial products contact one of the authors of the project.
  • Frederic Vernier (frederic.vernier@limsi.fr)
  • Chia Shen (chia_shen@harvard.edu)
  • Guillaume Besacier (guillaume.besacier@limsi.fr)
  • Daniel Wigdor (dwigdor@microsoft.com)

IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

Version:
: 1.0
Author:
: Frederic vernier, (frederic.vernier@gmail.com) and Meredith Ringel (merrie@stanford.edu) under Chia Shen supervision n(chia_shen@harvard.edu).

Field Summary
protected  double backgroundAngle
           
protected  Point2D.Double backgroundCenter
           
protected  BufferedImage backgroundImage
           
protected  int backgroundMarginX
           
protected  int backgroundMarginY
           
protected  Paint backgroundPaint
           
protected  double backgroundZoom
           
protected  DSTabletopPane dsTabletopPane
           
static double FOLDED_HEIGHT_PERCENTAGE
           
static double FOLDED_WIDTH_PERCENTAGE
           
protected  double foldedHeightPercentage
           
protected  double foldedWidthPercentage
           
protected  double oldBackgroundAngle
           
protected  Point2D.Double oldBackgroundCenter
           
protected  double oldBackgroundZoom
           
protected  BufferedImage resizedBackground
           
protected  EventListenerList viewListeners
           
 
Constructor Summary
DSView(DSTabletopPane dsTabletopPane_Arg)
          Constructor
 
Method Summary
 void addDSGestureListener(DSGestureListener listener)
           
 void addDSViewListener(DSViewListener listener)
           
 void fireBackgroundRotated()
           
 void fireBackgroundTranslated()
           
 void fireBackgroundUpdated()
           
 void fireBackgroundZoomed()
           
 void fireGestureProgress(DSGestureEvent evt)
           
 void fireGestureStart(DSGestureEvent evt)
           
 void fireGestureStop(DSGestureEvent evt)
           
 void fireViewGrabbed()
           
 void fireViewReleased()
          a view trigger events for global rotation
 void fireViewRotated()
          a view trigger events for global rotation
 void fireViewTranslated()
           
 void fireViewZoomed()
           
 BufferedImage getBackground()
          background cropped image for the view
 double getBackgroundAngle()
           
 Point2D.Double getBackgroundCenter()
          for the views which have a space bigger than the container it is possible to pan the
 Paint getBackgroundPaint()
          Gets the backgroundPaint attribute of the DSView object
 double getBackgroundZoom()
          zoom the background to set the given point in the center
 double getFoldedHeightPercentage()
           
 double getFoldedWidthPercentage()
           
 BufferedImage getFullBackground()
          background image for the view
 DSTabletopPane getTabletopPane()
          Gets the container attribute of the DSView object
 void incrBackgroundX(int incr)
          scroll or pan or move (choose your word) the background
 void incrBackgroundY(int incr)
          scroll or pan or move (choose your word) the background
 void mouseClicked(MouseEvent event)
          mouse callbacks to receive events from the DSTabletopPane
 void mouseDragged(MouseEvent event)
          mouse callbacks to receive events from the DSTabletopPane
 void mouseEntered(MouseEvent event)
          mouse callbacks to receive events from the DSTabletopPane
 void mouseExited(MouseEvent event)
          mouse callbacks to receive events from the DSTabletopPane
 void mouseMoved(MouseEvent event)
          mouse callbacks to receive events from the DSTabletopPane
 void mousePressed(MouseEvent event)
          mouse callbacks to receive events from the DSTabletopPane
 void mouseReleased(MouseEvent event)
          mouse callbacks to receive events from the DSTabletopPane
 void openPopupMenuGlobal(double d, double alpha, int id)
          open a popup menu related generally to the view, not one particular element
 void paint(Graphics2D g)
          all the views can be painted
 void removeDSGestureListener(DSGestureListener l)
           
 void removeViewListener(DSViewListener listener)
           
 void setBackground(BufferedImage img)
          a view has a nice image in background
 void setBackgroundAngle(double a)
          rotate the background to reach the given angle
 void setBackgroundCenter(double x, double y)
          scroll or pan or move (choose your word) the background to set the given point in the center
 void setBackgroundPaint(Paint paint)
          Sets the backgroundPaint attribute of the DSView object
 void setBackgroundZoom(double z)
          zoom the background to set the given point in the center
 void setFoldedHeightPercentage(double foldedHeightPercentage)
           
 void setFoldedWidthPercentage(double foldedWidthPercentage)
           
 void setSnapToAngle(boolean shouldSnap)
          if this is set to true, then all objects in the view will snap to a certain angle
 void updateBackground()
          As displayed background may be rotated / translated /zoomed compred to the backgroundImage we have to update it often
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dsTabletopPane

protected DSTabletopPane dsTabletopPane

viewListeners

protected EventListenerList viewListeners

FOLDED_WIDTH_PERCENTAGE

public static final double FOLDED_WIDTH_PERCENTAGE
See Also:
Constant Field Values

FOLDED_HEIGHT_PERCENTAGE

public static final double FOLDED_HEIGHT_PERCENTAGE
See Also:
Constant Field Values

foldedWidthPercentage

protected double foldedWidthPercentage

foldedHeightPercentage

protected double foldedHeightPercentage

backgroundImage

protected BufferedImage backgroundImage

resizedBackground

protected BufferedImage resizedBackground

backgroundPaint

protected Paint backgroundPaint

backgroundCenter

protected Point2D.Double backgroundCenter

backgroundMarginX

protected int backgroundMarginX

backgroundMarginY

protected int backgroundMarginY

backgroundZoom

protected double backgroundZoom

backgroundAngle

protected double backgroundAngle

oldBackgroundZoom

protected double oldBackgroundZoom

oldBackgroundAngle

protected double oldBackgroundAngle

oldBackgroundCenter

protected Point2D.Double oldBackgroundCenter
Constructor Detail

DSView

public DSView(DSTabletopPane dsTabletopPane_Arg)
Constructor

Parameters:
dsTabletopPane_Arg - Description of the Parameter
Method Detail

addDSViewListener

public void addDSViewListener(DSViewListener listener)

removeViewListener

public void removeViewListener(DSViewListener listener)

addDSGestureListener

public void addDSGestureListener(DSGestureListener listener)

removeDSGestureListener

public void removeDSGestureListener(DSGestureListener l)

fireGestureStart

public void fireGestureStart(DSGestureEvent evt)

fireGestureProgress

public void fireGestureProgress(DSGestureEvent evt)

fireGestureStop

public void fireGestureStop(DSGestureEvent evt)

fireViewRotated

public void fireViewRotated()
a view trigger events for global rotation


fireViewReleased

public void fireViewReleased()
a view trigger events for global rotation


fireViewTranslated

public void fireViewTranslated()

fireBackgroundTranslated

public void fireBackgroundTranslated()

fireBackgroundRotated

public void fireBackgroundRotated()

fireBackgroundZoomed

public void fireBackgroundZoomed()

fireBackgroundUpdated

public void fireBackgroundUpdated()

fireViewZoomed

public void fireViewZoomed()

fireViewGrabbed

public void fireViewGrabbed()

getTabletopPane

public DSTabletopPane getTabletopPane()
Gets the container attribute of the DSView object

Returns:
The container value

paint

public void paint(Graphics2D g)
all the views can be painted

Parameters:
g - Description of the Parameter

openPopupMenuGlobal

public void openPopupMenuGlobal(double d,
                                double alpha,
                                int id)
open a popup menu related generally to the view, not one particular element

Parameters:
d - the D where the popup should appear
alpha - the Alpha where the popup should appear
id - the user who invoked the popup menu

setBackground

public void setBackground(BufferedImage img)
a view has a nice image in background

Parameters:
img - The new background value

updateBackground

public void updateBackground()
As displayed background may be rotated / translated /zoomed compred to the backgroundImage we have to update it often


getBackground

public BufferedImage getBackground()
background cropped image for the view

Returns:
The background image

getFullBackground

public BufferedImage getFullBackground()
background image for the view

Returns:
The background image

getBackgroundCenter

public Point2D.Double getBackgroundCenter()
for the views which have a space bigger than the container it is possible to pan the

Returns:
The backgroundX value

setBackgroundCenter

public void setBackgroundCenter(double x,
                                double y)
scroll or pan or move (choose your word) the background to set the given point in the center

Parameters:
x - The new background Center in the view
y - The new background Center in the view

getBackgroundAngle

public double getBackgroundAngle()
Returns:
the angle of the background

setBackgroundAngle

public void setBackgroundAngle(double a)
rotate the background to reach the given angle

Parameters:
a - The new background angle

getBackgroundZoom

public double getBackgroundZoom()
zoom the background to set the given point in the center


setBackgroundZoom

public void setBackgroundZoom(double z)
zoom the background to set the given point in the center

Parameters:
z - The new zoom factor in the view

incrBackgroundX

public void incrBackgroundX(int incr)
scroll or pan or move (choose your word) the background

Parameters:
incr - Description of the Parameter

incrBackgroundY

public void incrBackgroundY(int incr)
scroll or pan or move (choose your word) the background

Parameters:
incr - Description of the Parameter

mousePressed

public void mousePressed(MouseEvent event)
mouse callbacks to receive events from the DSTabletopPane

Specified by:
mousePressed in interface MouseListener
Parameters:
event - Description of the Parameter

mouseReleased

public void mouseReleased(MouseEvent event)
mouse callbacks to receive events from the DSTabletopPane

Specified by:
mouseReleased in interface MouseListener
Parameters:
event - Description of the Parameter

mouseEntered

public void mouseEntered(MouseEvent event)
mouse callbacks to receive events from the DSTabletopPane

Specified by:
mouseEntered in interface MouseListener
Parameters:
event - Description of the Parameter

mouseExited

public void mouseExited(MouseEvent event)
mouse callbacks to receive events from the DSTabletopPane

Specified by:
mouseExited in interface MouseListener
Parameters:
event - Description of the Parameter

mouseClicked

public void mouseClicked(MouseEvent event)
mouse callbacks to receive events from the DSTabletopPane

Specified by:
mouseClicked in interface MouseListener
Parameters:
event - Description of the Parameter

mouseMoved

public void mouseMoved(MouseEvent event)
mouse callbacks to receive events from the DSTabletopPane

Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
event - Description of the Parameter

mouseDragged

public void mouseDragged(MouseEvent event)
mouse callbacks to receive events from the DSTabletopPane

Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
event - Description of the Parameter

getBackgroundPaint

public Paint getBackgroundPaint()
Gets the backgroundPaint attribute of the DSView object

Returns:
The backgroundPaint value

setBackgroundPaint

public void setBackgroundPaint(Paint paint)
Sets the backgroundPaint attribute of the DSView object

Parameters:
paint - The new backgroundPaint value

setSnapToAngle

public void setSnapToAngle(boolean shouldSnap)
if this is set to true, then all objects in the view will snap to a certain angle

Parameters:
shouldSnap - The new snapToAngle value

getFoldedWidthPercentage

public double getFoldedWidthPercentage()

setFoldedWidthPercentage

public void setFoldedWidthPercentage(double foldedWidthPercentage)

getFoldedHeightPercentage

public double getFoldedHeightPercentage()

setFoldedHeightPercentage

public void setFoldedHeightPercentage(double foldedHeightPercentage)


Copyright © 2006 Frederic Vernier(LIMSI) Chia Shen(MERL) Guillaume Besacier(LIMSI). All Rights Reserved.