com.limegroup.gnutella.gui.search
Class DisplayManager

java.lang.Object
  extended bycom.limegroup.gnutella.gui.search.DisplayManager

public class DisplayManager
extends java.lang.Object

The class that handles all the display details.

Has a singleton pattern,

When instantiated, loads up the display properties for each schema, and stores the URIs against the properties in a HashMap.

This class also has the responsibility of remembering which columns are visible in the search window and the width of each column


Method Summary
 void addColumn(java.lang.String rawName, int prefWidth)
          called when a column is added.
 void commit()
          Writes the props out to disk
static int getDefaultWidth(int val)
           
 java.lang.String getDisplayName(java.lang.String rawName, java.lang.String schemaURI)
          For given schemaURI and rawFieldName returns the Display name.
static java.lang.String getKeyString(int val)
           
 java.util.Properties getProperties(java.lang.String schemaURI)
           
 java.lang.String getValue(java.lang.String key)
          returns the preferred width of a column, if the column is not found in the props, we return a width of -1
static DisplayManager instance()
           
 void removeColumn(java.lang.String rawName)
          called when column is removed.
 void resetPropsFile()
           
 void setValue(java.lang.String rawName, int prefWidth)
           
static java.lang.String stripPreferredSize(java.lang.String rawName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static DisplayManager instance()

resetPropsFile

public void resetPropsFile()

getProperties

public java.util.Properties getProperties(java.lang.String schemaURI)
Returns:
for give URI returns Properties, which was loaded up at startup If Properties was not found, returns a empty properties

getDisplayName

public java.lang.String getDisplayName(java.lang.String rawName,
                                       java.lang.String schemaURI)
For given schemaURI and rawFieldName returns the Display name. Either by looking up the properties or, by proecessing the rawName


addColumn

public void addColumn(java.lang.String rawName,
                      int prefWidth)
called when a column is added. Puts that in the props, and commits it


setValue

public void setValue(java.lang.String rawName,
                     int prefWidth)

removeColumn

public void removeColumn(java.lang.String rawName)
called when column is removed. Puts it in the props, and commits it


getValue

public java.lang.String getValue(java.lang.String key)
returns the preferred width of a column, if the column is not found in the props, we return a width of -1

Parameters:
key - if normal column the key has a special value stored in ResultPanel, otherwise, its the raw name of the column

commit

public void commit()
Writes the props out to disk


getKeyString

public static java.lang.String getKeyString(int val)
Returns:
The "raw name" for columns that do not belong to any schema this is based on the value of the column index

getDefaultWidth

public static int getDefaultWidth(int val)
Returns:
the preferred default widths for non-schema columns. The equivalent for schema columns are stored in their property files (separated by a ^)

stripPreferredSize

public static java.lang.String stripPreferredSize(java.lang.String rawName)