com.michaelbaranov.microba.gradienteditor
Class GradientEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.michaelbaranov.microba.common.MicrobaComponent
                  extended by com.michaelbaranov.microba.gradient.GradientBar
                      extended by com.michaelbaranov.microba.gradienteditor.GradientEditor
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class GradientEditor
extends GradientBar

IMPORTANT: alpha featre not implemented. Stubs only. No alpha marker bar yet.

This is a component for displaying/modifying a gradient (palette).

Implementation details:
This implementation combines a GradientBar with two MarkerBar components. The marker bars are used to provide editing capabilities to the gradient bar. Note, that this component doesn't provide direct color-selecting capabilitied but relies on other external components such as JColorChooser.

Author:
Michael Baranov
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static java.lang.String PROPERTY_ALPHA_MUTATION_MODEL
          The name of a "alphaMutationModel" property.
static java.lang.String PROPERTY_ALPHA_SELECTION_MODEL
          The name of a "alphaSelectionModel" property.
static java.lang.String PROPERTY_COLOR_MUTATION_MODEL
          The name of a "colorMutationModel" property.
static java.lang.String PROPERTY_COLOR_SELECTION_MODEL
          The name of a "colorSelectionModel" property.
 
Fields inherited from class com.michaelbaranov.microba.gradient.GradientBar
PROPERTY_ALPHA_COLUMN, PROPERTY_ALPHA_MODEL, PROPERTY_ALPHA_POSITION_COLUMN, PROPERTY_COLOR_COLUMN, PROPERTY_COLOR_POSITION_COLUMN, PROPERTY_DATA_MODEL, PROPERTY_ORIENTATION
 
Fields inherited from class com.michaelbaranov.microba.common.MicrobaComponent
PROPERTY_NAME_COLOR_OVERRIDE_MAP
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GradientEditor()
          Constructor.
 
Method Summary
 MarkerMutationModel getAlphaMutationModel()
          Regturns the current alpha mutation model.
 javax.swing.ListSelectionModel getAlphaSelectionModel()
          Returns current alpha selection model.
 MarkerMutationModel getColorMutationModel()
          Regturns the current color mutation model.
 javax.swing.ListSelectionModel getColorSelectionModel()
          Returns current color selection model.
 java.lang.String getUIClassID()
           
 void setAlphaMutationModel(MarkerMutationModel mutationModel)
          Replaces current alpha mutation model with given one.
 void setAlphaSelectionModel(javax.swing.ListSelectionModel selectionModel)
          Replaces current alpha selection model with given one.
 void setColorMutationModel(MarkerMutationModel mutationModel)
          Replaces current color mutation model with given one.
 void setColorSelectionModel(javax.swing.ListSelectionModel selectionModel)
          Replaces current color selection model with given one.
 
Methods inherited from class com.michaelbaranov.microba.gradient.GradientBar
getAlphaColumn, getAlphaModel, getAlphaPositionColumn, getColorColumn, getColorPositionColumn, getDataModel, getOrientation, setAlphaColumn, setAlphaModel, setAlphaPositionColumn, setColorColumn, setColorPositionColumn, setDataModel, setOrientation
 
Methods inherited from class com.michaelbaranov.microba.common.MicrobaComponent
getColorOverrideMap, getUI, setColorOverrideMap, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_COLOR_SELECTION_MODEL

public static final java.lang.String PROPERTY_COLOR_SELECTION_MODEL
The name of a "colorSelectionModel" property.

See Also:
Constant Field Values

PROPERTY_ALPHA_SELECTION_MODEL

public static final java.lang.String PROPERTY_ALPHA_SELECTION_MODEL
The name of a "alphaSelectionModel" property.

See Also:
Constant Field Values

PROPERTY_COLOR_MUTATION_MODEL

public static final java.lang.String PROPERTY_COLOR_MUTATION_MODEL
The name of a "colorMutationModel" property.

See Also:
Constant Field Values

PROPERTY_ALPHA_MUTATION_MODEL

public static final java.lang.String PROPERTY_ALPHA_MUTATION_MODEL
The name of a "alphaMutationModel" property.

See Also:
Constant Field Values
Constructor Detail

GradientEditor

public GradientEditor()
Constructor.

Method Detail

getUIClassID

public java.lang.String getUIClassID()
Overrides:
getUIClassID in class GradientBar

getColorMutationModel

public MarkerMutationModel getColorMutationModel()
Regturns the current color mutation model.

Returns:
current color mutation model
See Also:
setColorMutationModel(MarkerMutationModel), MarkerMutationModel

setColorMutationModel

public void setColorMutationModel(MarkerMutationModel mutationModel)
Replaces current color mutation model with given one.

Parameters:
mutationModel - new mutation model. May be null.
See Also:
getColorMutationModel(), MarkerMutationModel

getColorSelectionModel

public javax.swing.ListSelectionModel getColorSelectionModel()
Returns current color selection model.

Returns:
current color selection model.
See Also:
setColorSelectionModel(ListSelectionModel)

setColorSelectionModel

public void setColorSelectionModel(javax.swing.ListSelectionModel selectionModel)
Replaces current color selection model with given one. This implementation uses ListSelectionModel.getLeadSelectionIndex() to determine selected marker.

Parameters:
selectionModel - new selection model. May be null.
See Also:
getColorSelectionModel()

getAlphaSelectionModel

public javax.swing.ListSelectionModel getAlphaSelectionModel()
Returns current alpha selection model.

Returns:
current alpha selection model.
See Also:
setAlphaSelectionModel(ListSelectionModel)

setAlphaSelectionModel

public void setAlphaSelectionModel(javax.swing.ListSelectionModel selectionModel)
Replaces current alpha selection model with given one. This implementation uses ListSelectionModel.getLeadSelectionIndex() to determine selected marker.

Parameters:
selectionModel - new selection model. May be null.
See Also:
getAlphaSelectionModel()

getAlphaMutationModel

public MarkerMutationModel getAlphaMutationModel()
Regturns the current alpha mutation model.

Returns:
current alpha mutation model
See Also:
setAlphaMutationModel(MarkerMutationModel), MarkerMutationModel

setAlphaMutationModel

public void setAlphaMutationModel(MarkerMutationModel mutationModel)
Replaces current alpha mutation model with given one.

Parameters:
mutationModel - new mutation model. May be null.
See Also:
getAlphaMutationModel(), MarkerMutationModel