com.nwoods.jgo
Class JGoPalette

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended bycom.nwoods.jgo.JGoView
                      extended bycom.nwoods.jgo.JGoPalette
All Implemented Interfaces:
org.eclipse.swt.events.ControlListener, org.eclipse.swt.events.DisposeListener, org.eclipse.swt.dnd.DragSourceListener, org.eclipse.swt.graphics.Drawable, org.eclipse.swt.dnd.DropTargetListener, java.util.EventListener, JGoDocumentListener, JGoObjectCollection, JGoObjectSimpleCollection, org.eclipse.swt.events.KeyListener, org.eclipse.swt.events.MouseListener, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.events.MouseTrackListener, org.eclipse.swt.events.PaintListener, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.events.ShellListener, org.eclipse.swt.internal.SWTEventListener

public class JGoPalette
extends JGoView

A simple view holding objects that can be dragged into another view.

A JGoPalette's document is not Modifiable, so users cannot move or delete any of the items that are being displayed. The palette's grid determines the spacing of the items, as determined by the layoutItems method.


Field Summary
static int OrientationHorizontal
          Horizontally oriented layout, with a horizontal scroll bar.
static int OrientationVertical
          Vertically oriented layout, with a vertical scroll bar.
 
Fields inherited from class com.nwoods.jgo.JGoView
ChangedDimensions, ChangedOrigin, ChangedPen, ChangedSnapMove, ChangedSnapResize, ChangedSpot, ChangedStyle, DebugEvents, EventMouseDown, EventMouseMove, EventMouseUp, GridCross, GridDot, GridInvisible, GridLine, MouseStateAction, MouseStateCreateLink, MouseStateCreateLinkFrom, MouseStateDragBoxSelection, MouseStateLast, MouseStateMove, MouseStateNone, MouseStateResize, MouseStateSelection, NoSnap, SnapAfter, SnapJump
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
JGoPalette(org.eclipse.swt.widgets.Composite parent, int style)
          Create a JGoPalette that is initially empty.
 
Method Summary
 void doAutoscroll(int modifiers, org.eclipse.swt.graphics.Point dc, org.eclipse.swt.graphics.Point vc)
          Disable autoscrolling.
 void documentChanged(JGoDocumentEvent evt)
          Call layoutItems when items are added or removed from this palette's document.
 void doLayout()
          call layoutItems when the view changes shape.
 int getOrientation()
          This value will be either OrientationVertical (the default), or OrientationHorizontal.
 boolean getSingleRowCol()
          Returns true if the items in the palette will be layout out in a single row if a horizontal layout, or a single column if a horizontal layout.
 boolean isShowSampleItems()
          Returns true if sample items are being shown in the palette.
 void layoutItems()
          Position all of the items, according to the orientation and grid, without overlapping.
 void onGridChange(int what)
          Call layoutItems when the grid changes.
 JGoObject pickObject(org.eclipse.swt.graphics.Point pointToCheck, boolean selectableOnly)
          Disable picking any view object.
 void setOrientation(int o)
          This value determines how the layoutItems method positions the items in this palette and how the user may be able to scroll the window.
 void setShowSampleItems(boolean b)
          This value determines whether the palette will be populated with some sample nodes or not.
 void setSingleRowCol(boolean b)
          This value determines whether items in the palette will be layout out in a single row if a horizontal layout, or a single column if a horizontal layout.
 
Methods inherited from class com.nwoods.jgo.JGoView
addDocumentListener, addObjectAtHead, addObjectAtTail, addViewListener, applyRenderingHints, bringObjectToFront, canPaste, computeAcceptableDrop, computeAutoscrollViewPosition, computeEffectiveSelection, computeEffectiveSelection, computeSize, computeSize, controlMoved, controlResized, convertActionToModifiers, convertDocToView, convertDocToView, convertDocToView, convertViewToDoc, convertViewToDoc, convertViewToDoc, copy, copySelection, copyToClipboard, createDefaultModel, createDefaultSelection, createTemporaryLinkForNewLink, createTemporaryPortForNewLink, cut, deleteSelection, disposeJGoGraphics, doBackgroundClick, doBackgroundToolTip, doCancelMouse, doCancelMoveSelection, doCancelResize, docToViewCoords, docToViewCoords, docToViewCoords, docToViewCoords, docToViewCoords, doDrop, doEndEdit, doMouseClick, doMouseDblClick, doMouseDown, doMouseMove, doMouseUp, doMoveSelection, doToolTip, doUncapturedMouseMove, dragAccept, dragEnter, dragFinished, dragLeave, dragOperationChanged, dragOver, dragSetData, dragStart, drawGridCrosses, drawGridLines, drawXORBox, drawXORRect, drop, dropAccept, findNearestGridPoint, findObject, fireUpdate, fireUpdate, getAutoscrollInsets, getBackgroundColor, getBackgroundImage, getCurrentMouseEvent, getCurrentObject, getCursorType, getDebugFlags, getDefaultCursorType, getDefaultPortGravity, getDefaultPrimarySelectionColor, getDefaultSecondarySelectionColor, getDocument, getDocumentListeners, getDocumentSize, getDocumentTopLeft, getDragSource, getDropTarget, getEditControl, getEditPresentationName, getExtentSize, getFirstLayer, getFirstObjectPos, getGridHeight, getGridOrigin, getGridPen, getGridSpot, getGridStyle, getGridWidth, getInternalMouseActions, getJGoGraphics, getLastLayer, getLastObjectPos, getNextLayer, getNextObjectPos, getNextObjectPosAtTop, getNumObjects, getObjectAtPos, getPortGravity, getPrevLayer, getPrevObjectPos, getPrimarySelectionColor, getPrintDocumentSize, getPrintDocumentTopLeft, getPrintPageRect, getPrintScale, getScale, getSecondarySelectionColor, getSelection, getSnapMove, getSnapResize, getState, getToolTipText, getViewListeners, getViewPosition, getViewRect, handleActionObject, handleResizing, initializeDragDropHandling, initializeMouseHandling, insertObjectAfter, insertObjectBefore, isDragDropEnabled, isDragEnabled, isDragsRealtime, isDragsSelectionImage, isDrawsXorMode, isDropEnabled, isEditingTextControl, isEmpty, isHidingDisabledScrollbars, isIgnoreNextMouseDown, isIncludingNegativeCoords, isInternalDragDrop, isKeyEnabled, isMouseEnabled, isPrinting, keyClearSelection, keyExtendSelection, keyMultipleSelect, keyPressed, keyReleased, keySingleSelection, keyToggleSelection, keyTyped, limitScale, mouseDoubleClick, mouseDown, mouseEnter, mouseExit, mouseHover, mouseMove, mouseUp, moveSelection, newLink, noNewLink, noReLink, onExternalDragOver, onExternalDrop, onKeyEvent, paintBackgroundDecoration, paintControl, paintDocumentObjects, paintPaperColor, paintView, paintViewObjects, paste, pasteFromClipboard, pickActionObject, pickDocObject, pickHandle, pickNearestPort, pickPort, print, print, printBegin, printDecoration, printEnd, printView, reLink, removeDocumentListener, removeObject, removeObjectAtPos, removeViewListener, scrollRectToVisible, selectAll, selectInBox, selectObject, sendObjectToBack, setAutoscrollInsets, setBackgroundColor, setBackgroundImage, setCurrentObject, setCursorType, setDebugFlags, setDefaultCursorType, setDefaultPortGravity, setDefaultPrimarySelectionColor, setDefaultSecondarySelectionColor, setDocument, setDragDropEnabled, setDragEnabled, setDragsRealtime, setDragsSelectionImage, setDrawsXorMode, setDropEnabled, setEditControl, setGridHeight, setGridOrigin, setGridPen, setGridSpot, setGridStyle, setGridWidth, setHidingDisabledScrollbars, setIgnoreNextMouseDown, setIncludingNegativeCoords, setInternalMouseActions, setKeyEnabled, setMouseEnabled, setPrimarySelectionColor, setScale, setSecondarySelectionColor, setSnapMove, setSnapResize, setState, setViewPosition, setViewPosition, shellActivated, shellClosed, shellDeactivated, shellDeiconified, shellIconified, snapAllObjects, snapAllObjects, snapObject, snapObject, startActionObject, startDragBoxSelection, startMoveSelection, startNewLink, startReLink, startResizing, stopAutoscroll, updateScrollbars, updateView, updateView, validDestinationPort, validLink, validSourcePort, viewToDocCoords, viewToDocCoords, viewToDocCoords, viewToDocCoords, viewToDocCoords, widgetDefaultSelected, widgetDisposed, widgetSelected
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, 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, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, 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, dispose, 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

