public final class DiffController extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DiffController.DiffPane
Enumerates Base (left) and Modified (right) panes of a Diff view for setLocation() method
|
static class |
DiffController.LocationType
Enumerates types of location for setLocation() method.
|
Modifier and Type | Field and Description |
---|---|
static String |
PROP_DIFFERENCES
Property change that indicates that set of differences OR the current difference changed.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.
|
static DiffController |
create(StreamSource base,
StreamSource modified)
Creates a Diff Controller for supplied left and right sources.
|
static DiffController |
createEnhanced(StreamSource base,
StreamSource modified)
Creates a Diff Controller for supplied left and right sources capable of creating enhanced UI.
|
int |
getDifferenceCount()
Gets total number of Differences between sources currently displayed in the Diff view.
|
int |
getDifferenceIndex()
Gets the current (highlighted) difference in the Diff view.
|
JComponent |
getJComponent()
Intializes the Controller and creates visual presenter of the Diff.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.
|
void |
setLocation(DiffController.DiffPane pane,
DiffController.LocationType type,
int location)
Ensure the requested location in the Diff view is visible on screen.
|
public static final String PROP_DIFFERENCES
public static DiffController create(StreamSource base, StreamSource modified) throws IOException
base
- defines content of the Base Diff panemodified
- defines content of the Modified (possibly editable) Diff paneIOException
- when the reading from input streams fails.public static DiffController createEnhanced(StreamSource base, StreamSource modified) throws IOException
base
- defines content of the Base Diff panemodified
- defines content of the Modified (possibly editable) Diff paneIOException
- when the reading from input streams fails.public void setLocation(DiffController.DiffPane pane, DiffController.LocationType type, int location)
pane
- defines which pane the location parameter refers totype
- defines the location parameter, see belowlocation
- depending on the type parameter this defines either a line number or a Difference index, both 0-basedIllegalArgumentException
- if location parameter is out of range for the given pane and location typepublic JComponent getJComponent()
public int getDifferenceCount()
public int getDifferenceIndex()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- property change listenerpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- property change listener