Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui
Class SystemConnectionForm


java.lang.Object
  extended by 
org.eclipse.rse.ui.SystemConnectionForm
All Implemented Interfaces:
Runnable, EventListener, IRunnableWithProgress, SelectionListener, org.eclipse.swt.internal.SWTEventListener, Listener

public class SystemConnectionForm
extends Object
implements Listener, SelectionListener, Runnable, IRunnableWithProgress

A reusable form for prompting for connection information, in new or update mode. May be used to populate a dialog or a wizard page.

You may subclass this to refine the form. In this case you can override the getForm method of SystemNewConnectionWizardDefaultMainPage and SystemUpdateConnection to return your subclass.


Field Summary
protected  boolean addEncodingFields
           
protected   ISystemConnectionFormCaller caller
           
protected  boolean callerInstanceOfPropertyPage
           
protected  boolean callerInstanceOfSystemPromptDialog
           
protected  boolean callerInstanceOfWizardPage
           
protected   IHost conn
           
protected  boolean connectionNameEmpty
           
protected  int connectionNameLength
           
protected  boolean connectionNameListen
           
protected  boolean contentsCreated
           
static boolean CREATE_MODE
           
protected   String currentHostName
           
protected   String defaultConnectionName
           
protected   String defaultDescription
           
protected   String defaultEncoding
           
protected   String defaultHostName
           
protected   String defaultProfile
           
protected   String[] defaultProfileNames
           
protected   IRSESystemType defaultSystemType
           
protected   String defaultUserId
           
protected  boolean defaultWorkOffline
           
protected  int descriptionLength
           
protected   Group encodingGroup
           
protected   SystemMessage errorMessage
           
protected  int hostNameLength
           
protected   ISystemValidator hostValidator
           
protected  boolean isRemoteEncoding
           
protected  boolean isValidBefore
           
protected   Label labelConnectionName
           
protected   Label labelDescription
           
protected   Label labelHostName
           
protected   Label labelProfile
           
protected   Label labelProfileValue
           
protected   Label labelSystemTypeValue
           
protected   Label labelType
           
protected   Label labelTypeValue
           
protected   Label labelUserId
           
static  IRSESystemType lastSystemType
           
protected   ISystemMessageLine msgLine
           
protected   ISystemValidator[] nameValidators
           
protected   String originalHostName
           
protected   Button otherEncodingButton
           
protected   Combo otherEncodingCombo
           
protected   Combo profileCombo
           
protected   Button remoteEncodingButton
           
protected  boolean singleTypeMode
           
protected   Text textConnectionName
           
protected   Text textDescription
           
protected   Combo textHostName
           
protected   Combo textSystemType
           
protected   Label textSystemTypeReadOnly
           
protected   InheritableEntryField textUserId
           
static boolean UPDATE_MODE
           
protected  boolean updateMode
           
protected  boolean userIdFromSystemTypeDefault
           
protected  int userIdLength
           
protected  int userIdLocation
           
protected   ISystemValidator userIdValidator
           
protected  boolean userPickedVerifyHostnameCB
           
protected   IRSESystemType[] validSystemTypes
           
protected   Button verifyHostNameCB
           
protected   SystemMessage verifyingHostName
           
protected   Button workOfflineCB
           
 
Constructor Summary
SystemConnectionForm ( ISystemMessageLine msgLine, ISystemConnectionFormCaller caller)
          Constructor.
 
Method Summary
 void addDefaultEncodingFields ()
          Add fields to enable encoding for the host to be set.
  Control createContents ( Composite parent, boolean updateMode, String parentHelpId)
          CreateContents is the one method that must be overridden from the parent class.
  String getConnectionDescription ()
          Return user-entered Description.
  String getConnectionName ()
          Return user-entered Connection Name.
static  ISystemValidator getConnectionNameValidator ( IHost conn)
          Reusable method to return a name validator for renaming a connection.
static  ISystemValidator getConnectionNameValidator ( ISystemProfile profile)
          Reusable method to return a name validator for renaming a connection.
static  ISystemValidator[] getConnectionNameValidators ()
          Reusable method to return name validators for creating a connection.
  String getDefaultEncoding ()
          Returns the encoding that was specified.
  String getDefaultUserId ()
          Return user-entered Default User Id.
  String getHostName ()
          Return user-entered Host Name.
  Control getInitialFocusControl ()
          Return control to recieve initial focus
  String getProfileName ()
          Return user-selected profile to contain this connection Call this after finish ends successfully, and only in update mode.
protected   IRunnableContext getRunnableContext ()
          Return the runnable context from the hosting dialog or wizard, if applicable
  IRSESystemType getSystemType ()
          Return user-entered System Type.
 int getUserIdLocation ()
          If a default userId was specified, the user may have been queried where to put the userId.
 void handleEvent ( Event evt)
          Default implementation to satisfy Listener interface.
 void initializeInputFields ( IHost conn)
          Initialize input fields to current values in update mode.
 void initializeInputFields ( IHost conn, boolean updateMode)
          Initialize input fields to current values in update mode.
protected  void internalSetConnectionName ( String name)
          Set the connection name internally without validation
 boolean isConnectionUnique ()
           
 boolean isEncodingRemoteDefault ()
          Returns whether the encoding option is to use the encoding of the remote system.
 boolean isPageComplete ()
          This method can be called by the dialog or wizard page host, to decide whether to enable or disable the next, final or ok buttons.
 boolean isWorkOffline ()
          Return the user-entered value for work offline.
 void restrictSystemType ( IRSESystemType systemType)
          Call this to restrict the system type that the user is allowed to choose.
 void restrictSystemTypes ( IRSESystemType[] systemTypes)
          Call this to restrict the system types that the user is allowed to choose.
 void run ()
           
 void run ( IProgressMonitor pm)
          METHOD REQUIRED BY IRunnableWithProgress, USED TO SHOW PROGRESS WHILE VERIFYING HOSTNAME
 void setConnectionName ( String name)
          Preset the connection name
 void setConnectionNameValidators ( ISystemValidator[] v)
          Call this to specify a validator for the connection name.
 void setCurrentlySelectedConnection ( IHost connection)
          Set the currently selected connection so as to better initialize input fields
 void setHostName ( String name)
          Preset the host name
 void setHostNameValidator ( ISystemValidator v)
          Call this to specify a validator for the hostname.
 void setMessageLine ( ISystemMessageLine msgLine)
          Often the message line is null at the time of instantiation, so we have to call this after it is created.
 void setPageComplete ()
          Inform caller of page-complete status of this form
 void setProfileNamePreSelection ( String selection)
          Set the profile name to preselect
 void setProfileNames ( String[] names)
          Set the profile names to show in the combo
 void setUserId ( String userId)
          For "new" mode, allows setting of the initial user Id.
 void setUserIdValidator ( ISystemValidator v)
          Call this to specify a validator for the userId.
protected   SystemMessage validateConnectionNameInput (boolean userTyped)
          This hook method is called whenever the text changes in the input field.
protected   SystemMessage validateHostNameInput ()
          This hook method is called whenever the text changes in the input field.
protected   SystemMessage validateUserIdInput ()
          This hook method is called whenever the text changes in the input field.
 boolean verify (boolean okPressed)
          Verifies all input.
 void widgetDefaultSelected ( SelectionEvent event)
          Combo selection listener method
 void widgetSelected ( SelectionEvent event)
          Combo selection listener method
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATE_MODE

public static final boolean CREATE_MODE
See Also:
Constant Field Values

UPDATE_MODE

public static final boolean UPDATE_MODE
See Also:
Constant Field Values

lastSystemType

public static 
IRSESystemType lastSystemType

conn

protected 
IHost conn

defaultSystemType

protected 
IRSESystemType defaultSystemType

validSystemTypes

protected 
IRSESystemType[] validSystemTypes

labelType

protected 
Label labelType

labelConnectionName

protected 
Label labelConnectionName

labelHostName

protected 
Label labelHostName

labelUserId

protected 
Label labelUserId

labelDescription

protected 
Label labelDescription

labelProfile

protected 
Label labelProfile

labelTypeValue

protected 
Label labelTypeValue

labelSystemTypeValue

protected 
Label labelSystemTypeValue

labelProfileValue

protected 
Label labelProfileValue

textSystemType

protected 
Combo textSystemType

textHostName

protected 
Combo textHostName

profileCombo

protected 
Combo profileCombo

textConnectionName

protected 
Text textConnectionName

textDescription

protected 
Text textDescription

verifyHostNameCB

protected 
Button verifyHostNameCB

encodingGroup

protected 
Group encodingGroup

remoteEncodingButton

protected 
Button remoteEncodingButton

otherEncodingButton

protected 
Button otherEncodingButton

otherEncodingCombo

protected 
Combo otherEncodingCombo

workOfflineCB

protected 
Button workOfflineCB

textUserId

protected 
InheritableEntryField textUserId

textSystemTypeReadOnly

protected 
Label textSystemTypeReadOnly

nameValidators

protected 
ISystemValidator[] nameValidators

hostValidator

protected 
ISystemValidator hostValidator

userIdValidator

protected 
ISystemValidator userIdValidator

msgLine

protected 
ISystemMessageLine msgLine

caller

protected 
ISystemConnectionFormCaller caller

defaultConnectionName

protected 
String defaultConnectionName

defaultHostName

protected 
String defaultHostName

defaultUserId

protected 
String defaultUserId

defaultDescription

protected 
String defaultDescription

defaultProfile

protected 
String defaultProfile

defaultProfileNames

protected 
String[] defaultProfileNames

defaultWorkOffline

protected boolean defaultWorkOffline

userPickedVerifyHostnameCB

protected boolean userPickedVerifyHostnameCB

hostNameLength

protected int hostNameLength

connectionNameLength

protected int connectionNameLength

userIdLength

protected int userIdLength

descriptionLength

protected int descriptionLength

userIdLocation

protected int userIdLocation

callerInstanceOfWizardPage

protected boolean callerInstanceOfWizardPage

callerInstanceOfSystemPromptDialog

protected boolean callerInstanceOfSystemPromptDialog

callerInstanceOfPropertyPage

protected boolean callerInstanceOfPropertyPage

userIdFromSystemTypeDefault

protected boolean userIdFromSystemTypeDefault

updateMode

protected boolean updateMode

contentsCreated

protected boolean contentsCreated

connectionNameEmpty

protected boolean connectionNameEmpty

connectionNameListen

protected boolean connectionNameListen

singleTypeMode

protected boolean singleTypeMode

originalHostName

protected 
String originalHostName

currentHostName

protected 
String currentHostName

errorMessage

protected 
SystemMessage errorMessage

verifyingHostName

protected 
SystemMessage verifyingHostName

addEncodingFields

protected boolean addEncodingFields

defaultEncoding

protected 
String defaultEncoding

isRemoteEncoding

protected boolean isRemoteEncoding

isValidBefore

protected boolean isValidBefore
Constructor Detail

SystemConnectionForm

public SystemConnectionForm(
ISystemMessageLine msgLine,
                            
ISystemConnectionFormCaller caller)
Constructor.

Parameters:
msgLine - A GUI widget capable of writing error messages to.
caller - The wizardpage or dialog hosting this form.
Method Detail

setMessageLine

public void setMessageLine(
ISystemMessageLine msgLine)
Often the message line is null at the time of instantiation, so we have to call this after it is created.


setConnectionNameValidators

public void setConnectionNameValidators(
ISystemValidator[] v)
Call this to specify a validator for the connection name. It will be called per keystroke. You must supply one per active profile, as connections must be unique per profile. The order must be the same as the order of profiles given by getActiveSystemProfiles() in the system registry.


setHostNameValidator

public void setHostNameValidator(
ISystemValidator v)
Call this to specify a validator for the hostname. It will be called per keystroke.


setUserIdValidator

public void setUserIdValidator(
ISystemValidator v)
Call this to specify a validator for the userId. It will be called per keystroke.


setProfileNames

public void setProfileNames(
String[] names)
Set the profile names to show in the combo


setProfileNamePreSelection

public void setProfileNamePreSelection(
String selection)
Set the profile name to preselect


setUserId

public void setUserId(
String userId)
For "new" mode, allows setting of the initial user Id. Sometimes subsystems like to have their own default userId preference page option. If so, query it and set it here by calling this.


setCurrentlySelectedConnection

public void setCurrentlySelectedConnection(
IHost connection)
Set the currently selected connection so as to better initialize input fields


restrictSystemType

public void restrictSystemType(
IRSESystemType systemType)
Call this to restrict the system type that the user is allowed to choose. Must be called before the widgets are created in createContents(Composite, boolean, String).

Parameters:
systemType - the only IRSESystemType allowed, or null to show all allowed system types.

restrictSystemTypes

public void restrictSystemTypes(
IRSESystemType[] systemTypes)
Call this to restrict the system types that the user is allowed to choose.

Parameters:
systemTypes - the list of allowed system types, or null to not restrict the allowed system types.

initializeInputFields

public void initializeInputFields(
IHost conn)
Initialize input fields to current values in update mode. Note in update mode we do NOT allow users to change the system type. This must be called after calling getContents! You must also be sure to pass true in createContents in order to call this method.

Parameters:
conn - The SystemConnection object that is being modified.

initializeInputFields

public void initializeInputFields(
IHost conn,
                                  boolean updateMode)
Initialize input fields to current values in update mode. Note in update mode we do NOT allow users to change the system type. This must be called after calling getContents! You must also be sure to pass true in createContents in order to call this method.

Parameters:
conn - The SystemConnection object that is being modified.

setConnectionName

public void setConnectionName(
String name)
Preset the connection name


setHostName

public void setHostName(
String name)
Preset the host name


isPageComplete

public boolean isPageComplete()
This method can be called by the dialog or wizard page host, to decide whether to enable or disable the next, final or ok buttons. It returns true if the minimal information is available and is correct.


isConnectionUnique

public boolean isConnectionUnique()
Returns:
whether the connection name is unique or not

verify

public boolean verify(boolean okPressed)
Verifies all input. Call this when user presses OK or Finish your dialog or wizard.

Parameters:
okPressed - true if this verify is being done when OK is pressed. If so, we position cursor on error checking, else we do not.
Returns:
true if there are no errors in the user input

getRunnableContext

protected 
IRunnableContext getRunnableContext()
Return the runnable context from the hosting dialog or wizard, if applicable


getSystemType

public 
IRSESystemType getSystemType()
Return user-entered System Type. Call this after finish ends successfully.


getConnectionName

public 
String getConnectionName()
Return user-entered Connection Name. Call this after finish ends successfully.


getHostName

public 
String getHostName()
Return user-entered Host Name. Call this after finish ends successfully.


getDefaultUserId

public 
String getDefaultUserId()
Return user-entered Default User Id. Call this after finish ends successfully.


isWorkOffline

public boolean isWorkOffline()
Return the user-entered value for work offline. Call this after finish ends successfully.


getConnectionDescription

public 
String getConnectionDescription()
Return user-entered Description. Call this after finish ends successfully.


getProfileName

public 
String getProfileName()
Return user-selected profile to contain this connection Call this after finish ends successfully, and only in update mode.


getUserIdLocation

public int getUserIdLocation()
If a default userId was specified, the user may have been queried where to put the userId. This returns one of the constants from IRSEUserIdConstants.

Returns:
the user id location
See Also:
IRSEUserIdConstants

createContents

public 
Control createContents(
Composite parent,
                              boolean updateMode,
                              
String parentHelpId)
CreateContents is the one method that must be overridden from the parent class. In this method, we populate an SWT container with widgets and return the container to the caller (JFace). This is used as the contents of this page.

Parameters:
parent - The parent composite
updateMode - true if we are in update mode versus create mode.

getInitialFocusControl

public 
Control getInitialFocusControl()
Return control to recieve initial focus


handleEvent

public void handleEvent(
Event evt)
Default implementation to satisfy Listener interface. Does nothing.

Specified by:
handleEvent in interface Listener

widgetDefaultSelected

public void widgetDefaultSelected(
SelectionEvent event)
Combo selection listener method

Specified by:
widgetDefaultSelected in interface SelectionListener

widgetSelected

public void widgetSelected(
SelectionEvent event)
Combo selection listener method

Specified by:
widgetSelected in interface SelectionListener

validateConnectionNameInput

protected 
SystemMessage validateConnectionNameInput(boolean userTyped)
This hook method is called whenever the text changes in the input field. The default implementation delegates the request to an ISystemValidator object. If the ISystemValidator reports an error the error message is displayed in the Dialog's message line.

See Also:
setConnectionNameValidators(ISystemValidator[])

internalSetConnectionName

protected void internalSetConnectionName(
String name)
Set the connection name internally without validation


validateHostNameInput

protected 
SystemMessage validateHostNameInput()
This hook method is called whenever the text changes in the input field. The default implementation delegates the request to an ISystemValidator object. If the ISystemValidator reports an error the error message is displayed in the Dialog's message line.

See Also:
setHostNameValidator(ISystemValidator)

validateUserIdInput

protected 
SystemMessage validateUserIdInput()
This hook method is called whenever the text changes in the input field. The default implementation delegates the request to an ISystemValidator object. If the ISystemValidator reports an error the error message is displayed in the Dialog's message line.

See Also:
setUserIdValidator(ISystemValidator)

setPageComplete

public void setPageComplete()
Inform caller of page-complete status of this form


getConnectionNameValidator

public static 
ISystemValidator getConnectionNameValidator(
IHost conn)
Reusable method to return a name validator for renaming a connection.

Parameters:
conn - the current connection object on updates. Can be null for new names. Used to remove from the existing name list the current connection.

getConnectionNameValidator

public static 
ISystemValidator getConnectionNameValidator(
ISystemProfile profile)
Reusable method to return a name validator for renaming a connection.

Parameters:
profile - the current connection object's profile from which to get the existing names. Can be null for syntax checking only, versus name-in-use.

getConnectionNameValidators

public static 
ISystemValidator[] getConnectionNameValidators()
Reusable method to return name validators for creating a connection. There is one validator per active system profile.


run

public void run()
Specified by:
run in interface Runnable

run

public void run(
IProgressMonitor pm)
         throws 
InvocationTargetException,
                
InterruptedException
METHOD REQUIRED BY IRunnableWithProgress, USED TO SHOW PROGRESS WHILE VERIFYING HOSTNAME

Specified by:
run in interface IRunnableWithProgress
Throws:
InvocationTargetException
InterruptedException

addDefaultEncodingFields

public void addDefaultEncodingFields()
Add fields to enable encoding for the host to be set. This form will not have any encoding fields unless this is called.


getDefaultEncoding

public 
String getDefaultEncoding()
Returns the encoding that was specified. Only applies if encoding fields were added to this form.

Returns:
the encoding that was specified. This will return null if the selection is to use the encoding from the remote system but that encoding has not been obtained yet.
See Also:
addDefaultEncodingFields()

isEncodingRemoteDefault

public boolean isEncodingRemoteDefault()
Returns whether the encoding option is to use the encoding of the remote system. Only applies if encoding fields were added to this form.

Returns:
true if the encoding option is to use the encoding of the remote system, false if the user specified the encoding.
See Also:
addDefaultEncodingFields()

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire