pl.edu.agh.cast.schema.model.presentation
Class SchemaDataSet

java.lang.Object
  extended by pl.edu.agh.cast.data.model.property.PropertyContainer
      extended by pl.edu.agh.cast.data.model.AbstractDataSet<T>
          extended by pl.edu.agh.cast.data.model.presentation.PresentationDataSet<ISchemaElement<? extends IElement>>
              extended by pl.edu.agh.cast.schema.model.presentation.SchemaDataSet
All Implemented Interfaces:
Serializable, Observer, IDisposable, IValidatable, ICopyable<ISchemaElement<? extends IElement>>, IElementCopier<ISchemaElement<? extends IElement>>, IPastable<ISchemaElement<? extends IElement>>, IDataSet<ISchemaElement<? extends IElement>>, Identifiable, IPresentationDataSet<ISchemaElement<? extends IElement>>, IPropertyChangeProvider, IPropertyContainer, ISchemaDataSet

public class SchemaDataSet
extends PresentationDataSet<ISchemaElement<? extends IElement>>
implements ISchemaDataSet, IElementCopier<ISchemaElement<? extends IElement>>

Data set which contains elements for a schema diagram.

Author:
AGH CAST Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface pl.edu.agh.cast.data.model.presentation.IPresentationDataSet
IPresentationDataSet.Properties
 
Field Summary
 
Fields inherited from interface pl.edu.agh.cast.schema.model.presentation.ISchemaDataSet
ACCEPTED_TYPES, TYPE
 
Fields inherited from interface pl.edu.agh.cast.data.model.presentation.IPresentationDataSet
CHILD_EVENT, CHILDREN_EVENT
 
Constructor Summary
protected SchemaDataSet()
          Default constructor.
  SchemaDataSet(PresentationDataSetDescriptor descriptor)
          Initializes data set with its descriptor and a newly created MetaPropertyManager.
  SchemaDataSet(PresentationDataSetDescriptor descriptor, MetaPropertyManager metaPropertyManager)
          Initializes data set with its descriptor and MetaPropertyManager.
  SchemaDataSet(String name)
          Initializes data set with its descriptor and a newly created MetaPropertyManager.
 
Method Summary
protected  void afterAddElement(ISchemaElement<? extends IElement> element)
          This method is called after successfully adding the given element to the data set.
protected  void beforeRemoveElement(ISchemaElement<? extends IElement> element)
          This method is called before attempting to remove the given element from the data set.
 ElementTransferContainer<ISchemaElement<? extends IElement>> copy(Collection<IElement> elements)
          Returns a container containing copies of given elements.
protected  VisualSchemaDataSet createVisualDataSet()
          Creates a new visual data set to be associated with this presentation data set.
 Collection<Type> getAcceptedTypes()
          Returns collection of types of IElements this data set is able to accept.
 Collection<ISchemaConnection> getConnections()
          Gets all connections in data set.
 Collection<IElementCopier<ISchemaElement<? extends IElement>>> getCopiers()
          Returns a collection of compatible element copiers.
 IElementCopier<ISchemaElement<? extends IElement>> getDefaultCopier()
          Returns the default element copier.
 Collection<ISchemaNode> getNodes()
          Gets all nodes in data set.
protected  boolean isElementValid(ISchemaElement<? extends IElement> element)
          Checks if given element is valid for the data set.
 void paste(ElementTransferContainer<ISchemaElement<? extends IElement>> elements)
          Pastes given elements.
 void unpaste(ElementTransferContainer<ISchemaElement<? extends IElement>> elements)
          Un-pastes given elements.
 
Methods inherited from class pl.edu.agh.cast.data.model.presentation.PresentationDataSet
acquireDescriptor, addPropertyChangeListener, afterRemoveElement, createNewDescriptor, firePropertyChange, getDescriptor, getOriginalDataSets, getVisualDataSet, hasAssociatedVisualDataSet, isDescriptorValid, removePropertyChangeListener, setOriginalDataSets, setSuppressAllEvents, setVisualDataSet
 
Methods inherited from class pl.edu.agh.cast.data.model.AbstractDataSet
addElement, addElements, addElements, addMetaPropertyManager, addMetaPropertyManager, addMetaPropertyManagersForAcceptedTypes, afterSetMetaPropertyManager, beforeAddElement, checkIfValid, equals, getAssignableElements, getCreationDate, getDescString, getElement, getElementCount, getElements, getElements, getElementTypes, getId, getMetaPropertyManager, getMetaPropertyManagers, getName, getRegisteredTypes, getType, hashCode, isValid, removeElement, removeElement, removeElements, removeElements, setCreationDate, setDescriptor, setElements, setId, setName, setType, toString
 
Methods inherited from class pl.edu.agh.cast.data.model.property.PropertyContainer
addProperty, createProperty, dispose, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, initializeProperties, matches, removeProperty, setMetaPropertyManager, setProperty, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.data.model.presentation.IPresentationDataSet
getDescriptor, getOriginalDataSets, getVisualDataSet, hasAssociatedVisualDataSet, setOriginalDataSets, setSuppressAllEvents, setVisualDataSet
 
Methods inherited from interface pl.edu.agh.cast.data.model.IDataSet
addElement, addElements, addElements, addMetaPropertyManager, addMetaPropertyManagersForAcceptedTypes, getAssignableElements, getCreationDate, getElement, getElementCount, getElements, getElements, getElementTypes, getMetaPropertyManager, getMetaPropertyManagers, getName, getRegisteredTypes, removeElement, removeElement, removeElements, removeElements, setCreationDate, setElements, setName
 
Methods inherited from interface pl.edu.agh.cast.data.model.Identifiable
getId, getType
 
Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyContainer
addProperty, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, matches, removeProperty, setProperty
 
Methods inherited from interface java.util.Observer
update
 
Methods inherited from interface pl.edu.agh.cast.common.IValidatable
isValid
 
Methods inherited from interface pl.edu.agh.cast.common.IDisposable
dispose
 
Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyChangeProvider
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

SchemaDataSet

protected SchemaDataSet()
Default constructor.

Usage of this constructor is discouraged, since it does not provide any integrity control. If, however, this constructor is used, the AbstractDataSet.isValid() method should be called in order to check the integrity.


SchemaDataSet

public SchemaDataSet(String name)
Initializes data set with its descriptor and a newly created MetaPropertyManager.

Parameters:
name - the name of the data set
Throws:
IllegalArgumentException - if type is null

SchemaDataSet

public SchemaDataSet(PresentationDataSetDescriptor descriptor)
Initializes data set with its descriptor and a newly created MetaPropertyManager.

Parameters:
descriptor - the presentation data set descriptor
Throws:
IllegalArgumentException - if type is null

SchemaDataSet

public SchemaDataSet(PresentationDataSetDescriptor descriptor,
                     MetaPropertyManager metaPropertyManager)
Initializes data set with its descriptor and MetaPropertyManager.

Parameters:
descriptor - the presentation data set descriptor
metaPropertyManager - manager of data set's meta properties
Throws:
IllegalArgumentException - if any of the arguments is null
Method Detail

isElementValid

protected boolean isElementValid(ISchemaElement<? extends IElement> element)
                          throws ModelException
Checks if given element is valid for the data set.

This method is called by the AbstractDataSet.addElement(IElement) method. By default it always returns true , however it can be overridden in order to define new validation rules. In such case the implementation from base class should be called inside the overridden method in order to preserve data consistency.

Overrides:
isElementValid in class PresentationDataSet<ISchemaElement<? extends IElement>>
Parameters:
element - the element to validate
Returns:
true if the element is valid, false otherwise
Throws:
ModelException - if there is a severe validity violation
See Also:
AbstractDataSet.isElementValid(pl.edu.agh.cast.data.model.IElement)

afterAddElement

protected void afterAddElement(ISchemaElement<? extends IElement> element)
Description copied from class: PresentationDataSet
This method is called after successfully adding the given element to the data set.

It should be overridden by subclasses to add custom activities which should be perform after removing the given element.

Overrides:
afterAddElement in class PresentationDataSet<ISchemaElement<? extends IElement>>
Parameters:
element - element which has been just removed
See Also:
AbstractDataSet.afterAddElement(pl.edu.agh.cast.data.model.IElement)

beforeRemoveElement

protected void beforeRemoveElement(ISchemaElement<? extends IElement> element)
Description copied from class: PresentationDataSet
This method is called before attempting to remove the given element from the data set.

It should be overridden by subclasses to add custom activities which should be perform after removing the given element.

Overrides:
beforeRemoveElement in class PresentationDataSet<ISchemaElement<? extends IElement>>
Parameters:
element - element which is to be removed
See Also:
AbstractDataSet.beforeRemoveElement(pl.edu.agh.cast.data.model.IElement)

getAcceptedTypes

public Collection<Type> getAcceptedTypes()
Returns collection of types of IElements this data set is able to accept.

This method should be overridden by all concrete subclasses.

Returns collection of types of elements this data set is able to accept.

Specified by:
getAcceptedTypes in interface IDataSet<ISchemaElement<? extends IElement>>
Overrides:
getAcceptedTypes in class PresentationDataSet<ISchemaElement<? extends IElement>>
Returns:
collection of element types this data set is able to accept
See Also:
PresentationDataSet.getAcceptedTypes()

getNodes

public Collection<ISchemaNode> getNodes()
Gets all nodes in data set.

Specified by:
getNodes in interface ISchemaDataSet
Returns:
nodes in data set
See Also:
ISchemaDataSet.getNodes()

getConnections

public Collection<ISchemaConnection> getConnections()
Gets all connections in data set.

Specified by:
getConnections in interface ISchemaDataSet
Returns:
connections in data set
See Also:
ISchemaDataSet.getConnections()

createVisualDataSet

protected VisualSchemaDataSet createVisualDataSet()
Creates a new visual data set to be associated with this presentation data set.

This method should be implemented in each concrete subclass of PresentationDataSet.

Specified by:
createVisualDataSet in class PresentationDataSet<ISchemaElement<? extends IElement>>
Returns:
a new instance of visual data set to be associated with this instance
See Also:
PresentationDataSet.createVisualDataSet()

getCopiers

public Collection<IElementCopier<ISchemaElement<? extends IElement>>> getCopiers()
Returns a collection of compatible element copiers.

Specified by:
getCopiers in interface ICopyable<ISchemaElement<? extends IElement>>
Returns:
a collection of compatible element copiers
See Also:
ICopyable.getCopiers()

getDefaultCopier

public IElementCopier<ISchemaElement<? extends IElement>> getDefaultCopier()
Returns the default element copier.

Specified by:
getDefaultCopier in interface ICopyable<ISchemaElement<? extends IElement>>
Returns:
the default element copier
See Also:
ICopyable.getDefaultCopier()

copy

public ElementTransferContainer<ISchemaElement<? extends IElement>> copy(Collection<IElement> elements)
Returns a container containing copies of given elements. In order to preserve data consistency additional elements may be also copied.

Specified by:
copy in interface IElementCopier<ISchemaElement<? extends IElement>>
Parameters:
elements - collection of elements to copy
Returns:
a container containing copies of given elements (and possibly additional ones)
See Also:
IElementCopier.copy(java.util.Collection)

paste

public void paste(ElementTransferContainer<ISchemaElement<? extends IElement>> elements)
Pastes given elements.

Specified by:
paste in interface IPastable<ISchemaElement<? extends IElement>>
Parameters:
elements - the elements to paste (within container)
See Also:
#paste(pl.edu.agh.cast.data.model.copier.ElementTransferContainer)

unpaste

public void unpaste(ElementTransferContainer<ISchemaElement<? extends IElement>> elements)
Description copied from interface: IPastable
Un-pastes given elements.

Specified by:
unpaste in interface IPastable<ISchemaElement<? extends IElement>>
Parameters:
elements - the elements to un-paste (within container)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.