Archive for the ‘Meta Types’ Category

Meta Types

Posted: 2017-01-19 in Meta Types

MetaDataBuilder API (for databases, tables and columns), v2.1 will include a graphical “Meta Type Editor” and support user defined meta types

    • Added a new MetaTypeEditor for projects. You create “Meta Types” (which are essentially class definitions) for Apps, Pages, Sections or FormItems using the “Meta Type Editor”.
    • You can edit these “Meta Types” in either the “Projects” workspace or the “App” workspace.
    • The “Meta Type Editor” is a dialog similar in operation to the App Inspector as it stays on top of the UI as you are designing your App pages.
    • You can add/edit “Meta Types” and “Apply” the changes against your App as you design/develop it.
    • Each UI element: Apps, Pages, Sections or FormItems can have a list of “Meta Types” specified.
    • Unlike a “Class Editor” (or similar that you may be familiar with) this provides the ability to handle multiple inheritance of attributes and delegates in a scripting language independent manner.
    • These “Meta Types” are applied when an App is loaded.
    • If you are building Web and/or mobile Apps you then need to deploy your apps.
    • If you are building desktop apps the “Meta Types” are applied dynamically when the app is loaded.
    • “Meta Types” are stored in a new sub-directory called c:\lianja\metatypes and each file is named like this: projectname.metatypes.
    • You can override this name in the app settings on an app by app basis if required.
    • The default file name however will be projectname.metatypes if a project is open or appname.metatypes is no project is open.

This adheres to the Lianja App Builder core philosophy of
declarative device-independent UI building but provides the ability to inherit common appearance and behavior without needing to set individual attributes for each UI element, resulting in increased developer productivity and more rapid application development.

Is this similar to extend the standard app, page, section, form item attributes to include additional user defined attributes?
You can do that already for a long time using addProperty(). This adds a new attribute and prefixes it with user_ internally.
Any attributes that you set that are prefixed with user_ are user defined.

In v2.1Beta6 I’ve added several new functions to simplify working with MetaData and MetaType key/value pairs. This representation can be used as an alternative to JSON format and is much smaller.

// create an object from a metadata string
obj = metadata_decode("name=barry;company=Lianja")

// encode a string from an object representing metadata
str = metadata_encode( obj )

// Create an object from a metadata string
obj = metadata_decode("[type1]name=barry;backcolor=red;[type2]name=bill;backcolor=pink")

// Extract the attributes for a given metatype in a metadata string
str = metadata_findtype("type1", "[type1]name=barry;backcolor=red;[type2]name=bill;backcolor=pink")

MetaTypeEditor which shows you the names of all attributes and their descriptions. There are some new methods for page, section, field and gadgets called setAttribute() and getAttribute() which provide access to all attributes as detailed in the MetaTypeEditor.

These provide a powerful means of defining components (as MetaTypes) and then subclassing them in Pages, Sections and FormItems (Fields and Gadgets).
MetaType Editor exposes and documents all attributes available for Pages, Sections and FormItems.

So if you want to create your own builders, these attributes should be set using the new setAttribute(name, value) method on Pages, Sections or FormItems.
All attributes are exposed now. You set then using setAttribute(name, value) and get them using getAttribute(name).