Exemple #1
0
        //
        // Referable
        //

        public void DisplayOrEditEntityReferable(StackPanel stack,
                                                 AdminShell.Referable referable,
                                                 DispEditInjectAction injectToIdShort = null,
                                                 HintCheck[] addHintsCategory         = null,
                                                 bool categoryUsual = false)
        {
            // access
            if (stack == null || referable == null)
            {
                return;
            }

            // members
            this.AddGroup(stack, "Referable:", levelColors[1][0], levelColors[1][1]);

            // members
            this.AddHintBubble(stack, hintMode, new[] {
                new HintCheck(() => { return(referable.idShort == null || referable.idShort.Length < 1); },
                              "idShort is meanwhile mandatory for all Referables. It is a short, " +
                              "unique identifier that is unique just in its context, its name space. ", breakIfTrue: true),

                new HintCheck(
                    () => {
                    if (referable.idShort == null)
                    {
                        return(false);
                    }
                    return(!AdminShellUtil.ComplyIdShort(referable.idShort));
                },
                    "idShort shall only feature letters, digits, underscore ('_'); " +
                    "starting mandatory with a letter..")
            });
            this.AddKeyValueRef(
                stack, "idShort", referable, ref referable.idShort, null, repo,
                v => { referable.idShort = v as string; return(new ModifyRepo.LambdaActionNone()); },
                auxButtonTitles: DispEditInjectAction.GetTitles(null, injectToIdShort),
                auxButtonToolTips: DispEditInjectAction.GetToolTips(null, injectToIdShort),
                auxButtonLambda: injectToIdShort?.auxLambda
                );

            if (!categoryUsual)
            {
                this.AddHintBubble(
                    stack, hintMode,
                    new HintCheck(() => { return(referable.category != null && referable.category.Trim().Length >= 1); },
                                  "The use of category is unusual here.", severityLevel: HintCheck.Severity.Notice));
            }

            this.AddHintBubble(stack, hintMode, this.ConcatHintChecks(null, addHintsCategory));
            this.AddKeyValueRef(
                stack, "category", referable, ref referable.category, null, repo,
                v => { referable.category = v as string; return(new ModifyRepo.LambdaActionNone()); },
                comboBoxItems: AdminShell.Referable.ReferableCategoryNames, comboBoxIsEditable: true);

            this.AddHintBubble(
                stack, hintMode,
                new[] {
                new HintCheck(
                    () => {
                    return(referable.description == null || referable.description.langString == null ||
                           referable.description.langString.Count < 1);
                },
                    "The use of an description is recommended to allow the consumer of an Referable " +
                    "to understand the nature of it.",
                    breakIfTrue: true,
                    severityLevel: HintCheck.Severity.Notice),
                new HintCheck(
                    () => { return(referable.description.langString.Count < 2); },
                    "Consider having description in multiple langauges.",
                    severityLevel: HintCheck.Severity.Notice)
            });
            if (this.SafeguardAccess(stack, repo, referable.description, "description:", "Create data element!", v =>
            {
                referable.description = new AdminShell.Description();
                return(new ModifyRepo.LambdaActionRedrawEntity());
            }))
            {
                this.AddHintBubble(
                    stack, hintMode,
                    new HintCheck(
                        () =>
                {
                    return(referable.description.langString == null ||
                           referable.description.langString.Count < 1);
                },
                        "Please add some descriptions in your main languages here to help consumers " +
                        "of your Administration shell to understand your intentions."));
                this.AddKeyListLangStr(stack, "description", referable.description.langString, repo);
            }
        }
Exemple #2
0
 public void AtLine68AndColumn12()
 {
     Assert.IsTrue(AdminShellUtil.ComplyIdShort(""));
 }