Synergy Home Page

au.edu.swin.synergy.plugin.diagram
Class BViewport

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--au.edu.swin.synergy.plugin.diagram.BViewport

public class BViewport
extends JPanel
implements MouseInputListener, BView, BSplitable, Printable

See Also:
Serialized Form

Inner Class Summary
 class BViewport.BClipboardOwner
          Need to give the clipboard something to talk to
 class BViewport.BUndoableEdit
          Every time an edit is made, this will be used to determine what to do when it is undone or redone.
 
Inner classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
 int kAdded
           
static int kAdditiveSelect
           
static int kExclusiveSelect
           
 int kMoved
           
 int kRemoved
           
 int kResized
           
 
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
 
Constructor Summary
BViewport(BPlugin par)
          Please complete the missing tags for BViewport
 
Method Summary
 void addSelectionListener(BSelectionListener l)
           
 void adjustmentValueChanged(AdjustmentEvent e)
          What to do when the scroll bar is clicked...
 void backTransformPoint(BScalarPoint pt)
          Please complete the missing tags for mouseClicked
 void bringSelectionToFront()
           
 int calcXOffset(int spacing)
           
 int calcYOffset(int spacing)
           
 void continueAdd(Point pt)
           
 void disablePalette()
           
 void doCopySelection(Vector currentSelection)
          Takes the currently selected items and places a copy of them on the clipboard.
 void doCutSelection()
          This will take the currently selected items, place a copy of them on the system clipboard and delete the selection.
 boolean doDeleteSelection(boolean isUndoable)
           
 void dontScrollOnInit()
           
 void doPasteDrawables()
          This will paste the contents of the clipboard to the model
 void doRedo()
          This will call the redo method on the edit manager to redo the last command undone.
 void doUndo()
          This will call the undo method on the edit manager to undo the last command undone.
 void dragAdd(BScalarPoint deltaXY)
           
 void dragDrag(BScalarPoint deltaXY)
           
 void dragMove(BScalarPoint deltaXY)
           
 void dragResize(BScalarPoint deltaXY)
           
 void drawGrid(Graphics g)
           
 void drawRuler(Graphics g)
           
 void enableGrid(boolean enable)
           
 void enableRuler(boolean enable)
           
 void enableSnap(boolean snap)
           
 void fireSelection()
           
 BDiagram getDiagram()
          Returns the diagram the viewport contains
 Color getGridColour()
           
 int getHalfHeight()
           
 BScalarPoint getHalfWH()
           
 int getHalfWidth()
           
 int getMajorRulerSpace()
           
 int getMinorRulerSpace()
           
 BSplitable getNewView()
           
 BScalar getOOZ()
           
 Color getRulerColour()
           
 BScalarRect getViewBounds()
           
 BScalarRect getViewCoords()
           
 int getXPos()
           
 int getYPos()
           
 BScalar getZ()
           
 void initPopup()
           
 boolean isGridEnabled()
           
 boolean isRulerEnabled()
           
 boolean isSnapEnabled()
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
          Please complete the missing tags for mouseDragged
 void mouseEntered(MouseEvent e)
          Please complete the missing tags for mouseEntered
 void mouseExited(MouseEvent e)
          Please complete the missing tags for mouseExited
 void mouseMoved(MouseEvent e)
          Please complete the missing tags for mouseMoved
 void mousePressed(MouseEvent e)
          Please complete the missing tags for mousePressed
 void mouseReleased(MouseEvent e)
          Please complete the missing tags for mouseReleased
 void paintComponent(Graphics g)
          Please complete the missing tags for paintComponent
 int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
          print to the graphics context...
 void refreshPalette()
           
 void relinquishUndoManager()
          This will tell the viewport to use the edit support matching the given key
 void removeHorzAdjustable()
           
 void removeSelectionListener(BSelectionListener l)
           
 void removeVertAdjustable()
           
 void render(Graphics g)
           
 void repaint()
           
 void scroll(BScalarPoint deltaXY)
           
 void select(BDrawable drawable, int type)
           
 void sendSelectionToBack()
           
 void setBounds(int x, int y, int w, int h)
           
 void setCurrentEditSupport(Object key)
          This will tell the viewport to use the edit support matching the given key
 void setDiagram(BDiagram diagram)
          Please complete the missing tags for setDiagram
 void setDiagramPlugin(BDiagramPlugin fDiagramPlugin)
           
 void setDrawablePalette(BDrawablePalette drawablePalette)
          Please complete the missing tags for setDrawablePalette
 void setEditSupport(Object key, UndoableEditSupport editSupport, BUndoManager undoManager)
          Sets the undo manager to use
 void setGridColour(Color c)
           
 void setGridType(int type)
           
 void setHorzAdjustable(Adjustable horz)
           
 void setMajorRulerSpace(int space)
           
 void setMinorRulerSpace(int space)
           
 void setRulerColour(Color c)
           
 void setVertAdjustable(Adjustable vert)
           
 void specialRepaint()
           
 void startAdd(BDrawable drawable, Point pt)
           
 void startDrag(BScalarPoint pt)
           
 void startMove(BScalarPoint pt)
           
 void startPopup()
           
 void startResize(BDrawable drawable, BScalarPoint point, int sizer)
           
 void startScroll()
           
 void startZoom()
           
 void stopAdd(Point pt, int modifiers, boolean isUndoable)
           
 void stopDrag(BScalarPoint pt)
           
 void stopMove(BScalarPoint pt, boolean undoable)
           
 void stopPopup(int hitRes, int x, int y)
           
 void stopResize(BScalarPoint point, boolean undoable)
           
 void undoMove(BDrawable[] drawable, BScalarPoint point)
           
 void undoRemove(BDrawable[] drawable)
           
 void undoResize(BDrawable drawable, BScalarPoint point, int sizerNum)
           
 void unregisterUndoManager(Object key)
          Call this when the window is being closed never to be undone again
 void unselectAll()
           
 void zoomIn()
           
 void zoomOut()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kExclusiveSelect

public static final int kExclusiveSelect

kAdditiveSelect

public static final int kAdditiveSelect

kAdded

public final int kAdded

kRemoved

public final int kRemoved

kMoved

public final int kMoved

kResized

public final int kResized
Constructor Detail

BViewport

public BViewport(BPlugin par)
Please complete the missing tags for BViewport
Parameters:
-  
Method Detail

initPopup

public void initPopup()

refreshPalette

public void refreshPalette()

disablePalette

public void disablePalette()

dontScrollOnInit

public void dontScrollOnInit()

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Overrides:
setBounds in class Component

setDiagram

public void setDiagram(BDiagram diagram)
Please complete the missing tags for setDiagram
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

getDiagram

public BDiagram getDiagram()
Returns the diagram the viewport contains
Returns:
the diagram contained in this viewport

setDrawablePalette

public void setDrawablePalette(BDrawablePalette drawablePalette)
Please complete the missing tags for setDrawablePalette
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

setGridType

public void setGridType(int type)

print

public int print(Graphics graphics,
                 PageFormat pageFormat,
                 int pageIndex)
          throws PrinterException
print to the graphics context... currently ignore the pageIndex...i.e. always print the same page.. turns off the grids/rulers for printing...
Specified by:
print in interface Printable

repaint

public void repaint()
Overrides:
repaint in class Component

specialRepaint

public void specialRepaint()

paintComponent

public void paintComponent(Graphics g)
Please complete the missing tags for paintComponent
Parameters:
-  
Returns:
 
Overrides:
paintComponent in class JComponent
Pre Condition:
 
Post Condition:
 

render

public void render(Graphics g)

backTransformPoint

public void backTransformPoint(BScalarPoint pt)
Please complete the missing tags for mouseClicked
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

mouseClicked

public void mouseClicked(MouseEvent e)

mouseEntered

public void mouseEntered(MouseEvent e)
Please complete the missing tags for mouseEntered
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

mouseExited

public void mouseExited(MouseEvent e)
Please complete the missing tags for mouseExited
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

mousePressed

public void mousePressed(MouseEvent e)
Please complete the missing tags for mousePressed
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

mouseReleased

public void mouseReleased(MouseEvent e)
Please complete the missing tags for mouseReleased
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

mouseDragged

public void mouseDragged(MouseEvent e)
Please complete the missing tags for mouseDragged
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

mouseMoved

public void mouseMoved(MouseEvent e)
Please complete the missing tags for mouseMoved
Parameters:
-  
Returns:
 
Pre Condition:
 
Post Condition:
 

select

public void select(BDrawable drawable,
                   int type)

unselectAll

public void unselectAll()

bringSelectionToFront

public void bringSelectionToFront()

sendSelectionToBack

public void sendSelectionToBack()

doCutSelection

public void doCutSelection()
This will take the currently selected items, place a copy of them on the system clipboard and delete the selection.

setEditSupport

public void setEditSupport(Object key,
                           UndoableEditSupport editSupport,
                           BUndoManager undoManager)
Sets the undo manager to use
Parameters:
key - The named value for this undo manager
undoManager - The undo manager

relinquishUndoManager

public void relinquishUndoManager()
This will tell the viewport to use the edit support matching the given key
Parameters:
key - The key for the edit support to use

unregisterUndoManager

public void unregisterUndoManager(Object key)
Call this when the window is being closed never to be undone again

setCurrentEditSupport

public void setCurrentEditSupport(Object key)
This will tell the viewport to use the edit support matching the given key
Parameters:
key - The key for the edit support to use

doCopySelection

public void doCopySelection(Vector currentSelection)
Takes the currently selected items and places a copy of them on the clipboard.

doPasteDrawables

public void doPasteDrawables()
This will paste the contents of the clipboard to the model

doUndo

public void doUndo()
This will call the undo method on the edit manager to undo the last command undone.

doRedo

public void doRedo()
This will call the redo method on the edit manager to redo the last command undone.

doDeleteSelection

public boolean doDeleteSelection(boolean isUndoable)

continueAdd

public void continueAdd(Point pt)

startAdd

public void startAdd(BDrawable drawable,
                     Point pt)

dragAdd

public void dragAdd(BScalarPoint deltaXY)

stopAdd

public void stopAdd(Point pt,
                    int modifiers,
                    boolean isUndoable)

startDrag

public void startDrag(BScalarPoint pt)

dragDrag

public void dragDrag(BScalarPoint deltaXY)

stopDrag

public void stopDrag(BScalarPoint pt)

startMove

public void startMove(BScalarPoint pt)

dragMove

public void dragMove(BScalarPoint deltaXY)

stopMove

public void stopMove(BScalarPoint pt,
                     boolean undoable)

undoMove

public void undoMove(BDrawable[] drawable,
                     BScalarPoint point)

undoRemove

public void undoRemove(BDrawable[] drawable)

startResize

public void startResize(BDrawable drawable,
                        BScalarPoint point,
                        int sizer)

dragResize

public void dragResize(BScalarPoint deltaXY)

stopResize

public void stopResize(BScalarPoint point,
                       boolean undoable)

undoResize

public void undoResize(BDrawable drawable,
                       BScalarPoint point,
                       int sizerNum)

stopPopup

public void stopPopup(int hitRes,
                      int x,
                      int y)

startPopup

public void startPopup()

startZoom

public void startZoom()

startScroll

public void startScroll()

scroll

public void scroll(BScalarPoint deltaXY)

zoomIn

public void zoomIn()

zoomOut

public void zoomOut()

calcYOffset

public int calcYOffset(int spacing)

calcXOffset

public int calcXOffset(int spacing)

drawGrid

public void drawGrid(Graphics g)

drawRuler

public void drawRuler(Graphics g)

enableGrid

public void enableGrid(boolean enable)

isGridEnabled

public boolean isGridEnabled()

isSnapEnabled

public boolean isSnapEnabled()

enableSnap

public void enableSnap(boolean snap)

enableRuler

public void enableRuler(boolean enable)

isRulerEnabled

public boolean isRulerEnabled()

setMinorRulerSpace

public void setMinorRulerSpace(int space)

getMinorRulerSpace

public int getMinorRulerSpace()

setMajorRulerSpace

public void setMajorRulerSpace(int space)

getMajorRulerSpace

public int getMajorRulerSpace()

setGridColour

public void setGridColour(Color c)

getGridColour

public Color getGridColour()

setRulerColour

public void setRulerColour(Color c)

getRulerColour

public Color getRulerColour()

adjustmentValueChanged

public void adjustmentValueChanged(AdjustmentEvent e)
What to do when the scroll bar is clicked...

setHorzAdjustable

public void setHorzAdjustable(Adjustable horz)
Specified by:
setHorzAdjustable in interface BSplitable

setVertAdjustable

public void setVertAdjustable(Adjustable vert)
Specified by:
setVertAdjustable in interface BSplitable

removeHorzAdjustable

public void removeHorzAdjustable()
Specified by:
removeHorzAdjustable in interface BSplitable

removeVertAdjustable

public void removeVertAdjustable()
Specified by:
removeVertAdjustable in interface BSplitable

getNewView

public BSplitable getNewView()
Specified by:
getNewView in interface BSplitable

getZ

public BScalar getZ()
Specified by:
getZ in interface BView

getOOZ

public BScalar getOOZ()
Specified by:
getOOZ in interface BView

getHalfWidth

public int getHalfWidth()
Specified by:
getHalfWidth in interface BView

getHalfHeight

public int getHalfHeight()
Specified by:
getHalfHeight in interface BView

getXPos

public int getXPos()
Specified by:
getXPos in interface BView

getYPos

public int getYPos()
Specified by:
getYPos in interface BView

getViewCoords

public BScalarRect getViewCoords()
Specified by:
getViewCoords in interface BView

getViewBounds

public BScalarRect getViewBounds()
Specified by:
getViewBounds in interface BView

getHalfWH

public BScalarPoint getHalfWH()
Specified by:
getHalfWH in interface BView

addSelectionListener

public void addSelectionListener(BSelectionListener l)

removeSelectionListener

public void removeSelectionListener(BSelectionListener l)

fireSelection

public void fireSelection()

setDiagramPlugin

public void setDiagramPlugin(BDiagramPlugin fDiagramPlugin)

Synergy Home Page