|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.diff.AbstractDiffPane
public abstract class AbstractDiffPane
AbstractDiffPane
is the base for the diff/merge panes. We introduced this level of abstraction so that
we can support different kinds of diff components, to compare string arrays, folders etc.
createPane(Object, int)
: override to use a different component to display the objects to be compared.
createToolBar()
: override to create a different component for the toolbar.
createStatusBar()
: override to create a different component for the status bar.
createLegendBar()
: override to customize the legend bar. It is part of the status bar.
initLayout(javax.swing.JComponent, javax.swing.JComponent, javax.swing.JComponent)
: override to arrange
the pane, the toolbar and the status bar.
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 Map<String,Action> |
_actions
|
protected Color |
_changedColor
|
protected Color |
_deletedColor
|
protected Color |
_insertedColor
|
static String |
COMMAND_FIRST
|
static String |
COMMAND_LAST
|
static String |
COMMAND_NEXT
|
static String |
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 | |
---|---|
AbstractDiffPane(Object... items)
Creates an AbstractDiffPane . |
Method Summary | |
---|---|
protected void |
adjustDividerOffset(DiffDivider divider,
int index)
Adjusts the DiffDivider's left and right offset. |
protected void |
createActions()
Creates the actions used by the diff pane. |
protected AbstractButton |
createButton(Action action)
Creates the button. |
protected JComponent |
createContentArea(JComponent... panes)
Creates the content area. |
abstract DiffDivider |
createDivider(int index)
Subclass implements it to create a DiffDivider that appears between the panes. |
protected JComponent |
createLegendBar()
Creates the legend area which shows the meaning of the colors used by the diff pane. |
abstract JComponent |
createPane(Object item,
int index)
Subclass implements it to use a different component to display the objects to be compared. |
protected JComponent |
createStatusBar()
Creates the status bar component. |
protected JComponent |
createToolBar()
Creates the toolbar component for the DiffPane. |
protected Action |
customizeAction(Action action,
String command)
Customizes the action for a command string by getting the text, tooltip, mnemonic, icon etc from the resource file. |
protected void |
customizeDivider(DiffDivider divider,
int i)
Customizes the newly created DiffDivider. |
protected void |
customizePane(JComponent pane,
int index)
Customizes the pane. |
protected void |
customizePanes(JComponent[] panes)
Customizes the components after the panes are created. |
protected void |
customizeToolBar(JComponent toolBar)
Adds components to the toolbar. |
protected void |
firstChange()
Goes to the first change. |
void |
flip()
Flips the from to the to and vice versa. |
Color |
getChangedColor()
|
Color |
getDeletedColor()
|
Color |
getInsertedColor()
|
String |
getMessage()
Get the message. |
protected String |
getResourceString(String key)
Gets the localized string from resource bundle. |
protected void |
initLayout(JComponent contentArea,
JComponent toolBar,
JComponent statusBar)
Initialize the layout. |
protected void |
installListeners()
Installs the listeners. |
protected void |
lastChange()
Goes to the last change. |
protected void |
nextChange()
Goes to the next change. |
protected void |
previousChange()
Goes to the previous change. |
void |
setChangedColor(Color changedColor)
|
void |
setDeletedColor(Color deletedColor)
|
void |
setInsertedColor(Color insertedColor)
|
void |
setMessage(String message)
Changes the message. |
protected void |
uninstallListeners()
Uninstalls the listeners. |
protected void |
updateActions(int index)
Updates the enable/disable states of the actions on the toolbar buttons. |
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 Color _insertedColor
protected Color _changedColor
protected Color _deletedColor
protected Map<String,Action> _actions
public static final String COMMAND_FIRST
public static final String COMMAND_PREVIOUS
public static final String COMMAND_NEXT
public static final String COMMAND_LAST
Constructor Detail |
---|
public AbstractDiffPane(Object... items)
AbstractDiffPane
.
items
- items to be compared.Method Detail |
---|
public void flip()
protected void initLayout(JComponent contentArea, JComponent toolBar, JComponent statusBar)
contentArea
- the content area. It is a JideSplitPane by default.toolBar
- the tool bar.statusBar
- the status bar.protected JComponent createContentArea(JComponent... panes)
panes
- the panes. Each pane contains a component that displays one item to be compared.
protected void customizeDivider(DiffDivider divider, int i)
divider
- the diff divideri
- the index of the diff dividerprotected void adjustDividerOffset(DiffDivider divider, int index)
divider
- the DiffDivider.index
- the index of the DiffDivider.protected void customizePane(JComponent pane, int index)
customizePanes(JComponent[])
.
pane
- the pane.index
- the index of the pane.protected void customizePanes(JComponent[] panes)
panes
- the panes.protected JComponent createToolBar()
protected AbstractButton createButton(Action action)
protected AbstractButton createButton(Action action) {
AbstractButton button = new JideButton(action);
button.setName("" + action.getValue(Action.ACTION_COMMAND_KEY));
button.setDisabledIcon((Icon) action.getValue("disabledIcon"));
button.setRequestFocusEnabled(false);
AutoRepeatButtonUtils.install(button, 50, 200);
return button;
}
action
- the action for the button.
protected String getResourceString(String key)
key
- the key
protected void createActions()
protected Action customizeAction(Action action, String command)
action
- the action.command
- the command string.
protected void customizeToolBar(JComponent toolBar)
toolBar
- the tool bar where we will add the buttons.protected JComponent createStatusBar()
setMessage(String)
to change the status. It also has
a legend area which shows the meaning of the colors used by the diff pane. The legend component can be customized
by overriding createLegendBar()
.
protected JComponent createLegendBar()
public Color getInsertedColor()
public void setInsertedColor(Color insertedColor)
public Color getChangedColor()
public void setChangedColor(Color changedColor)
public Color getDeletedColor()
public void setDeletedColor(Color deletedColor)
public abstract JComponent createPane(Object item, int index)
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.
public abstract DiffDivider createDivider(int index)
index
- the index of the DiffDivider
public void setMessage(String message)
message
- the new message.public String getMessage()
protected void updateActions(int index)
index
- the pane index. This is the pane that triggers the update.protected void firstChange()
protected void previousChange()
protected void nextChange()
protected void lastChange()
protected void installListeners()
protected void uninstallListeners()
installListeners()
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |