macaw.util
Class DisplayableListPanel

java.lang.Object
  extended by macaw.util.DisplayableListPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

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

Provides a general class for add, delete, view, edit operations for a list capable of supporting items that implement the "Displayable" interface. DisplayableListPanel will change its display depending on the value of "allowWriteAccess". This parameter means whether or not users should be able to do any of add, edit or delete operations. If allowWriteAccess is set to true, then one or more of these buttons will appear sensitised. The class can also be parameterised using "allowRecordEditing", which only indicates whether if people can invoke an editor to change a record. In cases such as SourceVariablePanel, which allow curators to build a list from predefined immutable items, the edit button will be changed to "View".


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)

Constructor Summary
DisplayableListPanel(SessionProperties sessionProperties, DisplayableListParentForm parentForm, java.lang.String panelTitleText, boolean allowWriteAccess)
           
DisplayableListPanel(SessionProperties sessionProperties, DisplayableListParentForm parentForm, java.lang.String panelTitleText, boolean allowWriteAccess, boolean allowRecordEditing)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void addListItem()
           
 void deleteSelectedListItems()
           
 java.util.ArrayList<Displayable> getAllListItems()
          private void restore() { ArrayList currentList = new ArrayList(); for (Displayable displayableItem : masterList) { Displayable cloneItem = (Displayable) displayableItem.clone(); currentList.add(cloneItem); } displayableList.setDisplayItems(currentList); updateButtonStates(); }
 javax.swing.JPanel getPanel()
           
 void save()
           
 void setDisplayableItems(java.util.ArrayList<Displayable> masterList)
           
 void setDisplayableListItemAdder(DisplayableListItemAdder listItemAdder)
           
 void setDisplayableListItemDeleter(DisplayableListItemDeleter listItemDeleter)
           
 void setDisplayableListItemEditor(DisplayableListItemEditor listItemEditor)
           
 void setDisplayableListItemSelector(DisplayableListItemSelector listItemSelector)
           
 void setDisplayableListItemViewer(DisplayableListItemViewer listItemViewer)
           
 void setListOwnerName(java.lang.String listOwnerName)
           
 void setNewRecord(boolean isNewRecord)
           
 void updateButtonStates()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayableListPanel

public DisplayableListPanel(SessionProperties sessionProperties,
                            DisplayableListParentForm parentForm,
                            java.lang.String panelTitleText,
                            boolean allowWriteAccess)

DisplayableListPanel

public DisplayableListPanel(SessionProperties sessionProperties,
                            DisplayableListParentForm parentForm,
                            java.lang.String panelTitleText,
                            boolean allowWriteAccess,
                            boolean allowRecordEditing)
Method Detail

setNewRecord

public void setNewRecord(boolean isNewRecord)

getPanel

public javax.swing.JPanel getPanel()

setDisplayableListItemSelector

public void setDisplayableListItemSelector(DisplayableListItemSelector listItemSelector)

setDisplayableListItemAdder

public void setDisplayableListItemAdder(DisplayableListItemAdder listItemAdder)

setDisplayableListItemEditor

public void setDisplayableListItemEditor(DisplayableListItemEditor listItemEditor)

setDisplayableListItemViewer

public void setDisplayableListItemViewer(DisplayableListItemViewer listItemViewer)

setDisplayableListItemDeleter

public void setDisplayableListItemDeleter(DisplayableListItemDeleter listItemDeleter)

addListItem

public void addListItem()

deleteSelectedListItems

public void deleteSelectedListItems()

updateButtonStates

public void updateButtonStates()

setDisplayableItems

public void setDisplayableItems(java.util.ArrayList<Displayable> masterList)

save

public void save()

getAllListItems

public java.util.ArrayList<Displayable> getAllListItems()
private void restore() { ArrayList currentList = new ArrayList(); for (Displayable displayableItem : masterList) { Displayable cloneItem = (Displayable) displayableItem.clone(); currentList.add(cloneItem); } displayableList.setDisplayItems(currentList); updateButtonStates(); }


setListOwnerName

public void setListOwnerName(java.lang.String listOwnerName)

actionPerformed

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