public class MappingsPanel
extends javax.swing.JPanel
JPanel
.
This panel is used for representing mappings(connections) between various
nodes of two JTree
s. Each mapping is an instance of VisualComponentConnection
class stored in an ArrayList
.
This class has two JScrollPanes
with viewports one Jtree
each.
By default all listeners needed for handling Mouse Events, resizing, scrolling are added.
Also adding and deleting(removing) a VisualComponentConnection
component is already handled.
On a side note this class also provides all the needed methods for adding, removing
and managing VisualComponentConnection
properties manually.
VisualComponentConnection
s see #CreateRandomMappings
JTree
s will trigger a popup menu
Modifier and Type | Field and Description |
---|---|
static int |
DESTINATION_TREE
An integer indicating the
destination JTree ID |
java.awt.Point |
destScrollPaneLocation
The top left
(x,y) coordinates of the JScrollPane
containing the destTree Jtree |
static int |
SOURCE_TREE
An integer indicating the
source JTree ID |
java.awt.Point |
sourceScrollPaneLocation
The top left
(x,y) coordinates of the JScrollPane
containing the sourceTree Jtree |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
MappingsPanel(java.util.ArrayList<VisualComponentConnection> mappings,
InterfaceMappingsVisualizerListener callbackOperations)
Creates new form MappingsPanel with the specified
VisualComponentConnection s
Warning:Not fully implemented! |
MappingsPanel(InterfaceMappingsVisualizerListener callbackOperations)
Creates new form MappingsPanel
|
MappingsPanel(javax.swing.JTree sourceTree,
javax.swing.JTree destTree,
InterfaceMappingsVisualizerListener callbackOperations)
Creates new form MappingsPanel with
sourceTree as the
source JTree , at the left side of the panel and
destTree as the destination JTree ,
at the right side of the panel |
Modifier and Type | Method and Description |
---|---|
void |
addMapping(javax.swing.tree.TreePath sourcePath,
javax.swing.tree.TreePath destPath)
Adds a new
VisualComponentConnection with the Rectangle containing the last component
of sourcePath as source and the Rectangle containing the
last component of destPath as destination. |
void |
addMapping(VisualComponentConnection newMapping)
|
void |
addToAddedMappings(VisualComponentConnection mapping) |
void |
addToDeletedMappings(VisualComponentConnection mapping) |
void |
clearMappings()
Clears the
VisualComponentConnection ArrayList of this Container |
void |
complete(InterfaceMappingsVisualizerListener callbackOperations) |
VisualComponentConnection |
createNewMapping(javax.swing.tree.TreePath source,
javax.swing.tree.TreePath dest)
Creates and returns a new default
VisualComponentConnection component with source's TreePath
last compomonent as source and with dest's TreePath
last compomonent as destination. |
void |
createRandomMappings() |
java.awt.Color |
getAddedLineColor() |
java.util.ArrayList<VisualComponentConnection> |
getAddedMappings() |
javax.swing.JTextArea |
getData()
A temporary method for testing if it's possible to get data from
Mappings added by user.
|
java.awt.Color |
getDeletedLineColor() |
java.util.ArrayList<VisualComponentConnection> |
getDeletedMappings() |
java.awt.Point |
getDestScrollPaneLocation() |
javax.swing.JTree |
getDestTree() |
java.awt.Point |
getDestTreeLocation() |
javax.swing.JScrollPane |
getDestTreeScrollPane() |
VisualComponentConnection |
getExistingMapping(int mappingIndex) |
java.util.ArrayList<VisualComponentConnection> |
getExistingMappings()
Returns the
VisualComponentConnection components of this Container. |
int |
getExistingMappingsCount() |
java.awt.Color |
getLineColor()
Returns the current line color of all existing
VisualComponentConnection objects
in this Container |
int |
getLineType()
Returns the current line type of all the
VisualComponentConnection objects
in this Container |
java.util.ArrayList<VisualComponentConnection> |
getMappingsFromHistory() |
javax.swing.JButton |
getRedoButton() |
java.awt.Point |
getSourceScrollPaneLocation() |
javax.swing.JTree |
getSourceTree() |
java.awt.Point |
getSourceTreeLocation() |
javax.swing.JScrollPane |
getSourceTreeScrollPane() |
javax.swing.JButton |
getUndoButton() |
void |
paint(java.awt.Graphics g) |
void |
removeMapping(VisualComponentConnection mapping)
Removes a
VisualComponentConnection component from the existing Mappings ArrayList
of this Container. |
void |
setAddedLineColor(java.awt.Color lineColor) |
void |
setDeletedLineColor(java.awt.Color lineColor) |
void |
setDestScrollPaneLocation(java.awt.Point newLocation) |
void |
setDestTreeLocation(java.awt.Point newDestTreeLocation) |
void |
setDestTreeModel(javax.swing.tree.DefaultTreeModel treeModel)
Sets the
TreeModel of destTree to treeModel |
void |
setExistingMapping(int pos,
java.awt.Rectangle source,
java.awt.Rectangle dest,
boolean visible)
Note: Not used.
|
void |
setExistingMappings(java.util.ArrayList<VisualComponentConnection> mappings)
|
void |
setLineColor(java.awt.Color lineColor)
Sets the line color of all existing Mappings to
lineColor |
void |
setLineType(int lineType)
Sets the line type of all
VisualComponentConnection components to lineType . |
void |
setSourceScrollPaneLocation(java.awt.Point newLocation) |
void |
setSourceTreeLocation(java.awt.Point newSourceTreeLocation) |
void |
setSourceTreeModel(javax.swing.tree.DefaultTreeModel treeModel)
Sets the
TreeModel of sourceTree to treeModel |
void |
setViewLabels(java.lang.String source,
java.lang.String dest)
Sets the text in the
sourceViewLabel and destViewLabel
to source and dest respectively |
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int SOURCE_TREE
source JTree
IDpublic static final int DESTINATION_TREE
destination JTree
IDpublic java.awt.Point sourceScrollPaneLocation
(x,y)
coordinates of the JScrollPane
containing the sourceTree Jtree
public java.awt.Point destScrollPaneLocation
(x,y)
coordinates of the JScrollPane
containing the destTree Jtree
public MappingsPanel(InterfaceMappingsVisualizerListener callbackOperations)
callbackOperations
- public MappingsPanel(javax.swing.JTree sourceTree, javax.swing.JTree destTree, InterfaceMappingsVisualizerListener callbackOperations)
sourceTree
as the
source JTree
, at the left side of the panel and
destTree
as the destination JTree
,
at the right side of the panelsourceTree
- An instance of JTree
class for the source JTtreedestTree
- An instance of JTree
class for the destination JTreepublic MappingsPanel(java.util.ArrayList<VisualComponentConnection> mappings, InterfaceMappingsVisualizerListener callbackOperations)
VisualComponentConnection
s
Warning:Not fully implemented!mappings
- the VisualComponentConnections to be contained in the Containerpublic void complete(InterfaceMappingsVisualizerListener callbackOperations)
public void createRandomMappings()
public void addMapping(VisualComponentConnection newMapping)
newMapping
- The VisualComponentConnection component to be addedpublic void addMapping(javax.swing.tree.TreePath sourcePath, javax.swing.tree.TreePath destPath)
VisualComponentConnection
with the Rectangle containing the last component
of sourcePath
as source and the Rectangle containing the
last component of destPath
as destination.
Sets the sourcePath and destPath fields of VisualComponentConnection to the specified
sourcePath
and destPath
sourcePath
- The Source TreePath of the mappingdestPath
- The Destination TreePath of the mappingpublic void removeMapping(VisualComponentConnection mapping)
VisualComponentConnection
component from the existing Mappings
ArrayList
of this Container.
Note: If no such VisualComponentConnection
exists in the ArrayList nothing is done.
mapping
- An instance of VisualComponentConnection
indicating the VisualComponentConnection
to remove.public void addToDeletedMappings(VisualComponentConnection mapping)
public void addToAddedMappings(VisualComponentConnection mapping)
public VisualComponentConnection createNewMapping(javax.swing.tree.TreePath source, javax.swing.tree.TreePath dest)
VisualComponentConnection
component with source's TreePath
last compomonent as source and with dest's TreePath
last compomonent as destination.source
- An instance of TreePath
indicating the source of the new VisualComponentConnection
dest
- An instance of TreePath
indicating the destination of the new VisualComponentConnection
VisualComponentConnection
public VisualComponentConnection getExistingMapping(int mappingIndex)
mappingIndex
- An integer indicating the index of the desired VisualComponentConnection
VisualComponentConnection
at mappingIndex
of the VisualComponentConnections array List.
Returns null if no VisualComponentConnection component exists in this Containerpublic void setExistingMapping(int pos, java.awt.Rectangle source, java.awt.Rectangle dest, boolean visible)
Sets the source and destination Rectangle of the specified VisualComponentConnection
to
source
and dest
pos
- The location of a VisualComponentConnection
component in the ArrayList
of VisualComponentConnection
s in this Containersource
- The new source Rectangledest
- The new destination Rectanglevisible
- The visibility state of the Mappingpublic java.util.ArrayList<VisualComponentConnection> getExistingMappings()
VisualComponentConnection
components of this Container.ArrayList
of VisualComponentConnection
Objectspublic void setExistingMappings(java.util.ArrayList<VisualComponentConnection> mappings)
mappings
- An ArrayList
of VisualComponentConnection componentspublic java.util.ArrayList<VisualComponentConnection> getAddedMappings()
public java.util.ArrayList<VisualComponentConnection> getDeletedMappings()
public java.util.ArrayList<VisualComponentConnection> getMappingsFromHistory()
public int getExistingMappingsCount()
VisualComponentConnection
components in this Containerpublic void clearMappings()
VisualComponentConnection
ArrayList
of this Containerpublic void setViewLabels(java.lang.String source, java.lang.String dest)
sourceViewLabel
and destViewLabel
to source
and dest
respectivelysource
- The text for sourceViewLabeldest
- The text for destViewLabelpublic int getLineType()
VisualComponentConnection
objects
in this Containerpublic void setLineType(int lineType)
VisualComponentConnection
components to lineType
.
lineType
- The line typepublic java.awt.Color getLineColor()
VisualComponentConnection
objects
in this ContainerColor
class indicating the current color of existing Mappingspublic void setLineColor(java.awt.Color lineColor)
lineColor
lineColor
- An instance of Color
public void setAddedLineColor(java.awt.Color lineColor)
public void setDeletedLineColor(java.awt.Color lineColor)
public java.awt.Color getAddedLineColor()
public java.awt.Color getDeletedLineColor()
public javax.swing.JTree getSourceTree()
source JTree
, at the left side of the Containerpublic java.awt.Point getSourceTreeLocation()
public void setSourceTreeLocation(java.awt.Point newSourceTreeLocation)
public void setSourceTreeModel(javax.swing.tree.DefaultTreeModel treeModel)
TreeModel
of sourceTree
to treeModel
treeModel
- An instance of DefaultTreeModel
public javax.swing.JScrollPane getSourceTreeScrollPane()
public java.awt.Point getSourceScrollPaneLocation()
public void setSourceScrollPaneLocation(java.awt.Point newLocation)
public javax.swing.JTree getDestTree()
destination JTree
, at the right side of the Containerpublic java.awt.Point getDestTreeLocation()
public void setDestTreeLocation(java.awt.Point newDestTreeLocation)
public void setDestTreeModel(javax.swing.tree.DefaultTreeModel treeModel)
TreeModel
of destTree
to treeModel
treeModel
- An instance of DefaultTreeModel
public java.awt.Point getDestScrollPaneLocation()
public void setDestScrollPaneLocation(java.awt.Point newLocation)
public javax.swing.JScrollPane getDestTreeScrollPane()
public javax.swing.JButton getUndoButton()
public javax.swing.JButton getRedoButton()
public javax.swing.JTextArea getData()
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent