com.jidesoft.diff
Class DiffDivider
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.jidesoft.diff.DiffDivider
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
public class DiffDivider
- extends JPanel
DiffDivider
is a panel using different color area to indicate different type of changes (changed,
inserted or deleted) between two panes.
- See Also:
- Serialized Form
Nested Class Summary |
static interface |
DiffDivider.RowConverter
Converts from the row index as in the Difference to the y position for DiffDivider . |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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 |
PROPERTY_SELECTED_DIFFERENCE
public static final String PROPERTY_SELECTED_DIFFERENCE
- The property of selected difference.
- Since:
- 3.4.1
- See Also:
- Constant Field Values
DiffDivider
public DiffDivider()
DiffDivider
public DiffDivider(DiffDivider.RowConverter firstConverter,
DiffDivider.RowConverter secondConverter)
DiffDivider
public DiffDivider(DiffDivider.RowConverter firstConverter,
DiffDivider.RowConverter secondConverter,
List<Difference> differences)
getFirstConverter
public DiffDivider.RowConverter getFirstConverter()
setFirstConverter
public void setFirstConverter(DiffDivider.RowConverter firstConverter)
getSecondConverter
public DiffDivider.RowConverter getSecondConverter()
setSecondConverter
public void setSecondConverter(DiffDivider.RowConverter secondConverter)
getInsertedColor
public Color getInsertedColor()
setInsertedColor
public void setInsertedColor(Color insertedColor)
getChangedColor
public Color getChangedColor()
setChangedColor
public void setChangedColor(Color changedColor)
getDeletedColor
public Color getDeletedColor()
setDeletedColor
public void setDeletedColor(Color deletedColor)
getConflictedColor
public Color getConflictedColor()
setConflictedColor
public void setConflictedColor(Color conflictedColor)
getDifferences
public List<Difference> getDifferences()
setDifferences
public void setDifferences(List<Difference> differences)
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
getPreferredSize
in class JComponent
getFirstOffsetY
public int getFirstOffsetY()
setFirstOffsetY
public void setFirstOffsetY(int firstOffsetY)
getSecondOffsetY
public int getSecondOffsetY()
setSecondOffsetY
public void setSecondOffsetY(int secondOffsetY)
getFirstTopMargin
public int getFirstTopMargin()
setFirstTopMargin
public void setFirstTopMargin(int firstTopMargin)
getSecondTopMargin
public int getSecondTopMargin()
setSecondTopMargin
public void setSecondTopMargin(int secondTopMargin)
getFirstBottomMargin
public int getFirstBottomMargin()
setFirstBottomMargin
public void setFirstBottomMargin(int firstBottomMargin)
getSecondBottomMargin
public int getSecondBottomMargin()
setSecondBottomMargin
public void setSecondBottomMargin(int secondBottomMargin)
isOpposite
public boolean isOpposite()
setOpposite
public void setOpposite(boolean opposite)
setSelectedDifference
public void setSelectedDifference(Difference selectedDifference)
- Sets the current selected difference.
- Parameters:
selectedDifference
- the selected difference- Since:
- 3.4.1
getSelectedDifference
public Difference getSelectedDifference()
- Gets the current selected difference.
- Returns:
- the current selected difference.
- Since:
- 3.4.1
paintComponent
protected void paintComponent(Graphics g)
- Overrides:
paintComponent
in class JComponent
getSelectedColor
protected Color getSelectedColor(Color c)
- Gets the color to identify the currently selected difference.
The default implementation is to return c.darker().
- Parameters:
c
- the default inserted/deleted/changed/conflicted color
- Returns:
- the derived color.
- Since:
- 3.4.1
getSecondMatchLine
protected int getSecondMatchLine(int totalVisibleLines,
int firstLine)
getFirstMatchLine
protected int getFirstMatchLine(int totalVisibleLines,
int firstLine)
adjustFirstVerticalOffset
protected void adjustFirstVerticalOffset(int offsetY,
int topMargin)
adjustSecondVerticalOffset
protected void adjustSecondVerticalOffset(int offsetY,
int topMargin)