sk.uniba.euromath.gene.gui.widgets
Class EncodingWidget

java.lang.Object
  extended by sk.uniba.euromath.editor.widgets.AbstractUserInputWidget
      extended by sk.uniba.euromath.gene.gui.widgets.EncodingWidget
All Implemented Interfaces:
IUserInputWidget

public class EncodingWidget
extends AbstractUserInputWidget

Allows user to set the encoding of the output document. Allows user to select encoding returned by the Charset.availableCharsets() function (the IANA Charset Registry).

Author:
Martin Vysny

Field Summary
 
Fields inherited from class sk.uniba.euromath.editor.widgets.AbstractUserInputWidget
listeners, msgListeners
 
Constructor Summary
EncodingWidget(Composite parent)
          Creates an instance of the object.
EncodingWidget(Composite parent, IEncodingFilter filter)
          Creates the query and applies the filter to displayed encodings.
 
Method Summary
 Composite getComposite()
          Returns composite that is encapsulated in this object.
 ValidityMessages getMessages()
          Checks if data contained in the widget are correct.
 String getSelected()
          Returns currently selected encoding.
 String getSelectedCanonicalName()
          Returns currently selected encoding canonical name.
 Charset getSelectedCharset()
          Returns currently selected charset.
 Object getState()
          Returns the state of this widget.
 Class<?> getStateClass()
          Returns the class of the state that the widget accepts.
 void select(String encoding)
          Selects given encoding.
 void setState(Object model)
          Sets new state for the widget.
 
Methods inherited from class sk.uniba.euromath.editor.widgets.AbstractUserInputWidget
addMessageListener, addModifyListener, allowModifyEvent, fireDataModified, removeMessageListener, removeModifyListener, suppressModifyEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodingWidget

public EncodingWidget(Composite parent)
Creates an instance of the object.

Parameters:
parent - the parent composite

EncodingWidget

public EncodingWidget(Composite parent,
                      IEncodingFilter filter)
Creates the query and applies the filter to displayed encodings.

Parameters:
parent - the parent composite.
filter - filters out the encodings. If null then no filter is applied.
Method Detail

getSelected

public final String getSelected()
Returns currently selected encoding.

Returns:
currently selected encoding name or null if none is selected.

getSelectedCanonicalName

public final String getSelectedCanonicalName()
Returns currently selected encoding canonical name. If an alias is selected then the returned value is the canonical name.

Returns:
the canonical name or null if none is selected.

select

public final void select(String encoding)
Selects given encoding. If no encoding with such name is available then selects an empty item (item with index -1).

Parameters:
encoding - the encoding to select.

getSelectedCharset

public Charset getSelectedCharset()
Returns currently selected charset.

Returns:
the charset instance or null if none is selected.

getComposite

public Composite getComposite()
Description copied from interface: IUserInputWidget
Returns composite that is encapsulated in this object.

Returns:
composite where all controls are placed.

getMessages

public ValidityMessages getMessages()
Description copied from interface: IUserInputWidget
Checks if data contained in the widget are correct. Contains error/info/warning messages that occured during last data change.

Returns:
null if data is correct, or instance of ValidityMessages if there is error, warning or info message.

getState

public Object getState()
Description copied from interface: IUserInputWidget
Returns the state of this widget. The state must be in sync with the controls placed on the widget.

Returns:
the model.

getStateClass

public Class<?> getStateClass()
Description copied from interface: IUserInputWidget
Returns the class of the state that the widget accepts.

Returns:
model class, never null.

setState

public void setState(Object model)
Description copied from interface: IUserInputWidget
Sets new state for the widget. The widget must re-read all relevant properties from the state and set its controls with new values.

Parameters:
model - the model to set. You may use the construct setModel(getModel()) to reflect changes made in the model. Please note that nearly all widgets rejects null value.


Copyright © 2003-2006 null. All Rights Reserved.