org.eclipse.corona.client.collaboration.event
Class EventProperty

java.lang.Object
  extended by org.eclipse.corona.client.collaboration.event.EventProperty
All Implemented Interfaces:
java.util.Comparator

public class EventProperty
extends java.lang.Object
implements java.util.Comparator

This class represents a single property of a collaboration event.

Author:
Marcin Okraszewski

Constructor Summary
EventProperty(java.lang.String key)
          Creates a new event property definition.
 
Method Summary
 void addValue(java.lang.String value)
          Adds a new value of allowed values of the property.
 int compare(java.lang.Object e1, java.lang.Object e2)
          Compares two events.
 boolean equals(java.lang.Object o)
          Checks if two objects point to the same property.
 java.util.Comparator getComparator()
          Gets a comparator used to compare two values of the property.
 IFormatter getFormatter()
          Gets converter of the property value to human readable form.
 java.lang.String getKey()
          A key under which the property value is kept.
 java.lang.String getName()
          Gets a human readable form of property name.
 java.lang.String getStrValue(org.osgi.service.event.Event evt)
          Obtains a human readable string representation of a property from a given event.
 java.lang.Object getValue(org.osgi.service.event.Event evt)
          Gets value of a property form an event.
 java.util.Set getValues()
          Gets a set of available predefined values.
 int hashCode()
          Calculates hash code.
 boolean isImportant()
          Gets if the property is important, should be displayed in an overview or not.
 void setComparator(java.util.Comparator comparator)
          Sets a comparator used to compare two values of the property.
 void setFormatter(IFormatter formatter)
          Sets converter of the property value to human readable form.
 void setImportant(boolean important)
          Sets if the property is important, should be displayed in an overview or not.
 void setName(java.lang.String name)
          Sets a human readable form of property name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventProperty

public EventProperty(java.lang.String key)
Creates a new event property definition.

Parameters:
key - The key of the property.
Method Detail

compare

public int compare(java.lang.Object e1,
                   java.lang.Object e2)
Compares two events.

Specified by:
compare in interface java.util.Comparator
Parameters:
e1 - The first event to compare.
e2 - The second event to compare.

getStrValue

public java.lang.String getStrValue(org.osgi.service.event.Event evt)
Obtains a human readable string representation of a property from a given event.

Parameters:
evt - The event from which the property will be taken and converted to string.
Returns:
The string representation of property value.

getValue

public java.lang.Object getValue(org.osgi.service.event.Event evt)
Gets value of a property form an event.

Parameters:
evt - The event from which the property is to be taken.
Returns:
The property value or null if the property is not defined.

equals

public boolean equals(java.lang.Object o)
Checks if two objects point to the same property.

Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object
Parameters:
o - An other property.

hashCode

public int hashCode()
Calculates hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
hashCode

getKey

public java.lang.String getKey()
A key under which the property value is kept.

Returns:
the key

getComparator

public java.util.Comparator getComparator()
Gets a comparator used to compare two values of the property.

Returns:
the comparator

setComparator

public void setComparator(java.util.Comparator comparator)
Sets a comparator used to compare two values of the property.

Parameters:
comparator - the comparator to set

getFormatter

public IFormatter getFormatter()
Gets converter of the property value to human readable form.

Returns:
The formatter; if null, toString() is used.

setFormatter

public void setFormatter(IFormatter formatter)
Sets converter of the property value to human readable form.

Parameters:
formatter - The formatter to set; if null, toString() will be used.

getName

public java.lang.String getName()
Gets a human readable form of property name.

Returns:
the name

setName

public void setName(java.lang.String name)
Sets a human readable form of property name.

Parameters:
name - the name to set

setImportant

public void setImportant(boolean important)
Sets if the property is important, should be displayed in an overview or not.

Parameters:
important - Value if important (true) or not (false).

isImportant

public boolean isImportant()
Gets if the property is important, should be displayed in an overview or not.

Returns:
If property is important (true) or not (false).

getValues

public java.util.Set getValues()
Gets a set of available predefined values.

Returns:
The set of predefined allowed values of the property. The set can be empty, but never null.

addValue

public void addValue(java.lang.String value)
Adds a new value of allowed values of the property.

Parameters:
value - The new value.

Copyright 2006 IBM Corporation and others.
All Rights Reserved.