Class MarkerBar
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable
Features:
- Single marker selection.
- Respects unmovable marks.
- Mouse marker selection invalid input: '&' dragging.
- Hirizontal invalid input: '&' verical orientation.
- Supported Linvalid input: '&F': Metal, Windows, Motif, Basic for others.
- Data model:
BoundedTableModel - Selection model:
ListSelectionModel - MutationModel model:
MarkerMutationModel - UI delegate:
MarkerBarUI
This implementation queries marker positions from a single table column of
the data model. The index defaults to 0, but you can specify it with
.
A marker is considered to be unmovable, if corresponding table cell of the
data model is reported to be uneditable.
setPositionColumn(int)
This implementation determines the only currently selected marker with
of the selection model, so current selection model's selection mode has no
effect.ListSelectionModel.getLeadSelectionIndex()
- Author:
- Michael Baranov
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of a "colorColumn" property.static final StringThe name of a "dataModel" property.static final StringThe name of a "fliped" property.static final StringThe name of a "mutationModel" property.static final StringThe name of a "orientation" property.static final StringThe name of a "positionColumn" property.static final StringThe name of a "selectionModel" property.Fields inherited from class com.michaelbaranov.microba.common.MicrobaComponent
PROPERTY_NAME_COLOR_OVERRIDE_MAPFields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aMarkerBarwith all models set to a singleDefaultMarkerModel.MarkerBar(int orientation) Constructs aMarkerBarwith given orientation.MarkerBar(BoundedTableModel dataModel) Constructs aMarkerBarwith given data model, aDefaultListSelectionModelas selection model and no mutation model.MarkerBar(BoundedTableModel dataModel, ListSelectionModel selectionModel) Constructs aMarkerBarwith given data model and selection model. -
Method Summary
Modifier and TypeMethodDescriptionintReturns an index of currently used table column to query marker color.Returns current data model.intReturns a distance in pixeld between the edge of the component (left invalid input: '&' right edge for horizontal orientation, top invalid input: '&' bottom edge for vertical) and a marker beak point in outermost position.Returns current mutation model.intReturns current component orientation.intReturns an index of currently used table column to query marker position.Returns current selection model.Lookinvalid input: '&Feel' UI delegate key (classID).booleanisFliped()Returns current flip flag value.voidsetColorColumn(int colorColumn) Sets the index of the data model table column used to query marker color.voidsetDataModel(BoundedTableModel model) Replaces current data model with specified one.voidsetFliped(boolean flip) Set flip flag value.voidsetMutationModel(MarkerMutationModel mutationModel) Replaces current mutation model with given one.voidsetOrientation(int orientation) Re-orientates the component.voidsetPositionColumn(int positionColumn) Sets the index of the data model table column used to query marker position.voidsetSelectionModel(ListSelectionModel selectionModel) Replaces current selection model with given one.Methods inherited from class com.michaelbaranov.microba.common.MicrobaComponent
getColorOverrideMap, getUI, setColorOverrideMap, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, updateMethods 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, transferFocusDownCycle, validateMethods 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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
PROPERTY_DATA_MODEL
The name of a "dataModel" property.- See Also:
-
PROPERTY_SELECTION_MODEL
The name of a "selectionModel" property.- See Also:
-
PROPERTY_MUTATION_MODEL
The name of a "mutationModel" property.- See Also:
-
PROPERTY_ORIENTATION
The name of a "orientation" property.- See Also:
-
PROPERTY_POSITION_COLUMN
The name of a "positionColumn" property.- See Also:
-
PROPERTY_COLOR_COLUMN
The name of a "colorColumn" property.- See Also:
-
PROPERTY_FLIP
The name of a "fliped" property.- See Also:
-
-
Constructor Details
-
MarkerBar
public MarkerBar()Constructs aMarkerBarwith all models set to a singleDefaultMarkerModel.- See Also:
-
MarkerBar
public MarkerBar(int orientation) Constructs aMarkerBarwith given orientation. All models set to a singleDefaultMarkerModel.- Parameters:
orientation- initial orientation. Possible values:SwingConstants.HORIZONTALorSwingConstants.VERTICAL- See Also:
-
MarkerBar
Constructs aMarkerBarwith given data model, aDefaultListSelectionModelas selection model and no mutation model.- Parameters:
dataModel- initial data model. May benull- See Also:
-
MarkerBar
Constructs aMarkerBarwith given data model and selection model. No mutation model.- Parameters:
dataModel- initial data model. May benull;selectionModel- initial selection model.- See Also:
-
-
Method Details
-
getUIClassID
Lookinvalid input: '&Feel' UI delegate key (classID). This implementation returns:"MarkerBarUI".- Overrides:
getUIClassIDin classJComponent
-
getDataModel
Returns current data model.- Returns:
- current BoundedTableModel.
- See Also:
-
setDataModel
Replaces current data model with specified one. This implementation uses current position column index to query marker positions.- Parameters:
model- new data model.- See Also:
-
getOrientation
public int getOrientation()Returns current component orientation.- Returns:
- current component orientation.
- See Also:
-
setOrientation
public void setOrientation(int orientation) Re-orientates the component.- Parameters:
orientation- new orientation value. Possible values:orSwingConstants.HORIZONTALSwingConstants.VERTICAL- See Also:
-
getMutationModel
Returns current mutation model.- Returns:
- current MutationModel.
- See Also:
-
setMutationModel
Replaces current mutation model with given one.- Parameters:
mutationModel- new mutation model. May benull.- See Also:
-
getSelectionModel
Returns current selection model.- Returns:
- current ListSelectionModel.
- See Also:
-
setSelectionModel
Replaces current selection model with given one. This implementation usesto determine selected marker.ListSelectionModel.getLeadSelectionIndex()- Parameters:
selectionModel- new selection model. May benull.- See Also:
-
getPositionColumn
public int getPositionColumn()Returns an index of currently used table column to query marker position.- Returns:
- current position column index.
- See Also:
-
setPositionColumn
public void setPositionColumn(int positionColumn) Sets the index of the data model table column used to query marker position.- Parameters:
positionColumn- new position column index.- See Also:
-
getColorColumn
public int getColorColumn()Returns an index of currently used table column to query marker color. Defaults to -1, which means not to query data model for color.- Returns:
- current color column index.
- See Also:
-
setColorColumn
public void setColorColumn(int colorColumn) Sets the index of the data model table column used to query marker color. Set to -1 in order not to query data model for color data.- Parameters:
colorColumn- new color column index.- See Also:
-
getMarkerSideGap
public int getMarkerSideGap()Returns a distance in pixeld between the edge of the component (left invalid input: '&' right edge for horizontal orientation, top invalid input: '&' bottom edge for vertical) and a marker beak point in outermost position. The value is actually queried from current UI delegate.- Returns:
- Gap value.
- See Also:
-
isFliped
public boolean isFliped()Returns current flip flag value.The flip flag defines where marker bicks are pointed:
true: down for horizontal orientation, left for vertical.
false: up for horizontal orientation, right for vertical.- Returns:
- current flip value.
-
setFliped
public void setFliped(boolean flip) Set flip flag value.The flip flag defines where marker bicks are pointed:
true: down for horizontal orientation, left for vertical.
false: up for horizontal orientation, right for vertical.- Parameters:
flip- new flip flag value.
-