OrientationVertical

public static final int OrientationVertical
Vertically oriented layout, with a vertical scroll bar.

See Also:
Constant Field Values

OrientationHorizontal

public static final int OrientationHorizontal
Horizontally oriented layout, with a horizontal scroll bar.

See Also:
Constant Field Values
Constructor Detail

JGoPalette

public JGoPalette(org.eclipse.swt.widgets.Composite parent,
                  int style)
Create a JGoPalette that is initially empty.

Method Detail

getOrientation

public int getOrientation()
This value will be either OrientationVertical (the default), or OrientationHorizontal.


setOrientation

public void setOrientation(int o)
This value determines how the layoutItems method positions the items in this palette and how the user may be able to scroll the window.

When the value is OrientationVertical, the layoutItems method will fill each row of items before adding a new row. There is a vertical scroll bar if needed, but no horizontal scroll bar. When the value is OrientationHorizontal, the layoutItems method will position items in columns, and there is no vertical scroll bar.

Calling this method will make sure the one appropriate scrollbar exists-- for example, for OrientationVertical, there will be a VerticalScrollBar and no HorizontalScrollBar.


setSingleRowCol

public void setSingleRowCol(boolean b)
This value determines whether items in the palette will be layout out in a single row if a horizontal layout, or a single column if a horizontal layout.

When the value is true, the items will be layed out in a single row or column. When the value is false, the as many items as will fit will be placed in each row or column of the palette.


getSingleRowCol

public boolean getSingleRowCol()
Returns true if the items in the palette will be layout out in a single row if a horizontal layout, or a single column if a horizontal layout. Returns false if as many items as will fit will be placed in each row or column of the palette.


setShowSampleItems

public void setShowSampleItems(boolean b)
This value determines whether the palette will be populated with some sample nodes or not.

When the value is set to true, the palette is populated with sample elements if they have not already been added. When the value is set to false, the sample items that have been previously added to the palette (if any) are removed.


isShowSampleItems

public boolean isShowSampleItems()
Returns true if sample items are being shown in the palette. Returns false otherwise.


layoutItems

public void layoutItems()
Position all of the items, according to the orientation and grid, without overlapping.


documentChanged

public void documentChanged(JGoDocumentEvent evt)
Call layoutItems when items are added or removed from this palette's document.

Specified by:
documentChanged in interface JGoDocumentListener
Overrides:
documentChanged in class JGoView
Parameters:
evt - the document event, including the hint type, any flags, and any relevant object

doLayout

public void doLayout()
call layoutItems when the view changes shape.

Overrides:
doLayout in class JGoView

onGridChange

public void onGridChange(int what)
Call layoutItems when the grid changes.

Overrides:
onGridChange in class JGoView
Parameters:
what - the aspect of the grid that has changed

pickObject

public JGoObject pickObject(org.eclipse.swt.graphics.Point pointToCheck,
                            boolean selectableOnly)
Disable picking any view object.

Specified by:
pickObject in interface JGoObjectCollection
Overrides:
pickObject in class JGoView
Parameters:
pointToCheck - the point under which to find the object
selectableOnly - if true, consider only selectable objects

doAutoscroll

public void doAutoscroll(int modifiers,
                         org.eclipse.swt.graphics.Point dc,
                         org.eclipse.swt.graphics.Point vc)
Disable autoscrolling.

Overrides:
doAutoscroll in class JGoView