net.sourceforge.rssowl.controller.dialog
Class LoginDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.TitleAreaDialog
              extended by net.sourceforge.rssowl.controller.dialog.LoginDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

public class LoginDialog
extends org.eclipse.jface.dialogs.TitleAreaDialog

Class displays a Dialog prompting for a username and a password. Will return a BASE64 encoded inputValue that can be used to auth to a webserver.

Version:
1.2.4
Author:
Benjamin Pasero

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
private  java.lang.String dialogMessage
           
private static int dialogMinWidth
          Min. width of the dialog in DLUs
private  Text domain
           
private  java.lang.String domainValue
           
private  boolean isNtlm
           
(package private) static int openDialogsCount
          Count number of opened dialogs
private  Text password
           
private  java.lang.String passwordValue
           
private  java.lang.String pathOrUrl
           
private static java.lang.String PROTOCOL_SEPARATOR
          Divider between Protocol and Host
private  Button saveData
           
private  java.lang.String title
           
private  Text username
           
private  java.lang.String usernameValue
           
 
Fields inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
DLG_IMG_TITLE_BANNER, DLG_IMG_TITLE_ERROR, INFO_MESSAGE, WARNING_MESSAGE
 
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, dialogArea, DLG_IMG_ERROR, 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
LoginDialog(Shell parentShell, java.lang.String dialogTitle, java.lang.String dialogMessage, java.lang.String pathOrUrl, boolean isNtlm)
          Creates an input dialog with OK and Cancel buttons.
 
Method Summary
protected  void buttonPressed(int buttonId)
           
 boolean close()
           
protected  void configureShell(Shell shell)
           
protected  void createButtonsForButtonBar(Composite parent)
           
protected  Control createDialogArea(Composite parent)
           
 java.lang.String getDomain()
          Get the entered Domain
 java.lang.String getPassword()
          Get the entered password
protected  int getShellStyle()
           
 java.lang.String getUsername()
          Get the entered username
protected  void initializeBounds()
           
 int open()
           
protected  void setButtonLayoutData(Button button)
          Set the layout data of the button to a GridData with appropriate widths This method was slightly modified so that it is not setting a heightHint.
 
Methods inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
createContents, getInitialSize, getTitleArea, getTitleImageLabel, setErrorMessage, setMessage, setMessage, setTitle, setTitleAreaColor, setTitleImage
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getOKButton, initializeDialogUnits, okPressed, setBlockedHandler, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getInitialLocation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getWindowManager, handleFontChange, handleShellCloseEvent, 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

dialogMinWidth

private static final int dialogMinWidth
Min. width of the dialog in DLUs

See Also:
Constant Field Values

PROTOCOL_SEPARATOR

private static final java.lang.String PROTOCOL_SEPARATOR
Divider between Protocol and Host

See Also:
Constant Field Values

openDialogsCount

static int openDialogsCount
Count number of opened dialogs


dialogMessage

private java.lang.String dialogMessage

domain

private Text domain

domainValue

private java.lang.String domainValue

isNtlm

private boolean isNtlm

password

private Text password

passwordValue

private java.lang.String passwordValue

pathOrUrl

private java.lang.String pathOrUrl

saveData

private Button saveData

title

private java.lang.String title

username

private Text username

usernameValue

private java.lang.String usernameValue
Constructor Detail

LoginDialog

public LoginDialog(Shell parentShell,
                   java.lang.String dialogTitle,
                   java.lang.String dialogMessage,
                   java.lang.String pathOrUrl,
                   boolean isNtlm)
Creates an input dialog with OK and Cancel buttons. Prompts for Username Password and Domain (if Authentication is NTLM). Note that the dialog will have no visual representation (no widgets) until it is told to open.

Note that the open method blocks for input dialogs.

Parameters:
parentShell - the parent shell
dialogTitle - the dialog title, or null if none
dialogMessage - the dialog dialogMessage, or null if none
pathOrUrl - The URL where the auth happens
isNtlm - TRUE if required Authentication is NTLM (requires Domain)
Method Detail

close

public boolean close()
Overrides:
close in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.close()

getDomain

public java.lang.String getDomain()
Get the entered Domain

Returns:
String The entered domain

getPassword

public java.lang.String getPassword()
Get the entered password

Returns:
String The entered password

getUsername

public java.lang.String getUsername()
Get the entered username

Returns:
String The entered username

open

public int open()
Overrides:
open in class org.eclipse.jface.window.Window
See Also:
Window.open()

buttonPressed

protected void buttonPressed(int buttonId)
Overrides:
buttonPressed in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.buttonPressed(int)

configureShell

protected void configureShell(Shell shell)
Overrides:
configureShell in class org.eclipse.jface.window.Window
See Also:
Window.configureShell(org.eclipse.swt.widgets.Shell)

createButtonsForButtonBar

protected void createButtonsForButtonBar(Composite parent)
Overrides:
createButtonsForButtonBar in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)

createDialogArea

protected Control createDialogArea(Composite parent)
Overrides:
createDialogArea in class org.eclipse.jface.dialogs.TitleAreaDialog
See Also:
Dialog.createDialogArea(org.eclipse.swt.widgets.Composite)

getShellStyle

protected int getShellStyle()
Overrides:
getShellStyle in class org.eclipse.jface.window.Window
See Also:
Window.getShellStyle()

initializeBounds

protected void initializeBounds()
Overrides:
initializeBounds in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.initializeBounds()

setButtonLayoutData

protected void setButtonLayoutData(Button button)
Set the layout data of the button to a GridData with appropriate widths This method was slightly modified so that it is not setting a heightHint.

Overrides:
setButtonLayoutData in class org.eclipse.jface.dialogs.Dialog
Parameters:
button - The button to layout


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo