private Shape CreateShapeFrom(IActiveRecordDescriptor descriptor) { Shape shape = null; if (descriptor is ActiveRecordBaseDescriptor) { ActiveRecordBaseClassShape arshape = (ActiveRecordBaseClassShape) graphControl1.AddShape("castle.ar.base.shape", new PointF(80, 20)); arshape.RelatedDescriptor = descriptor as ActiveRecordBaseDescriptor; arshape.FitSize(false); shape = arshape; } else { ActiveRecordShape arshape = (ActiveRecordShape) graphControl1.AddShape("castle.ar.shape", new PointF(30, 20)); arshape.ActiveRecordDescriptor = (ActiveRecordDescriptor)descriptor; shape = arshape; } System.Diagnostics.Debug.Assert(shape != null); shape.X = descriptor.PositionInView.X; shape.Y = descriptor.PositionInView.Y; _desc2Shape[descriptor] = shape; return(shape); }
private void CreateConnectionsIfNecessary(Shape shape) { ActiveRecordShape arshape = shape as ActiveRecordShape; if (arshape != null) { if (arshape.ActiveRecordDescriptor is ActiveRecordDescriptorSubClass) { ActiveRecordDescriptorSubClass subclass = arshape.ActiveRecordDescriptor as ActiveRecordDescriptorSubClass; ConnectSubToSuperClass(ObtainShape(subclass.BaseClass), shape); } else { ConnectSubToSuperClass(ObtainBaseShape(arshape), shape); } } }
private void graphControl1_OnShapeAdded(object sender, Netron.GraphLib.Shape shape) { graphControl1.Nodes.Remove(shape); if (shape is ActiveRecordShape) { ActiveRecordShape arshape = shape as ActiveRecordShape; _actionSet.DoNewARWizard(); } else if (shape is ActiveRecordBaseClassShape) { ActiveRecordBaseClassShape arshape = shape as ActiveRecordBaseClassShape; // if (_actionSet.DoAssociateDatabase(arshape)) // { // } } }
public bool Run(ActiveRecordShape shape) { using (NewARClassWizard wizard = new NewARClassWizard(Model)) { if (wizard.ShowDialog(Workspace.ActiveWindow) != DialogResult.OK) { return(false); } Model.CurrentProject.AddActiveRecordDescriptor(wizard.ActiveRecordDescriptor); foreach (ActiveRecordDescriptor dependent in wizard.Dependents) { Model.CurrentProject.AddActiveRecordDescriptor(dependent); } Model.Update(); return(true); } }
private Shape ObtainBaseShape(ActiveRecordShape arshape) { return(_desc2Shape[arshape.ActiveRecordDescriptor.Table.DatabaseDefinition.ActiveRecordBaseDescriptor] as Shape); }