net.officefloor.eclipse.common.dialog.input
Class InputHandler<T>

java.lang.Object
  extended by net.officefloor.eclipse.common.dialog.input.InputHandler<T>
All Implemented Interfaces:
InputContext

public class InputHandler<T>
extends Object
implements InputContext

Handle for the Input.

Author:
Daniel Sagenschneider

Constructor Summary
InputHandler(org.eclipse.swt.widgets.Composite parent, Input<? extends org.eclipse.swt.widgets.Control> input)
          Convenience constructor.
InputHandler(org.eclipse.swt.widgets.Composite parent, Input<? extends org.eclipse.swt.widgets.Control> input, InputListener listener)
          Convenience constructor.
InputHandler(org.eclipse.swt.widgets.Composite parent, Input<? extends org.eclipse.swt.widgets.Control> input, Object initialValue)
          Convenience constructor.
InputHandler(org.eclipse.swt.widgets.Composite parent, Input<? extends org.eclipse.swt.widgets.Control> input, Object initialValue, InputListener listener)
          Convenience constructor.
InputHandler(org.eclipse.swt.widgets.Composite parent, Input<? extends org.eclipse.swt.widgets.Control> input, Object initialValue, ValueTranslator translator)
          Initiate.
 
Method Summary
 Object getAttribute(String name)
          Obtains the attribute for the name.
 org.eclipse.swt.widgets.Control getControl()
          Obtains the Control.
 Object getInitialValue()
          Obtains the initial value.
 Input<? extends org.eclipse.swt.widgets.Control> getInput()
          Obtains the Input.
 org.eclipse.swt.widgets.Composite getParent()
          Obtains the Composite.
 T getTrySafeValue()
          Obtains the value defaulting to null if failure obtaining.
 T getValue()
          Obtains the value.
 void notifyValueChanged(Object value)
           Invoked by the Input on the value changing.
 void notifyValueInvalid(String message)
          Invoked by the Input to indicate invalid.
 void setAttribute(String name, Object value)
          Adds an attribute to the context of the property.
 void setInputListener(InputListener listener)
          Specifies the InputListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputHandler

public InputHandler(org.eclipse.swt.widgets.Composite parent,
                    Input<? extends org.eclipse.swt.widgets.Control> input)
Convenience constructor.

Parameters:
parent - Parent Composite.
input - Input being handled.

InputHandler

public InputHandler(org.eclipse.swt.widgets.Composite parent,
                    Input<? extends org.eclipse.swt.widgets.Control> input,
                    Object initialValue)
Convenience constructor.

Parameters:
parent - Parent Composite.
input - Input being handled.
initialValue - Initial value.

InputHandler

public InputHandler(org.eclipse.swt.widgets.Composite parent,
                    Input<? extends org.eclipse.swt.widgets.Control> input,
                    InputListener listener)
Convenience constructor.

Parameters:
parent - Parent Composite.
input - Input being handled.
listener - InputListener.

InputHandler

public InputHandler(org.eclipse.swt.widgets.Composite parent,
                    Input<? extends org.eclipse.swt.widgets.Control> input,
                    Object initialValue,
                    InputListener listener)
Convenience constructor.

Parameters:
parent - Parent Composite.
input - Input being handled.
initialValue - Initial value.
listener - InputListener.

InputHandler

public InputHandler(org.eclipse.swt.widgets.Composite parent,
                    Input<? extends org.eclipse.swt.widgets.Control> input,
                    Object initialValue,
                    ValueTranslator translator)
Initiate.

Parameters:
parent - Parent Composite.
input - Input being handled.
initialValue - Initial value.
translator - ValueTranslator.
Method Detail

getControl

public org.eclipse.swt.widgets.Control getControl()
Obtains the Control.

Returns:
Control.

getInput

public Input<? extends org.eclipse.swt.widgets.Control> getInput()
Obtains the Input.

Returns:
Input.

getValue

public T getValue()
           throws InvalidValueException
Obtains the value.

Returns:
Value.
Throws:
InvalidValueException - If value is invalid.

getTrySafeValue

public T getTrySafeValue()
Obtains the value defaulting to null if failure obtaining.

Returns:
Value or null.

setInputListener

public void setInputListener(InputListener listener)
Specifies the InputListener.

Parameters:
listener - InputListener.

getParent

public org.eclipse.swt.widgets.Composite getParent()
Description copied from interface: InputContext
Obtains the Composite.

Specified by:
getParent in interface InputContext
Returns:
Composite.

getInitialValue

public Object getInitialValue()
Description copied from interface: InputContext
Obtains the initial value.

Specified by:
getInitialValue in interface InputContext
Returns:
Initial value.

getAttribute

public Object getAttribute(String name)
Description copied from interface: InputContext
Obtains the attribute for the name.

Specified by:
getAttribute in interface InputContext
Parameters:
name - Name of the attribute.
Returns:
Attribute by name, or null if not specified.

setAttribute

public void setAttribute(String name,
                         Object value)
Description copied from interface: InputContext
Adds an attribute to the context of the property.

Specified by:
setAttribute in interface InputContext
Parameters:
name - Name of the attribute.
value - Value of the attribute.

notifyValueChanged

public void notifyValueChanged(Object value)
Description copied from interface: InputContext

Invoked by the Input on the value changing.

This allows for validation of the value to determine if value is valid.

Specified by:
notifyValueChanged in interface InputContext
Parameters:
value - New value.

notifyValueInvalid

public void notifyValueInvalid(String message)
Description copied from interface: InputContext
Invoked by the Input to indicate invalid.

Specified by:
notifyValueInvalid in interface InputContext
Parameters:
message - Reason invalid.


Copyright © 2005-2013. All Rights Reserved.