JIDE 3.5.15

com.jidesoft.diff
Class DiffDivider

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by 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.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String PROPERTY_SELECTED_DIFFERENCE
          The property of selected difference.
 
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.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DiffDivider()
           
DiffDivider(DiffDivider.RowConverter firstConverter, DiffDivider.RowConverter secondConverter)
           
DiffDivider(DiffDivider.RowConverter firstConverter, DiffDivider.RowConverter secondConverter, List<Difference> differences)
           
 
Method Summary
protected  void adjustFirstVerticalOffset(int offsetY, int topMargin)
           
protected  void adjustSecondVerticalOffset(int offsetY, int topMargin)
           
 Color getChangedColor()
           
 Color getConflictedColor()
           
 Color getDeletedColor()
           
 List<Difference> getDifferences()
           
 int getFirstBottomMargin()
           
 DiffDivider.RowConverter getFirstConverter()
           
protected  int getFirstMatchLine(int totalVisibleLines, int firstLine)
           
 int getFirstOffsetY()
           
 int getFirstTopMargin()
           
 Color getInsertedColor()
           
 Dimension getPreferredSize()
           
 int getSecondBottomMargin()
           
 DiffDivider.RowConverter getSecondConverter()
           
protected  int getSecondMatchLine(int totalVisibleLines, int firstLine)
           
 int getSecondOffsetY()
           
 int getSecondTopMargin()
           
protected  Color getSelectedColor(Color c)
          Gets the color to identify the currently selected difference.
 Difference getSelectedDifference()
          Gets the current selected difference.
 boolean isOpposite()
           
protected  void paintComponent(Graphics g)
           
 void setChangedColor(Color changedColor)
           
 void setConflictedColor(Color conflictedColor)
           
 void setDeletedColor(Color deletedColor)
           
 void setDifferences(List<Difference> differences)
           
 void setFirstBottomMargin(int firstBottomMargin)
           
 void setFirstConverter(DiffDivider.RowConverter firstConverter)
           
 void setFirstOffsetY(int firstOffsetY)
           
 void setFirstTopMargin(int firstTopMargin)
           
 void setInsertedColor(Color insertedColor)
           
 void setOpposite(boolean opposite)
           
 void setSecondBottomMargin(int secondBottomMargin)
           
 void setSecondConverter(DiffDivider.RowConverter secondConverter)
           
 void setSecondOffsetY(int secondOffsetY)
           
 void setSecondTopMargin(int secondTopMargin)
           
 void setSelectedDifference(Difference selectedDifference)
          Sets the current selected difference.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_SELECTED_DIFFERENCE

public static final String PROPERTY_SELECTED_DIFFERENCE
The property of selected difference.

Since:
3.4.1
See Also:
Constant Field Values
Constructor Detail

DiffDivider

public DiffDivider()

DiffDivider

public DiffDivider(DiffDivider.RowConverter firstConverter,
                   DiffDivider.RowConverter secondConverter)

DiffDivider

public DiffDivider(DiffDivider.RowConverter firstConverter,
                   DiffDivider.RowConverter secondConverter,
                   List<Difference> differences)
Method Detail

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)

JIDE 3.5.15