|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--upidiff.merge.Merge
This class represents the management for the merged version of two files
Nested Class Summary | |
(package private) class |
Merge.MergeListener
This class represents the DocumentListener for the MergeDocument After an editing in the document or a merged ChangeObject it calls the method to correct the offset. |
Field Summary | |
private DebugGraphics |
debugGraphics
Object to handel graphics and to get the FontMetiric of the Textpanes |
private JScrollPane |
externScrollPane
extern object to handel scrolling of the merged text |
private FileChange |
fileChange
Container with all collected Information about the two files set to be merged |
private FontMetrics |
fontMetrics
Object for the FontMetric of the Textpanes |
private StyledDocument |
linenumbers
The container for the linenumbers |
private StyledDocument |
mergeDoc
The container for the text and the Interface for the GUI |
private LineOffset |
mergeOffset
Object to manage the Line/Char Offset for the Text The information about every singel line are contained in LineElements |
static int |
NEWFILE
A constant definde to name the new file |
private String |
newLine
Contains the NextLine String of the current running operatingsystem |
static int |
OLDFILE
A constant defined to name the old file |
private String |
spacer
Contains the spacer to be inserted in the text in place of the changes to mark their positions |
private VisualDiff |
visualDiff
Reference of the parent VisualDiff object |
Constructor Summary | |
Merge(FileChange fileChange,
VisualDiff visualDiff)
Constructs a new object of this class |
Method Summary | |
void |
addChange(Change addChange,
int whichFile)
Method to add a Version of the Change to the file |
private void |
addCharChange(Change charChange,
int linenumber,
int whichFile)
This Method adds a CharChange to the mergeDoc |
void |
addEditedString(int start,
String addedString)
Method to add a String to the offset of the file Attention: This Method doesn't add the String itself to the file but adds the offset of the string. |
private void |
addEmtyLine(int linenumber,
Change change,
boolean addNextLine)
Method to add an emty line to the text |
private void |
addLine(String insert,
int orgLinenum,
Change change)
Method to add a line to the text |
private void |
addLineChange(int linenumber,
int whichFile)
This Method adds a LineChange to the mergeDoc |
private void |
addLinenumber()
This method adds a line with a linenumber to the linenumber document |
void |
debugOutput()
This Method creates an debugoutput. |
StyledDocument |
getLinenumbers()
Queries the StyledDocument used for the linenumbers in the text. |
StyledDocument |
getMergeDoc()
Queries the StyledDocument used for the merged text |
void |
recalculate(int lineOldFile,
int lineNewFile)
Method to handel a manual recalculation of the differences |
void |
removeChange(Change removeChange)
Method to remove a Version of the Change from the file |
void |
removeEditedString(int start,
int length)
Method to remove a String from the fileoffset Attention: This Method doesn't remove the String itself to the file but removes the offset of the string. |
private void |
removeLinenumber()
This method removes the last linenumber from the Linenumbers Document |
private void |
removeSpacer(int pos)
Removes a Spacer in the Text that marks the Positon of a Change |
void |
scrollToChange(Change change)
This Method scrolls the externScrollpane to the given ChangeObject |
void |
setChangeMerged(Change currentChange,
int whichVersion)
This Method sets the Current Change-Object merged If this Object has SubChangeobjects, these will also be set merged |
void |
setExternScrollPane(JScrollPane externScrollPane)
This Method set the extern ScrollPane to handel scrolling |
private void |
setSpacer(int line,
int charInLine)
Sets a Spacer in the Text to mark the Positon of a Change |
void |
setUnchangedText(int lineOldFile,
int lineNewFile)
Method to take the parts of the text that were unchanged between the two versions of the text in this document and create the offsets. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private StyledDocument mergeDoc
StyledDocument
private StyledDocument linenumbers
private LineOffset mergeOffset
LineOffset
,
LineElement
private FileChange fileChange
FileChange
private VisualDiff visualDiff
private DebugGraphics debugGraphics
private FontMetrics fontMetrics
public static final int OLDFILE
public static final int NEWFILE
private JScrollPane externScrollPane
private String newLine
private String spacer
Constructor Detail |
public Merge(FileChange fileChange, VisualDiff visualDiff)
fileChange
- Container with all information about the two
files set to be mergedvisualDiff
- referenze to the parent VisualDiff objectMethod Detail |
public void setUnchangedText(int lineOldFile, int lineNewFile)
lineOldFile
- Line to start with in the old filelineNewFile
- Line to start with in the new fileprivate void addEmtyLine(int linenumber, Change change, boolean addNextLine)
change
- The change of this line or null if there isn't onelinenumber
- The number of the line to add the emty line toaddNextLine
- True adds a lineseparatorprivate void addLine(String insert, int orgLinenum, Change change)
insert
- The String to insert in the TextorgLinenum
- The linenumber the String has in the original Textchange
- The change-object of the change in this line, or null
if ther is no change in this line.public void recalculate(int lineOldFile, int lineNewFile)
lineOldFile
- The line where the recalculation starts
in the old filelineNewFile
- The line where the recalculation starts
in the old filepublic void addChange(Change addChange, int whichFile) throws Exception
addChange
- The Changeobjekt containing the
information about the differencewhichFile
- The File wich contains the choosen
Version. Use the constants OLDFILE and NEWFILE for this
parameter
Exception
- If the handed over Change is not valid or already mergedprivate void addLineChange(int linenumber, int whichFile)
linenumber
- The number of line to addwhichFile
- From which file add the change?private void addCharChange(Change charChange, int linenumber, int whichFile)
charChange
- The change to addlinenumber
- The line that contains the CharChangewhichFile
- From which file add the change?public void removeChange(Change removeChange)
removeChange
- The Changeobjekt containing the
information about the differencepublic void addEditedString(int start, String addedString)
start
- the position of the char where the inserted
string starts in the file (Use the totalnumber of Chars in
text)addedString
- The added String itself.public void removeEditedString(int start, int length)
start
- the position of the char where the inserted
string starts in the file (Use the totalnumber of Chars in
text)length
- The length of the removed String.private void addLinenumber()
private void removeLinenumber()
private void setSpacer(int line, int charInLine)
line
- The Position of the line in the Text where to
set the spacercharInLine
- The Positon of the char in the line to
set the spacerprivate void removeSpacer(int pos)
pos
- The position of the Spacer in the Textpublic void setChangeMerged(Change currentChange, int whichVersion)
currentChange
- The ChangeObject to be set mergedwhichVersion
- The merged version. Use OLDFILE or NEWFILE onlypublic void scrollToChange(Change change)
change
- the Changeobject to scroll topublic StyledDocument getMergeDoc()
public StyledDocument getLinenumbers()
public void setExternScrollPane(JScrollPane externScrollPane)
externScrollPane
- The extern ScrollPanepublic void debugOutput()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |