Skip to content

Message icon selection

This operation determines which status icon (Error/Warning/Complete) SAIFMessage displays, based on keyword scanning of the message text, unless the caller has explicitly overridden the icon.

Field Value
Operation ID OP-V2-MSG-001
Trigger Text property set with content containing "Error:", "Warning:", "Complete:", or "changes saved.".
Inputs Text content; DisplayImage property (if explicitly set by caller).
Outputs DisplayImage/_img.ImageUrl selection; "Complete:" keyword text stripped from the displayed message via regex.
Primary components SAIFMessage.SetImage, called from SAIFMessage.RenderControl.
Entry point SAIF.Presentation.Web.Controls.V2\SAIFMessage.vb

Steps

  1. RenderControl calls SetImage before rendering the image and label. (BR-V2-005)
  2. SetImage checks DisplayImage; if it has not been explicitly overridden (= Images.DefaultImage), it scans Text (case-insensitive) in this order:
  3. Contains "error:" → sets image to the error icon (MsgError.png).
  4. Contains "warning:" → sets image to the warning icon (MsgWarning.png).
  5. Contains "complete:" → sets DisplayImage = Images.CompleteImage and updates the alternate text.
  6. Exact match "changes saved."/"changes saved. <br>" → sets image to the complete icon (MsgComplete.png).
  7. Otherwise → defaults to the warning icon.
  8. After the keyword scan, any "complete:" occurrence in Text is stripped via a case-insensitive regex replace, so the keyword itself never displays to the user.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([RenderControl invoked]) --> Check{DisplayImage overridden?}
    Check -->|Yes| Skip([Use caller-supplied image])
    Check -->|No| Scan[Scan Text for keywords]
    Scan --> Error{Contains error:}
    Error -->|Yes| ErrImg([Error icon])
    Error -->|No| Warn{Contains warning:}
    Warn -->|Yes| WarnImg([Warning icon])
    Warn -->|No| Complete{Contains complete:}
    Complete -->|Yes| CompImg[Complete icon, strip keyword text]
    Complete -->|No| Saved{Exact match changes saved.}
    Saved -->|Yes| CompImg2([Complete icon])
    Saved -->|No| DefaultImg([Default: warning icon])

Failure and edge-case behavior

  • This is a UI convention for auto-selecting status iconography by message-text keyword, not a business rule about application data.
  • The client-side Message.js script referenced for postback re-rendering is not present in this project folder; its exact behavior could not be verified from this library's source**.

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Presentation.Web.Controls.V2\SAIFMessage.vb