com.swfm.mica.view
Class MiGraphicsPalette

java.lang.Object
  extended bycom.swfm.mica.core.MiPart
      extended bycom.swfm.mica.core.MiContainer
          extended bycom.swfm.mica.layouts.MiLayout
              extended bycom.swfm.mica.core.MiVisibleContainer
                  extended bycom.swfm.mica.widgets.MiWidget
                      extended bycom.swfm.mica.parts.MiEditorPalette
                          extended bycom.swfm.mica.view.MiGraphicsPalette
All Implemented Interfaces:
MiiActionHandler, MiiActionTypes, MiiAttributeTypes, MiiCommandHandler, MiiCommandNames, MiiCopyable, MiiDragAndDropParticipant, MiiEventTypes, MiiLayout, MiiMessages, MiiNames, MiiPropertyTypes, MiiTypes

public class MiGraphicsPalette
extends MiEditorPalette
implements MiiCommandHandler, MiiMessages

This class creates a graphics palette. This is a list of graphics that can be dragged and dropped into the editor. It's contents is loaded from the Mica graphics files in the location specified by the setGraphicsPalettesDirectory() method (which by default is equal to ${Mi_HOME}/apps/palettes). The palette can be modified by drag and droping graphics from the graphics editor into the palette.

NOTE: this palette initially NOT visible - in order to reduce creation/startup time.

Version:
%I% %G%
Author:
Michael L. Davis

Field Summary
                         
Constructor Summary
MiGraphicsPalette()
          Constructs a new MiGraphicsPalette.
 
Method Summary
 java.lang.String getGraphicsPalettesDirectory()
          Gets the directory in which to look for files *.pal that specify the palettes contents.
 boolean getHasChanged()
          Gets whether this window has changed.
 MiiController getOpenDocumentController()
          Gets the manager of the current open document.
 java.lang.String getPaletteFilenamePattern()
          Gets the pattern to use to find palettes in the palettes directory.
 MiComboBox getPaletteNameComboBox()
          Gets the combo box used to list palette names.
 boolean openFile(java.lang.String filename)
          Loads this palette to from given filename.
 void processCommand(java.lang.String command)
          Processes the given command.
 boolean saveFile(java.lang.String filename)
          Saves this palette to the given filename into the current graphics palettes directory.
 void setDefaultController(MiiController controller)
          Sets the default controller to use to load documents with.
 void setGraphicsPalettesDirectory(java.lang.String directoryName)
          Sets the directory in which to look for files *.pal that specify the palettes contents.
 void setHasChanged(boolean flag)
          Sets whether this window has changed.
 void setPaletteFilenamePattern(java.lang.String pattern)
          Sets the pattern to use to find palettes in the palettes directory.
 boolean verifyLossOfAnyChanges()
          Gets whether this window has changed.
 
Methods inherited from class com.swfm.mica.parts.MiEditorPalette
doImport, getComboTableComboBox, getComboTablePalettes, getComboTablePalettesArray, getContentsBackground, getLabelFont, getLabelsAreEditable, getLabelsAreVisible, getOverlayPalette, getPalettes, getScrolledBox, getStandardSizeOfPaletteGraphics, getTreeListPalette, processAction, setComboTablePalette, setLabelFont, setLabelsAreEditable, setLabelsAreVisible, setPalettes, setPaletteType, setStandardSizeOfPaletteGraphics
 
Methods inherited from class com.swfm.mica.widgets.MiWidget
copy, doExport, getContents, getEnterKeyFocusAttributes, getEnterKeyFocusBackgroundColor, getEnterKeyFocusBorderLook, getEnterKeyFocusColor, getEnterKeyFocusStatusHelp, getInSensitiveAttributes, getInSensitiveBackgroundColor, getInSensitiveBorderLook, getInSensitiveColor, getInSensitiveStatusHelp, getKeyboardFocusAttributes, getKeyboardFocusBackgroundColor, getKeyboardFocusBorderLook, getKeyboardFocusColor, getKeyboardFocusStatusHelp, getMouseFocusAttributes, getMouseFocusBackgroundColor, getMouseFocusBorderLook, getMouseFocusColor, getMouseFocusStatusHelp, getNormalAttributes, getNormalBackgroundColor, getNormalBorderLook, getNormalColor, getNormalStatusHelp, getPropertyDescriptions, getPropertyValue, getRadioStateEnforcer, getSelectedAttributes, getSelectedBackgroundColor, getSelectedBorderLook, getSelectedColor, getSelectedStatusHelp, getToolkit, getValue, getWidgetAttributes, isAutoAttributesEnabled, isDesignTime, select, setAttributes, setAutoAttributesEnabled, setContents, setCurrentBackgroundColor, setCurrentColor, setEnterKeyFocus, setEnterKeyFocusAttributes, setEnterKeyFocusBackgroundColor, setEnterKeyFocusBorderLook, setEnterKeyFocusColor, setEnterKeyFocusStatusHelpMessage, setInSensitiveAttributes, setInSensitiveBackgroundColor, setInSensitiveBorderLook, setInSensitiveColor, setInSensitiveStatusHelpMessage, setKeyboardFocus, setKeyboardFocusAttributes, setKeyboardFocusBackgroundColor, setKeyboardFocusBorderLook, setKeyboardFocusColor, setKeyboardFocusStatusHelpMessage, setMouseFocus, setMouseFocusAttributes, setMouseFocusBackgroundColor, setMouseFocusBorderLook, setMouseFocusColor, setMouseFocusStatusHelpMessage, setNormalAttributes, setNormalBackgroundColor, setNormalBorderLook, setNormalColor, setNormalStatusHelpMessage, setPropertyValue, setPropertyValues, setRadioStateEnforcer, setSelectedAttributes, setSelectedBackgroundColor, setSelectedBorderLook, setSelectedColor, setSelectedStatusHelpMessage, setSensitive, setValue, setWidgetAttributes, setWidgetAttributes
 
Methods inherited from class com.swfm.mica.core.MiVisibleContainer
calcMinimumSize, calcPreferredSize, getContainerLayoutSpec, getDisplaysFocusBorder, getInnerBounds, getIntersectionWithLine, getOKToDrawOutsideInnerBounds, getShadowShape, getShape, getTotalMargins, getVisibleContainerAutomaticLayoutEnabled, invalidateArea, isShapeShrinkToFitEnabled, pick, setContainerLayoutSpec, setDisplaysFocusBorder, setMargins, setOKToDrawOutsideInnerBounds, setShape, setShape, setShapeShrinkToFitEnabled, setVisibleContainerAutomaticLayoutEnabled
 
Methods inherited from class com.swfm.mica.layouts.MiLayout
determinesPreferredAndMinimumSizes, getAlleyHSpacing, getAlleyMargins, getAlleyVSpacing, getCellMargins, getCellMargins, getElementHJustification, getElementHSizing, getElementVJustification, getElementVSizing, getInsetMargins, getInsetMargins, getLastElementJustification, getTarget, getUniqueElementIndex, getUniqueElementSizing, isEnabled, isIndependantOfTargetPosition, isScalingOfPartsWhenBoundsChangesHandledDuringLayout, layoutParts, makeCopy, setAlleyHSpacing, setAlleySpacing, setAlleyVSpacing, setCellMargins, setCellMargins, setElementHJustification, setElementHSizing, setElementJustification, setElementSizing, setElementVJustification, setElementVSizing, setEnabled, setInsetMargins, setInsetMargins, setLastElementJustification, setScalingOfPartsWhenBoundsChangesHandledDuringLayout, setTarget, setUniqueElementIndex, setUniqueElementSizing, toString
 
Methods inherited from class com.swfm.mica.core.MiContainer
appendPart, containsPart, deepCopy, getIndexOfPart, getKeepConnectionsBelowNodes, getNumberOfParts, getPart, getPart, getSupportedImportFormats, hasEventHandlers, hasValidCachedEventHandlerInfo, insertPart, invalidateCachedEventHandlerInfo, isContainerOf, isContainerOf, isContainerOfWithAttachments, pickDeepListContents, pickObject, removeAllParts, removePart, removePart, setKeepConnectionsBelowNodes, setPart, translate
 
Methods inherited from class com.swfm.mica.core.MiPart
_reCalcBounds, _render, _replaceBounds, _setContainer, _setDrawManager, _setValidatingLayout, appendActionHandler, appendActionHandler, appendActionHandler, appendActionHandler, appendActionHandler, appendAttachment, appendAttachment, appendCommandHandler, appendCommandHandler, appendCommandHandler, appendConnection, appendContainer, appendEventHandler, appendItem, appendPoint, appendPoint, applyCustomLookAndFeel, containsItem, containsOpaqueRectangles, copy, deleteAllConnections, deleteAllParts, deleteSelf, dispatchAction, dispatchAction, dispatchAction, dispatchActionRequest, dispatchActionRequest, dispatchActionRequest, dispatchEvent, draw, drawNow, drawNow, flip, flip, freeAccessLock, get1DShapeStrokeBackgroundColor, get1DShapeStrokesFilled, getAccessLock, getActionHandler, getActionsGenerated, getActionsLocallyGenerated, getActionsRequestedFromParts, getAfterRenderer, getAlphaCompositeRenderMode, getAnnotationPointManager, getAssociatedParts, getAttachment, getAttachment, getAttachmentMargins, getAttachments, getAttributeLockMask, getAttributePublicMask, getAttributes, getAttributeValue, getBackgroundColor, getBackgroundImage, getBackgroundRenderer, getBackgroundTile, getBalloonHelp, getBeforeRenderer, getBlackColor, getBorderHiliteColor, getBorderHiliteWidth, getBorderLook, getBorderRenderer, getBounds, getBounds, getCenter, getCenter, getCenterOfRotation, getCenterX, getCenterY, getColor, getConnection, getConnectionPointManager, getContainer, getContainerRequestedActions, getContainingEditor, getContainingWindow, getContextCursor, getContextMenu, getContextMenu, getControlPointManager, getCustomLookAndFeels, getCustomLookAndFeels, getDarkColor, getDeepConnection, getDeepConnection, getDeepConnections, getDeeplyInvalidateAreas, getDefaultAttributes, getDialogHelp, getDoubleBuffer, getDragAndDropBehavior, getDrawBounds, getDrawManager, getEventHandler, getEventHandler, getEventHandlerWithClass, getEventHandlingDisabledByContainer, getEventHandlingEnabled, getFlipped, getFont, getFontHorizontalJustification, getFontPointSize, getFontVerticalJustification, getHasBorderHilite, getHasShadow, getHeight, getID, getIncomingInvalidLayoutNotificationsEnabled, getIndexOfItem, getInnerBounds, getInvalidAreaNotificationsEnabled, getInvalidLayoutNotificationsEnabled, getItem, getItem, getKeyFocusTraversalGroup, getLayout, getLayoutManipulator, getLightColor, getLineEndSize, getLineEndsRenderer, getLineEndsSizeFnOfLineWidth, getLineEndStyle, getLineStartSize, getLineStartStyle, getLineStyle, getLineWidth, getLocallyRequestedEventTypes, getManipulator, getMargins, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumPickAreaSize, getMinimumSize, getMinimumWidth, getName, getNumberOfActionHandlers, getNumberOfAttachments, getNumberOfConnections, getNumberOfContainers, getNumberOfDeepConnections, getNumberOfEventHandlers, getNumberOfItems, getNumberOfPoints, getNumberOfResources, getOutgoingInvalidLayoutNotificationsEnabled, getPoint, getPoint, getPointEntryAngle, getPointExitAngle, getPointX, getPointY, getPreferredSize, getPrototypeManipulator, getRelativeLocation, getResource, getResourceName, getRootWindow, getRotation, getSelectionGraphics, getShadowColor, getShadowDirection, getShadowLength, getShadowRenderer, getShadowStyle, getSize, getSnapPointManager, getStatusHelp, getSupportedExportFormats, getThisOrPartHasInvalidArea, getToolHintHelp, getTotalNumberOfPartsCreated, getTransform, getTransparency, getValidatingLayout, getVisibilityAnimator, getWhiteColor, getWidth, getWriteMode, getXmax, getXmin, getXorColor, getYmax, getYmin, hasAttachment, hasAttribute, hasEnterKeyFocus, hasEventHandler, hasFixedAspectRatio, hasFixedHeight, hasFixedWidth, hasKeyboardFocus, hasMouseFocus, hasOverriddenMinimumSize, hasOverriddenPreferredSize, hasProperty, hasTotallyInvalidArea, hasValidLayout, insertActionHandler, insertActionHandler, insertActionHandler, insertConnection, insertContainer, insertEventHandler, insertItem, insertPoint, insertPoint, invalidateArea, invalidateLayout, isAcceptingEnterKeyFocus, isAcceptingKeyboardFocus, isAcceptingMouseFocus, isAcceptingTabKeys, isActionDispatchingEnabled, isConnectable, isConnectedTo, isCopyable, isCopyableAsPartOfCopyable, isDeletable, isDoubleBuffered, isDragAndDropSource, isDragAndDropTarget, isFilled, isFontBold, isFontItalic, isFontUnderlined, isHidden, isMovable, isOpaqueRectangle, isPickable, isPickableWhenTransparent, isPrintable, isSavable, isSelectable, isSelected, isSensitive, isShowing, isSnappable, isUngroupable, isValidConnectionDestination, isValidConnectionSource, isVisible, makeImageFromArea, makeLayoutManipulator, makeManipulator, optimizedInvalidateArea, optimizedInvalidateDrawBoundsArea, overrideAttributes, overrideEventHandlingDisabledByContainer, packLayout, pickDeepList, preRenderToDoubleBuffer, refreshBounds, refreshLookAndFeel, refreshLookAndFeel, removeActionHandler, removeActionHandler, removeActionHandlers, removeAllActionHandlers, removeAllAttachments, removeAllConnections, removeAllEventHandlers, removeAllItems, removeAllManipulators, removeAttachment, removeAttachment, removeCommandHandler, removeCommandHandler, removeConnection, removeConnection, removeContainer, removeContainer, removeEventHandler, removeFromAllContainers, removeItem, removeItem, removePoint, removeResource, removeSelf, replaceDrawBounds, replaceSelf, requestEnterKeyFocus, requestKeyboardFocus, rotate, rotate, rotateTo, scale, scale, scale, set1DShapeStrokeBackgroundColor, set1DShapeStrokesFilled, setAcceptingEnterKeyFocus, setAcceptingKeyboardFocus, setAcceptingMouseFocus, setAcceptingTabKeys, setActionDispatchingEnabled, setAfterRenderer, setAlphaCompositeRenderMode, setAnnotationPointManager, setAttachmentDrawnAfter, setAttachmentMargins, setAttachmentsVisibility, setAttributeLockMask, setAttributePublicMask, setAttributeValue, setAttributeValue, setAttributeValue, setAttributeValue, setAttributeValue, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundRenderer, setBackgroundTile, setBalloonHelp, setBalloonHelpMessage, setBeforeRenderer, setBlackColor, setBorderHiliteColor, setBorderHiliteWidth, setBorderLook, setBorderRenderer, setBounds, setBounds, setCenter, setCenter, setCenterX, setCenterY, setColor, setColor, setConnectable, setConnectionPointManager, setContextCursor, setContextMenu, setControlPointManager, setCopyable, setCopyableAsPartOfCopyable, setCustomLookAndFeels, setCustomLookAndFeels, setDarkColor, setDeeplyInvalidateAreas, setDefaultAttributes, setDeletable, setDialogHelp, setDialogHelpMessage, setDoubleBuffer, setDoubleBuffered, setDragAndDropBehavior, setEventHandlingEnabled, setFilled, setFixedAspectRatio, setFixedHeight, setFixedWidth, setFont, setFontBold, setFontHorizontalJustification, setFontItalic, setFontPointSize, setFontUnderlined, setFontVerticalJustification, setHasBorderHilite, setHasShadow, setHeight, setHidden, setIncomingInvalidLayoutNotificationsEnabled, setInvalidAreaNotificationsEnabled, setInvalidLayoutNotificationsEnabled, setIsDragAndDropSource, setIsDragAndDropTarget, setIsOpaqueRectangle, setItem, setKeyFocusTraversalGroup, setLayout, setLightColor, setLineEndSize, setLineEndSizeFnOfLineWidth, setLineEndsRenderer, setLineEndStyle, setLineStartSize, setLineStartStyle, setLineStyle, setLineWidth, setMaximumHeight, setMaximumWidth, setMinimumHeight, setMinimumPickAreaSize, setMinimumSize, setMinimumWidth, setMovable, setName, setNumberOfPoints, setOutgoingInvalidLayoutNotificationsEnabled, setPickable, setPickableWhenTransparent, setPoint, setPoint, setPreferredSize, setPrintable, setPrototypeManipulator, setResource, setSavable, setSelectable, setSelectionGraphics, setShadowColor, setShadowDirection, setShadowLength, setShadowRenderer, setShadowStyle, setSize, setSize, setSnappable, setSnapPointManager, setStatusHelp, setStatusHelpMessage, setSupportedImportFormats, setToolHintHelp, setToolHintMessage, setTransparency, setTransparency, setUngroupable, setVisibilityAnimator, setVisible, setWhiteColor, setWidth, setWriteMode, setXmax, setXmin, setXorColor, setYmax, setYmin, supportsImportOfSpecificInstance, translate, translate, translatePoint, validateLayout, validatePropertyValue, waitUntilRedrawn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.swfm.mica.layouts.MiiLayout
getMinimumSize, getPreferredSize, invalidateLayout
 

