org.fosstrak.llrp.commander.dialogs
Class ConnectDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.fosstrak.llrp.commander.dialogs.ConnectDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
Direct Known Subclasses:
AddFCDialog, AddReaderDialog

public abstract class ConnectDialog
extends org.eclipse.jface.dialogs.Dialog

superclass for all the connect dialogs. all subclasses have to instantiate the two members FIELDS and DEFAULTS as arrays providing the labels and the default values for the fields available.

FIELDS = new String[]{ "test", "me" };
DEFAULTS = new String [] { "myTestDefault", "memuuDefault" };
will create two fields with labels "test" and "me" with the respective default values.

Author:
sawielan

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
protected  java.lang.String caption
          the caption.
 java.lang.String[] DEFAULTS
          the default values for the fields.
 java.lang.String[] FIELDS
          the label of the fields.
protected  org.eclipse.swt.layout.GridData gridAll
          the grid settings for a horizontal filler.
protected  org.eclipse.swt.layout.GridData gridLabel
          the grid settings for the label fields.
protected  org.eclipse.swt.layout.GridData gridText
          the grid settings for the text fields.
protected  org.eclipse.swt.widgets.Text[] txts
          the text fields.
 java.lang.String[] values
          the values collected from the fields.
 
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
 
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK
 
Constructor Summary
ConnectDialog(org.eclipse.swt.widgets.Shell shell, java.lang.String caption)
          create a new connect dialog.
 
Method Summary
protected  void addCancelButton(org.eclipse.swt.widgets.Composite parent)
          adds a Cancel button.
protected  void addInvisibleButton(org.eclipse.swt.widgets.Composite parent)
          adds an invisible button to the grid to keep the alignment.
protected  void addOKButton(org.eclipse.swt.widgets.Composite parent)
          adds a OK button and installs the necessary listeners.
protected  void addTextFields(org.eclipse.swt.widgets.Composite parent)
          adds the text fields.
protected  org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
          Create GUI elements in the dialog.
abstract  org.eclipse.swt.widgets.Listener getListener(org.eclipse.swt.widgets.Text txt, int offset, org.eclipse.swt.widgets.Button ok)
          this method allows the subclasses to put constraints via listeners on the content of the value fields. you can use the offset to determine the field.
protected  void registerTextFieldListeners(org.eclipse.swt.widgets.Button btnOK)
          registers listeners to the text fields with the OK button as the parent.
protected  void setLayout(org.eclipse.swt.widgets.Composite parent)
          sets the layout for the dialog.
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createButtonsForButtonBar, createDialogArea, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, configureShell, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELDS

public java.lang.String[] FIELDS
the label of the fields.


DEFAULTS

public java.lang.String[] DEFAULTS
the default values for the fields.


values

public java.lang.String[] values
the values collected from the fields.


txts

protected org.eclipse.swt.widgets.Text[] txts
the text fields.


caption

protected final java.lang.String caption
the caption.


gridLabel

protected org.eclipse.swt.layout.GridData gridLabel
the grid settings for the label fields.


gridText

protected org.eclipse.swt.layout.GridData gridText
the grid settings for the text fields.


gridAll

protected org.eclipse.swt.layout.GridData gridAll
the grid settings for a horizontal filler.

Constructor Detail

ConnectDialog

public ConnectDialog(org.eclipse.swt.widgets.Shell shell,
                     java.lang.String caption)
create a new connect dialog.

Parameters:
shell - the parent shell.
caption - the caption for the dialog.
Method Detail

setLayout

protected void setLayout(org.eclipse.swt.widgets.Composite parent)
sets the layout for the dialog.

Parameters:
parent - the parent where to set the layout.

registerTextFieldListeners

protected void registerTextFieldListeners(org.eclipse.swt.widgets.Button btnOK)
registers listeners to the text fields with the OK button as the parent.

Parameters:
btnOK - the ok button to use as parent.

addTextFields

protected void addTextFields(org.eclipse.swt.widgets.Composite parent)
adds the text fields.

Parameters:
parent - the parent where to add.

addCancelButton

protected void addCancelButton(org.eclipse.swt.widgets.Composite parent)
adds a Cancel button.

Parameters:
parent - the parent where to add.

addOKButton

protected void addOKButton(org.eclipse.swt.widgets.Composite parent)
adds a OK button and installs the necessary listeners.

Parameters:
parent - the parent where to add.

addInvisibleButton

protected void addInvisibleButton(org.eclipse.swt.widgets.Composite parent)
adds an invisible button to the grid to keep the alignment.

Parameters:
parent - the parent where to add.

createContents

protected org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
Create GUI elements in the dialog.

Overrides:
createContents in class org.eclipse.jface.dialogs.Dialog

getListener

public abstract org.eclipse.swt.widgets.Listener getListener(org.eclipse.swt.widgets.Text txt,
                                                             int offset,
                                                             org.eclipse.swt.widgets.Button ok)
this method allows the subclasses to put constraints via listeners on the content of the value fields. you can use the offset to determine the field.

Parameters:
txt - the field holding the changed text.
offset - the offset of the field.
ok - the OK button.
Returns:
null if no constraint, otherwise the listener.


Copyright © 2009. All Rights Reserved.