Class TextTable

    • Field Detail

      • AUTO_TRANSLATE_TO

        public static final java.lang.String AUTO_TRANSLATE_TO
        Constant for the atom name of the property: automatic translation to this table.
        See Also:
        Constant Field Values
      • AUTO_TRANSLATE_FROM

        public static final java.lang.String AUTO_TRANSLATE_FROM
        Constant for the atom name of the property: automatic translation from this table.
        See Also:
        Constant Field Values
      • MUST_DEFINE

        public static final java.lang.String MUST_DEFINE
        Constant for the atom name of the property: must defined every derived entry.
        See Also:
        Constant Field Values
      • VERIFY

        public static final java.lang.String VERIFY
        Constant for the atom name of the property: enable verification of entries.
        See Also:
        Constant Field Values
      • EMPTY_ARRAY

        public static final TextTable[] EMPTY_ARRAY
        An empty array.
    • Constructor Detail

      • TextTable

        protected TextTable()
        Creates the text table property container without a name. The name must be set in all cases using the setPropertyAtom call.
      • TextTable

        public TextTable​(Atom propertyAtom)
        Creates the text table with the specified name. All system-reserved names for components begins with "$".
        Parameters:
        propertyAtom - the name of the component, unique within it's parent.
    • Method Detail

      • onResolved

        public void onResolved​(Atom refAtom,
                               TextTable target)
        Called when the reference has been resolved.
        Specified by:
        onResolved in interface IReferenceOwner<TextTable>
        Parameters:
        refAtom - The atom of the reference property.
        target - The target reference.
      • onBroken

        public void onBroken​(Atom refAtom,
                             TextTable target)
        Called when the reference has been broken, i.e. unresolved.
        Specified by:
        onBroken in interface IReferenceOwner<TextTable>
        Parameters:
        refAtom - The atom of the reference property.
        target - The target reference.
      • getDerivesReference

        public java.lang.String getDerivesReference()
        Gets the text table reference string that this tables derives.
        Returns:
        The reference string, or null for no table derived.
      • getDerives

        public TextTable getDerives()
        Gets the text table that is derived.
        Returns:
        The derived table, or null for none (or reference not found).
      • getDerivedTextTables

        public TextTable[] getDerivedTextTables()
        Gets all tables in all open projects that derives from this text table.

        In runtime, this method returns an empty array!

        Returns:
        An array of all derived tables, in runtime always empty, only defined in the Designer!
      • getDerivedTextTable

        public TextTable getDerivedTextTable​(java.lang.String languageCode)
        Gets the derived text table to this text table with the specified language code.
        Parameters:
        languageCode - The language code.
        Returns:
        The derived text table, or null if not found.
      • getTextID

        public KString getTextID​(java.lang.String id)
        Gets the text entry in this table. If the text is not found, the derived table is verified in order.
        Parameters:
        id - The text ID to look-up.
        Returns:
        The text string or null if not found.
      • getTextID

        public KString getTextID​(java.lang.String id,
                                 java.lang.String languageCode)
        Gets the text entry with the specified ID for a language. The specific language code is first looked up, then it falls back on the derived tables in order.
        Parameters:
        id - The text ID to look-up.
        languageCode - The language code, or null for this table.
        Returns:
        The text string or null if not found.
      • getKStringProp

        public KStringProp getKStringProp​(java.lang.String id)
        Gets the text entry in this table. If the text is not found, the derived table is verified in order.
        Parameters:
        id - The text ID to look-up.
        Returns:
        The text string or null if not found.
      • getKStringProp

        public KStringProp getKStringProp​(java.lang.String id,
                                          java.lang.String languageCode)
        Gets the text entry with the specified ID for a language. The specific language code is first looked up, then it falls back on the derived tables in order.
        Parameters:
        id - The text ID to look-up.
        languageCode - The language code, or null for this table.
        Returns:
        The text string or null if not found.
      • getDescription

        public java.lang.String getDescription()
        Gets the description of this text table.
      • setDescription

        public void setDescription​(java.lang.String descr)
        Sets the description of this text table.
        Parameters:
        descr - The description text, non-null.
      • getLanguageCode

        public java.lang.String getLanguageCode()
        Gets the language for this text table.
        Returns:
        The language code, or null for none.
      • setLanguageCode

        public void setLanguageCode​(java.lang.String languageCode)
        Sets a valid language code.
        Parameters:
        languageCode - The language code, non-null.
        Throws:
        java.lang.IllegalArgumentException - If the language code is not valid.
      • hasLanguageCode

        public boolean hasLanguageCode()
        Checks if a valid language code is set, i.e. not null or empty. This means a generic language or auto-detect for auto-translate.
      • getLanguageDescription

        public java.lang.String getLanguageDescription()
        Gets the language description for the language of this text table.
        Returns:
        The language description, or null for none (or invalid language code).
      • setAutomaticTranslationFromTableEnabled

        public void setAutomaticTranslationFromTableEnabled​(boolean on)
        Sets automatic translation is enabled from this table.
        Parameters:
        on - The enabled flag.
      • isAutomaticTranslationFromTableEnabled

        public boolean isAutomaticTranslationFromTableEnabled()
        Checks if automatic translation is enabled from this table.
      • setAutomaticTranslationToTableEnabled

        public void setAutomaticTranslationToTableEnabled​(boolean on)
        Checks if automatic translation to this table is enabled.
        Parameters:
        on - The enabled flag.
      • isAutomaticTranslationToTableEnabled

        public boolean isAutomaticTranslationToTableEnabled()
        Checks if automatic translation to this table is enabled.
      • isTableDerived

        public boolean isTableDerived()
        Checks if the table derives another.
        Returns:
        true if configured for table derivation AND the derived table is found.
      • setMustDefineDerivedEntries

        public void setMustDefineDerivedEntries​(boolean on)
        Sets if all derived entries must be defined.
        Parameters:
        on - The enabling flag.
      • mustDefineDerivedEntries

        public boolean mustDefineDerivedEntries()
        Checks if all derived entries must be defined.
      • setEntryVerificationEnabled

        public void setEntryVerificationEnabled​(boolean on)
        Sets if entry verification is enabled.
        Parameters:
        on - The enabling flag.
      • isEntryVerificationEnabled

        public boolean isEntryVerificationEnabled()
        Checks if entry verification is enabled.
      • getText

        public KString getText​(java.lang.String name)
        Get the text associated with the specified text name or text ID.
        Parameters:
        name - The name of the text or text ID.
        Returns:
        The associated text, null for not found.
      • getTextProp

        public KStringProp getTextProp​(Atom atom)
        Get the text property associated with the specified text name or text ID.
        Parameters:
        atom - The atom of the text or text ID.
        Returns:
        The associated text, null for not found.
      • getTextProp

        public KStringProp getTextProp​(java.lang.String name)
        Get the text property associated with the specified text name or text ID.
        Parameters:
        name - The name of the text or text ID.
        Returns:
        The associated text, null for not found.
      • verify

        public void verify​(PropVerification verification)
        Verifies this property container. The check performed is the extension of classes and that no circular reference is present.
        Specified by:
        verify in interface IGProp<GProp<?>[]>
        Overrides:
        verify in class PropCnr
        Parameters:
        verification - The property verification class.