protected Type EditorType(IModelNode node) { var modelListView = node as IModelListView; if (modelListView != null) return modelListView.EditorType; var modelColumn = node as IModelColumn; if (modelColumn != null) return ((IModelListView)modelColumn.ParentView).EditorType; throw new NotImplementedException(node.GetType().ToString()); }
public bool IsVisible(IModelNode node, string propertyName) { var any = node.GetType().GetInterfaces().Any(type => { return(type.GetCustomAttributes(typeof(InvisibleLogicPropertyAttribute), false) .Cast <InvisibleLogicPropertyAttribute>() .Any(attribute => attribute.PropertyName == nameof(IContextLogicRule.ExecutionContextGroup))); }); return(!any); }
public static ITypeInfo GetGenericListArgument(this IModelNode nodeByPath) { var type = nodeByPath.GetType(); if (typeof(IEnumerable).IsAssignableFrom(type)) { var genericModelList = type.GetInterfaces().First(type1 => typeof(IEnumerable).IsAssignableFrom(type1) && type1.IsGenericType); return(XafTypesInfo.Instance.FindTypeInfo(genericModelList.GetGenericArguments()[0])); } return(null); }
public override IDiagramNode CreateDiagramNode(IDiagramShapeResolver diagramShapeResolver, IModelNode modelNode) { if (modelNode == null) { throw new ArgumentNullException(nameof(modelNode)); } if (modelNode is TypeNode typeNode) { return(new TypeDiagramNode(typeNode)); } if (modelNode is PropertyNode propertyNode) { return(new PropertyDiagramNode(propertyNode)); } throw new ArgumentException($"Unexpected type {modelNode.GetType().Name} in {GetType().Name}"); }
public override IDiagramNode CreateDiagramNode(IDiagramShapeResolver diagramShapeResolver, IModelNode modelNode, IModelNode parentModelNode) { // TODO: handle parentModelNode if (modelNode is IRoslynTypeNode roslynTypeNode) { return(new RoslynTypeDiagramNode(roslynTypeNode)); } throw new ArgumentException($"Expected {typeof(IRoslynTypeNode).Name} but received {modelNode.GetType().Name}"); }
public bool IsVisible(IModelNode node, string propertyName) { var criteria = node.GetPropertyAttribute <ModelMapperBrowsableAttribute>(propertyName).Criteria; if (criteria != null) { node = node.GetNode(propertyName); var criteriaOperator = CriteriaOperator.Parse(criteria); var expressionEvaluator = new ExpressionEvaluator(new EvaluatorContextDescriptorDefault(node.GetType()), criteriaOperator, customFunctions: CustomFunctions); var isVisible = expressionEvaluator.Evaluate(node); if (isVisible != null) { return((bool)isVisible); } } return(true); }
public static Type ModelListType(this IModelNode modelNode) { return(modelNode.GetType().ModelListType()); }
public static System.Type ModelListType(this IModelNode modelNode) => modelNode.GetType().ModelListType();