Constructor Detail

MiGraphicsPalette

public MiGraphicsPalette()
Constructs a new MiGraphicsPalette.

Method Detail

setGraphicsPalettesDirectory

public void setGraphicsPalettesDirectory(java.lang.String directoryName)
Sets the directory in which to look for files *.pal that specify the palettes contents.

Parameters:
directoryName - the directory of palettes

getGraphicsPalettesDirectory

public java.lang.String getGraphicsPalettesDirectory()
Gets the directory in which to look for files *.pal that specify the palettes contents.

Returns:
the directory of palettes

setDefaultController

public void setDefaultController(MiiController controller)
Sets the default controller to use to load documents with. Note that this is copied before use because a document may specify it's own MiIOFormatManager and MiViewManagers.

Parameters:
controller - the default controller

getOpenDocumentController

public MiiController getOpenDocumentController()
Gets the manager of the current open document.

Returns:
the document manager

setPaletteFilenamePattern

public void setPaletteFilenamePattern(java.lang.String pattern)
Sets the pattern to use to find palettes in the palettes directory.

Parameters:
pattern - the pattern (i.e. "*.pal")

getPaletteFilenamePattern

public java.lang.String getPaletteFilenamePattern()
Gets the pattern to use to find palettes in the palettes directory.

Returns:
the pattern

