Share My Creation BuilderPattern creator

Hi to all! As i've been using the Builder Pattern a lot lately, i write a small utility in B4j that make the .bas file for B4A from the class instance with his property. B4J project is attached
This is the tutorial: https://www.b4x.com/android/forum/threads/b4x-builder-pattern.87260/

How to use it?
Simply write in Text Area the instance and click on Save. First line must be this:
B4X:
Dim Object as Type
You should change Type with the type of the class (Label, custom type, etc..)
Second line must be the initialize method

Other lines are the properties of the object (NOT METHOD) that you want to write in Builder. A property line should be write like this
B4X:
Object.Property = DefaultValue 'Type Of Property
If the property is an array, you should write () after the type, like this
B4X:
Object.Property = Array as Type(default,default,default,default) 'Type()

A small example

B4X:
    Dim b As Button
    b.Initialize("")
    b.Color = Colors.Transparent 'int
    b.Ellipsize = "NONE" 'string
    b.Enabled = True 'boolean
    b.Gravity = Gravity.CENTER 'int
    b.Height = 0 'int
    b.Left = 0 'int
    b.Padding = Array As Int(4dip,4dip,4dip,4dip) 'int()
    b.SingleLine = False 'boolean
    b.Text = "" 'string
    b.TextColor = Colors.White 'int
    b.TextSize = 14 'int
    b.Top = 0 'int
    b.Typeface = Typeface.DEFAULT 'typeface
    b.Visible = True 'boolean
    b.Width = 0 'int


 

Attachments

  • Export.zip
    3.5 KB · Views: 270
Top