public static void CreateAppearanceRuleNodes(IEnumerable <EditorStateRuleAttribute> attributes, IModelClass modelClass, string methodName, ViewItemVisibility visibility)
 {
     foreach (EditorStateRuleAttribute attribute in attributes)
     {
         ConditionalEditorStateConverter.CreateAppearanceRuleNode(modelClass, attribute.Id, attribute.Properties, attribute.EditorState, attribute.Criteria, attribute.ViewType, methodName, default(int?), visibility);
     }
 }
Exemple #2
0
 protected void Convert(IModelConditionalFormatting targetnode, IModelApplication application, IModelObjectView view) {
     IModelConditionalFormatting ruleList = (IModelConditionalFormatting)targetnode;
     if (ruleList.ConditionalFormatting == null) {
         return;
     }
     foreach (IModelConditionalFormattingRule node in ruleList.ConditionalFormatting) {
         if (((ModelNode)node).IsNewNode && view.ModelClass != null) {
             IModelClass modelClass = ConditionalEditorStateConverter.GetModelClassNode(((ModelNode)node).Application, view.ModelClass.Name);
             if (modelClass is IModelConditionalAppearance) {
                 IModelConditionalAppearance appearance = modelClass as IModelConditionalAppearance;
                 IModelAppearanceRule targetRule = appearance.AppearanceRules.AddNode<IModelAppearanceRule>(view.Id + node.Id);
                 targetRule.Criteria = node.Criteria;
                 targetRule.Priority = node.Priority;
                 targetRule.AppearanceItemType = AppearanceItemType.ViewItem.ToString();
                 targetRule.Context = "ListView";
                 string targetItems = "";
                 if (targetnode is IModelListView) {
                     targetItems = "*";
                 }
                 else if (targetnode is IModelColumn) {
                     targetItems = ((IModelColumn)targetnode).Id;
                 }
                 targetRule.TargetItems = targetItems;
                 foreach (IModelConditionalFormattingTarget target in node) {
                     if (target.Name == "Foreground") {
                         targetRule.FontColor = (Color)target.Color;
                     }
                     else if (target.Name == "Background") {
                         targetRule.BackColor = (Color)target.Color;
                     }
                 }
             }
             node.Remove();
         }
     }
 }