org.comedia.db.view
Class CTableLink

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.comedia.db.view.CTableLink
All Implemented Interfaces:
java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class CTableLink
extends javax.swing.JComponent
implements java.awt.event.FocusListener, java.awt.event.MouseListener

Implements a link between two tables on database schemas.

Usage examples:

 CTableBox table1 = new CTableBox();
 CTableBox table2 = new CTableBox();

 CTableLink link = new CTableLink();
 link.setLeftTable(table1);
 link.setLeftLinkType(CTableLink.NORMAL_LINK);
 link.setLeftRelation(CTableLink.ONE_RELATION);
 link.setLeftFieldIndex(0);
 link.setRightTable(table2);
 link.setRightLinkType(CTableLink.JOIN_LINK);
 link.setRightRelation(CTableLink.MANY_RELATION);
 link.setRightFieldIndex(5);
 link.setLocation(150, 150);
 link.setSize(100, 100);
 

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int JOIN_LINK
          The join link type.
static int MANY_RELATION
          The many relation.
static int NORMAL_LINK
          The normal link type.
static int ONE_RELATION
          The one relation.
static int UNKNOWN_RELATION
          The unknown relation.
 
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
CTableLink()
          Constructs this link with default properties.
 
Method Summary
 boolean contains(int x, int y)
          Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.
 void focusGained(java.awt.event.FocusEvent e)
          Performs event when this table box gets a focus.
 void focusLost(java.awt.event.FocusEvent e)
          Performs event when this table box lost a focus.
 int getLeftFieldIndex()
          Gets the related field index of left table box.
 int getLeftLinkType()
          Gets the related link type of left table box.
 int getLeftRelation()
          Gets the related relation for left table box.
 CTableBox getLeftTable()
          Gets the left related table box.
 int getRightFieldIndex()
          Gets the related field index of right table box.
 int getRightLinkType()
          Gets the related link type of right table box.
 int getRightRelation()
          Gets the related relation for right table box.
 CTableBox getRightTable()
          Gets the right related table box.
 boolean isFocusTraversable()
          Checks is focus of the links is traversable.
 boolean isManagingFocus()
          Checks is focus of the links is managable.
 boolean isUpdated()
          Checks is link updated.
 void mouseClicked(java.awt.event.MouseEvent e)
          Performs event when mouse is clicked on the component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Performs event when mouse is entered to the component.
 void mouseExited(java.awt.event.MouseEvent e)
          Performs event when mouse is exited from the component.
 void mousePressed(java.awt.event.MouseEvent e)
          Performs event when mouse is pressed on the component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Performs event when mouse is released on the component.
 void paint(java.awt.Graphics g)
          Paints the contents of this link.
 void setLeftFieldIndex(int leftFieldIndex)
          Sets a new related field index of left table box.
 void setLeftLinkType(int leftLinkType)
          Sets a new related link type of left table box.
 void setLeftRelation(int leftRelation)
          Sets a new related relation for left table box.
 void setLeftTable(CTableBox leftTable)
          Sets a new left related table box.
 void setRightFieldIndex(int rightFieldIndex)
          Sets a new related field index of right table box.
 void setRightLinkType(int rightLinkType)
          Sets a new related link type of right table box.
 void setRightRelation(int rightRelation)
          Sets a new related relation for right table box.
 void setRightTable(CTableBox rightTable)
          Sets a new right related table box.
 void updateShape()
          Updates the shape of this link.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORMAL_LINK

public static final int NORMAL_LINK
The normal link type.

JOIN_LINK

public static final int JOIN_LINK
The join link type.

UNKNOWN_RELATION

public static final int UNKNOWN_RELATION
The unknown relation.

ONE_RELATION

public static final int ONE_RELATION
The one relation.

MANY_RELATION

public static final int MANY_RELATION
The many relation.
Constructor Detail

CTableLink

public CTableLink()
Constructs this link with default properties.
Method Detail

isFocusTraversable

public boolean isFocusTraversable()
Checks is focus of the links is traversable.
Overrides:
isFocusTraversable in class javax.swing.JComponent

isManagingFocus

public boolean isManagingFocus()
Checks is focus of the links is managable.
Overrides:
isManagingFocus in class javax.swing.JComponent

isUpdated

public boolean isUpdated()
Checks is link updated.

getLeftTable

public CTableBox getLeftTable()
Gets the left related table box.

setLeftTable

public void setLeftTable(CTableBox leftTable)
Sets a new left related table box.
Parameters:
leftTable - a new left related table box.

getRightTable

public CTableBox getRightTable()
Gets the right related table box.

setRightTable

public void setRightTable(CTableBox rightTable)
Sets a new right related table box.
Parameters:
rightTable - a new right related table box.

getLeftFieldIndex

public int getLeftFieldIndex()
Gets the related field index of left table box.

setLeftFieldIndex

public void setLeftFieldIndex(int leftFieldIndex)
Sets a new related field index of left table box.
Parameters:
leftFieldIndex - a new related field index of left table box.

getRightFieldIndex

public int getRightFieldIndex()
Gets the related field index of right table box.

setRightFieldIndex

public void setRightFieldIndex(int rightFieldIndex)
Sets a new related field index of right table box.
Parameters:
rightFieldIndex - a new related field index of right table box.

getLeftLinkType

public int getLeftLinkType()
Gets the related link type of left table box.

setLeftLinkType

public void setLeftLinkType(int leftLinkType)
Sets a new related link type of left table box.
Parameters:
leftLinkType - a new related link type of left table box.

getRightLinkType

public int getRightLinkType()
Gets the related link type of right table box.

setRightLinkType

public void setRightLinkType(int rightLinkType)
Sets a new related link type of right table box.
Parameters:
rightLinkType - a new related link type of right table box.

getLeftRelation

public int getLeftRelation()
Gets the related relation for left table box.

setLeftRelation

public void setLeftRelation(int leftRelation)
Sets a new related relation for left table box.
Parameters:
leftRelation - a new related relation for left table box.

getRightRelation

public int getRightRelation()
Gets the related relation for right table box.

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Performs event when this table box gets a focus.
Specified by:
focusGained in interface java.awt.event.FocusListener
Parameters:
e - an object which described occured event.

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Performs event when this table box lost a focus.
Specified by:
focusLost in interface java.awt.event.FocusListener
Parameters:
e - an object which described occured event.

setRightRelation

public void setRightRelation(int rightRelation)
Sets a new related relation for right table box.
Parameters:
rightRelation - a new related relation for right table box.

paint

public void paint(java.awt.Graphics g)
Paints the contents of this link.
Overrides:
paint in class javax.swing.JComponent

updateShape

public void updateShape()
Updates the shape of this link.

contains

public boolean contains(int x,
                        int y)
Checks whether this component "contains" the specified point, where x and y are defined to be relative to the coordinate system of this component.
Overrides:
contains in class javax.swing.JComponent
Parameters:
x - the x coordinate of the point.
y - the y coordinate of the point.
Since:
JDK1.1
See Also:
Component.getComponentAt(int, int)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Performs event when mouse is clicked on the component.
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - an object which described occured event.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Performs event when mouse is pressed on the component.
Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - an object which described occured event.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Performs event when mouse is released on the component.
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - an object which described occured event.

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Performs event when mouse is entered to the component.
Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - an object which described occured event.

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Performs event when mouse is exited from the component.
Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - an object which described occured event.