net.sourceforge.rssowl.controller.dialog
Class SelectCategoryDialog

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

public class SelectCategoryDialog
extends org.eclipse.jface.dialogs.Dialog

This dialog is used to select a category from a tree that is displaying all categories, without blogrolls in case the Dialog is not readonly.

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
(package private)  Tree categoryTree
           
private  java.lang.String catPath
           
private static Rectangle dialogShellSize
          Bounds of the shell in DLUs
private  boolean readonly
           
(package private)  TreeItem rootItem
           
private  java.lang.String title
           
 
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
SelectCategoryDialog(Shell parentShell, java.lang.String dialogTitle)
          Creates an dialog with a tree filled with all categories.
 
Method Summary
(package private)  void buildCatTree()
          Recursivly write all categorys and subcategories to the tree
private  void buildCatTree(TreeItem parent, Category cat)
          Recursivly write all categorys and subcategories to the tree
protected  void buttonPressed(int buttonId)
           
protected  void configureShell(Shell shell)
           
protected  void createButtonsForButtonBar(Composite parent)
           
protected  Control createDialogArea(Composite parent)
           
(package private)  void createNewCategory()
          Opens the New Category dialog and prompts for a name of the new category.
protected  Button getButton(int id)
           
 java.lang.String getCatPath()
          Get the selected category as String path
private  java.lang.String getCatPath(TreeItem treeItem)
          Get the category path beginning with the given treeitem.
private  Image getImage(Category category)
          Get the Image for the given Category.
protected  Point getInitialSize()
           
(package private)  Category getSelectedCategory()
          Get the associated Category model object for the selection in the category tree or the root category if no selection was made or the tree is empty
protected  int getShellStyle()
           
protected  void initializeBounds()
           
(package private)  void onSelection()
          Called upon selection change in the Category Tree.
private  void selectCategory(java.lang.String catPath)
          Selects the given Category in the Tree.
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.
 void setCatPath(java.lang.String catPath)
          Sets the input category as String path
 void setReadonly(boolean readonly)
          If this flag is set to TRUE, it is not possible to create new categories from the Dialog.
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, 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, 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

dialogShellSize

private static final Rectangle dialogShellSize
Bounds of the shell in DLUs


catPath

private java.lang.String catPath

readonly

private boolean readonly

title

private java.lang.String title

categoryTree

Tree categoryTree

rootItem

TreeItem rootItem
Constructor Detail

SelectCategoryDialog

public SelectCategoryDialog(Shell parentShell,
                            java.lang.String dialogTitle)
Creates an dialog with a tree filled with all categories. 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
Method Detail

getCatPath

public java.lang.String getCatPath()
Get the selected category as String path

Returns:
String The selected category as category String path

setCatPath

public void setCatPath(java.lang.String catPath)
Sets the input category as String path

Parameters:
catPath - The input category as category String path.

setReadonly

public void setReadonly(boolean readonly)
If this flag is set to TRUE, it is not possible to create new categories from the Dialog.

Parameters:
readonly - Set to TRUE, if it should not be allowed to create new categories from the Dialog.

buildCatTree

private void buildCatTree(TreeItem parent,
                          Category cat)
Recursivly write all categorys and subcategories to the tree

Parameters:
parent - The parent treeitem
cat - Current Category

getCatPath

private java.lang.String getCatPath(TreeItem treeItem)
Get the category path beginning with the given treeitem.

Parameters:
treeItem - The entry point for the category path String
Returns:
String A String represenation of the selected category

getImage

private Image getImage(Category category)
Get the Image for the given Category.

Parameters:
category - The Category to get an Image for.
Returns:
Image for this Category.

selectCategory

private void selectCategory(java.lang.String catPath)
Selects the given Category in the Tree.

Parameters:
catPath - The Path to the Category to select.

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.Dialog
See Also:
Dialog.createDialogArea(org.eclipse.swt.widgets.Composite)

getButton

protected Button getButton(int id)
Overrides:
getButton in class org.eclipse.jface.dialogs.Dialog
See Also:
Dialog.getButton(int)

getInitialSize

protected Point getInitialSize()
Overrides:
getInitialSize in class org.eclipse.jface.window.Window
See Also:
Window.getInitialSize()

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:
Window.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

buildCatTree

void buildCatTree()
Recursivly write all categorys and subcategories to the tree


createNewCategory

void createNewCategory()
Opens the New Category dialog and prompts for a name of the new category. The new category will be created as sub-category of the selected one, or in the case the tree is empty, created as child of the tree.


getSelectedCategory

Category getSelectedCategory()
Get the associated Category model object for the selection in the category tree or the root category if no selection was made or the tree is empty

Returns:
Category The selected category or the root category

onSelection

void onSelection()
Called upon selection change in the Category Tree.



RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo