com.nwoods.jgo
Class JGoPalette

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.nwoods.jgo.JGoView
                  extended bycom.nwoods.jgo.JGoPalette
All Implemented Interfaces:
java.awt.dnd.Autoscroll, java.awt.datatransfer.ClipboardOwner, java.awt.dnd.DragGestureListener, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, java.util.EventListener, java.awt.image.ImageObserver, JGoDocumentListener, JGoObjectCollection, JGoObjectSimpleCollection, java.awt.event.KeyListener, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable

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.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.nwoods.jgo.JGoView
JGoView.JGoViewCanvas
 
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
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 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.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JGoPalette()
          Create a JGoPalette that is initially empty.
 
Method Summary
 void addNotify()
          Call layoutItems when the view is realized.
 void autoscroll(java.awt.Point location)
          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.
 java.awt.Dimension getMinimumSize()
          Limit the dimensions of this palette window.
 int getOrientation()
          This value will be either OrientationVertical (the default), or OrientationHorizontal.
 java.awt.Dimension getPreferredSize()
          Limit the dimensions of this palette window.
 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(java.awt.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, completeDrop, computeAcceptableDrop, computeEffectiveSelection, computeEffectiveSelection, convertActionToModifiers, convertDocToView, convertDocToView, convertDocToView, convertViewToDoc, convertViewToDoc, convertViewToDoc, copy, copySelection, copyToClipboard, createDefaultModel, createDefaultSelection, createTemporaryLinkForNewLink, createTemporaryPortForNewLink, cut, deleteSelection, disposeJGoGraphics, doBackgroundClick, doCancelMouse, doCancelMoveSelection, doCancelResize, docToViewCoords, docToViewCoords, docToViewCoords, docToViewCoords, docToViewCoords, doDrop, doEndEdit, doMouseClick, doMouseDblClick, doMouseDown, doMouseMove, doMouseUp, doMoveSelection, doUncapturedMouseMove, dragDropEnd, dragEnter, dragEnter, dragExit, dragExit, dragGestureRecognized, dragOver, dragOver, drawGridCrosses, drawGridLines, drawXORBox, drawXORRect, drop, dropActionChanged, dropActionChanged, findNearestGridPoint, findObject, fireUpdate, fireUpdate, getAutoscrollInsets, getBackgroundImage, getCanvas, getCorner, getCurrentMouseEvent, getCurrentObject, getDebugFlags, getDefaultCursor, getDefaultPortGravity, getDefaultPrimarySelectionColor, getDefaultSecondarySelectionColor, getDocument, getDocumentListeners, getDocumentSize, getDocumentTopLeft, getEditControl, getEditPresentationName, getExtentSize, getFirstLayer, getFirstObjectPos, getFrame, getGridHeight, getGridOrigin, getGridPen, getGridSpot, getGridStyle, getGridWidth, getHorizontalScrollBar, getInternalMouseActions, getJGoGraphics, getLastLayer, getLastObjectPos, getNextLayer, getNextObjectPos, getNextObjectPosAtTop, getNumObjects, getObjectAtPos, getPortGravity, getPrevLayer, getPrevObjectPos, getPrimarySelectionColor, getPrintDocumentSize, getPrintDocumentTopLeft, getPrintPageRect, getPrintScale, getScale, getSecondarySelectionColor, getSelection, getSnapMove, getSnapResize, getState, getToolTipText, getVerticalScrollBar, getViewListeners, getViewPosition, getViewRect, handleActionObject, handleResizing, initializeDragDropHandling, initializeMouseHandling, insertObjectAfter, insertObjectBefore, internalPrint, isDragDropEnabled, isDragEnabled, isDragsRealtime, isDragsSelectionImage, isDrawsXorMode, isDropEnabled, isDropFlavorAcceptable, isEditingTextControl, isEmpty, isFocusTraversable, isHidingDisabledScrollbars, isIgnoreNextMouseDown, isIncludingNegativeCoords, isInternalDragDrop, isKeyEnabled, isMouseEnabled, isPrinting, keyClearSelection, keyExtendSelection, keyMultipleSelect, keyPressed, keyReleased, keySingleSelection, keyToggleSelection, keyTyped, limitScale, lostOwnership, moveSelection, newLink, noNewLink, noReLink, onDragDropEnd, onDragEnter, onDragEnter, onDragExit, onDragExit, onDragGestureRecognized, onDragOver, onDragOver, onDrop, onDropActionChanged, onDropActionChanged, onKeyEvent, onMouseDragged, onMouseMoved, onMousePressed, onMouseReleased, onPaintComponent, onScrollEvent, paintBackgroundDecoration, paintDocumentObjects, paintPaperColor, paintView, paintViewObjects, paste, pasteFromClipboard, pickActionObject, pickDocObject, pickHandle, pickNearestPort, pickPort, print, print, printBegin, printDecoration, printEnd, printPreview, printPreview, printShowPageDialog, printView, reLink, removeDocumentListener, removeObject, removeObjectAtPos, removeViewListener, scrollRectToVisible, selectAll, selectInBox, selectObject, sendObjectToBack, setAutoscrollInsets, setBackgroundImage, setBounds, setBounds, setCorner, setCurrentObject, setCursor, setCursorImmediately, setDebugFlags, setDefaultCursor, setDefaultPortGravity, setDefaultPrimarySelectionColor, setDefaultSecondarySelectionColor, setDocument, setDragDropEnabled, setDragEnabled, setDragsRealtime, setDragsSelectionImage, setDrawsXorMode, setDropEnabled, setEditControl, setGridHeight, setGridOrigin, setGridPen, setGridSpot, setGridStyle, setGridWidth, setHidingDisabledScrollbars, setHorizontalScrollBar, setIgnoreNextMouseDown, setIncludingNegativeCoords, setInternalMouseActions, setKeyEnabled, setMouseEnabled, setPrimarySelectionColor, setScale, setSecondarySelectionColor, setSize, setSize, setSnapMove, setSnapResize, setState, setVerticalScrollBar, setViewPosition, setViewPosition, snapAllObjects, snapAllObjects, snapObject, snapObject, startActionObject, startDragBoxSelection, startMoveSelection, startNewLink, startReLink, startResizing, updateScrollbars, updateView, updateView, validDestinationPort, validLink, validSourcePort, viewToDocCoords, viewToDocCoords, viewToDocCoords, viewToDocCoords, viewToDocCoords
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, 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, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, 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, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, show, show, size, toString, transferFocus, transferFocusUpCycle
 
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()
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

getPreferredSize

public java.awt.Dimension getPreferredSize()
Limit the dimensions of this palette window.

Overrides:
getPreferredSize in class JGoView

getMinimumSize

public java.awt.Dimension getMinimumSize()
Limit the dimensions of this palette window.

Overrides:
getMinimumSize in class JGoView

addNotify

public void addNotify()
Call layoutItems when the view is realized.

Overrides:
addNotify in class JGoView

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(java.awt.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

autoscroll

public void autoscroll(java.awt.Point location)
Disable autoscrolling.

Specified by:
autoscroll in interface java.awt.dnd.Autoscroll
Overrides:
autoscroll in class JGoView
Parameters:
location - a point in the canvas, not in this view component, (nor in the document).