project35.tabletDeployment
Class TabletTextFieldView

java.lang.Object
  extended by project35.desktopDeployment.DataFieldView
      extended by project35.desktopDeployment.EditFieldView
          extended by project35.tabletDeployment.TabletTextFieldView
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, CustomisedFieldView, TextComponentSupplier, ContextHelpItem
Direct Known Subclasses:
TabletIDFieldView

public class TabletTextFieldView
extends EditFieldView
implements TextComponentSupplier, CustomisedFieldView, java.awt.event.ActionListener

Renders text field views for EditFieldModel model components. Text fields can be associated with ontology services. If a field has at least one service, the field label will be prefixed by a "*"


Copyright (c) 2008 Kevin Garwood for Project35. The original code was developed by Kevin Garwood for the University of Manchester. Revisions have been made for Project35, a project that is independent of that institution. This code is licensed under the Academic Free License version 3.0. The code attribution for the original code is included here:

Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.


Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net),

Field Summary
protected  javax.swing.JButton clear
           
protected  TabletProject35Dialog dialog
           
protected  javax.swing.JButton markUp
           
static int minTextComponentWidth
           
protected  OntologyServiceManager ontologyServiceManager
           
protected  java.util.ArrayList ontologyServices
           
protected  java.util.ArrayList pluginsList
           
protected  java.awt.Point pointWithinMarkUp
           
protected  javax.swing.text.JTextComponent text
           
protected  TextFieldModel textFieldModel
           
protected  boolean useTextArea
           
 
Fields inherited from class project35.desktopDeployment.EditFieldView
edit, editFieldModel, ontologyContext, plugins, schemaConceptPropertyManager
 
Fields inherited from class project35.desktopDeployment.DataFieldView
activityArea, collator, dataFieldModel, font, label, name, project35FormContext, project35UIFactory
 
Constructor Summary
TabletTextFieldView()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
protected  void choosePlugin()
           
 void clearValues()
          clears the value of the text field identical to reset()
protected  java.util.ArrayList createOntologyServices(OntologyServiceConfiguration[] ontologyServiceConfigurations)
          creates ontology services given a list of ontology service descriptions.
 void deregisterToolTipComponents()
          helps ensure that the field view removes its UI components from the the tool tip manager
 void disableOntologyServices()
           
 OntologyService getPrimaryOntologyService()
          gets the first ontology service associated with this field.
 java.lang.String getSelectedText()
           
 javax.swing.text.JTextComponent getTextComponent()
           
 java.lang.String getValue()
           
 void initialise(DataFieldModel dataFieldModel, Project35FormContext project35FormContext)
          this is an awkward construction that should never be called but is here to satisfy methods of EditFieldView.
 void initialiseField(Project35FormContext project35FormContext, DataFieldModel dataFieldModel, java.util.ArrayList additionalParameters)
           
 boolean isDirty()
           
 void keepValue()
           
protected  javax.swing.JTextField newJTextField()
           
 void pasteClipboardText()
           
 void reset()
           
 void restoreValue()
           
 void setEditable(boolean isEditable)
           
 void setFieldValue(java.lang.String value)
           
 
Methods inherited from class project35.desktopDeployment.EditFieldView
changeFont, editFieldWithEditingComponent, getEditFieldEditingComponent, getModel, getValueSupplier, initialise, setUnits, setValueSupplier
 
Methods inherited from class project35.desktopDeployment.DataFieldView
enableContextHelp, getActivityArea, getFont, getHelpLink, getLabel, getName, hasFocus, indicateErrors, isContextHelpEnabled, isRequiredField, setActivityArea, setHelpLink, setName, setRequiredField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minTextComponentWidth

public static int minTextComponentWidth

dialog

protected TabletProject35Dialog dialog

text

protected javax.swing.text.JTextComponent text

ontologyServiceManager

protected OntologyServiceManager ontologyServiceManager

ontologyServices

protected java.util.ArrayList ontologyServices

textFieldModel

protected TextFieldModel textFieldModel

markUp

protected javax.swing.JButton markUp

clear

protected javax.swing.JButton clear

useTextArea

protected boolean useTextArea

pointWithinMarkUp

protected java.awt.Point pointWithinMarkUp

pluginsList

protected java.util.ArrayList pluginsList
Constructor Detail

TabletTextFieldView

public TabletTextFieldView()
Method Detail

initialise

public void initialise(DataFieldModel dataFieldModel,
                       Project35FormContext project35FormContext)
this is an awkward construction that should never be called but is here to satisfy methods of EditFieldView. It is only initialiseField that will be called.

Overrides:
initialise in class DataFieldView
Parameters:
dataFieldModel - the model used by the view

initialiseField

public void initialiseField(Project35FormContext project35FormContext,
                            DataFieldModel dataFieldModel,
                            java.util.ArrayList additionalParameters)
Specified by:
initialiseField in interface CustomisedFieldView

newJTextField

protected javax.swing.JTextField newJTextField()

getSelectedText

public java.lang.String getSelectedText()

getValue

public java.lang.String getValue()
Overrides:
getValue in class EditFieldView

getTextComponent

public javax.swing.text.JTextComponent getTextComponent()
Specified by:
getTextComponent in interface TextComponentSupplier

getPrimaryOntologyService

public OntologyService getPrimaryOntologyService()
gets the first ontology service associated with this field. the service is used to set the current ontology source in the touch type ontology dialog

Returns:
the first ontology service associated with the field

createOntologyServices

protected java.util.ArrayList createOntologyServices(OntologyServiceConfiguration[] ontologyServiceConfigurations)
creates ontology services given a list of ontology service descriptions. Project35 creates ontology services on an as needed basis. The pro to this approach is that services are not needlessly instantiated. The con is that the speed at which a new record view is rendered may be slowed through the creation process. This should only happen the first few times a new record in the tree is selected. Ontology sources are cached to prevent needless instantiation that could take up time.


disableOntologyServices

public void disableOntologyServices()

keepValue

public void keepValue()
Specified by:
keepValue in class EditFieldView

restoreValue

public void restoreValue()
Specified by:
restoreValue in class EditFieldView

pasteClipboardText

public void pasteClipboardText()
Specified by:
pasteClipboardText in interface TextComponentSupplier

setFieldValue

public void setFieldValue(java.lang.String value)
Specified by:
setFieldValue in interface TextComponentSupplier
Specified by:
setFieldValue in class EditFieldView

reset

public void reset()

setEditable

public void setEditable(boolean isEditable)

clearValues

public void clearValues()
clears the value of the text field identical to reset()


deregisterToolTipComponents

public void deregisterToolTipComponents()
Description copied from class: EditFieldView
helps ensure that the field view removes its UI components from the the tool tip manager

Overrides:
deregisterToolTipComponents in class EditFieldView

choosePlugin

protected void choosePlugin()
Overrides:
choosePlugin in class EditFieldView

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class EditFieldView

isDirty

public boolean isDirty()
Specified by:
isDirty in class EditFieldView
Returns:
whether the displayed value matches the value stored in the underlying model