org.lyra.Interface.Options
Class HostsPanel.HostListModel

java.lang.Object
  extended by org.lyra.Interface.Options.HostsPanel.HostListModel
All Implemented Interfaces:
javax.swing.ListModel
Enclosing class:
HostsPanel

private class HostsPanel.HostListModel
extends java.lang.Object
implements javax.swing.ListModel

Implementation of list model which makes use of a List of Map instances that can be used to track changes to the host list without directly affecting changes to the database.

Author:
Martin Foster

Field Summary
private static java.lang.String CLASS
           
private  java.util.List<java.util.Map<java.lang.String,java.lang.String>> myList
           
private  java.util.List<javax.swing.event.ListDataListener> myListener
           
 
Constructor Summary
HostsPanel.HostListModel()
          Alternate constructor method.
HostsPanel.HostListModel(java.util.List<java.util.Map<java.lang.String,java.lang.String>> list)
          Base constructor method, will take a list of all known hosts with all attributes.
 
Method Summary
 void addListDataListener(javax.swing.event.ListDataListener l)
           
private  void fireContentsChanged(int type, int start, int end)
          Notifies various listeners that a change has taken place.
 java.lang.Object getElementAt(int index)
           
 java.util.List<java.util.Map<java.lang.String,java.lang.String>> getModelList()
          Returns the currently stored list in the model.
 int getSize()
           
 void insertRow(java.util.Map<java.lang.String,java.lang.String> row)
          Add in a row of new host information into the list.
 void removeListDataListener(javax.swing.event.ListDataListener l)
           
 void removeRow(int index)
          Remove a row in the data model.
 void removeRows(int start, int end)
          Remove a range of rows in the data model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myList

private java.util.List<java.util.Map<java.lang.String,java.lang.String>> myList

myListener

private java.util.List<javax.swing.event.ListDataListener> myListener

CLASS

private static final java.lang.String CLASS
See Also:
Constant Field Values
Constructor Detail

HostsPanel.HostListModel

public HostsPanel.HostListModel()
Alternate constructor method. Does not contain any information when creating the model.


HostsPanel.HostListModel

public HostsPanel.HostListModel(java.util.List<java.util.Map<java.lang.String,java.lang.String>> list)
Base constructor method, will take a list of all known hosts with all attributes. This constructor can be interfaced directly with the org.lyra.Database.Comptroller class.

Parameters:
list - Complete list of all hosts and attributes.
See Also:
Comptroller
Method Detail

getModelList

public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getModelList()
Returns the currently stored list in the model.

Returns:
List of Maps containing host state.

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener l)
Specified by:
addListDataListener in interface javax.swing.ListModel

getElementAt

public java.lang.Object getElementAt(int index)
Specified by:
getElementAt in interface javax.swing.ListModel

getSize

public int getSize()
Specified by:
getSize in interface javax.swing.ListModel

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener l)
Specified by:
removeListDataListener in interface javax.swing.ListModel

insertRow

public void insertRow(java.util.Map<java.lang.String,java.lang.String> row)
Add in a row of new host information into the list.

Parameters:
row - Map containing host information.

removeRow

public void removeRow(int index)
Remove a row in the data model.

Parameters:
index - Index of row to remove.

removeRows

public void removeRows(int start,
                       int end)
Remove a range of rows in the data model.

Parameters:
start - Start index to remove.
end - End index to remove.

fireContentsChanged

private void fireContentsChanged(int type,
                                 int start,
                                 int end)
Notifies various listeners that a change has taken place.

Parameters:
type - An integer specifying CONTENTS_CHANGED, INTERVAL_ADDED, or INTERVAL_REMOVED
start - An integer specifying the bottom of a range
end - An integer specifying the top of a range