com.starbase.starteam
Class ViewConfigurationDiffer

java.lang.Object
  |
  +--com.starbase.starteam.ViewConfigurationDiffer

public class ViewConfigurationDiffer
extends java.lang.Object

Used to compare two configurations of a given view, triggering FolderUpdateEvents and ItemUpdateEvents describing the changes detected between the two.

Events are triggered only for differences detectable by comparing the two view configurations. For example, if an item was added sometime after the time represented by the first configuration, and then removed sometime before the time represented by the second configuration, then no events would be triggered for that item.

Events are triggered in an order that reflects the times the change actually occurred, when possible. For some older server versions, and for some types of view configurations, it is not currently possible to determine when a move has occurred. It is also not currently possible to determine when a folder or item was removed. Such events are triggered last.


Constructor Summary
ViewConfigurationDiffer(View view)
          Constructs a new ViewCOnfigurationDiffer.
 
Method Summary
 void addFolderUpdateListener(FolderUpdateListener listener)
          Registers a FolderUpdateListener, whose methods will be invoked during a compare() whenever changes to the folder tree are detected.
 void addItemUpdateListener(ItemUpdateListener listener, Type type)
          Registers an ItemUpdateListener, whose methods will be invoked durng a compare() whenever changes to the items of the given type are detected.
 void addRequiredPropertyName(Type type, java.lang.String propertyName)
          Marks a given property name as required for a given type.
 void addRequiredPropertyNames(Type type, java.lang.String[] propertyNames)
          Marks a list of property names as required for a given type.
 void compare(ViewConfiguration config1, ViewConfiguration config2)
          Comnpares the two given configurations of this view, triggering FolderUpdateEvents and ItemUpdateEvents for all changes detected between the two.
 boolean equals(java.lang.Object source)
          returns true if this object instance is equal to the source
 int hashCode()
          returns a unique hash for all instances of this type
 void removeFolderUpdateListener(FolderUpdateListener listener)
          Unregisters a previously registered FolderUpdateListener.
 void removeItemUpdateListener(ItemUpdateListener listener, Type type)
          Unregisters a previously registered ItemUpdateListener.
 void setAllPropertyNamesRequired(Type type)
          Marks all property names as required for a given type.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewConfigurationDiffer

public ViewConfigurationDiffer(View view)
Constructs a new ViewCOnfigurationDiffer.

Parameters:
view - The view whose configurations are to be compared.
Method Detail

addFolderUpdateListener

public void addFolderUpdateListener(FolderUpdateListener listener)
Registers a FolderUpdateListener, whose methods will be invoked during a compare() whenever changes to the folder tree are detected.

Parameters:
listener - The listener to be registered.
See Also:
FolderUpdateListener, ViewConfigurationDiffer.compare(com.starbase.starteam.ViewConfiguration, com.starbase.starteam.ViewConfiguration), ViewConfigurationDiffer.removeFolderUpdateListener(com.starbase.starteam.FolderUpdateListener)

removeFolderUpdateListener

public void removeFolderUpdateListener(FolderUpdateListener listener)
Unregisters a previously registered FolderUpdateListener.

Parameters:
listener - The listener to be unregistered.
See Also:
ViewConfigurationDiffer.addFolderUpdateListener(com.starbase.starteam.FolderUpdateListener)

addItemUpdateListener

public void addItemUpdateListener(ItemUpdateListener listener,
                                  Type type)
Registers an ItemUpdateListener, whose methods will be invoked durng a compare() whenever changes to the items of the given type are detected.

Parameters:
listener - The listener to be registered.
type - The item type.
See Also:
ItemUpdateListener, ViewConfigurationDiffer.compare(com.starbase.starteam.ViewConfiguration, com.starbase.starteam.ViewConfiguration), ViewConfigurationDiffer.removeItemUpdateListener(com.starbase.starteam.ItemUpdateListener, com.starbase.starteam.Type)

removeItemUpdateListener

public void removeItemUpdateListener(ItemUpdateListener listener,
                                     Type type)
Unregisters a previously registered ItemUpdateListener.

Parameters:
listener - The listener to be unregistered.
type - The item type.
See Also:
ViewConfigurationDiffer.addItemUpdateListener(com.starbase.starteam.ItemUpdateListener, com.starbase.starteam.Type)

addRequiredPropertyName

public void addRequiredPropertyName(Type type,
                                    java.lang.String propertyName)
Marks a given property name as required for a given type. This property will be populated as items of the given type are compared.

If addPropertyName() or any of its variations is never called for a given type, then a default set of properties (including the type's descriptors) is assumed. In fact, if neither addPropertyName() nor addItemUpdateListener() is called, then that item type is not even compared.

Parameters:
type - An item type.
propertyName - A property name.
See Also:
ViewConfigurationDiffer.compare(com.starbase.starteam.ViewConfiguration, com.starbase.starteam.ViewConfiguration), ViewConfigurationDiffer.addRequiredPropertyNames(com.starbase.starteam.Type, java.lang.String[]), ViewConfigurationDiffer.setAllPropertyNamesRequired(com.starbase.starteam.Type)

addRequiredPropertyNames

public void addRequiredPropertyNames(Type type,
                                     java.lang.String[] propertyNames)
Marks a list of property names as required for a given type. These properties will be populated as items of the given type are compared.

Parameters:
type - An item type.
propertyNames - A list of property names.
See Also:
ViewConfigurationDiffer.addRequiredPropertyName(com.starbase.starteam.Type, java.lang.String)

setAllPropertyNamesRequired

public void setAllPropertyNamesRequired(Type type)
Marks all property names as required for a given type. All properties will be populated as items of the given type are compared.

Parameters:
type - An item type.
See Also:
ViewConfigurationDiffer.addRequiredPropertyName(com.starbase.starteam.Type, java.lang.String)

compare

public void compare(ViewConfiguration config1,
                    ViewConfiguration config2)
Comnpares the two given configurations of this view, triggering FolderUpdateEvents and ItemUpdateEvents for all changes detected between the two.

The folder tree is always compared. In addition, the items are compared for each item type that the application has shown an interest in, either by adding an ItemUpdateListener for that item type, or by calling addRequiredPropertyName() with that item type.

Parameters:
config1 - The first (earlier) view configuration.
config2 - The second (later) view configuration.

equals

public boolean equals(java.lang.Object source)
returns true if this object instance is equal to the source

Overrides:
equals in class java.lang.Object
Parameters:
source - Object the source to comapre with
Returns:
boolean true if this object is equal to the source

hashCode

public int hashCode()
returns a unique hash for all instances of this type

Overrides:
hashCode in class java.lang.Object
Returns:
int a unique hash for all instances of this type


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.