cst.loggingTool.presentationLayer
Class TrialActivityView

java.lang.Object
  extended by cst.loggingTool.presentationLayer.TrialActivityView
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class TrialActivityView
extends java.lang.Object
implements java.awt.event.ActionListener


 Copyright 2010 Medical Research Council Unit for Lifelong Health and Ageing
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software 
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License. 
 

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

Field Summary
protected  java.util.ArrayList<javax.swing.JCheckBox> checkBoxes
           
protected  ConfigurationManager configurationManager
           
protected  TrialActivityModel currentTrialActivityModel
           
protected  java.lang.String currentTrialSubjectIdentifier
           
protected  User currentUser
           
protected  LoggingServiceAPI database
           
protected  java.util.HashMap<javax.swing.JCheckBox,DateFieldView> fieldViewFromCheckBox
           
protected  Log log
           
protected  java.awt.GridBagConstraints mainFieldPanelGC
           
protected  java.lang.String name
           
protected  int numberOfFields
           
protected  javax.swing.JPanel panel
           
protected  SessionProperties sessionProperties
           
protected  java.lang.String toolTipText
           
protected  java.lang.String trialActivityDataStorageName
           
protected  java.lang.String trialActivityDisplayName
           
protected  UserInterfaceFactory userInterfaceFactory
           
 
Constructor Summary
TrialActivityView(SessionProperties sessionProperties, java.lang.String trialActivityDisplayName, java.lang.String trialActivityDataStorageName)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
protected  void addFieldToDisplay(DateFieldView dateFieldView)
           
 boolean commitChanges()
           
protected  void commitUIChangesToModel()
           
 void displayCurrentTrialActivityModel(java.lang.String currentTrialSubjectModelIdentifier, TrialActivityModel currentTrialActivityModel)
           
 void displayEmptyTrialActivityModel(TrialActivityModel emptyTrialActivityModel)
           
protected  java.lang.String getCurrentTrialSubjectIdentifier()
          public void setEnabled(boolean isEnabled) { ArrayList dateFieldViews = new ArrayList(); dateFieldViews.addAll(fieldViewFromCheckBox.values()); for (DateFieldView currentFieldView : dateFieldViews) { JCheckBox checkBox = currentFieldView.getCheckBox(); checkBox.removeActionListener(this); if (isEnabled == true) { //enable the form but now one by one //check if it's OK to enable the field view checkBox.setEnabled(true); Date savedDate = currentFieldView.getSavedDate(); currentFieldView.initialiseView(savedDate, isEnabled); if (savedDate == null) { currentFieldView.disableView(); } else { currentFieldView.enableView(); } } else { checkBox.setEnabled(false); currentFieldView.disableView(); } checkBox.addActionListener(this); } if (isEnabled == true) { commentFieldView.enableView(); } else { commentFieldView.disableView(); } panel.setEnabled(isEnabled); }
 int getNumberOfDateFields()
           
 javax.swing.JPanel getPanel()
           
 java.lang.String getToolTipText()
           
 java.lang.String getTrialActivityDataStorageName()
           
 java.lang.String getTrialActivityDisplayName()
           
 boolean isCompleted()
           
protected  void logException(CSTException exception)
           
 boolean ownsPanel(javax.swing.JPanel candidatePanel)
           
protected  void resetDisplay()
           
 void restoreSavedValues()
           
 void setTrialActivityModel(TrialActivityModel trialActivityModel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionProperties

protected SessionProperties sessionProperties

panel

protected javax.swing.JPanel panel

configurationManager

protected ConfigurationManager configurationManager

userInterfaceFactory

protected UserInterfaceFactory userInterfaceFactory

database

protected LoggingServiceAPI database

currentUser

protected User currentUser

log

protected Log log

currentTrialSubjectIdentifier

protected java.lang.String currentTrialSubjectIdentifier

currentTrialActivityModel

protected TrialActivityModel currentTrialActivityModel

numberOfFields

protected int numberOfFields

checkBoxes

protected java.util.ArrayList<javax.swing.JCheckBox> checkBoxes

fieldViewFromCheckBox

protected java.util.HashMap<javax.swing.JCheckBox,DateFieldView> fieldViewFromCheckBox

trialActivityDisplayName

protected java.lang.String trialActivityDisplayName

trialActivityDataStorageName

protected java.lang.String trialActivityDataStorageName

name

protected java.lang.String name

toolTipText

protected java.lang.String toolTipText

mainFieldPanelGC

protected java.awt.GridBagConstraints mainFieldPanelGC
Constructor Detail

TrialActivityView

public TrialActivityView(SessionProperties sessionProperties,
                         java.lang.String trialActivityDisplayName,
                         java.lang.String trialActivityDataStorageName)
Method Detail

resetDisplay

protected void resetDisplay()

addFieldToDisplay

protected void addFieldToDisplay(DateFieldView dateFieldView)

getPanel

public javax.swing.JPanel getPanel()

ownsPanel

public boolean ownsPanel(javax.swing.JPanel candidatePanel)

getCurrentTrialSubjectIdentifier

protected java.lang.String getCurrentTrialSubjectIdentifier()
public void setEnabled(boolean isEnabled) { ArrayList dateFieldViews = new ArrayList(); dateFieldViews.addAll(fieldViewFromCheckBox.values()); for (DateFieldView currentFieldView : dateFieldViews) { JCheckBox checkBox = currentFieldView.getCheckBox(); checkBox.removeActionListener(this); if (isEnabled == true) { //enable the form but now one by one //check if it's OK to enable the field view checkBox.setEnabled(true); Date savedDate = currentFieldView.getSavedDate(); currentFieldView.initialiseView(savedDate, isEnabled); if (savedDate == null) { currentFieldView.disableView(); } else { currentFieldView.enableView(); } } else { checkBox.setEnabled(false); currentFieldView.disableView(); } checkBox.addActionListener(this); } if (isEnabled == true) { commentFieldView.enableView(); } else { commentFieldView.disableView(); } panel.setEnabled(isEnabled); }


getTrialActivityDisplayName

public java.lang.String getTrialActivityDisplayName()

getTrialActivityDataStorageName

public java.lang.String getTrialActivityDataStorageName()

isCompleted

public boolean isCompleted()

setTrialActivityModel

public void setTrialActivityModel(TrialActivityModel trialActivityModel)

displayEmptyTrialActivityModel

public void displayEmptyTrialActivityModel(TrialActivityModel emptyTrialActivityModel)

displayCurrentTrialActivityModel

public void displayCurrentTrialActivityModel(java.lang.String currentTrialSubjectModelIdentifier,
                                             TrialActivityModel currentTrialActivityModel)

logException

protected void logException(CSTException exception)

commitUIChangesToModel

protected void commitUIChangesToModel()

restoreSavedValues

public void restoreSavedValues()

commitChanges

public boolean commitChanges()
Returns:
true if changes were successfully committed

getNumberOfDateFields

public int getNumberOfDateFields()

actionPerformed

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

getToolTipText

public java.lang.String getToolTipText()