dsto.dfc.swt.forms
Class LabelizerPipe

java.lang.Object
  extended by dsto.dfc.swt.forms.AbstractPipe
      extended by dsto.dfc.swt.forms.AbstractBiDiPipe
          extended by dsto.dfc.swt.forms.LabelizerPipe
All Implemented Interfaces:
Pipe, Disposable

public class LabelizerPipe
extends AbstractBiDiPipe

A pipe that turns a value into a UI label and vice-versa. This can be used as an in-between translator to turn enumerated values e.g. ["on", "off", null] into user-presentable ones like ["On", "Off", "Invalid!"]. This control's label/value mapping is compatible with RadioEndpoint's.

Author:
Matthew Phillips

Field Summary
 boolean hideShortcuts
          Set to true (default) to enable ignoring "&" in labels.
 ValueLabel[] labelsAndValues
           
 
Fields inherited from class dsto.dfc.swt.forms.AbstractBiDiPipe
childPipe
 
Fields inherited from class dsto.dfc.swt.forms.AbstractPipe
errorHandler, parent
 
Constructor Summary
LabelizerPipe(ValueLabel[] labelsAndValues)
          Create a new instance.
 
Method Summary
 void dispose()
          Forwarded to the child pipe.
 boolean input(Object value)
          Input a value into the pipe tree.
 boolean isDisposed()
          Test if pipe has been disposed.
 boolean output(Object value)
          Output a value from a child into the pipe (the reverse of input ()).
 
Methods inherited from class dsto.dfc.swt.forms.AbstractBiDiPipe
connect, flush, setErrorHandler
 
Methods inherited from class dsto.dfc.swt.forms.AbstractPipe
getParent, handlePipeError, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dsto.dfc.swt.forms.Pipe
getParent, setParent
 

Field Detail

hideShortcuts

public boolean hideShortcuts
Set to true (default) to enable ignoring "&" in labels.


labelsAndValues

public ValueLabel[] labelsAndValues
Constructor Detail

LabelizerPipe

public LabelizerPipe(ValueLabel[] labelsAndValues)
Create a new instance.

Parameters:
labelsAndValues - The control's mapping of labels to values. eg {{"On", "on"}, {"Off", "off"}, {null, "[invalid]"}}. This mapping is compatible with RadioEndpoint's. In particular, the labels may have "&" in them which will be ignored.
See Also:
RadioEndpoint, hideShortcuts
Method Detail

dispose

public void dispose()
Description copied from class: AbstractBiDiPipe
Forwarded to the child pipe.

Specified by:
dispose in interface Pipe
Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractBiDiPipe

isDisposed

public boolean isDisposed()
Description copied from interface: Pipe
Test if pipe has been disposed.


input

public boolean input(Object value)
Description copied from interface: Pipe
Input a value into the pipe tree.

Returns:
True if the operation completed successfully.
See Also:
for more info on handling errors.

output

public boolean output(Object value)
Description copied from interface: Pipe
Output a value from a child into the pipe (the reverse of input ()).

Returns:
True if the operation completed successfully.
See Also:
for more info on handling errors.


Copyright © 2008 Commonwealth of Australia