|
JIDE 3.4.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.jidesoft.diff.AbstractDiffPane
com.jidesoft.diff.BasicDiffPane<String>
com.jidesoft.diff.CodeEditorDiffPane
public class CodeEditorDiffPane
CodeEditorDiffPane is a diff pane based on CodeEditor component in JIDE Code Editor
product. It can be used to compare two block of multiple line texts. The text will be displayed in a
CodeEditor to have syntax coloring. It also uses the highlight features provided by
CodeEditor to make it easy to see the differences.
| Nested Class Summary |
|---|
| 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 | |
|---|---|
protected CodeEditor |
_fromEditor
|
protected CodeEditor |
_toEditor
|
| Fields inherited from class com.jidesoft.diff.AbstractDiffPane |
|---|
_actions, _changedColor, _deletedColor, _insertedColor, COMMAND_FIRST, COMMAND_LAST, COMMAND_NEXT, COMMAND_PREVIOUS |
| 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 | |
|---|---|
CodeEditorDiffPane()
Creates a CodeEditorDiffPane. |
|
CodeEditorDiffPane(String fromText,
String toText)
|
|
| Method Summary | |
|---|---|
protected List<Difference> |
acceptDifference(List<Difference> differences,
Difference c)
Accepts the specified Difference and return a new list of Differences. |
protected void |
adjustDividerOffset(DiffDivider divider,
int index)
Adjusts the DiffDivider's left and right offset. |
void |
clearHighlights()
|
JComponent |
createComponent(Object item,
int index)
Creates the component to display the content for the diff. |
protected CodeEditor |
createEditor()
|
protected CodeEditor |
createEditor(int index)
Creates the code editor. |
Diff<?> |
createLinesDiff(int fromStartOffset,
int fromEndOffset,
int toStartOffset,
int toEndOffset)
Creates multiple lines diff. |
protected MarkerSupport |
createMarkerSupport(JComponent component)
|
JComponent |
createPane(Object item,
int index)
Subclass implements it to use a different component to display the objects to be compared. |
protected RowMarginSupport |
createRowMarginSupport(JComponent component,
JScrollPane scrollPane)
|
protected void |
customizeEditor(CodeEditor editor,
int index)
|
protected void |
customizePane(JComponent pane,
int index)
Customizes the pane. |
boolean |
delete(int line,
int numberOfLines,
boolean runDiffAfterward)
Deletes number of lines from the specified started line in the toEditor. |
void |
endHighlights()
|
String[] |
getFromItems()
|
String |
getFromText()
|
protected int |
getSelectedIndex(int paneIndex)
|
String[] |
getToItems()
|
String |
getToText()
|
void |
highlightChanged(int fromStartOffset,
int fromEndOffset,
int toStartOffset,
int toEndOffset,
Color c,
Color separatorColor,
String changeToolTip)
|
void |
highlightChangedExactly(List<Difference> lineDiff,
int fromStartOffset,
int fromEndOffset,
int toStartOffset,
int toEndOffset,
Color c,
Color separatorColor,
String changeToolTip)
|
void |
highlightDeleted(int fromStartLine,
int fromEndLine,
int toStartLine,
Color c,
Color separatorColor,
String changeToolTip)
|
void |
highlightInserted(int fromStartLine,
int toStartLine,
int toEndLine,
Color c,
Color separatorColor,
String changeToolTip)
|
boolean |
insert(int line,
int fromLine,
int fromNumberOfLines,
boolean runDiffAfterward)
Inserts some lines from the fromEditor to the toEditor. |
protected void |
installListeners()
Installs the listeners. |
void |
setFromText(String fromText)
Sets the text for the from editor. |
void |
setReadOnly(boolean readOnly)
Sets the read only flag. |
void |
setToText(String toText)
Sets the text for the to editor. |
protected String[] |
splitString(String string,
String lineBreak)
|
void |
startHighlights()
|
protected void |
synchronizeViewport(DiffDivider diffDivider,
boolean startFrom)
|
| Methods inherited from class com.jidesoft.diff.AbstractDiffPane |
|---|
createActions, createButton, createContentArea, createLegendBar, createStatusBar, createToolBar, customizeAction, customizePanes, customizeToolBar, getChangedColor, getDeletedColor, getInsertedColor, getMessage, getResourceString, initLayout, setMessage |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected CodeEditor _fromEditor
protected CodeEditor _toEditor
| Constructor Detail |
|---|
public CodeEditorDiffPane()
setFromText(String) and setToText(String) methods.
public CodeEditorDiffPane(String fromText,
String toText)
| Method Detail |
|---|
public JComponent createComponent(Object item,
int index)
BasicDiffPane
createComponent in class BasicDiffPane<String>item - the content to be displayed in the component.index - the index of the component.
public JComponent createPane(Object item,
int index)
AbstractDiffPane
createPane in class BasicDiffPane<String>item - item to be compared. The component should be able to display the item.index - the index of the pane. For example, for a type diff pane to compare two items before and after
modification, the index 0 will be the original item before modification, the index 1 will be the
item after modification.
protected void customizePane(JComponent pane,
int index)
AbstractDiffPaneAbstractDiffPane.customizePanes(JComponent[]).
customizePane in class AbstractDiffPanepane - the pane.index - the index of the pane.protected MarkerSupport createMarkerSupport(JComponent component)
createMarkerSupport in class BasicDiffPane<String>
protected RowMarginSupport createRowMarginSupport(JComponent component,
JScrollPane scrollPane)
createRowMarginSupport in class BasicDiffPane<String>
protected void adjustDividerOffset(DiffDivider divider,
int index)
AbstractDiffPane
adjustDividerOffset in class BasicDiffPane<String>divider - the DiffDivider.index - the index of the DiffDivider.protected CodeEditor createEditor(int index)
createEditor() to create a CodeEditor instance.
index - the code editor index
protected CodeEditor createEditor()
protected void customizeEditor(CodeEditor editor,
int index)
public String[] getFromItems()
getFromItems in class BasicDiffPane<String>public String[] getToItems()
getToItems in class BasicDiffPane<String>public void setFromText(String fromText)
fromText - the new text for the from editor.public String getFromText()
public Diff<?> createLinesDiff(int fromStartOffset,
int fromEndOffset,
int toStartOffset,
int toEndOffset)
highlightChangedExactly(java.util.List, int, int, int, int, java.awt.Color, java.awt.Color, String)
will consider the offset and get the correct position
createLinesDiff in class BasicDiffPane<String>fromStartOffset - from start offsetfromEndOffset - from end offsettoStartOffset - to start offsettoEndOffset - to end offset
public void setToText(String toText)
toText - the new text for the to editor.public String getToText()
protected void synchronizeViewport(DiffDivider diffDivider,
boolean startFrom)
protected int getSelectedIndex(int paneIndex)
getSelectedIndex in class BasicDiffPane<String>protected void installListeners()
AbstractDiffPane
installListeners in class BasicDiffPane<String>
protected String[] splitString(String string,
String lineBreak)
public void setReadOnly(boolean readOnly)
setReadOnly in class BasicDiffPane<String>readOnly - the new read only flag.public void clearHighlights()
clearHighlights in class BasicDiffPane<String>public void startHighlights()
startHighlights in class BasicDiffPane<String>public void endHighlights()
endHighlights in class BasicDiffPane<String>
public void highlightChangedExactly(List<Difference> lineDiff,
int fromStartOffset,
int fromEndOffset,
int toStartOffset,
int toEndOffset,
Color c,
Color separatorColor,
String changeToolTip)
highlightChangedExactly in class BasicDiffPane<String>
public void highlightChanged(int fromStartOffset,
int fromEndOffset,
int toStartOffset,
int toEndOffset,
Color c,
Color separatorColor,
String changeToolTip)
highlightChanged in class BasicDiffPane<String>
public void highlightInserted(int fromStartLine,
int toStartLine,
int toEndLine,
Color c,
Color separatorColor,
String changeToolTip)
highlightInserted in class BasicDiffPane<String>
public void highlightDeleted(int fromStartLine,
int fromEndLine,
int toStartLine,
Color c,
Color separatorColor,
String changeToolTip)
highlightDeleted in class BasicDiffPane<String>
protected List<Difference> acceptDifference(List<Difference> differences,
Difference c)
acceptDifference in class BasicDiffPane<String>differences - the list of Differences.c - the Difference to be accepted.
public boolean delete(int line,
int numberOfLines,
boolean runDiffAfterward)
delete in class BasicDiffPane<String>line - the starting linenumberOfLines - the number of lines to be deleted.runDiffAfterward - true of run the diff() again after deleting the lines.
public boolean insert(int line,
int fromLine,
int fromNumberOfLines,
boolean runDiffAfterward)
insert in class BasicDiffPane<String>line - the insersion line in the toEditorfromLine - the starting line in the fromEditorfromNumberOfLines - the number of lines in the fromEditor to be inserted to the toEditor.runDiffAfterward - true of run the diff() again after inserting the lines.
|
JIDE 3.4.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||