Published 2015-05-07 00:00:00

It's been a busy month, unfortunately not for our paid work, which has dropped down to a trickle. Taking advantage of this I've been building more into our App Builder. This post hopefully is the first in a series about some of those additions.
The Primary purposes of our Builder is
  • A WYSIWYG tool for web applications using both Bootstrap or the RooJS libraries.
  • A new visual way of building Gnome/Gtk Applications 
In working towards these goals the builder has moved forward in a few directions. the first one that this blog post talks about is generating User interfaces from Database Schemas.

Database based Plugin builders for Web components.

One of the versions I tried a while back was a completely web based version of the builder, I eventually gave up on that as the whole concept of writing to files on the server, and revision control was just too complicated and not that well suited to our general workflow (develop locally on the filesystem etc.)

 
The old browser based builder (not really maintained)

However one bit that was quite handy on the web based version, was that we could construct forms and grids by parsing the database schema's and very rapidly create an interactive form for any piece of data. This was possible as the web version had direct access to our whole DataObjects driven schema tools. So it had a deep understanding of the 'assumed' relationships. These relationships (links.ini) files from DB_DataObject are normally hand crafted, as Mysql does not have a very good concept of loose foreign keys. In postgresql foreign keys can be set up so that they are either NULL or point to the foreign table. In Mysql this is not feasible, and we also tend to store '0' as the value when it does not need to point to a foreign table.

The trick of using '0' is mostly due to the HTML/PHP<->Mysql mapping of base types, NULL is not really a first class type when dealing wht HTTP and PHP, it's difficult to send 'null' from a web browser to PHP and then end up in Mysql - It's basically for more reliable to use '0' as an indicator of nothing being selected.

So many moons ago when the original DB_DataObject design was done, apart from Mysql lacking even basic Foreign key support, we set up the links.ini to store the relationships between tables, in the same way that foriegn keys are done normally. As an asside, the generator can actually read Postgress Foreign keys and generate these links.ini files.  They are also used to generate automatic Joins etc.. 

Templating in the Builder.

Very early on in the builder's life, it became clear that we needed to copy elements from on file to another (eg. a combo box, or a submit button etc..) These elements may consist of multiple object, and only need minor adjustments when used in other locations. In the builder, you would right click on the tree element and select 'save template', fill in a name, then it would be written to the local PC's 'builder' directory under ~/.Builder/{Element type}/{the name you chose}.json

When adding an element to the builder tree, if there was elements in the template directory, before a new node was added, you would be prompted asking you if you wanted to use a template. Saving quite a bit of work adding standard elements in the UI.


This was idea later improved by allowing you to drag elements from one builder instance to another (eg. dragging whole UI elements  between files). You could basically take a whole 'themed' page and create a new website, by just dragging the root element of the tree.

 
To enable the builder to quickly create elements based on the database schema, I original wrote a seed script that queried the database, and looked at the links.ini files, and generated templates for all the relivant elements. The downside to this was that once you had created template elements for multiple databases, the list of templates became extremely long and undweildy. Hence I finally got round to addressing this. 

Adding the Database Table based elements.

