net.sourceforge.java.feednread.frontend.dialog
Class CategoryInputDialog

java.lang.Object
  extended byorg.eclipse.jface.window.Window
      extended byorg.eclipse.jface.dialogs.Dialog
          extended byorg.eclipse.jface.dialogs.TrayDialog
              extended byorg.eclipse.jface.dialogs.TitleAreaDialog
                  extended bynet.sourceforge.java.feednread.frontend.dialog.CategoryInputDialog
All Implemented Interfaces:
IInputValidator, IShellProvider

public class CategoryInputDialog
extends TitleAreaDialog
implements IInputValidator

Dialog to edit the properties of a Category.

Author:
Sebastian Machhausen

Nested Class Summary
 
Nested classes inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
 
Field Summary
private  boolean adoptRecursive
           Stores the adopt recursive setting
private  Button adoptRecursiveButton
           Button to let the user decide if he wants to adopt the refresh interval setting recursively for all Favorites in the Category or only for the Favorite that are situated directly one level beneath the Category.
private  String categoryTitle
           The title of the new Category as entered by the end-user
private  Text categoryTitleField
           The text field that carries the title user input
private  LanguageResource defaultResource
           Default language resource used in this dialog
private  String dialogTitle
           The dialog title
private  Category editCategory
           The Category to be edited, null if new Category
private  MainApplicationWindow mainWindow
           The Feed'n Read main window
private  Category parentCategory
           The parent Category of the edited Category
private  JobExecutionInterval refreshInterval
           The refresh interval of the Category
private  ComboViewer refreshIntervalSelectionViewer
           ComboViewer to select the update interval of the Category
 
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.TrayDialog
 
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
CategoryInputDialog(MainApplicationWindow mainWindow, Category parentCategory, Category editCategory, String dialogTitle)
           Creates a new CategoryInputDialog using the specified dialog settings.
 
Method Summary
 boolean adoptRefreshIntervalRecursive()
           Returns true if refresh interval setting should be adopted recursively to all Favorites in the Category.
protected  void buttonPressed(int buttonId)
           Called whenever a button is pressed in this CategoryInputDialog.
protected  void configureShell(Shell shell)
           Configures the Shell representing this dialog.
protected  void createButtonsForButtonBar(Composite parent)
           Creates the buttons used in this CategoryInputDialog and sets up their default enabled state.
protected  Control createDialogArea(Composite parent)
           Creates the dialog area of this CategoryInputDialog.
private  void createRefreshIntervalContainer(Composite parent)
           Creates a container which holds all ui items to select the update interval of a Category.
 String getCategoryTitle()
           Gets the category title as entered by the user.
 Category getParentCategory()
           Gets the parent Category of the edited Category.
 JobExecutionInterval getRefreshInterval()
           Gets the Category's refresh interval as selected by the end user.
 String isValid(String newText)
           Verifies if the given input is valid.
 
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.TrayDialog
close, closeTray, createButtonBar, createHelpControl, getLayout, getTray, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, 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

mainWindow

private MainApplicationWindow mainWindow

The Feed'n Read main window


dialogTitle

private String dialogTitle

The dialog title


parentCategory

private Category parentCategory

The parent Category of the edited Category


editCategory

private Category editCategory

The Category to be edited, null if new Category


categoryTitle

private String categoryTitle

The title of the new Category as entered by the end-user


categoryTitleField

private Text categoryTitleField

The text field that carries the title user input


refreshIntervalSelectionViewer

private ComboViewer refreshIntervalSelectionViewer

ComboViewer to select the update interval of the Category


adoptRecursiveButton

private Button adoptRecursiveButton

Button to let the user decide if he wants to adopt the refresh interval setting recursively for all Favorites in the Category or only for the Favorite that are situated directly one level beneath the Category.


refreshInterval

private JobExecutionInterval refreshInterval

The refresh interval of the Category


adoptRecursive

private boolean adoptRecursive

Stores the adopt recursive setting


defaultResource

private LanguageResource defaultResource

Default language resource used in this dialog

Constructor Detail

CategoryInputDialog

public CategoryInputDialog(MainApplicationWindow mainWindow,
                           Category parentCategory,
                           Category editCategory,
                           String dialogTitle)

Creates a new CategoryInputDialog using the specified dialog settings.

Parameters:
mainWindow - the Feed'n Read main window
parentCategory - the parent category for which to create a new category; code if the new category has no parent category
editCategory - the Category to edit; null if new Category
dialogTitle - the title of this dialog
Method Detail

getCategoryTitle

public String getCategoryTitle()

Gets the category title as entered by the user.

Returns:
the category title

getParentCategory

public Category getParentCategory()

Gets the parent Category of the edited Category.

Returns:
the parent Category of the edited Category

getRefreshInterval

public JobExecutionInterval getRefreshInterval()

Gets the Category's refresh interval as selected by the end user.

Returns:
the Category's refresh interval as selected by the end user; null if this CategoryInputDialog has been canceled

adoptRefreshIntervalRecursive

public boolean adoptRefreshIntervalRecursive()

Returns true if refresh interval setting should be adopted recursively to all Favorites in the Category.

Returns:
true if refresh interval setting should be adopted recursively to all Favorites in the Category; false otherwise which means that the setting should only be adopted to all Favorites situated directly one level beneath the Category (non recursive).

isValid

public String isValid(String newText)

Verifies if the given input is valid. Currently only an empty input is being declined.

Specified by:
isValid in interface IInputValidator
Parameters:
newText - the text to verify
Returns:
an error message if the given input is invalid; null otherwise

configureShell

protected void configureShell(Shell shell)

Configures the Shell representing this dialog.

Parameters:
shell - the Shell to configure

createDialogArea

protected Control createDialogArea(Composite parent)

Creates the dialog area of this CategoryInputDialog.

Parameters:
parent - the parent component to embed the dialog area into
Returns:
the created dialog area

createButtonsForButtonBar

protected void createButtonsForButtonBar(Composite parent)

Creates the buttons used in this CategoryInputDialog and sets up their default enabled state.

Parameters:
parent - the parent component to embed the buttons into

buttonPressed

protected void buttonPressed(int buttonId)

Called whenever a button is pressed in this CategoryInputDialog.

Parameters:
buttonId - the id of the button that was pressed
See Also:
for the button ids defined in the JFace framework

createRefreshIntervalContainer

private void createRefreshIntervalContainer(Composite parent)

Creates a container which holds all ui items to select the update interval of a Category.

Parameters:
parent - the parent Composite to embed the refresh interval container into