DatatypeWidget

public abstract class DatatypeWidget<T extends EhrDatatype> implements EhrDatatypeChangeListener<T>

This the base class for all DatatypeWidgets. A DatatypeWidget is a visual and interactive widget mapped on a specific EhrDatatype. A user can instantiate a DatatypeWidget for reading, editing and saving the content of the EhrDatatype handled by it.

Parameters:

Fields

_context

protected Context _context

The _context.

_name

protected String _name

The _name.

_ontology

protected JSONObject _ontology

The _ontology.

_parent_index

protected int _parent_index

The _parent_index.

_priority

protected int _priority

The _priority.

_root_view

protected View _root_view

The _root_view.

_view

protected View _view

The _view.

_widget_provider

protected WidgetProvider _widget_provider

datatype

protected T datatype

The datatype.

description

protected String description

The description.

displayTitle

protected String displayTitle

The display title.

toolTip

protected ToolTip toolTip

The tool tip.

Constructors

DatatypeWidget

protected DatatypeWidget()

DatatypeWidget

public DatatypeWidget(WidgetProvider provider, String name, T datatype, int parent_index)

Instantiates a new DatatypeWidget widget.

Parameters:
  • context – the context
  • name – the name of this widget
  • datatype – the EhrDatatype to be handled by this widget
  • ontology – the ontology used
  • parent_index – the parent_index

Methods

getDatatype

public T getDatatype()

Gets the EhrDatatype handled by this widget

Returns:the EhrDatatype

getDescription

public String getDescription()

Gets the description.

Returns:the description

getDisplayTitle

public String getDisplayTitle()

Gets the display title.

Returns:the display title

getName

public String getName()

returns the name of this widget

Returns:the name

getParentIndex

public int getParentIndex()

Gets the parent index.

Returns:the parent index

getPriority

public int getPriority()

returns the visual priority of this widget (essentially this means it’s physical location in the form).

Returns:the priority

getToolTip

public ToolTip getToolTip()

Gets the tool tip.

Returns:the tool tip

getView

public View getView()

get the Root View containing this widget’s view elements.

Returns:the view

getWidgetProvider

public WidgetProvider getWidgetProvider()

replaceTooltip

protected abstract void replaceTooltip(ToolTip tooltip)

Replace tooltip.

Parameters:
  • tooltip – the tooltip

reset

public abstract void reset()

Reset all fields of this widget according to the current underlying datatype value.

save

public abstract void save()

Update the value of the underlying datatype according to the current value of the fields of this widget.

Throws:

setOntology

public void setOntology(JSONObject ontology, String lang)

Sets the ontology.

Parameters:
  • ontology – the new ontology
  • lang – the language of the new loaded ontology

setPriority

public void setPriority(int value)

sets the visual priority of this widget essentially this means it’s physical location in the form.

Parameters:
  • value – the new priority

setVisibility

public void setVisibility(int value)

set the visibility of this widget.

Parameters:
  • value – the new visibility

setupTooltip

protected void setupTooltip()

Setup tooltip.

updateLabelsContent

protected abstract void updateLabelsContent()

Update the content of the labels of the widget, according to the current ontology language.