Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)

com.lapetus_ltd.api.db.gui.dialogs
Class TLptsConnectionDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.lapetus_ltd.api.db.gui.dialogs.TLptsConnectionDialog
All Implemented Interfaces:
ILptsCharSetLocaleListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class TLptsConnectionDialog
extends javax.swing.JPanel
implements ILptsCharSetLocaleListener

Class Description :

Maybe the name of this class is a little deceiving as it holds not only the connections,
but the statements too. It is the placeholder for all activity around the GUI for connections and statements.
The panels generated by the user interaction with this dialog are added to a tabbed pane.
These panels have buttons for detaching (floating) and reattaching themselves to the tabbed pane.
There are three kinds of panels, namely SELECT, UPDATE and CREATE statement panels. They are added to the tabbed pane
and can be deleted, without the actual statement being deleted. The statement can only be deleted from the Connection
dialog tree with the red "X". Double clicking on a statement will cause it to be shown in the tabbed pane if it was deleted
by using the tabbed pane delete. The name of the statement can be changed by double clicking on the name in the tabbed pane.

All the buttons in these dialogs, actually in all the dialogs in dbJAPI, can be configured as to their icon and text description.
To do this the application must either implement ILptsGuiIconSet or extend TLptsDefaultGuiIconSet.
The new class needs to be set in TLptsFactoryIcon.setGuiIconSet(com.lapetus_ltd.api.central.common.view.ILptsGuiIconSet). dbJAPI is then able to use the implementation for the icons and text settings. This includes actually specifying whether just icons and/or text is to shown on the buttons.

This dialog is maily used by the plugin to generate code for the application.

$LastChangedRevision: 1230 $
$LastChangedDate:: 2010-12-09 11:06:40 +0200 #$

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
TLptsConnectionDialog()
           Constructor to create the main frame of the application.
 
Method Summary
 void localeHasChanged(java.lang.String language, java.lang.String country)
           Used to inform a listener of the changed locale.
static void registerCodeListener(ILptsCodeInsertListener codeInsertListener)
          Registers the listener for code insertions.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TLptsConnectionDialog

public TLptsConnectionDialog()

Constructor to create the main frame of the application.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : N/A

Notes :
This dialog will add itself to the relative factory listeners so that it captures the generated connections and statements.

Example :

 

public class ExampleConnectionDialogUsage { public static void main(String[] args) { new ExampleConnectionDialogUsage(); }

private JTextPane outputPane;

public ExampleConnectionDialogUsage() { TLptsMainDatabase.init(); // this needs to be done at the beginning of every application.

// a new panel so that we can add other panels besides the connection dialog. JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel,BoxLayout.X_AXIS));

// don't blink, you may miss the intricacies of adding a new connection dialog to your application panel.add(new TLptsConnectionDialog());

// we can show messages coming from the connection manager panel.add(outputPane=new JTextPane());

JFrame frame = new JFrame("How to use the Connection Dialog"); frame.getRootPane().setContentPane(panel); frame.addWindowListener(new WindowListener() { public void windowOpened(WindowEvent e) { } public void windowClosing(WindowEvent e) { } public void windowClosed(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { ((JFrame)e.getSource()).setMinimumSize(new Dimension(800,600)); ((JFrame)e.getSource()).setPreferredSize(new Dimension(800,800)); } public void windowDeactivated(WindowEvent e) { } }); frame.setVisible(true); // Now lets give some meaning to the connection dialog's existence by adding a listener for new connections. TLptsFactoryConnection.addListener(new MyLovelyConnectionListener()); // Links : ILptsFactoryConnectionListener // ILptsFactoryStatementListener // ILptsFactoryRowSetListener } ... }

Method Detail

localeHasChanged

public void localeHasChanged(java.lang.String language,
                             java.lang.String country)
Description copied from interface: ILptsCharSetLocaleListener

Used to inform a listener of the changed locale.

Notes :
The function TLptsCharSetLocaleUtil.setLocale calls this function on all implementations.
The setLocale function sets the default locale to the specified one, which means that the implementations can call
Locale.getDefault() for the charset that is supplied in the parameters.
If required, use the function TLptsCharSetLocaleUtil.getCharsetList() to get a list of all charsets.
Each charset has the Country and Language, as supplied by this function for the new locale.

Example :

class MyClass implements ILptsCharSetLocaleListener
{
  public static void main(String[] args)
  {
    TLptsCharSetLocaleUtil.addLocaleListener(this);
    ...
    TLptsCharSetLocaleUtil.setLocale("gb","en");
    // This calls the localeHasChanged for every listener registered (like this class)
  }
  public void localeHasChanged(String country, String language)
  {
    // just received notification of a change of locale
  }
}
 

Specified by:
localeHasChanged in interface ILptsCharSetLocaleListener
Parameters:
language - The language code of the newly set locale.
country - The country code of the newly set locale.

registerCodeListener

public static void registerCodeListener(ILptsCodeInsertListener codeInsertListener)
Registers the listener for code insertions.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : N/A

Notes :
Used by the plugin to register the listener for code insertions.
There can be only one.

Parameters:
codeInsertListener - The implementation of the listener that will receive code insertion events.


Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)