|
From: <mcu...@us...> - 2007-08-08 00:31:32
|
Revision: 1078
http://orm.svn.sourceforge.net/orm/?rev=1078&view=rev
Author: mcurland
Date: 2007-08-07 17:31:35 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
Adding internal uniqueness constraints (and a number of other shape actions) after a file reload caused the FactTypeShape to lose its center-of-rolesbox anchor point. Added fixup listener to reset the RolesPosition property. refs #218
Modified Paths:
--------------
trunk/ORMModel/ObjectModel/ORMModel.cs
trunk/ORMModel/ShapeModel/FactTypeShape.cs
trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs
trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs
trunk/ORMModel/ShapeModel/ORMShape.dsl
Modified: trunk/ORMModel/ObjectModel/ORMModel.cs
===================================================================
--- trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:27:57 UTC (rev 1077)
+++ trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:31:35 UTC (rev 1078)
@@ -62,10 +62,14 @@
/// </summary>
ValidateErrors = 500,
/// <summary>
+ /// Fixup stored presentation elements
+ /// </summary>
+ ModifyStoredPresentationElements = 700,
+ /// <summary>
/// Add any presentation elements that are implicit and not
/// serialized with the model.
/// </summary>
- AddImplicitPresentationElements = 600,
+ AddImplicitPresentationElements = 700,
}
#endregion // ORMDeserializationFixupPhase enum
public partial class ORMModel
Modified: trunk/ORMModel/ShapeModel/FactTypeShape.cs
===================================================================
--- trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:27:57 UTC (rev 1077)
+++ trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:31:35 UTC (rev 1078)
@@ -5284,6 +5284,41 @@
}
}
#endregion // Derivation Rules
+ #region Deserialization Fixup
+ /// <summary>
+ /// Return a deserialization fixup listener. The listener
+ /// ensures that non-serialized information on a FactTypeShape is properly restored
+ /// </summary>
+ public static IDeserializationFixupListener FixupListener
+ {
+ get
+ {
+ return new FactTypeShapeFixupListener();
+ }
+ }
+ /// <summary>
+ /// A listener to reset non-serialized FactTypeShape properties.
+ /// </summary>
+ private sealed class FactTypeShapeFixupListener : DeserializationFixupListener<FactTypeShape>
+ {
+ /// <summary>
+ /// Create a new FactTypeShapeFixupListener
+ /// </summary>
+ public FactTypeShapeFixupListener()
+ : base((int)ORMDeserializationFixupPhase.ModifyStoredPresentationElements)
+ {
+ }
+ /// <summary>
+ /// Update the non-serialized RolesPosition property, used to keep a FactTypeShape
+ /// anchored on the center of the roles box
+ /// </summary>
+ protected sealed override void ProcessElement(FactTypeShape element, Store store, INotifyElementAdded notifyAdded)
+ {
+ PointD centerPoint = RolesShape.GetBounds(element).Center;
+ element.RolesPosition = (element.DisplayOrientation != DisplayOrientation.Horizontal) ? centerPoint.X : centerPoint.Y;
+ }
+ }
+ #endregion Deserialization Fixup
}
#endregion // FactTypeShape class
#region ObjectifiedFactTypeNameShape class
Modified: trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs
===================================================================
--- trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs 2007-08-08 00:27:57 UTC (rev 1077)
+++ trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs 2007-08-08 00:31:35 UTC (rev 1078)
@@ -818,8 +818,9 @@
[DslDesign::DisplayNameResource("Neumont.Tools.ORM.ShapeModel.FactTypeShape/RolesPosition.DisplayName", typeof(global::Neumont.Tools.ORM.ShapeModel.ORMShapeDomainModel), "Neumont.Tools.ORM.GeneratedCode.ShapeDomainModelResx")]
[DslDesign::DescriptionResource("Neumont.Tools.ORM.ShapeModel.FactTypeShape/RolesPosition.Description", typeof(global::Neumont.Tools.ORM.ShapeModel.ORMShapeDomainModel), "Neumont.Tools.ORM.GeneratedCode.ShapeDomainModelResx")]
[global::System.ComponentModel.Browsable(false)]
+ [global::System.ComponentModel.ReadOnly(true)]
[DslModeling::DomainObjectId("89244439-fbb1-4deb-bff3-69d47cb90a6b")]
- public global::System.Double RolesPosition
+ private global::System.Double RolesPosition
{
[global::System.Diagnostics.DebuggerStepThrough]
get
Modified: trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs
===================================================================
--- trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:27:57 UTC (rev 1077)
+++ trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:31:35 UTC (rev 1078)
@@ -39,6 +39,7 @@
yield return new DisplayRoleNameFixupListener();
yield return new DisplayUnaryFactTypeFixupListener();
yield return new DisplayModelNoteLinksFixupListener();
+ yield return FactTypeShape.FixupListener;
}
}
IEnumerable<IDeserializationFixupListener> IDeserializationFixupListenerProvider.DeserializationFixupListenerCollection
Modified: trunk/ORMModel/ShapeModel/ORMShape.dsl
===================================================================
--- trunk/ORMModel/ShapeModel/ORMShape.dsl 2007-08-08 00:27:57 UTC (rev 1077)
+++ trunk/ORMModel/ShapeModel/ORMShape.dsl 2007-08-08 00:31:35 UTC (rev 1078)
@@ -152,7 +152,7 @@
<DomainEnumerationMoniker Name="DisplayOrientation"/>
</Type>
</DomainProperty>
- <DomainProperty Name="RolesPosition" Id="89244439-FBB1-4DEB-BFF3-69D47CB90A6B" DefaultValue="0" IsBrowsable="false">
+ <DomainProperty Name="RolesPosition" Id="89244439-FBB1-4DEB-BFF3-69D47CB90A6B" DefaultValue="0" IsBrowsable="false" GetterAccessModifier="Private" SetterAccessModifier="Private">
<Type>
<ExternalTypeMoniker Name="/System/Double"/>
</Type>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mcu...@us...> - 2007-08-08 00:38:30
|
Revision: 1079
http://orm.svn.sourceforge.net/orm/?rev=1079&view=rev
Author: mcurland
Date: 2007-08-07 17:38:27 -0700 (Tue, 07 Aug 2007)
Log Message:
-----------
Display unary FactType with a unary glyph in the model browser and correctly initialize FactTypeShape for unary dropped off the model browser. Required moving creation of single-role role display order for unaries to OnChildConfiguring. Doing this early eliminates the need for subsequent calls to AutoResize and for the fixup listener.
Also made some of the fixup rules more robust for cases where the element is deleted before the shape can be created. refs #296
Modified Paths:
--------------
trunk/ORMModel/ObjectModel/ORMModel.cs
trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs
trunk/ORMModel/ShapeModel/FactTypeShape.cs
trunk/ORMModel/ShapeModel/ORMDiagram.cs
trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs
trunk/ORMModel/ShapeModel/ViewFixupRules.cs
trunk/ORMModel/Transforms/SerializationExtensions.xsd
Modified: trunk/ORMModel/ObjectModel/ORMModel.cs
===================================================================
--- trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:31:35 UTC (rev 1078)
+++ trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:38:27 UTC (rev 1079)
@@ -64,7 +64,7 @@
/// <summary>
/// Fixup stored presentation elements
/// </summary>
- ModifyStoredPresentationElements = 700,
+ ModifyStoredPresentationElements = 600,
/// <summary>
/// Add any presentation elements that are implicit and not
/// serialized with the model.
Modified: trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs
===================================================================
--- trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs 2007-08-08 00:31:35 UTC (rev 1078)
+++ trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs 2007-08-08 00:38:27 UTC (rev 1079)
@@ -194,12 +194,14 @@
}
else
{
- switch (RoleCollection.Count)
+ LinkedElementCollection<RoleBase> roles = RoleCollection;
+ switch (roles.Count)
{
case 1:
+ // This case should not get hit with unary binarization, but it isn't hurting anything
return (int)SurveyQuestionGlyph.UnaryFactType;
case 2:
- return (int)SurveyQuestionGlyph.BinaryFactType;
+ return GetUnaryRoleIndex(roles).HasValue ? (int)SurveyQuestionGlyph.UnaryFactType : (int)SurveyQuestionGlyph.BinaryFactType;
case 3:
return (int)SurveyQuestionGlyph.TernaryFactType;
default:
Modified: trunk/ORMModel/ShapeModel/FactTypeShape.cs
===================================================================
--- trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:31:35 UTC (rev 1078)
+++ trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:38:27 UTC (rev 1079)
@@ -578,6 +578,41 @@
return displayRoles;
}
/// <summary>
+ /// Standard override
+ /// </summary>
+ public override void ConfiguringAsChildOf(NodeShape parent, bool createdDuringViewFixup)
+ {
+ /// Make sure the factType shape is prepared to display as a unary
+ FactType factType;
+ Role unaryRole;
+ if (null != (factType = AssociatedFactType) &&
+ null != (unaryRole = factType.UnaryRole))
+ {
+ // Create a RoleDisplayOrder for Unary FactTypes.
+ LinkedElementCollection<RoleBase> displayRoles = RoleDisplayOrderCollection;
+ switch (displayRoles.Count)
+ {
+ case 0:
+ // The RoleDisplayOrder is empty, so we don't need to do anything.
+ break;
+ case 1:
+ // We already have only one role in the RoleDisplayOrder, so all
+ // we have to do is make sure it is the right one.
+ if (displayRoles[0] != unaryRole)
+ {
+ displayRoles[0] = unaryRole;
+ }
+ return;
+ default:
+ // We have more than one role in the RoleDisplayOrder, so we
+ // have to clear it.
+ displayRoles.Clear();
+ break;
+ }
+ displayRoles.Add(unaryRole);
+ }
+ }
+ /// <summary>
/// Retrieve an editable version of the <see cref="DisplayedRoleOrder"/> property. Editing
/// DisplayedRoleOrder directly can change the role order in the associated FactType. Using
/// this method to retrieve the collection ensures it will only be modified on the shape.
@@ -5093,7 +5128,7 @@
FactTypeShape shape = pel as FactTypeShape;
if (shape != null)
{
- // When a binarized Unary Fact is not longer a unary, clear the displayed role orders
+ // When a binarized Unary Fact is no longer a unary, clear the displayed role orders
shape.RoleDisplayOrderCollection.Clear();
shape.AutoResize();
}
Modified: trunk/ORMModel/ShapeModel/ORMDiagram.cs
===================================================================
--- trunk/ORMModel/ShapeModel/ORMDiagram.cs 2007-08-08 00:31:35 UTC (rev 1078)
+++ trunk/ORMModel/ShapeModel/ORMDiagram.cs 2007-08-08 00:38:27 UTC (rev 1079)
@@ -255,7 +255,6 @@
int roleCount = roleCollection.Count;
for (int i = 0; i < roleCount; ++i)
{
- //Role role = roleBase.Role;
Role role = roleCollection[i].Role;
if (!duplicateShape)
Modified: trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs
===================================================================
--- trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:31:35 UTC (rev 1078)
+++ trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:38:27 UTC (rev 1079)
@@ -37,7 +37,6 @@
yield return new DisplayRoleValueConstraintFixupListener();
yield return new DisplayValueTypeValueConstraintFixupListener();
yield return new DisplayRoleNameFixupListener();
- yield return new DisplayUnaryFactTypeFixupListener();
yield return new DisplayModelNoteLinksFixupListener();
yield return FactTypeShape.FixupListener;
}
Modified: trunk/ORMModel/ShapeModel/ViewFixupRules.cs
===================================================================
--- trunk/ORMModel/ShapeModel/ViewFixupRules.cs 2007-08-08 00:31:35 UTC (rev 1078)
+++ trunk/ORMModel/ShapeModel/ViewFixupRules.cs 2007-08-08 00:38:27 UTC (rev 1079)
@@ -439,9 +439,9 @@
FactTypeShape shape = pel as FactTypeShape;
if (shape != null)
{
- if (factType.UnaryRole != null)
+ Role unaryRole = factType.UnaryRole;
+ if (unaryRole != null)
{
- Role unaryRole = factType.UnaryRole;
LinkedElementCollection<RoleBase> displayOrder = shape.RoleDisplayOrderCollection;
if (!displayOrder.Contains(unaryRole))
{
@@ -515,49 +515,48 @@
// Make sure the object type, fact type, and link
// are displayed on the diagram
FactType associatedFact;
- if ((associatedFact = link.PlayedRole.FactType) != null)
+ ObjectType rolePlayer;
+ ORMModel model;
+ if (!link.IsDeleted &&
+ null != (associatedFact = link.PlayedRole.FactType) &&
+ null != (model = (rolePlayer = link.RolePlayer).Model))
{
- ObjectType rolePlayer = link.RolePlayer;
- ORMModel model;
- if ((model = rolePlayer.Model) != null)
+ FactType nestedFact;
+ if (FactTypeShape.ShouldDrawObjectification(nestedFact = rolePlayer.NestedFactType))
{
- FactType nestedFact;
- if (FactTypeShape.ShouldDrawObjectification(nestedFact = rolePlayer.NestedFactType))
- {
- Diagram.FixUpDiagram(model, nestedFact);
- Diagram.FixUpDiagram(nestedFact, rolePlayer);
- }
- else
- {
- Diagram.FixUpDiagram(model, rolePlayer);
- }
- Diagram.FixUpDiagram(model, associatedFact);
+ Diagram.FixUpDiagram(model, nestedFact);
+ Diagram.FixUpDiagram(nestedFact, rolePlayer);
+ }
+ else
+ {
+ Diagram.FixUpDiagram(model, rolePlayer);
+ }
+ Diagram.FixUpDiagram(model, associatedFact);
- object AllowMultipleShapes;
- Dictionary<object, object> topLevelContextInfo;
- bool containedAllowMultipleShapes;
- if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes)))
- {
- topLevelContextInfo.Add(AllowMultipleShapes, null);
- }
+ object AllowMultipleShapes;
+ Dictionary<object, object> topLevelContextInfo;
+ bool containedAllowMultipleShapes;
+ if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes)))
+ {
+ topLevelContextInfo.Add(AllowMultipleShapes, null);
+ }
- foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId))
+ foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId))
+ {
+ ORMDiagram diagram;
+ if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null)
{
- ORMDiagram diagram;
- if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null)
+ //add a link shape for each fact type shape on the diagram for the played role
+ foreach (FactTypeShape shapeElement in MultiShapeUtility.FindAllShapesForElement<FactTypeShape>(diagram, associatedFact))
{
- //add a link shape for each fact type shape on the diagram for the played role
- foreach (FactTypeShape shapeElement in MultiShapeUtility.FindAllShapesForElement<FactTypeShape>(diagram, associatedFact))
- {
- diagram.FixUpLocalDiagram(link);
- }
+ diagram.FixUpLocalDiagram(link);
}
}
+ }
- if (!containedAllowMultipleShapes)
- {
- topLevelContextInfo.Remove(AllowMultipleShapes);
- }
+ if (!containedAllowMultipleShapes)
+ {
+ topLevelContextInfo.Remove(AllowMultipleShapes);
}
}
}
@@ -844,45 +843,46 @@
// are displayed on the diagram
IFactConstraint ifc = link as IFactConstraint;
IConstraint constraint = ifc.Constraint;
- FactType factType = ifc.FactType;
- if (factType != null)
+ FactType factType;
+ ORMModel model;
+ ModelElement constraintElement = (ModelElement)constraint;
+ if (!constraintElement.IsDeleted &&
+ null != (factType = ifc.FactType) &&
+ !factType.IsDeleted &&
+ null != (model = factType.Model))
{
- ORMModel model = factType.Model;
- if (model != null)
- {
- Debug.Assert(model == constraint.Model);
+ Debug.Assert(model == constraint.Model);
- Diagram.FixUpDiagram(model, constraint as ModelElement);
- Diagram.FixUpDiagram(model, factType);
+ Diagram.FixUpDiagram(model, constraint as ModelElement);
+ Diagram.FixUpDiagram(model, factType);
- object AllowMultipleShapes;
- Dictionary<object, object> topLevelContextInfo;
- bool containedAllowMultipleShapes;
- if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes)))
- {
- topLevelContextInfo.Add(AllowMultipleShapes, null);
- }
+ object AllowMultipleShapes;
+ Dictionary<object, object> topLevelContextInfo;
+ bool containedAllowMultipleShapes;
+ if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes)))
+ {
+ topLevelContextInfo.Add(AllowMultipleShapes, null);
+ }
- foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId))
+ foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId))
+ {
+ ORMDiagram diagram;
+ if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null)
{
- ORMDiagram diagram;
- if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null)
+ //add a link shape for each constraint shape
+ foreach (ExternalConstraintShape shapeElement in MultiShapeUtility.FindAllShapesForElement<ExternalConstraintShape>(diagram, constraint as ModelElement))
{
- //add a link shape for each constraint shape
- foreach (ExternalConstraintShape shapeElement in MultiShapeUtility.FindAllShapesForElement<ExternalConstraintShape>(diagram, constraint as ModelElement))
+ if (null == diagram.FixUpLocalDiagram(link))
{
- if (null == diagram.FixUpLocalDiagram(link))
- {
- shapeElement.Delete();
- }
+ shapeElement.Delete();
}
}
}
+ }
- if (!containedAllowMultipleShapes)
- {
- topLevelContextInfo.Remove(AllowMultipleShapes);
- }
+ if (!containedAllowMultipleShapes)
+ {
+ topLevelContextInfo.Remove(AllowMultipleShapes);
}
}
}
@@ -1016,59 +1016,6 @@
}
}
#endregion // DisplayRolePlayersFixupListener class
- #region DisplayUnaryFactTypeFixupListener class
- /// <summary>
- /// Processes Unary FactTypes so that they display the correct number of roles
- /// </summary>
- private sealed class DisplayUnaryFactTypeFixupListener : DeserializationFixupListener<FactType>
- {
- /// <summary>
- /// Create a new DisplayUnaryFactTypeFixupListener
- /// </summary>
- public DisplayUnaryFactTypeFixupListener()
- : base((int)ORMDeserializationFixupPhase.AddImplicitPresentationElements)
- {
- }
-
- protected override void ProcessElement(FactType element, Store store, INotifyElementAdded notifyAdded)
- {
- Role unaryRole = element.UnaryRole;
- if (unaryRole != null)
- {
- foreach (PresentationElement pel in PresentationViewsSubject.GetPresentation(element))
- {
- FactTypeShape shape = pel as FactTypeShape;
- if (shape != null)
- {
- // Create a RoleDisplayOrder for Unary FactTypes.
- LinkedElementCollection<RoleBase> roles = shape.RoleDisplayOrderCollection;
- switch (roles.Count)
- {
- case 0:
- // The RoleDisplayOrder is empty, so we don't need to do anything.
- break;
- case 1:
- // We already have only one role in the RoleDisplayOrder, so all
- // we have to do is make sure it is the right one.
- if (roles[0] != unaryRole)
- {
- roles[0] = unaryRole;
- }
- continue;
- default:
- // We have more than one role in the RoleDisplayOrder, so we
- // have to clear it.
- roles.Clear();
- break;
- }
- roles.Add(unaryRole);
- shape.AutoResize();
- }
- }
- }
- }
- }
- #endregion // DisplayUnaryFactTypeFixupListener class
#region ModelNote fixup
#region ModelNoteAddedRule
/// <summary>
Modified: trunk/ORMModel/Transforms/SerializationExtensions.xsd
===================================================================
--- trunk/ORMModel/Transforms/SerializationExtensions.xsd 2007-08-08 00:31:35 UTC (rev 1078)
+++ trunk/ORMModel/Transforms/SerializationExtensions.xsd 2007-08-08 00:38:27 UTC (rev 1079)
@@ -25,6 +25,7 @@
</xs:appinfo>
</xs:annotation>
+ <xs:import namespace="http://schemas.neumont.edu/CodeGeneration/PLiX"/>
<xs:simpleType name="ElementWriteStyle">
<xs:annotation>
<xs:documentation>How to write and element.</xs:documentation>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mcu...@us...> - 2007-09-20 20:51:26
|
Revision: 1139
http://orm.svn.sourceforge.net/orm/?rev=1139&view=rev
Author: mcurland
Date: 2007-09-20 13:51:23 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
Display/accept entry of 'Unbounded' instead the underlying 0 value for the FrequencyConstraint.MaxFrequency property. fixes #341
Also added instructions to Note property description text.
Modified Paths:
--------------
trunk/ORMModel/ORMModel.csproj
trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs
trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx
trunk/ORMModel/ObjectModel/ORMCore.dsl
trunk/ORMModel/ObjectModel/ORMModel.resx
trunk/ORMModel/Resources/ResourceStringsGenerator.cs
trunk/ORMModel/Resources/ResourceStringsGenerator.xml
Added Paths:
-----------
trunk/ORMModel/ObjectModel/Design/Editors/FrequencyConstraintMaxPicker.cs
trunk/ORMModel/ObjectModel/Design/FrequencyConstraintBoundConverter.cs
Modified: trunk/ORMModel/ORMModel.csproj
===================================================================
--- trunk/ORMModel/ORMModel.csproj 2007-09-20 20:48:24 UTC (rev 1138)
+++ trunk/ORMModel/ORMModel.csproj 2007-09-20 20:51:23 UTC (rev 1139)
@@ -417,6 +417,8 @@
</Compile>
<Compile Include="Framework\Shell\DiagramMenuDisplay.cs" />
<Compile Include="Framework\Shell\SerializationEngine.cs" />
+ <Compile Include="ObjectModel\Design\FrequencyConstraintBoundConverter.cs" />
+ <Compile Include="ObjectModel\Design\Editors\FrequencyConstraintMaxPicker.cs" />
<Compile Include="ObjectModel\Design\ObjectificationRolePlayerPropertyDescriptor.cs" />
<Compile Include="ObjectModel\Design\Editors\ModelErrorDisplayFilterEditor.cs" />
<Compile Include="ObjectModel\ModelErrorDisplayFilter.cs" />
Added: trunk/ORMModel/ObjectModel/Design/Editors/FrequencyConstraintMaxPicker.cs
===================================================================
--- trunk/ORMModel/ObjectModel/Design/Editors/FrequencyConstraintMaxPicker.cs (rev 0)
+++ trunk/ORMModel/ObjectModel/Design/Editors/FrequencyConstraintMaxPicker.cs 2007-09-20 20:51:23 UTC (rev 1139)
@@ -0,0 +1,69 @@
+#region Common Public License Copyright Notice
+/**************************************************************************\
+* Neumont Object-Role Modeling Architect for Visual Studio *
+* *
+* Copyright \xA9 Neumont University. All rights reserved. *
+* *
+* The use and distribution terms for this software are covered by the *
+* Common Public License 1.0 (http://opensource.org/licenses/cpl) which *
+* can be found in the file CPL.txt at the root of this distribution. *
+* By using this software in any fashion, you are agreeing to be bound by *
+* the terms of this license. *
+* *
+* You must not remove this notice, or any other, from this software. *
+\**************************************************************************/
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.Globalization;
+using System.Security.Permissions;
+using Microsoft.VisualStudio.Modeling;
+using Neumont.Tools.Modeling;
+using Neumont.Tools.Modeling.Design;
+using Neumont.Tools.ORM.ObjectModel;
+
+namespace Neumont.Tools.ORM.ObjectModel.Design
+{
+ #region FrequencyConstraintMaxPicker class
+ /// <summary>
+ /// An element picker to hide the fact that 0 means unbounded for the <see cref="FrequencyConstraint.MaxFrequency"/> property
+ /// </summary>
+ [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
+ public sealed class FrequencyConstraintMaxPicker : ElementPicker<FrequencyConstraintMaxPicker>
+ {
+ private int myStartValue;
+ /// <summary>
+ /// Returns the Unbounded value, as well as the current value if it is not unbounded
+ /// </summary>
+ protected sealed override IList GetContentList(ITypeDescriptorContext context, object value)
+ {
+ int intValue = (int)value;
+ myStartValue = intValue;
+ return (intValue == 0) ?
+ new string[]{ResourceStrings.FrequencyConstraintUnboundedMaxValueText} :
+ new string[]{intValue.ToString(CultureInfo.CurrentCulture), ResourceStrings.FrequencyConstraintUnboundedMaxValueText};
+ }
+ /// <summary>
+ /// Translate a value back to the integer. This will be either the starting value or 0, meaning unbounded
+ /// </summary>
+ protected override object TranslateFromDisplayObject(int newIndex, object newObject)
+ {
+ return (newIndex == 1) ? 0 : myStartValue;
+ }
+ /// <summary>
+ /// Get the display object for the current value
+ /// </summary>
+ protected override object TranslateToDisplayObject(object initialObject, IList contentList)
+ {
+ int value = (int)initialObject;
+ return (value == 0 && contentList.Count == 2) ? contentList[1] : contentList[0];
+ }
+ }
+ #endregion // FrequencyConstraintMaxPicker class
+}
Added: trunk/ORMModel/ObjectModel/Design/FrequencyConstraintBoundConverter.cs
===================================================================
--- trunk/ORMModel/ObjectModel/Design/FrequencyConstraintBoundConverter.cs (rev 0)
+++ trunk/ORMModel/ObjectModel/Design/FrequencyConstraintBoundConverter.cs 2007-09-20 20:51:23 UTC (rev 1139)
@@ -0,0 +1,95 @@
+#region Common Public License Copyright Notice
+/**************************************************************************\
+* Neumont Object-Role Modeling Architect for Visual Studio *
+* *
+* Copyright \xA9 Neumont University. All rights reserved. *
+* *
+* The use and distribution terms for this software are covered by the *
+* Common Public License 1.0 (http://opensource.org/licenses/cpl) which *
+* can be found in the file CPL.txt at the root of this distribution. *
+* By using this software in any fashion, you are agreeing to be bound by *
+* the terms of this license. *
+* *
+* You must not remove this notice, or any other, from this software. *
+\**************************************************************************/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.Security.Permissions;
+using Microsoft.VisualStudio.Modeling;
+using Microsoft.VisualStudio.Modeling.Design;
+using Neumont.Tools.Modeling.Design;
+using Neumont.Tools.ORM.ObjectModel;
+
+namespace Neumont.Tools.ORM.ObjectModel.Design
+{
+ /// <summary>
+ /// <see cref="TypeConverter"/> for <see cref="FrequencyConstraint.MinFrequency"/>s.
+ /// </summary>
+ [HostProtection(SecurityAction.LinkDemand, SharedState = true)]
+ public class FrequencyConstraintMinConverter : TypeConverter
+ {
+ /// <summary>
+ /// Standard override. Allow string conversion.
+ /// </summary>
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ return sourceType == typeof(string);
+ }
+ /// <summary>
+ /// Standard override. Map any value less than 1 to 1.
+ /// </summary>
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ string stringValue = (value == null) ? "" : value.ToString();
+ int result = int.Parse(stringValue);
+ return (result > 1) ? result : 1;
+ }
+ }
+ /// <summary>
+ /// <see cref="TypeConverter"/> for <see cref="FrequencyConstraint.MaxFrequency"/>s.
+ /// </summary>
+ [HostProtection(SecurityAction.LinkDemand, SharedState = true)]
+ public class FrequencyConstraintMaxConverter : TypeConverter
+ {
+ /// <summary>
+ /// Standard override. Allow string conversion.
+ /// </summary>
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ return sourceType == typeof(string);
+ }
+ /// <summary>
+ /// Standard override. Map any value less than 1 to 1.
+ /// </summary>
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ string stringValue = (value == null) ? "" : value.ToString();
+ if (0 == string.Compare(stringValue, ResourceStrings.FrequencyConstraintUnboundedMaxValueText, StringComparison.CurrentCultureIgnoreCase))
+ {
+ return 0;
+ }
+ int result = int.Parse(stringValue);
+ return (result > 0) ? result : 0;
+ }
+ /// <summary>
+ /// Standard override. Show 'Unbounded' for the 0 value.
+ /// </summary>
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(string))
+ {
+ int intValue = (int)value;
+ if (intValue == 0)
+ {
+ return ResourceStrings.FrequencyConstraintUnboundedMaxValueText;
+ }
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
Modified: trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs
===================================================================
--- trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs 2007-09-20 20:48:24 UTC (rev 1138)
+++ trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs 2007-09-20 20:51:23 UTC (rev 1139)
@@ -1384,7 +1384,8 @@
/// <summary>
/// Gets or sets the value of NoteText domain property.
- /// Description for Neumont.Tools.ORM.ObjectModel.ObjectType.Note
+ /// A note to associate with this ObjectType. To insert new lines, use Control-Enter
+ /// in the dropdown editor, or open the 'ORM Notes Editor' toolwindow.
/// </summary>
[global::System.ComponentModel.Editor(typeof(global::Neumont.Tools.Modeling.Design.MultilineTextEditor<global::Neumont.Tools.ORM.ObjectModel.Note>), typeof(global::System.Drawing.Design.UITypeEditor))]
[global::System.ComponentModel.MergableProperty(false)]
@@ -3086,7 +3087,8 @@
/// <summary>
/// Gets or sets the value of NoteText domain property.
- /// Description for Neumont.Tools.ORM.ObjectModel.FactType.Note
+ /// A note to associate with this FactType. To insert new lines, use Control-Enter
+ /// in the dropdown editor, or open the 'ORM Notes Editor' toolwindow.
/// </summary>
[global::System.ComponentModel.Editor(typeof(global::Neumont.Tools.Modeling.Design.MultilineTextEditor<global::Neumont.Tools.ORM.ObjectModel.Note>), typeof(global::System.Drawing.Design.UITypeEditor))]
[global::System.ComponentModel.MergableProperty(false)]
@@ -6247,6 +6249,7 @@
/// Gets or sets the value of MinFrequency domain property.
/// Description for Neumont.Tools.ORM.ObjectModel.FrequencyConstraint.MinFrequency
/// </summary>
+ [global::System.ComponentModel.TypeConverter(typeof(global::Neumont.Tools.ORM.ObjectModel.Design.FrequencyConstraintMinConverter))]
[DslDesign::DisplayNameResource("Neumont.Tools.ORM.ObjectModel.FrequencyConstraint/MinFrequency.DisplayName", typeof(global::Neumont.Tools.ORM.ObjectModel.ORMCoreDomainModel), "Neumont.Tools.ORM.GeneratedCode.CoreDomainModelResx")]
[DslDesign::DescriptionResource("Neumont.Tools.ORM.ObjectModel.FrequencyConstraint/MinFrequency.Description", typeof(global::Neumont.Tools.ORM.ObjectModel.ORMCoreDomainModel), "Neumont.Tools.ORM.GeneratedCode.CoreDomainModelResx")]
[global::System.ComponentModel.DefaultValue(1)]
@@ -6335,6 +6338,8 @@
/// Gets or sets the value of MaxFrequency domain property.
/// Description for Neumont.Tools.ORM.ObjectModel.FrequencyConstraint.MaxFrequency
/// </summary>
+ [global::System.ComponentModel.Editor(typeof(global::Neumont.Tools.ORM.ObjectModel.Design.FrequencyConstraintMaxPicker), typeof(global::System.Drawing.Design.UITypeEditor))]
+ [global::System.ComponentModel.TypeConverter(typeof(global::Neumont.Tools.ORM.ObjectModel.Design.FrequencyConstraintMaxConverter))]
[DslDesign::DisplayNameResource("Neumont.Tools.ORM.ObjectModel.FrequencyConstraint/MaxFrequency.DisplayName", typeof(global::Neumont.Tools.ORM.ObjectModel.ORMCoreDomainModel), "Neumont.Tools.ORM.GeneratedCode.CoreDomainModelResx")]
[DslDesign::DescriptionResource("Neumont.Tools.ORM.ObjectModel.FrequencyConstraint/MaxFrequency.Description", typeof(global::Neumont.Tools.ORM.ObjectModel.ORMCoreDomainModel), "Neumont.Tools.ORM.GeneratedCode.CoreDomainModelResx")]
[global::System.ComponentModel.DefaultValue(2)]
@@ -13876,7 +13881,8 @@
/// <summary>
/// Gets or sets the value of Text domain property.
- /// Description for Neumont.Tools.ORM.ObjectModel.Note.Note
+ /// The note contents. To insert new lines, use Control-Enter in the dropdown
+ /// editor, or open the 'ORM Notes Editor' toolwindow.
/// </summary>
[global::System.ComponentModel.Editor(typeof(global::Neumont.Tools.Modeling.Design.MultilineTextEditor<global::Neumont.Tools.ORM.ObjectModel.Note>), typeof(global::System.Drawing.Design.UITypeEditor))]
[global::System.ComponentModel.MergableProperty(false)]
Modified: trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx
===================================================================
--- trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx 2007-09-20 20:48:24 UTC (rev 1138)
+++ trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx 2007-09-20 20:51:23 UTC (rev 1139)
@@ -278,7 +278,7 @@
<comment>DisplayName for DomainProperty 'IsExternal' on DomainClass 'ObjectType'</comment>
</data>
<data name="Neumont.Tools.ORM.ObjectModel.ObjectType/NoteText.Description" xml:space="preserve">
- <value>Description for Neumont.Tools.ORM.ObjectModel.ObjectType.Note</value>
+ <value>A note to associate with this ObjectType. To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' toolwindow.</value>
<comment>Description for DomainProperty 'NoteText' on DomainClass 'ObjectType'</comment>
</data>
<data name="Neumont.Tools.ORM.ObjectModel.ObjectType/NoteText.DisplayName" xml:space="preserve">
@@ -398,7 +398,7 @@
<comment>DisplayName for DomainProperty 'IsExternal' on DomainClass 'FactType'</comment>
</data>
<data name="Neumont.Tools.ORM.ObjectModel.FactType/NoteText.Description" xml:space="preserve">
- <value>Description for Neumont.Tools.ORM.ObjectModel.FactType.Note</value>
+ <value>A note to associate with this FactType. To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' toolwindow.</value>
<comment>Description for DomainProperty 'NoteText' on DomainClass 'FactType'</comment>
</data>
<data name="Neumont.Tools.ORM.ObjectModel.FactType/NoteText.DisplayName" xml:space="preserve">
@@ -1550,7 +1550,7 @@
<comment>DisplayName for DomainClass 'Note'</comment>
</data>
<data name="Neumont.Tools.ORM.ObjectModel.Note/Text.Description" xml:space="preserve">
- <value>Description for Neumont.Tools.ORM.ObjectModel.Note.Note</value>
+ <value>The note contents. To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' toolwindow.</value>
<comment>Description for DomainProperty 'Text' on DomainClass 'Note'</comment>
</data>
<data name="Neumont.Tools.ORM.ObjectModel.Note/Text.DisplayName" xml:space="preserve">
Modified: trunk/ORMModel/ObjectModel/ORMCore.dsl
===================================================================
--- trunk/ORMModel/ObjectModel/ORMCore.dsl 2007-09-20 20:48:24 UTC (rev 1138)
+++ trunk/ORMModel/ObjectModel/ORMCore.dsl 2007-09-20 20:51:23 UTC (rev 1139)
@@ -202,7 +202,7 @@
<ExternalTypeMoniker Name="/System/Boolean"/>
</Type>
</DomainProperty>
- <DomainProperty Name="NoteText" DefaultValue="" DisplayName="Note" Id="17C4E23D-CA49-4329-982F-48F4EFCA23BD" Kind="CustomStorage">
+ <DomainProperty Name="NoteText" DefaultValue="" DisplayName="Note" Description="A note to associate with this ObjectType. To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' toolwindow." Id="17C4E23D-CA49-4329-982F-48F4EFCA23BD" Kind="CustomStorage">
<Attributes>
<ClrAttribute Name="global::System.ComponentModel.Editor">
<Parameters>
@@ -328,7 +328,7 @@
<ExternalTypeMoniker Name="/System/Boolean"/>
</Type>
</DomainProperty>
- <DomainProperty Name="NoteText" DefaultValue="" DisplayName="Note" Id="AF6200B1-068D-434A-98D3-44E872B921BD" Kind="CustomStorage">
+ <DomainProperty Name="NoteText" DefaultValue="" DisplayName="Note" Description="A note to associate with this FactType. To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' toolwindow." Id="AF6200B1-068D-434A-98D3-44E872B921BD" Kind="CustomStorage">
<Attributes>
<ClrAttribute Name="global::System.ComponentModel.Editor">
<Parameters>
@@ -593,11 +593,31 @@
</BaseClass>
<Properties>
<DomainProperty Name="MinFrequency" DefaultValue="1" DisplayName="MinFrequency" Id="2D48D3CA-564D-459E-A701-4209A12C4783">
+ <Attributes>
+ <ClrAttribute Name="global::System.ComponentModel.TypeConverter">
+ <Parameters>
+ <AttributeParameter Value="typeof(global::Neumont.Tools.ORM.ObjectModel.Design.FrequencyConstraintMinConverter)"/>
+ </Parameters>
+ </ClrAttribute>
+ </Attributes>
<Type>
<ExternalTypeMoniker Name="/System/Int32"/>
</Type>
</DomainProperty>
<DomainProperty Name="MaxFrequency" DefaultValue="2" DisplayName="MaxFrequency" Id="F46D9200-3602-435C-B852-C53BE10D99C6">
+ <Attributes>
+ <ClrAttribute Name="global::System.ComponentModel.Editor">
+ <Parameters>
+ <AttributeParameter Value="typeof(global::Neumont.Tools.ORM.ObjectModel.Design.FrequencyConstraintMaxPicker)"/>
+ <AttributeParameter Value="typeof(global::System.Drawing.Design.UITypeEditor)"/>
+ </Parameters>
+ </ClrAttribute>
+ <ClrAttribute Name="global::System.ComponentModel.TypeConverter">
+ <Parameters>
+ <AttributeParameter Value="typeof(global::Neumont.Tools.ORM.ObjectModel.Design.FrequencyConstraintMaxConverter)"/>
+ </Parameters>
+ </ClrAttribute>
+ </Attributes>
<Type>
<ExternalTypeMoniker Name="/System/Int32"/>
</Type>
@@ -1334,7 +1354,7 @@
<DomainClassMoniker Name="ORMModelElement"/>
</BaseClass>
<Properties>
- <DomainProperty Name="Text" DefaultValue="" DisplayName="Note" Id="0EF3BC12-45FF-46A8-B325-CDFCC105A1E1">
+ <DomainProperty Name="Text" DefaultValue="" Description="The note contents. To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' toolwindow." DisplayName="Note" Id="0EF3BC12-45FF-46A8-B325-CDFCC105A1E1">
<Attributes>
<ClrAttribute Name="global::System.ComponentModel.Editor">
<Parameters>
Modified: trunk/ORMModel/ObjectModel/ORMModel.resx
===================================================================
--- trunk/ORMModel/ObjectModel/ORMModel.resx 2007-09-20 20:48:24 UTC (rev 1138)
+++ trunk/ORMModel/ObjectModel/ORMModel.resx 2007-09-20 20:51:23 UTC (rev 1139)
@@ -163,6 +163,10 @@
<value>Remove Implied Internal Uniqueness Constraints</value>
<comment>The name of the transaction that auto-fixes implied and duplicate internal constraints.</comment>
</data>
+ <data name="FrequencyConstraint.UnboundedMaxValueText" xml:space="preserve">
+ <value>Unbounded</value>
+ <comment>Text used in the dropdown editor and type converter for the frequency constraint max value. Correspond to the 0 value in the object model.</comment>
+ </data>
<data name="ImplicitBooleanValueType.PropertyRestriction" xml:space="preserve">
<value>The modification of the IsImplicitBooleanValue property on a ValueType is not allowed.</value>
<comment>Error message for when a user attempts to modify properties on an Implicit Boolean ValueType</comment>
Modified: trunk/ORMModel/Resources/ResourceStringsGenerator.cs
===================================================================
--- trunk/ORMModel/Resources/ResourceStringsGenerator.cs 2007-09-20 20:48:24 UTC (rev 1138)
+++ trunk/ORMModel/Resources/ResourceStringsGenerator.cs 2007-09-20 20:51:23 UTC (rev 1139)
@@ -2268,6 +2268,14 @@
return ResourceStrings.GetString(ResourceManagers.Model, "ImplicitBooleanValueType.NoReadingFormatString");
}
}
+ /// <summary>Text used in the dropdown editor and type converter for the frequency constraint max value. Correspond to the 0 value in the object model.</summary>
+ public static string FrequencyConstraintUnboundedMaxValueText
+ {
+ get
+ {
+ return ResourceStrings.GetString(ResourceManagers.Model, "FrequencyConstraint.UnboundedMaxValueText");
+ }
+ }
/// <summary>Description for target HtmlReport customizations. Displays in the verbalization customizations dropdown in the options page.</summary>
public static string VerbalizationTargetHtmlReportDisplayName
{
Modified: trunk/ORMModel/Resources/ResourceStringsGenerator.xml
===================================================================
--- trunk/ORMModel/Resources/ResourceStringsGenerator.xml 2007-09-20 20:48:24 UTC (rev 1138)
+++ trunk/ORMModel/Resources/ResourceStringsGenerator.xml 2007-09-20 20:51:23 UTC (rev 1139)
@@ -426,6 +426,7 @@
<ResourceString name="ImplicitBooleanValueTypeRestriction" model="Model" resourceName="ImplicitBooleanValueType.Restriction"/>
<ResourceString name="ImplicitBooleanValueTypePropertyRestriction" model="Model" resourceName="ImplicitBooleanValueType.PropertyRestriction"/>
<ResourceString name="ImplicitBooleanValueTypeNoReadingFormatString" model="Model" resourceName="ImplicitBooleanValueType.NoReadingFormatString"/>
+ <ResourceString name="FrequencyConstraintUnboundedMaxValueText" model="Model" resourceName="FrequencyConstraint.UnboundedMaxValueText"/>
<ResourceString name="VerbalizationTargetHtmlReportDisplayName" model="Model" resourceName="VerbalizationTarget.HtmlReport.DisplayName"/>
<ResourceString name="VerbalizationTargetHtmlReportCommandName" model="Model" resourceName="VerbalizationTarget.HtmlReport.CommandName"/>
<ResourceString name="VerbalizationTargetVerbalizationBrowserDisplayName" model="Model" resourceName="VerbalizationTarget.VerbalizationBrowser.DisplayName"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|