|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--upidiff.gui.VisualDiff
This class represents the visualation for two compared files
Field Summary | |
private Catalog |
catalog
I18n Catalog |
private Change |
currentChange
The actual Change-Object to work with. |
private DebugGraphics |
debugGraphics
Object to handel graphics and to get the FontMetiric of the Textpanes |
private SimpleAttributeSet |
deletedCharAttribute
AttributeSet for the Backgroundcolor of a deleted Char |
private SimpleAttributeSet |
deletedLineAttribute
AttributeSet for the Backgroundcolor of a deleted Line |
private JScrollPane |
externScrollPaneNew
extern object to handel scrolling of the new text |
private JScrollPane |
externScrollPaneOld
extern object to handel scrolling of the old texts |
private JLabel |
externStatusBarLabel
extern object to be labeled with Information about the Changes |
private FileChange |
fileChange
The container with all needed information about the compared Documents |
private FontMetrics |
fontMetrics
Object for the FontMetric of the Textpanes |
private SimpleAttributeSet |
insertedCharAttribute
AttributeSet for the Backgroundcolor of an inserted Char |
private SimpleAttributeSet |
insertedLineAttribute
AttributeSet for the Backgroundcolor of an inserted Line |
private SimpleAttributeSet |
invertedAttribute
AttributeSet for highlighting the linenumbers |
private Merge |
merge
Object to handel the merging of the two files |
private SimpleAttributeSet |
mergedAttribute
AttributeSet for the backgroundcolor of allready merged changes |
private StyledDocument |
newFile
The container for the newFile Text and its Style |
static int |
NEWFILE
A constant definde to name the new file |
private StyledDocument |
newFileLinenumbers
The container for the newFile Linenumbers and its Style |
private LineOffset |
newFileOffset
Object to contain the Line/Char Offset for the new file The inner Vector contains a LineElement for each line |
private String |
newLine
Contains the NextLine String of the current running operatingsystem |
private SimpleAttributeSet |
noneLineAttribute
AttributeSet for none Backgroundcolor |
private StyledDocument |
oldFile
The container for the oldFile Text and its Style |
static int |
OLDFILE
A constant defined to name the old file |
private StyledDocument |
oldFileLinenumbers
The container for the oldFile Linenumbers and its Style |
private LineOffset |
oldFileOffset
Object to contain the Line/Char Offset for the old file The inner Vector contains a LineElement for each line |
private UserPreferences |
prefs
Reference to the User-Preferences |
private SimpleAttributeSet |
updatedLineAttribute
AttributeSet for the Backgroundcolor of an updated Line |
Constructor Summary | |
VisualDiff(FileChange fileChange,
JLabel externStatusBarLabel,
Catalog catalog)
Constructs a new Object of this class |
Method Summary | |
boolean |
addChangeToMerge(int version)
This method adds the current Change-Object to the merged document in the given Version |
private void |
addEmtyLine(int whichFile,
Change change)
method to add an emty line to the text |
private void |
addLine(int whichFile,
String insert,
int orgLinenum,
Change change)
method to add a line to the text |
private void |
createDocument(int lineOldFile,
int lineNewFile)
This method sets or resets the StyledDocument |
Change |
getCurrentChange()
This method queries the current change |
FileChange |
getFileChange()
This method Querries the FileChange object |
Merge |
getMerge()
This method queries the Merge-Object |
StyledDocument |
getNewFile()
Queries the newFile StyledDocument |
StyledDocument |
getNewFileLinenumbers()
Queries the newFileLinenumber StyledDocument |
StyledDocument |
getOldFile()
Queries the oldFile StyledDocument |
StyledDocument |
getOldFileLinenumbers()
Queries the oldFileLinenumber StyledDocument |
void |
jumpToNext()
This method sets the focus and the highlight on the next change. |
void |
jumpToPrev()
This method sets the focus and the highlight on the prev |
void |
recalculate(int lineOldFile,
int lineNewFile)
This method manages the changing of the Styles in case of a recalculation |
void |
resetColors()
This method resets the colors in the document |
private void |
scrollToLine(int linenumber)
This method scrolls the extern JScrollpanes, if they are not null, to the given Line |
void |
setCloserLook()
This method sets the next subchangeclass of currentChange visibel, if currentChange has such changes |
void |
setColors()
This method sets the Backroundcolors in the Text according to the userpreference |
void |
setExternScrollPaneNew(JScrollPane externScrollPaneNew)
This method sets the extern JScrollPane to handel the scrolling of the Text |
void |
setExternScrollPaneOld(JScrollPane externScrollPaneOld)
This method sets the extern JScrollPane to handel the scrolling of the Text |
void |
setExternStatusBarLabel(JLabel externStatusBarLabel)
This method sets the extern JLabel to show information about the curren Change |
void |
setHighlight()
This method sets a highlight on the current change. |
private void |
setLineHighlight(int linenumber)
This method sets a highlight on a line |
private void |
setLineStyle(int linenumber)
method to set the style of a line |
void |
setStatus()
This method sets the text on the statuslabel with information about the current ChangeObject |
void |
setStyle(Change change)
This method sets a style on a change |
void |
setUndoCloserLook()
This method sets the current visible subchangeclass of currentChange invisibel. |
void |
startMerge()
This method creates the Merge-Object |
private void |
unsetHighlight(Change change)
This method unsets the highlight on a change |
private void |
unsetLineStyle(int linenumber)
Method to set the the style of a line to normal |
private void |
usetStyle(Change change)
This method unsets the style of a change |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int OLDFILE
public static final int NEWFILE
private FileChange fileChange
private StyledDocument oldFile
private StyledDocument oldFileLinenumbers
private StyledDocument newFile
private StyledDocument newFileLinenumbers
private Change currentChange
private LineOffset oldFileOffset
LineElement
private LineOffset newFileOffset
LineElement
private Merge merge
private JScrollPane externScrollPaneOld
private JScrollPane externScrollPaneNew
private JLabel externStatusBarLabel
private DebugGraphics debugGraphics
private FontMetrics fontMetrics
private String newLine
private UserPreferences prefs
private Catalog catalog
private SimpleAttributeSet deletedLineAttribute
private SimpleAttributeSet insertedLineAttribute
private SimpleAttributeSet deletedCharAttribute
private SimpleAttributeSet insertedCharAttribute
private SimpleAttributeSet updatedLineAttribute
private SimpleAttributeSet noneLineAttribute
private SimpleAttributeSet invertedAttribute
private SimpleAttributeSet mergedAttribute
Constructor Detail |
public VisualDiff(FileChange fileChange, JLabel externStatusBarLabel, Catalog catalog)
fileChange
- contains the two files with their offset
an the ChangelistexternStatusBarLabel
- extern Label to show information
about the current changecatalog
- The languagecatalogMethod Detail |
private void createDocument(int lineOldFile, int lineNewFile)
lineOldFile
- The line to start with in the old filelineNewFile
- The line to start with in the new fileprivate void addEmtyLine(int whichFile, Change change)
whichFile
- To choose a file use the constants OLDFILE or NEWFILEchange
- The change of this line or null if there isn't oneprivate void addLine(int whichFile, String insert, int orgLinenum, Change change)
whichFile
- To choose a file use the constants OLDFILE or NEWFILEinsert
- 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 to start with in the old filelineNewFile
- The line to start with in the new filepublic void startMerge()
public void jumpToNext()
public void jumpToPrev()
private void scrollToLine(int linenumber)
linenumber
- The linenumber to scroll topublic void setHighlight()
private void setLineHighlight(int linenumber)
linenumber
- the number of the linepublic void setStyle(Change change)
change
- The change to set the style onprivate void setLineStyle(int linenumber)
linenumber
- The number of the line to set the style onprivate void usetStyle(Change change)
change
- The change to unset the change onprivate void unsetLineStyle(int linenumber)
linenumber
- The number of the lineprivate void unsetHighlight(Change change)
change
- The change to unset the highlight onpublic void setColors()
public void resetColors()
public void setCloserLook()
public void setUndoCloserLook()
public boolean addChangeToMerge(int version) throws Exception
version
- The version in that the Change-Object
shout be merged. Use VisualDiff.OLDFILE or VisualDiff.NEWFILE
for this parameter
Exception
- An exception from the merge.addChange call
will be handed over to the GUIpublic void setStatus()
public StyledDocument getOldFile()
public StyledDocument getOldFileLinenumbers()
public StyledDocument getNewFile()
public StyledDocument getNewFileLinenumbers()
public Change getCurrentChange()
public Merge getMerge()
public void setExternScrollPaneOld(JScrollPane externScrollPaneOld)
externScrollPaneOld
- The JScrollPane with the Old Textpublic void setExternScrollPaneNew(JScrollPane externScrollPaneNew)
externScrollPaneNew
- The JScrollPane with the New Textpublic void setExternStatusBarLabel(JLabel externStatusBarLabel)
externStatusBarLabel
- the JLabel of a GUIpublic FileChange getFileChange()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |