DesignerEntry

Coordinates clearing, translation, validation, and info read/write actions for a designer entry worksheet. Lazily resolves a DesignerTranslation translator (for applying language translations and translating message codes) from the host worksheet and its parent workbook. A test injects its translator through UseTranslator before the first resolve.

Depends on: DesignerTranslation, Checking

Factory

Create #

create

Create and configure a designer entry helper

Signature:

Public Function Create(ByVal hostSheet As Worksheet) As DesignerEntry

Factory method that creates a new DesignerEntry instance, binds it to the supplied worksheet via Configure, and returns the result. Called on the predeclared instance.

Parameters:

  • hostSheet: Worksheet. The worksheet hosting designer inputs.

Returns: DesignerEntry. A fully initialised instance ready for use.


Public API

Configure #

configure

Bind the helper to the target worksheet

Signature:

Public Sub Configure(ByVal hostSheet As Worksheet)

Stores a reference to the host worksheet. Called once by the factory, which then seals the instance; a later call raises. Raises an error when the worksheet is Nothing.

Parameters:

  • hostSheet: Worksheet. The worksheet hosting designer inputs.

Throws:

  • ProjectError.ObjectNotInitialized When the worksheet is Nothing.
  • ProjectError.SomethingWentWrong When the instance is sealed.

UseTranslator #

use-translator

Inject the translations manager the entry will use

Signature:

Public Sub UseTranslator(ByVal translator As DesignerTranslation)

Sets the DesignerTranslation translator the entry delegates to. A test injects its own translator here right after Create. The setter guards itself: it refuses Nothing, and it refuses to replace a translator that is already held (injected earlier, or lazily resolved by a translate call).

Parameters:

  • translator: DesignerTranslation. The translations provider to use.

Throws:

  • ProjectError.ObjectNotInitialized When the translator is Nothing.
  • ProjectError.SomethingWentWrong When a translator is already held.

Clear #

clear

Clear user inputs on the configured worksheet

Signature:

Public Sub Clear()

Resets all input ranges on the configured worksheet by clearing their values and setting backgrounds to white. Also clears any warning messages below the RNG_Warning range. Silently skips any named range that does not exist on the worksheet.


Translate #

translate

Translate the configured worksheet using the provided language

Signature:

Public Sub Translate(Optional ByVal language As String = vbNullString)

Delegates to the translations provider to apply translated labels, shapes, and dropdowns to the host worksheet. When a non-empty language string is supplied (e.g. "FRA - Francais"), the translator extracts the language code and persists it to the worksheet-level HiddenName.

Parameters:

  • language: Optional String. Language string in "CODE - Label" format. Defaults to vbNullString.

AddInfo #

add-info

Write a value to a named info range on the host worksheet

Signature:

Public Sub AddInfo(ByVal value As String, ByVal infoName As String)

Maps the logical infoName to its corresponding named range on the host worksheet, writes the value, and sets the background to white. Silently exits when the named range does not exist on the worksheet.

Parameters:

  • value: String. The value to write (path, translated message, etc.).
  • infoName: String. The logical name identifying the target range.

ValueOf #

value-of

Read a value from a named info range on the host worksheet

Signature:

Public Property Get ValueOf(ByVal infoName As String) As String

Maps the logical infoName to its corresponding named range on the host worksheet and returns the current cell value. Returns vbNullString when the named range does not exist.

Parameters:

  • infoName: String. The logical name identifying the source range.

Returns: String. The current value of the named range.


Validate #

validate

Check the generation entries on the host worksheet

Signature:

Public Function Validate() As Checking

Reads the generation entries from the Main named ranges and files one entry per fault into a Checking, every entry with the error scope. The checks: the setup path is set and on disk, the output folder is set and on disk, the linelist name is set, the setup language is set and is free of the internal double-underscore tag shape, the linelist language is set, the design value is set, and the template and geobase paths are on disk when they are set. An empty checking means every entry passes. A named range missing from the worksheet reads as an empty value and files the matching fault.

Returns: Checking. One entry per faulty generation entry.


TranslateMessage #

translate-message

Translate a message code using the designer translations

Signature:

Public Function TranslateMessage(ByVal msgCode As String) As String

Delegates to the lazily resolved translations provider to translate a message code into the current designer language. Returns the raw msgCode unchanged when no translation is available.

Parameters:

  • msgCode: String. The message code to translate.

Returns: String. The translated message text.


HostSheet #

host-sheet

The managed worksheet

Signature:

Public Property Get HostSheet() As Worksheet

Returns the designer entry worksheet that was bound via Configure. Raises an error when accessed before configuration.

Returns: Worksheet. The host worksheet.

Throws:

  • ProjectError.ObjectNotInitialized When the worksheet was not configured.

Internal members (not exported)

Instance Sealing

Seal #

seal

Seal the instance against further setup writes

Signature:

Public Sub Seal()

GuardNotSealed #

guard-not-sealed

Guard a setup-only member against post-seal writes

Signature:

Private Sub GuardNotSealed(ByVal memberName As String)

Parameters:


Internal Helpers

ClearRange #

clear-range

Clear a single named range value and reset its background

Signature:

Private Sub ClearRange(ByVal rngName As String)

Resolves the named range from the host worksheet, sets its value to empty, and resets the background to white. Silently skips when the named range does not exist.

Parameters:


ClearWarnings #

clear-warnings

Clear the warning range and all contiguous non-empty cells below it

Signature:

Private Sub ClearWarnings()

Resolves RNG_Warning and walks downward, clearing the value and background of each non-empty cell until an empty cell is encountered. Silently exits when RNG_Warning does not exist.


ResolveInfoRange #

resolve-info-range

Map a logical info name to its named range on the host worksheet

Signature:

Private Function ResolveInfoRange(ByVal infoName As String) As Range

Resolves an infoName string to the corresponding named range constant, then returns the Range object from the host worksheet. Returns Nothing when the infoName is unknown or the named range does not exist.

Parameters:

Returns: Range. The named range, or Nothing.


ResolveTranslator #

resolve-translator

Lazily resolve or return the translations provider

Signature:

Private Function ResolveTranslator() As DesignerTranslation

Returns the cached DesignerTranslation translator, or creates one via DesignerTranslation.Create with the DesignerTranslation worksheet on first access. Raises an error when the translation sheet cannot be found.

Returns: DesignerTranslation. The translations provider instance.

Throws:


TranslationSheet #

translation-sheet

Locate the DesignerTranslation worksheet in the parent workbook

Signature:

Private Function TranslationSheet() As Worksheet

Searches the parent workbook of the host worksheet for a sheet named "DesignerTranslation". Raises an error when not found.

Returns: Worksheet. The translations worksheet.

Throws:


RaiseError #

raise-error

Raise a ProjectError-based exception

Signature:

Private Sub RaiseError(ByVal errorCode As ProjectError, ByVal messageText As String)

Wrapper around Err.Raise that standardises the source to CLASS_NAME.

Parameters:

Throws:


Used in (7 file(s))