Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


oracle.javatools.compare.view.wedge
Class WedgeCompareView

java.lang.Object
  extended by oracle.javatools.compare.view.BaseCompareView
      extended by oracle.javatools.compare.view.SequenceCompareView
          extended by oracle.javatools.compare.view.wedge.WedgeCompareView

All Implemented Interfaces:
CompareView, ActionMenuView, CustomHorizontalScrollView, EditableView, EditorPaneView, NavigableConflictsView, NavigableView, SplitPanelView, StatusView, ToolTipView, ToolTipProvider

public class WedgeCompareView
extends SequenceCompareView
implements EditorPaneView, ToolTipProvider

The wedge compare view displays text differences as a series of blocks and connectors. Unlike the "block-style" compare viewer, the line size of compare contributors is not adjusted by inserting extra blank lines. This makes wedge-style compare ideal for editable diffs and merge.

Vertical scrolling with this style of compare viewer is tricky, because both sides must be scrolled at different rates to keep the diff blocks on either side within a reasonable vertical proximity. The WedgeTextCompareView contains its own vertical scrollbar to control the complex scrolling behavior.

As well as the n text panes showing the contributors, there are n editor gutters (for line numbers). n-1 central merge gutters contain the connectors between diff blocks and controls for shuttling changes between contributors. There is also a single overview gutter which displays a birds eye view of the entire diff.

The vertical scrollbar and overview are plotted in so-called "virtual space". The virtual height of diff is a unified height calculated by summing the maximum height of all the diff blocks. Using virtual space makes it possible to vertically scroll in a sensible way and display the overview gutter without having change blocks overlap each other. It does have the side effect that the scroll thumb does not necessarily line up correctly with the overview gutter.

Since:
10.0.3

Nested Class Summary

 

Nested classes/interfaces inherited from class oracle.javatools.compare.view.SequenceCompareView
SequenceCompareView.OverviewComponent, SequenceCompareView.OverviewComponentMouseHandler

 

Nested classes/interfaces inherited from class oracle.javatools.compare.view.BaseCompareView
BaseCompareView.CentralGutterMouseHandler, BaseCompareView.ContributorBias, BaseCompareView.CustomFocusTraversalPolicy, BaseCompareView.PositionListener

 

Field Summary

 

Fields inherited from class oracle.javatools.compare.view.BaseCompareView
_centerScrollPane, _centerTitle, _leftDiffGutter, _leftOverview, _leftScrollPane, _leftTitle, _rightDiffGutter, _rightOverview, _rightScrollPane, _rightTitle, GUI_VERTICAL_SCROLLBAR, GUI_VERTICAL_SPACER

 

Constructor Summary
WedgeCompareView()
           
WedgeCompareView(CompareMode mode)
           
WedgeCompareView(CompareMode mode, CompareViewBias bias)
           

 

Method Summary
 void addPopupManager(ComparePopupManager manager)
          Add a popup manager to this view.
 void addViewEditListener(ViewEditListener l)
           
protected  CompareModel createModel(CompareModel compareModel, CompareDifference[] differences)
           
protected  CompareModel createMutableModel(CompareModel compareModel)
           
protected  void createOverviews()
           
protected  void deleteBlock(oracle.javatools.compare.algorithm.BaseCompareDifference difference, ContributorKind contributor)
          Remove the specified difference block from the specified contributor.
 void dispose()
           
protected  oracle.javatools.compare.algorithm.sequence.SequenceCompareDifference getBlockAtRealLine(ContributorKind contributor, int line)
           
protected  ContributorKind getCurrentContributorKind()
           
protected  CompareDifference getCurrentDifference()
           
 BasicEditorPane getCurrentEditorPane()
          Get the current (focussed) editor pane, or null if no editor pane currently has focus.
 javax.swing.text.Document getDocument(ContributorKind contrib)
           
protected  BasicEditorPane getEditorPane(ContributorKind contributor)
           
 BasicEditorPane[] getEditorPanes()
          Get all editor panes in use by the view.
protected  java.awt.Component getFocusableCenterEditor()
           
 java.awt.Component getFocusComponent()
           
protected  CompareDifference getNextConflict()
           
protected  CompareDifference getNextDifference()
           
protected  java.awt.Color getOverviewDifferenceColor(oracle.javatools.compare.algorithm.sequence.SequenceCompareDifference differenceBlock, boolean isLeft, ContributorKind firstContributorKind, ContributorKind secondContributorKind)
           
protected  java.awt.Component getOverviewLeftEditor()
           
protected  java.awt.Component getOverviewRightEditor()
           
protected  CompareDifference getPreviousConflict()
           
protected  CompareDifference getPreviousDifference()
           
 java.lang.String getToolTipText(BasicEditorPane editorPane, java.awt.event.MouseEvent mouseEvent, int offset)
          Requests from the editor client an appropriate tooltip to display for the given editor.
protected  ViewEditListener[] getViewEditListeners()
           
protected  void goToDifference(CompareDifference difference, boolean requestFocus)
           
protected  void initializeView(CompareModel model)
           
protected  void insertBlockCopy(oracle.javatools.compare.algorithm.BaseCompareDifference difference, ContributorKind fromContributor, ContributorKind toContributor)
          Take a copy of the block from the specified contributor and insert it into the other contributor after the change.
 boolean isShowInlineCharDiffs()
           
protected  boolean isViewFocusOwner()
           
 void removePopupManager(ComparePopupManager manager)
          Remove a popup manager from this view.
 void removePopupManager(ComparePopupManager manager, BasicEditorPane editorPane)
           
 void removeViewEditListener(ViewEditListener l)
           
protected  void replaceBlock(oracle.javatools.compare.algorithm.BaseCompareDifference difference, ContributorKind fromContributor, ContributorKind toContributor)
          Take a copy of the block from the specified contributor and replace the text of the adjacent contributor with the text.
 void setEditLocked(boolean isLocked)
          Set whether this compare view is locked against editing, even if the underlying text buffers are writable.
 void setShowInlineDiffs(boolean showInlineDiffs)
           
protected  void updateCurrentMemento()
           
protected  void updateModelImpl()
          Reapplies the specified model to the view.
protected  void verticalScrollTo(int virtualLine)
          Scroll to the specified (virtual) position.

 

Methods inherited from class oracle.javatools.compare.view.SequenceCompareView
getDiffBlockIterator, getVirtualHeightLines, getVirtualLineForReal, initializeOverview

 

Methods inherited from class oracle.javatools.compare.view.BaseCompareView
addPositionListener, addStatusListener, attachContributorChangeListeners, calculateRightEditorInset, canReadElement, canWriteElement, createDeleteBlockAction, createFocusTraversalPolicy, createHorizontalScrollPane, createInsertBlockAction, createMarkAllResolvedAction, createMarkResolvedAction, createMemento, createModel, createReplaceBlockAction, detachContributorChangeListeners, firePositionChanged, fireStatusChanged, fireViewEditEvent, getAdjacentContributorKind, getAdjacentContributorKind, getBias, getBundle, getCenterScrollPane, getCenterTitle, getCompareMode, getCompareModel, getContributor, getDefaultEditAction, getDefaultEditActionIcon, getEditActions, getEditActions, getGUI, getHorizontalScrollBars, getHorizontalScrollComponent, getLeftDiffGutter, getLeftOrCenterSplitter, getLeftOverview, getLeftScrollPane, getLeftTitle, getModel, getPopupManager, getRightDiffGutter, getRightOverview, getRightScrollPane, getRightSplitter, getRightTitle, getSplitPanel, getSplitterLocation, getToolTipProvider, getUndoableEditListeners, getVerticalScrollbar, getVerticalScrollBar, getVerticalScrollCardLayout, getVerticalScrollPanel, goToDifference, goToFirstConflict, goToFirstDifference, goToInitialDifference, goToLastConflict, goToLastDifference, goToNextConflict, goToNextDifference, goToPreviousConflict, goToPreviousDifference, hasDefaultEditAction, hasNavigableConflicts, hasNavigableDifferences, hasNextConflict, hasNextDifference, hasPreviousConflict, hasPreviousDifference, horizontalScrollTo, initScrollPane, isAddition, isEditable, isEditLocked, isOverviewFocusOwner, isRemoval, markAllResolved, markResolved, registerViewDecoration, removePositionListener, removeStatusListener, repaintDiffGutters, resetGUI, setCenterScrollPane, setCompareModel, setLeftDiffGutter, setLeftScrollPane, setMemento, setModel, setRightDiffGutter, setRightScrollPane, setSplitPanel, setSplitterLocation, setSplitterLocation, setToolTipProvider, updateModel, updateOnEdit, updateTitles

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Methods inherited from interface oracle.javatools.compare.view.EditorPaneView
getEditActions

 

Constructor Detail

WedgeCompareView

public WedgeCompareView()

WedgeCompareView

public WedgeCompareView(CompareMode mode)

WedgeCompareView

public WedgeCompareView(CompareMode mode,
                        CompareViewBias bias)

Method Detail

getFocusComponent

public java.awt.Component getFocusComponent()
Overrides:
getFocusComponent in class BaseCompareView

dispose

public void dispose()
Overrides:
dispose in class BaseCompareView

createOverviews

protected void createOverviews()
Overrides:
createOverviews in class SequenceCompareView

getOverviewLeftEditor

protected java.awt.Component getOverviewLeftEditor()
Overrides:
getOverviewLeftEditor in class BaseCompareView

getOverviewRightEditor

protected java.awt.Component getOverviewRightEditor()
Overrides:
getOverviewRightEditor in class BaseCompareView

getFocusableCenterEditor

protected java.awt.Component getFocusableCenterEditor()
Overrides:
getFocusableCenterEditor in class BaseCompareView

getOverviewDifferenceColor

protected java.awt.Color getOverviewDifferenceColor(oracle.javatools.compare.algorithm.sequence.SequenceCompareDifference differenceBlock,
                                                    boolean isLeft,
                                                    ContributorKind firstContributorKind,
                                                    ContributorKind secondContributorKind)
Specified by:
getOverviewDifferenceColor in class SequenceCompareView

getToolTipText

public java.lang.String getToolTipText(BasicEditorPane editorPane,
                                       java.awt.event.MouseEvent mouseEvent,
                                       int offset)
Description copied from interface: ToolTipProvider
Requests from the editor client an appropriate tooltip to display for the given editor. The mouseEvent describes where the cursor is an what the mouse event was (i.e., mouse moved), and the offset is the location in the editor (document) corresponding to the current mouse cursor.
Specified by:
getToolTipText in interface ToolTipProvider
Parameters:
editorPane - the editor where the tooltip will be displayed
mouseEvent - the mouse event that generated the tooltip
offset - the document offset where the mouse cursor is located
Returns:
the tooltip text to display

addViewEditListener

public void addViewEditListener(ViewEditListener l)
Specified by:
addViewEditListener in interface EditableView
Overrides:
addViewEditListener in class BaseCompareView

removeViewEditListener

public void removeViewEditListener(ViewEditListener l)
Specified by:
removeViewEditListener in interface EditableView
Overrides:
removeViewEditListener in class BaseCompareView

getViewEditListeners

protected ViewEditListener[] getViewEditListeners()
Overrides:
getViewEditListeners in class BaseCompareView

createModel

protected CompareModel createModel(CompareModel compareModel,
                                   CompareDifference[] differences)
Overrides:
createModel in class SequenceCompareView

getBlockAtRealLine

protected oracle.javatools.compare.algorithm.sequence.SequenceCompareDifference getBlockAtRealLine(ContributorKind contributor,
                                                                                                   int line)

setEditLocked

public void setEditLocked(boolean isLocked)
Set whether this compare view is locked against editing, even if the underlying text buffers are writable.
Overrides:
setEditLocked in class BaseCompareView
Parameters:
isLocked - if true, no edits are allowed in this compare view, even if the underlying buffers are writable. If false, the editable state of the buffers is used to determine whether edits can be made from this view.

getEditorPane

protected BasicEditorPane getEditorPane(ContributorKind contributor)

verticalScrollTo

protected void verticalScrollTo(int virtualLine)
Scroll to the specified (virtual) position.
Specified by:
verticalScrollTo in class BaseCompareView
Parameters:
virtualLine - the virtual line to display at the top of the viewer.

updateCurrentMemento

protected void updateCurrentMemento()

updateModelImpl

protected void updateModelImpl()
Description copied from class: BaseCompareView
Reapplies the specified model to the view. This is used when the contributors are the same but the model has changed, mainly for performance (it does less work than setModel( model )).
Specified by:
updateModelImpl in class BaseCompareView

initializeView

protected void initializeView(CompareModel model)
Overrides:
initializeView in class BaseCompareView

createMutableModel

protected CompareModel createMutableModel(CompareModel compareModel)
Overrides:
createMutableModel in class BaseCompareView

getDocument

public javax.swing.text.Document getDocument(ContributorKind contrib)

isViewFocusOwner

protected boolean isViewFocusOwner()
Overrides:
isViewFocusOwner in class BaseCompareView

deleteBlock

protected void deleteBlock(oracle.javatools.compare.algorithm.BaseCompareDifference difference,
                           ContributorKind contributor)
Remove the specified difference block from the specified contributor.
Specified by:
deleteBlock in class BaseCompareView
Parameters:
difference - the block to remove
contributor - the contributor to remove the block from

insertBlockCopy

protected void insertBlockCopy(oracle.javatools.compare.algorithm.BaseCompareDifference difference,
                               ContributorKind fromContributor,
                               ContributorKind toContributor)
Take a copy of the block from the specified contributor and insert it into the other contributor after the change.
Specified by:
insertBlockCopy in class BaseCompareView
Parameters:
difference - the block to copy
fromContributor - the contributor to copy from
toContributor - the contributor to copy to

replaceBlock

protected void replaceBlock(oracle.javatools.compare.algorithm.BaseCompareDifference difference,
                            ContributorKind fromContributor,
                            ContributorKind toContributor)
Take a copy of the block from the specified contributor and replace the text of the adjacent contributor with the text. It only really makes sense to do this if the block is a change on both sides, i.e. block.getLength() for both contributors > 0.
Specified by:
replaceBlock in class BaseCompareView
Parameters:
difference - the block to change
fromContributor - the contributor to copy from
toContributor - the contributor whose block will be replaced.

getPreviousDifference

protected CompareDifference getPreviousDifference()
Specified by:
getPreviousDifference in class BaseCompareView

getNextDifference

protected CompareDifference getNextDifference()
Specified by:
getNextDifference in class BaseCompareView

getPreviousConflict

protected CompareDifference getPreviousConflict()
Specified by:
getPreviousConflict in class BaseCompareView

getNextConflict

protected CompareDifference getNextConflict()
Specified by:
getNextConflict in class BaseCompareView

getCurrentDifference

protected CompareDifference getCurrentDifference()
Specified by:
getCurrentDifference in class BaseCompareView

getCurrentContributorKind

protected ContributorKind getCurrentContributorKind()
Specified by:
getCurrentContributorKind in class BaseCompareView

goToDifference

protected void goToDifference(CompareDifference difference,
                              boolean requestFocus)
Specified by:
goToDifference in class BaseCompareView

setShowInlineDiffs

public void setShowInlineDiffs(boolean showInlineDiffs)

isShowInlineCharDiffs

public boolean isShowInlineCharDiffs()

addPopupManager

public void addPopupManager(ComparePopupManager manager)
Description copied from interface: ActionMenuView
Add a popup manager to this view. The popup manager will be attached to all editor panes that make up the view.
Specified by:
addPopupManager in interface ActionMenuView
Specified by:
addPopupManager in interface EditorPaneView
Overrides:
addPopupManager in class BaseCompareView
Parameters:
manager - the popup manager to attach

removePopupManager

public void removePopupManager(ComparePopupManager manager)
Description copied from interface: ActionMenuView
Remove a popup manager from this view. The popup manager will be removed from all editor panes that make up this view.
Specified by:
removePopupManager in interface ActionMenuView
Specified by:
removePopupManager in interface EditorPaneView
Overrides:
removePopupManager in class BaseCompareView
Parameters:
manager - the popup manager to remove

removePopupManager

public void removePopupManager(ComparePopupManager manager,
                               BasicEditorPane editorPane)

getEditorPanes

public BasicEditorPane[] getEditorPanes()
Description copied from interface: EditorPaneView
Get all editor panes in use by the view.
Specified by:
getEditorPanes in interface EditorPaneView
Returns:
the view's editor panes.

getCurrentEditorPane

public BasicEditorPane getCurrentEditorPane()
Description copied from interface: EditorPaneView
Get the current (focussed) editor pane, or null if no editor pane currently has focus.
Specified by:
getCurrentEditorPane in interface EditorPaneView
Returns:
the current editor pane

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


Copyright © 1997, 2013, Oracle. All rights reserved.