net.officefloor.eclipse.common.dialog
Class BeanDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by net.officefloor.eclipse.common.dialog.BeanDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider

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

Popuates the input bean by user entered information via a dialog window.

Author:
Daniel Sagenschneider

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
 
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
BeanDialog(org.eclipse.swt.widgets.Shell parentShell, Object bean, ClassLoader classLoader, String... ignoreProperties)
          Initiate.
BeanDialog(org.eclipse.swt.widgets.Shell parentShell, Object bean, String... ignoreProperties)
          Initiate without the ability to load Class instances.
 
Method Summary
 void addIgnoreType(Class<?> type)
          Adds type to be ignored.
protected  org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
           
protected  org.eclipse.swt.widgets.Control getDialogArea()
          Obtains the Control of the dialog area.
protected  void okPressed()
           
 boolean populate()
          Populates the bean.
 void registerPropertyInput(String propertyName, Input<?> input)
          Registers a specialised Input for the property name.
 void registerPropertyValueTranslator(String propertyName, ValueTranslator translator)
           Registers a ValueTranslator for the property name.
 
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, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, 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
 

Constructor Detail

BeanDialog

public BeanDialog(org.eclipse.swt.widgets.Shell parentShell,
                  Object bean,
                  ClassLoader classLoader,
                  String... ignoreProperties)
Initiate.

Parameters:
parentShell - Parent shell.
bean - Bean to be populated.
classLoader - ClassLoader to use to validate specified classes are available.
ignoreProperties - Properties to not populate.

BeanDialog

public BeanDialog(org.eclipse.swt.widgets.Shell parentShell,
                  Object bean,
                  String... ignoreProperties)
Initiate without the ability to load Class instances.

Parameters:
parentShell - Parent shell.
bean - Bean to be populated.
ignoreProperties - Properties to not populate.
Method Detail

populate

public boolean populate()
Populates the bean.

Returns:
true if bean is populated.

addIgnoreType

public void addIgnoreType(Class<?> type)
Adds type to be ignored.

Parameters:
type - Type to be ignored. May allow multiple in the one statement.

registerPropertyInput

public void registerPropertyInput(String propertyName,
                                  Input<?> input)
Registers a specialised Input for the property name.

Parameters:
propertyName - Name of property.
builder - Specialised Input.

registerPropertyValueTranslator

public void registerPropertyValueTranslator(String propertyName,
                                            ValueTranslator translator)

Registers a ValueTranslator for the property name.

Named ValueTranslator instances override typed ValueTranslator instances.

Parameters:
propertyName - Name of property.
translator - ValueTranslator.

getDialogArea

protected org.eclipse.swt.widgets.Control getDialogArea()
Obtains the Control of the dialog area.

Overrides:
getDialogArea in class org.eclipse.jface.dialogs.Dialog
Returns:
Dialog area.

createDialogArea

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

okPressed

protected void okPressed()
Overrides:
okPressed in class org.eclipse.jface.dialogs.Dialog


Copyright © 2005-2013. All Rights Reserved.