public CswNbtSchemaUpdateLayoutMgr(CswNbtSchemaModTrnsctn SchemaModTrnsctn, CswEnumNbtObjectClass ObjectClass, CswEnumNbtLayoutType LayoutType = null) { if (null == ObjectClass || CswResources.UnknownEnum == ObjectClass) { throw new CswDniException("Cannot instance a Layout Mgr without an Object Class. Object Class was null."); } this.LayoutType = LayoutType; this.SchemaModTrnsctn = SchemaModTrnsctn; this.ObjectClass = this.SchemaModTrnsctn.MetaData.getObjectClass(ObjectClass); LatestVersionNodeTypes = this.ObjectClass.getLatestVersionNodeTypes(); Props = new Collection <LayoutProp>(); }
/// <summary> /// Remove a property from the tab of a specific layout or from all tabs of a layout if the current tab is null. /// </summary> public void removeProp(string PropName, CswEnumNbtLayoutType LayoutType = null) { CswNbtSchemaUpdateLayoutMgr.LayoutProp Prop = _vetLayoutOp(PropName, true, LayoutType); foreach (CswNbtMetaDataNodeType NodeType in _LayoutMgr.LatestVersionNodeTypes) { CswNbtMetaDataNodeTypeTab Tab = _getTab(_LayoutMgr.SchemaModTrnsctn, NodeType); if (null != Tab) { CswNbtMetaDataNodeTypeProp Ntp = NodeType.getNodeTypePropByObjectClassProp(Prop.Prop); Ntp.removeFromLayout(Prop.Layout, Tab.TabId); } } }
public LayoutProp(CswNbtMetaDataObjectClassProp Prop, CswEnumNbtLayoutType Layout, string Tab) { this.Prop = Prop; this.Layout = Layout; this.Tab = Tab; }
/// <summary> /// Moves a property on the "first" tab, which should be the tab of the same name as the NodeType else the first tab by sequence. /// </summary> public void moveProp(string PropName, Int32 Row, Int32 Column, CswEnumNbtLayoutType LayoutType = null) { _doLayoutUpdate(PropName, Row, Column, DoMove: true, DoNotTrack: true, LayoutType: LayoutType); }
private void _doLayoutUpdate(string PropName, Int32 Row, Int32 Column, bool DoMove, bool DoNotTrack, CswEnumNbtLayoutType LayoutType = null) { CswNbtSchemaUpdateLayoutMgr.LayoutProp Prop = _vetLayoutOp(PropName, DoNotTrack, LayoutType); foreach (CswNbtMetaDataNodeType NodeType in _LayoutMgr.LatestVersionNodeTypes) { CswNbtMetaDataNodeTypeTab Tab = _getTab(_LayoutMgr.SchemaModTrnsctn, NodeType); CswNbtMetaDataNodeTypeProp Ntp = NodeType.getNodeTypePropByObjectClassProp(Prop.Prop); Ntp.updateLayout(Prop.Layout, TabId: Tab.TabId, DoMove: DoMove, DisplayRow: Row, DisplayColumn: Column); } }
private CswNbtSchemaUpdateLayoutMgr.LayoutProp _vetLayoutOp(string PropName, bool DoNotTrack, CswEnumNbtLayoutType LayoutType = null) { LayoutType = LayoutType ?? _LayoutMgr.LayoutType; CswNbtMetaDataObjectClassProp Ocp = _LayoutMgr.ObjectClass.getObjectClassProp(PropName); if (null == Ocp) { throw new CswDniException("Cannot copy a property that is not an Object Class prop. Object Class Prop {" + PropName + "} was null."); } CswNbtSchemaUpdateLayoutMgr.LayoutProp Ret = new CswNbtSchemaUpdateLayoutMgr.LayoutProp(Ocp, LayoutType, ""); //I originally thought we could prevent copy/paste errors by tracking which props had been positioned where, but this turns out to be non trivial. //It's not a bad idea, but not worth the overhead to do correctly right now. //if ( _LayoutMgr.Props.Contains( Ret ) ) //{ // if ( DoNotTrack ) // { // _LayoutMgr.Props.Remove( Ret ); // } // else // { // throw new CswDniException( "This property has already been placed in this layout. Prop: {" + PropName + "}, LayoutType: {" + LayoutType + "}, Tab: {" + CurrentTabName + "}." ); // } //} //if ( false == DoNotTrack ) //{ // _LayoutMgr.Props.Add( Ret ); //} return(Ret); }
} // getPropertiesForLayoutAdd() public bool addPropertyToLayout(string PropId, string TabId, CswEnumNbtLayoutType LayoutType) { return(_TabsPropsSd.addPropertyToLayout(PropId, TabId, LayoutType)); } // addPropertyToLayout()
} // saveProps() public JArray getPropertiesForLayoutAdd(string NodeId, string NodeKey, string NodeTypeId, string TabId, CswEnumNbtLayoutType LayoutType) { return(_TabsPropsSd.getPropertiesForLayoutAdd(NodeId, NodeKey, NodeTypeId, TabId, LayoutType)); } // getPropertiesForLayoutAdd()