com.tensegrity.gui.graphdocument
Class ElementDefinitionWrapper

java.lang.Object
  extended bycom.tensegrity.gui.graphdocument.ElementDefinitionWrapper

public class ElementDefinitionWrapper
extends java.lang.Object

The class ElementDefinitionWrapper contains information and methods that are used managing definitions and their conflicts during import operations.

It contains lists of conflicting elements for geometries, styles, rules, layouts and images.

An instance of this class is used for the transfer of information in the GraphDocument persistence and is passed to the conflict dialog.

Author:
BurkhardWick

Field Summary
 RuleRegistry defaultRuleRegistry
          defaultRuleRegistry: The default RuleRegistry of the application which is used to check for conflicts with the loaded rule definitions
 java.util.List elementConflicts
          elementConflicts: A list containing the names of all conflicting elements of type Element
 AttributeList elements
          elements: All elements that of the loaded definition file
 int elementsConflictResolving
          elementsConflictResolving: The option used for resolving conflicts of type: element
 AttributeList geometries
          geometries: All geometries of the loaded definition file
 int geometryConflictResolving
          geometryConflictResolving: The option used for resolving conflicts of type: geometry
 java.util.List[] geometryConflicts
          geometryConflicts: An array holding two lists containing the names of all conflicting GeometryDescriptors or GeometryDescriptorItems
 java.util.Map geomItemsRenameMap
          geomItemsRenameMap: A map containing new names for all conflicting elements of type GeometryDescriptorItem
 java.util.Map geomsRenameMap
          geomsRenameMap: A map containing new names for all conflicting elements of type GeometryDescriptor
 java.util.List imageConflicts
          imageConflicts: A list containing the names of all conflicting Rasters
 AttributeList images
          images: All images of the loaded definition file
 java.util.Map imagesRenameMap
          imagesRenameMap: A map containing new names for all conflicting elements of type Raster
 boolean isImportToDocument
          isImportToDocument: True if the definitions are imported to a document and there are no application defaults to check/apply against
 java.util.List layoutConflicts
          layoutConflicts: A list containing the names of all conflicting LayoutContexts
 AttributeSet layouts
          layouts: All layouts of the loaded definition file
 java.util.Map layoutsRenameMap
          layoutsRenameMap: A map containing new names for all conflicting elements of type LayoutContext
 int ruleConflictResolving
          ruleConflictResolving: The option used for resolving conflicts of type: rule
 java.util.List ruleConflicts
          ruleConflicts: A list containing the names of all conflicting Rules
 RuleRegistry rules
          rules: All rules of the loaded definition file
 java.util.Map rulesRenameMap
          rulesRenameMap: A map containing new names for all conflicting elements of type Rule
 int styleConflictResolving
          styleConflictResolving: The option used for resolving conflicts of type: style
 java.util.List[] styleConflicts
          styleConflicts: An array holding two lists containing the names of all conflicting StyleDescriptors or StyleDescriptorItems
 java.util.Map styleItemsRenameMap
          styleItemsRenameMap: A map containing new names for all conflicting elements of type StyleDescriptorItem
 java.util.List[] styleNameConflicts
          styleNameConflicts: An array holding two lists containing the names of all conflicting StyleDescriptors or StyleDescriptorItems
 AttributeList styles
          styles: All styles of the loaded definition file
 java.util.Map stylesRenameMap
          stylesRenameMap: A map containing new names for all conflicting elements of type StyleDescriptor
 
Constructor Summary
ElementDefinitionWrapper(AttributeCollection layoutConfiguration)
          Constructor
 
Method Summary
 boolean areGeometriesDisposable()
          This setting determines whether the geometries can be disposed or not
 boolean containsUnconflictingStyles()
          Returns true, if the styles contain items that are not in the pool and so will be handled as unconflicting styles and applied in any case.
 void createDefaultRenameMaps(LayoutController lc)
          Creates default rename maps for conflicting names in styles, geometries, layouts, images and rules.
 boolean elementConflict()
          Returns true, if there is an element conflict
 boolean geometryConflict()
          Returns true, if there is an geometry conflict
 java.util.Collection getGeometryConflicts()
          Returns a collection of all geometry conflicts as a combination of GeometryDescriptorItems and GeometryDescriptors
 java.lang.String getNewGeometryNameDefault(java.util.Map map, java.lang.String oldName)
          Generates and returns a new default name for the given geometry name, that can be used in the conflict dialog or when the dialog is suppressed.
 java.lang.String getNewImageNameDefault(java.util.Map map, java.lang.String oldName)
          Generates and returns a new default name for the given image name, that can be used in the conflict dialog or when the dialog is suppressed.
 java.lang.String getNewLayoutContextNameDefault(java.util.Map map, LayoutController lc, java.lang.String oldName)
          Generates and returns a new default name for the given layout context name, that can be used in the conflict dialog or when the dialog is suppressed.
 java.lang.String getNewRuleNameDefault(java.util.Map map, java.lang.String oldName)
          Generates and returns a new default name for the given rule name, that can be used in the conflict dialog or when the dialog is suppressed.
 java.lang.String getNewStyleNameDefault(java.util.Map map, java.lang.String oldName)
          Generates and returns a new default name for the given style name, that can be used in the conflict dialog or when the dialog is suppressed.
 java.util.Collection getStyleConflicts()
          Returns a collection of all style conflicts as a combination of StyleDescriptorItems and StyleDescriptors
 boolean isContextNameValid(java.util.Map map, java.lang.String name, LayoutController layoutController)
          Checks whether the given name is valid for a new layout context
 boolean isGeomNameValid(java.util.Map map, java.lang.String name)
          Checks whether the given name is valid for a new style
 boolean isImageNameValid(java.util.Map map, java.lang.String name)
          Checks whether the given name is valid for a new image
 boolean isRuleNameValid(java.util.Map map, java.lang.String name)
          Checks whether the given name is valid for a new style
 boolean isStyleNameValid(java.util.Map map, java.lang.String name)
          Checks whether the given name is valid for a new style
 boolean ruleConflict()
          Returns true, if there is an rule conflict
 void setGeometriesDisposable(boolean areGeometriesDisposable)
          This setting determines whether the geometries can be disposed or not
 boolean styleConflict()
          Returns true, if there is an style conflict
 boolean styleNameConflict()
          Returns true, if there is an style name conflict
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

public AttributeList elements
elements: All elements that of the loaded definition file


geometries

public AttributeList geometries
geometries: All geometries of the loaded definition file


styles

public AttributeList styles
styles: All styles of the loaded definition file


layouts

public AttributeSet layouts
layouts: All layouts of the loaded definition file


images

public AttributeList images
images: All images of the loaded definition file


rules

public RuleRegistry rules
rules: All rules of the loaded definition file


defaultRuleRegistry

public RuleRegistry defaultRuleRegistry
defaultRuleRegistry: The default RuleRegistry of the application which is used to check for conflicts with the loaded rule definitions


stylesRenameMap

public java.util.Map stylesRenameMap
stylesRenameMap: A map containing new names for all conflicting elements of type StyleDescriptor


styleItemsRenameMap

public java.util.Map styleItemsRenameMap
styleItemsRenameMap: A map containing new names for all conflicting elements of type StyleDescriptorItem


geomsRenameMap

public java.util.Map geomsRenameMap
geomsRenameMap: A map containing new names for all conflicting elements of type GeometryDescriptor


geomItemsRenameMap

public java.util.Map geomItemsRenameMap
geomItemsRenameMap: A map containing new names for all conflicting elements of type GeometryDescriptorItem


rulesRenameMap

public java.util.Map rulesRenameMap
rulesRenameMap: A map containing new names for all conflicting elements of type Rule


layoutsRenameMap

public java.util.Map layoutsRenameMap
layoutsRenameMap: A map containing new names for all conflicting elements of type LayoutContext


imagesRenameMap

public java.util.Map imagesRenameMap
imagesRenameMap: A map containing new names for all conflicting elements of type Raster


elementConflicts

public java.util.List elementConflicts
elementConflicts: A list containing the names of all conflicting elements of type Element


geometryConflicts

public java.util.List[] geometryConflicts
geometryConflicts: An array holding two lists containing the names of all conflicting GeometryDescriptors or GeometryDescriptorItems


styleConflicts

public java.util.List[] styleConflicts
styleConflicts: An array holding two lists containing the names of all conflicting StyleDescriptors or StyleDescriptorItems


styleNameConflicts

public java.util.List[] styleNameConflicts
styleNameConflicts: An array holding two lists containing the names of all conflicting StyleDescriptors or StyleDescriptorItems


ruleConflicts

public java.util.List ruleConflicts
ruleConflicts: A list containing the names of all conflicting Rules


layoutConflicts

public java.util.List layoutConflicts
layoutConflicts: A list containing the names of all conflicting LayoutContexts


imageConflicts

public java.util.List imageConflicts
imageConflicts: A list containing the names of all conflicting Rasters


elementsConflictResolving

public int elementsConflictResolving
elementsConflictResolving: The option used for resolving conflicts of type: element


geometryConflictResolving

public int geometryConflictResolving
geometryConflictResolving: The option used for resolving conflicts of type: geometry


styleConflictResolving

public int styleConflictResolving
styleConflictResolving: The option used for resolving conflicts of type: style


ruleConflictResolving

public int ruleConflictResolving
ruleConflictResolving: The option used for resolving conflicts of type: rule


isImportToDocument

public boolean isImportToDocument
isImportToDocument: True if the definitions are imported to a document and there are no application defaults to check/apply against

Constructor Detail

ElementDefinitionWrapper

public ElementDefinitionWrapper(AttributeCollection layoutConfiguration)
Constructor

Parameters:
layoutConfiguration - The layout configuration represented as an AttributeCollection, usually read from a GraphDocument or definition xml file
Method Detail

elementConflict

public boolean elementConflict()
Returns true, if there is an element conflict

Returns:
true, if there is an element conflict

geometryConflict

public boolean geometryConflict()
Returns true, if there is an geometry conflict

Returns:
true, if there is an geometry conflict

styleConflict

public boolean styleConflict()
Returns true, if there is an style conflict

Returns:
true, if there is an style conflict

styleNameConflict

public boolean styleNameConflict()
Returns true, if there is an style name conflict

Returns:
true, if there is an style name conflict

ruleConflict

public boolean ruleConflict()
Returns true, if there is an rule conflict

Returns:
true, if there is an rule conflict

getNewStyleNameDefault

public final java.lang.String getNewStyleNameDefault(java.util.Map map,
                                                     java.lang.String oldName)
Generates and returns a new default name for the given style name, that can be used in the conflict dialog or when the dialog is suppressed.

Parameters:
map - The map containing all previously generated default names
oldName - The old (conflicting) name of the item
Returns:
The generated default name that can be used

getNewGeometryNameDefault

public final java.lang.String getNewGeometryNameDefault(java.util.Map map,
                                                        java.lang.String oldName)
Generates and returns a new default name for the given geometry name, that can be used in the conflict dialog or when the dialog is suppressed.

Parameters:
map - The map containing all previously generated default names
oldName - The old (conflicting) name of the item
Returns:
The generated default name that can be used

getNewRuleNameDefault

public final java.lang.String getNewRuleNameDefault(java.util.Map map,
                                                    java.lang.String oldName)
Generates and returns a new default name for the given rule name, that can be used in the conflict dialog or when the dialog is suppressed.

Parameters:
map - The map containing all previously generated default names
oldName - The old (conflicting) name of the item
Returns:
The generated default name that can be used

getNewLayoutContextNameDefault

public final java.lang.String getNewLayoutContextNameDefault(java.util.Map map,
                                                             LayoutController lc,
                                                             java.lang.String oldName)
Generates and returns a new default name for the given layout context name, that can be used in the conflict dialog or when the dialog is suppressed.

Parameters:
map - The map containing all previously generated default names
lc - The layout controller to which the generated layout context name should be added
oldName - The old (conflicting) name of the item
Returns:
The generated default name that can be used

getNewImageNameDefault

public final java.lang.String getNewImageNameDefault(java.util.Map map,
                                                     java.lang.String oldName)
Generates and returns a new default name for the given image name, that can be used in the conflict dialog or when the dialog is suppressed.

Parameters:
map - The map containing all previously generated default names
oldName - The old (conflicting) name of the item
Returns:
The generated default name that can be used

isRuleNameValid

public boolean isRuleNameValid(java.util.Map map,
                               java.lang.String name)
Checks whether the given name is valid for a new style

Parameters:
map - The map containing all previously generated default names
name - The name to check
Returns:
true, if the name is valid

isImageNameValid

public boolean isImageNameValid(java.util.Map map,
                                java.lang.String name)
Checks whether the given name is valid for a new image

Parameters:
map - The map containing all previously generated default names
name - The name to check
Returns:
true, if the name is valid

isContextNameValid

public final boolean isContextNameValid(java.util.Map map,
                                        java.lang.String name,
                                        LayoutController layoutController)
Checks whether the given name is valid for a new layout context

Parameters:
map - The map containing all previously generated default names
name - The name to check
layoutController - The layout controller building the context for the name
Returns:
true, if the name is valid

isStyleNameValid

public boolean isStyleNameValid(java.util.Map map,
                                java.lang.String name)
Checks whether the given name is valid for a new style

Parameters:
map - The map containing all previously generated default names
name - The name to check
Returns:
true, if the name is valid

isGeomNameValid

public boolean isGeomNameValid(java.util.Map map,
                               java.lang.String name)
Checks whether the given name is valid for a new style

Parameters:
map - The map containing all previously generated default names
name - The name to check
Returns:
true, if the name is valid

getStyleConflicts

public java.util.Collection getStyleConflicts()
Returns a collection of all style conflicts as a combination of StyleDescriptorItems and StyleDescriptors

Returns:
a collection of all style conflicts as a combination of StyleDescriptorItems and StyleDescriptors

getGeometryConflicts

public java.util.Collection getGeometryConflicts()
Returns a collection of all geometry conflicts as a combination of GeometryDescriptorItems and GeometryDescriptors

Returns:
a collection of all style conflicts as a combination of GeometryDescriptorItems and GeometryDescriptors

createDefaultRenameMaps

public void createDefaultRenameMaps(LayoutController lc)
Creates default rename maps for conflicting names in styles, geometries, layouts, images and rules.

Parameters:
lc - The layout controller that is used to generate valid names for layout contexts

containsUnconflictingStyles

public boolean containsUnconflictingStyles()
Returns true, if the styles contain items that are not in the pool and so will be handled as unconflicting styles and applied in any case.

Returns:
true, if the styles contain items that are not in the pool and so will be handled as unconflicting styles and applied in any case.

areGeometriesDisposable

public boolean areGeometriesDisposable()
This setting determines whether the geometries can be disposed or not

Returns:
true, if the geometries can be disposed

setGeometriesDisposable

public void setGeometriesDisposable(boolean areGeometriesDisposable)
This setting determines whether the geometries can be disposed or not

Parameters:
areGeometriesDisposable - true, if the geometries can be disposed


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.