com.starteam
Class ViewConfigurationDiffer

java.lang.Object
  extended by com.starteam.ViewConfigurationDiffer

public final class ViewConfigurationDiffer
extends java.lang.Object

Used to compare two configurations of a given view, triggering FolderUpdateEvents, ItemUpdateEvents and ViewMemberUpdateEvents 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, Item.Type type)
          Registers an ItemUpdateListener, whose methods will be invoked during a compare() whenever changes to the items of the given type are detected.
 void addRequiredProperties(ViewMember.Type type, PropertyCollection pc)
          Marks a list of properties as required for a given type.
 void addRequiredProperty(ViewMember.Type type, Property property)
          Marks a given property as required for a given type.
 void addViewMemberUpdateListener(ViewMemberUpdateListener listener, ViewMember.Type type)
          Registers a ViewMemberUpdateListener, whose methods will be invoked during a compare() whenever changes to the view members of the given type are detected.
 void close()
          Frees all cached resources associated with this ViewConfigurationDiffer, and closes the associated view.
 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.
 void removeFolderUpdateListener(FolderUpdateListener listener)
          Unregisters a previously registered FolderUpdateListener.
 void removeItemUpdateListener(ItemUpdateListener listener, Item.Type type)
          Unregisters a previously registered ItemUpdateListener.
 void removeViewMemberUpdateListener(ViewMemberUpdateListener listener, ViewMember.Type type)
          Unregisters a previously registered ViewMemberUpdateListener.
 void setAllPropertiesRequired(ViewMember.Type type)
          Marks all properties as required for a given type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, 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.starteam.ViewConfiguration, com.starteam.ViewConfiguration), ViewConfigurationDiffer.removeFolderUpdateListener(com.starteam.events.FolderUpdateListener)

removeFolderUpdateListener

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

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

addItemUpdateListener

public void addItemUpdateListener(ItemUpdateListener listener,
                                  Item.Type type)
Registers an ItemUpdateListener, whose methods will be invoked during a compare() whenever changes to the items of the given type are detected. Use this listener interface for viewMembers that live in folders (e.g. File, ChangeRequest)

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

removeItemUpdateListener

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

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

addViewMemberUpdateListener

public void addViewMemberUpdateListener(ViewMemberUpdateListener listener,
                                        ViewMember.Type type)
Registers a ViewMemberUpdateListener, whose methods will be invoked during a compare() whenever changes to the view members of the given type are detected. Use this listener interface for (non-item) ViewMembers that do not live in folders e.g. (ChangePackage, Trace)

Parameters:
listener - The listener to be registered.
type - The view member type.
See Also:
ViewMemberUpdateListener, ViewConfigurationDiffer.compare(com.starteam.ViewConfiguration, com.starteam.ViewConfiguration), ViewConfigurationDiffer.removeViewMemberUpdateListener(com.starteam.events.ViewMemberUpdateListener, com.starteam.ViewMember.Type)

removeViewMemberUpdateListener

public void removeViewMemberUpdateListener(ViewMemberUpdateListener listener,
                                           ViewMember.Type type)
Unregisters a previously registered ViewMemberUpdateListener.

Parameters:
listener - The listener to be unregistered.
type - The viewMember type.
See Also:
ViewConfigurationDiffer.addViewMemberUpdateListener(com.starteam.events.ViewMemberUpdateListener, com.starteam.ViewMember.Type)

addRequiredProperty

public void addRequiredProperty(ViewMember.Type type,
                                Property property)
Marks a given property 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.
property - A property.
See Also:
ViewConfigurationDiffer.compare(com.starteam.ViewConfiguration, com.starteam.ViewConfiguration), ViewConfigurationDiffer.addRequiredProperties(com.starteam.ViewMember.Type, com.starteam.PropertyCollection), ViewConfigurationDiffer.setAllPropertiesRequired(com.starteam.ViewMember.Type)

addRequiredProperties

public void addRequiredProperties(ViewMember.Type type,
                                  PropertyCollection pc)
Marks a list of properties as required for a given type. These properties will be populated as items of the given type are compared.

Parameters:
type - An item type.
pc - A list of properties.
See Also:
ViewConfigurationDiffer.addRequiredProperty(com.starteam.ViewMember.Type, com.starteam.Property)

setAllPropertiesRequired

public void setAllPropertiesRequired(ViewMember.Type type)
Marks all properties 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.addRequiredProperty(com.starteam.ViewMember.Type, com.starteam.Property)

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.

close

public void close()
Frees all cached resources associated with this ViewConfigurationDiffer, and closes the associated view.

See Also:
View.close()


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.