project35.desktopDeployment
Class TextFieldView

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

public class TextFieldView
extends EditFieldView
implements TextComponentSupplier, 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
static int minTextComponentWidth
           
protected  OntologyServiceManager ontologyServiceManager
           
protected  java.util.ArrayList ontologyServices
           
protected  javax.swing.text.JTextComponent text
           
protected  TextFieldModel textFieldModel
           
 
Fields inherited from class project35.desktopDeployment.EditFieldView
edit, editFieldModel, ontologyContext, plugins, pluginsList, schemaConceptPropertyManager
 
Fields inherited from class project35.desktopDeployment.DataFieldView
activityArea, collator, dataFieldModel, font, label, name, project35FormContext, project35UIFactory
 
Constructor Summary
TextFieldView()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 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(TextFieldModel textFieldModel, Project35FormContext project35FormContext)
           
 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, choosePlugin, editFieldWithEditingComponent, getEditFieldEditingComponent, getModel, getValueSupplier, initialise, setUnits, setValueSupplier
 
Methods inherited from class project35.desktopDeployment.DataFieldView
enableContextHelp, getActivityArea, getFont, getHelpLink, getLabel, getName, hasFocus, indicateErrors, initialise, 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

text

protected javax.swing.text.JTextComponent text

ontologyServiceManager

protected OntologyServiceManager ontologyServiceManager

ontologyServices

protected java.util.ArrayList ontologyServices

textFieldModel

protected TextFieldModel textFieldModel
Constructor Detail

TextFieldView

public TextFieldView()
Method Detail

initialise

public void initialise(TextFieldModel textFieldModel,
                       Project35FormContext project35FormContext)

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

newJTextField

protected javax.swing.JTextField newJTextField()

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.


reset

public void reset()

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

setEditable

public void setEditable(boolean isEditable)

disableOntologyServices

public void disableOntologyServices()

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

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

clearValues

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


keepValue

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

restoreValue

public void restoreValue()
Specified by:
restoreValue 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