To enable the desktop App Builder to access this relationship data, I decided, rather than rely on configuring it to access all the files in some way, it would be better to append this information to the COMMENT area of the Mysql Table (It's almost impossible to update the COMMENT area for rows in Mysql). That way the builder could query the database schema using libgda, and extract the relations ships by looking at the comment data.

The code that was written to do this is inside an addon to our Database Updateing code https://github.com/roojs/Pman.Core/blob/master/UpdateDatabase/MysqlLinks.php.  We keep all our database schema details in .sql files inside a folder in our modules. We normally have various folder, 'sql' for generic schema (table definitions and changes to them), mysql/pgsql for stored procedures specific to a database type. The UpdateDatabase code is run at the command line and just applies any of these updates to the database. The new code we added other that adding comments to the database, also optionally added triggers to all the tables, so that we could effectively do the same kind of verification that adding a foriegn key does. This adds an extra level of verification so that mistakes done in the PHP code in deleting or modifying data, are checked against the database. It prevents you deleting related data, or pointing values a data that does not exist.

The Database integration is in two parts in the builder, the first is establishing the connection, this is done by an extra tab on the project properties, It's a very simple form, that you can fill in the database name, username/password, and database type (MySQL is the only one that really works at present). Then just press test connection

 

The when you add an element to the tree, along with  being prompted to add a element from a templates, it also offers you a list of the database tables.  If you pick a table, and a file exists in the resources folder (see other post about builder resoures). Then it will show a dialog with a webkit window that runs the UI for the Plugin. We have two working plugins at present, one for a grid, and one for a form.

Both of these plugins then list all the rows in the database, (and referenced rows) . Then offer you various alteratives about how you want build the form or grid (eg. form entry type or grid with etc.)

As we go forward, the plan is to develop a few more of these plugins so that you can use them with the Bootstrap library - creating bootstrap forms or tables from the data in the database.

Comments

Good informations
Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one.
#0 - Voyance amour par tchat ( Link) on 2017-12-27 19:49:27 Delete Comment
high-quality degree
this is a to a high-quality degree instructive article. I in like manner agree with your submit the name and you're to a remarkable diploma nicely light up your standpoint. I am to a super degree lively to peer this put up. A duty of appreciation is all together for percentage with us. preserve it up and proportion the greater maximum associated post.
Essay Writing Service UK
This is a to an astounding degree enlightening article. I in like way concur with your present the name and you're to a noteworthy certificate pleasantly illuminate your point of view. I am to a super degree energetic to peer this set up. An obligation of thankfulness is all together for rate with us. safeguard it up and extent the more prominent most extreme related post.
#2 - Essay Writing Service UK ( Link) on 2018-01-12 20:06:05 Delete Comment
Dissertation
I have not known about a Tele capabilities rivalry some time recently. i've gotten Dissertation before however it never observed this up. I as a general rule simply like the sound of this restriction despite the fact that, thank you bounty!
best essay writing service
it’s really excellent and helpful article, so many great tips for writing. I think that I will listen to most of the advice. Because, usually i read this blog about writing tips to be inspired. But i found your site now and i’m glad to read it.
#4 - Best essay writing service ( Link) on 2018-01-31 14:12:37 Delete Comment
Best customer service
Amazing post and plugins are awesome
Best customer service
It's been a great article.
Everyone really needs this type of article as this shows how we can apply and install plugins for web development
Assignment Help
It is very awesome and nice post, really appreciative. You can look forward to the Online Assignment help or you can say online assignment service provided by Assignment help experts.
#7 - Online Assingment help ( Link) on 2018-04-06 20:08:31 Delete Comment
Buy assignment
Students can buy assignments from Students Assignment Help at a cheap price. We value for your money and therefore, our assignment prices are low.
#8 - Buy assignment ( Link) on 2018-04-11 13:47:37 Delete Comment
Assignment Help
I really like this website allassignmenthelp.co.uk Reviews , it provides best assignment help All the team is so supported and helpful I will continue with this website for my further assignments. Thankyou..
Assignment Help
I really like this website allassignmenthelp.co.uk Reviews , it provides best assignment help All the team is so supported and helpful I will continue with this website for my further assignments. Thankyou..
Assignment help
Assignmenthelp.us brings to you a comprehensive solution with an assurance of peerless writing style, implemented in every paper.
#11 - suhana williams ( Link) on 2018-04-26 18:48:41 Delete Comment
Monopoly accounting assignment
Experts of Students Assignment Help provides monopoly accounting assignment Help for students. Our team of expert  has more than 3000 members who helps you as your demand for assignment services.
Do My Nursing Assignment
Those Who Come To Read Your Article Will Find Lots Of Helpful And Informative Tips.
#13 - Do My Nursing Assignment ( Link) on 2018-05-12 17:56:56 Delete Comment
Assignment help | Assignment help online
We have already set a high standard for assignments . We always make sure that we maintain that
standard because our customer satisfaction is our main priority. We have a strict quality control unit.
They scrutinize the solutions and assure us about the quality. We do not compromise with the quality.
If we are not satisfied, we ask the writers to revise the assignment solutions.Expert assignment helpers of
Allassignmenthelp are well efficient and capable of creating unique assignments for college or university studentsall across the globe.
#14 - Michael Jones ( Link) on 2018-05-15 14:57:13 Delete Comment
Ruby on rails Programming Help
I appreciate this work amazing post for us I like it.
#16 - Buy Online Assignment ( Link) on 2018-05-18 11:57:18 Delete Comment
Help With Ruby on rails Programing Homework
Get the dissertation writing service students look for these days with the prime focus being creating a well researched and lively content on any topic.
#17 - Edward Mark ( Link) on 2018-05-18 12:00:04 Delete Comment
Buy Harvard Business Case Studies Solutions
Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial.
#18 - Claude H. Blake ( Link) on 2018-05-18 12:02:58 Delete Comment
Case Study Writing Service
My Friend Recommended This Blog And He Was Totally Right Keep Up The Good Work
#19 - Eden Carter ( Link) on 2018-05-25 11:41:54 Delete Comment
Case Study Writing Service
My Friend Recommended This Blog And He Was Totally Right Keep Up The Good Work
#20 - Eden Carter ( Link) on 2018-05-25 11:44:10 Delete Comment
Programming Project Help
The Leading Assignment Help UK Firm Offers State Of The Art Services To Its Clients With A Promise Of Delivering All The Required Work Well Within The Deadline.
#21 - Marshal John ( Link) on 2018-05-25 16:29:08 Delete Comment
Olives
I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!
#22 - Olives ( Link) on 2018-06-04 18:29:01 Delete Comment
Cinnamon
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant!
#23 - Cinnamon ( Link) on 2018-06-05 01:34:43 Delete Comment
Kiwi
This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post.
#24 - Kiwi ( Link) on 2018-06-05 01:45:13 Delete Comment
Gluten
A debt of gratitude is in order for sharing the information, keep doing awesome... I truly delighted in investigating your site. great asset...
#25 - Gluten ( Link) on 2018-06-05 01:52:50 Delete Comment
Wormwood
I wish more writers of this sort of substance would take the time you did to explore and compose so well. I am exceptionally awed with your vision and knowledge.
#26 - Wormwood ( Link) on 2018-06-05 02:00:14 Delete Comment
Beta Carotene
Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers.
#27 - Beta Carotene ( Link) on 2018-06-05 02:08:10 Delete Comment
Green Apples
Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return.
#28 - Green Apples ( Link) on 2018-06-05 02:24:50 Delete Comment
Civil Engineering Assignment Help Service
The Leading Assignment Help UK Firm Offers State Of The Art Services To Its Clients With A Promise Of Delivering All The Required Work Well Within The Deadline.

Add Your Comment

Follow us on