getPaletteNameComboBox

public MiComboBox getPaletteNameComboBox()
Gets the combo box used to list palette names.

Returns:
the combo box

processCommand

public void processCommand(java.lang.String command)
Processes the given command. The commands supported are
    Mi_OPEN_COMMAND_NAME
    Mi_SAVE_COMMAND_NAME
    Mi_SAVE_AS_COMMAND_NAME
 

Specified by:
processCommand in interface MiiCommandHandler
Overrides:
processCommand in class MiEditorPalette
Parameters:
command - the command to execute

setHasChanged

public void setHasChanged(boolean flag)
Sets whether this window has changed. This is set to false after a save or open.

Parameters:
flag - true if this has changed.

getHasChanged

public boolean getHasChanged()
Gets whether this window has changed. This is checked before a open, close or new.

Overrides:
getHasChanged in class MiEditorPalette
Returns:
true if this has changed.

saveFile

public boolean saveFile(java.lang.String filename)
Saves this palette to the given filename into the current graphics palettes directory.

Overrides:
saveFile in class MiEditorPalette
Parameters:
filename - the name of the file to save to
Returns:
true if sucessful
See Also:
setGraphicsPalettesDirectory(java.lang.String)

openFile

public boolean openFile(java.lang.String filename)
Loads this palette to from given filename. The filename is prepended with the current graphics palettes directory. The user is asked to confirm the loss of changes, if any.

Overrides:
openFile in class MiEditorPalette
Parameters:
filename - the name of the file to load
Returns:
true if sucessful
See Also:
setGraphicsPalettesDirectory(java.lang.String)

verifyLossOfAnyChanges

public boolean verifyLossOfAnyChanges()
Gets whether this window has changed. This is checked by the MiFileEditorWindow before a open, close or new.

Overrides:
verifyLossOfAnyChanges in class MiEditorPalette
Returns:
true if it is OK to overwrite any changes the user has made