JDom is an html abstraction layer.
It separate the template layout to the call of html controls (inputs, combobox, radio, togglable in grid, calendar, front toolbar, editor, ...)
JDom is the only extra class that is not part of the native Joomla! core. We choosed to implement this because we want to offer you a maximum flexibility with your component.
Imagine, you have to rewrite totaly each layout of your component just because you want to change the dom structure of your inputs...
With JDom you can act the modification very easily, and you'll be also able to re-use for other Cook projects.
This class does not influence the application layer. You can substitute it if you want.
What is an abstraction layer ?It is a function that is called to call another. It is an interface between two processes.
An exemple of abstraction class is the JDatabase class. When you develop your component, you don't mind if you are using MySQL or MySQLi.
You furnish SQL queries to JDatabase, which call the right database engine. If you change database engine, you don't change the source code.
JDom is the same idea.
All your html calls (inputs, selects, calendar, toolbar, togglable in grid, ... ) are defined in a structured object with a JDom syntax (really simplified).
Then, when the executor parse the object, it will return an html formated structure based on the JDom library.
How to modify it ?
The only files to don't touch are dom.php and html.php
All others files are placed in a files tree that correspond to the called namespace.
Ex: html.form.input.editor is the html/form/input/editor.php file.
★ If you rewrite a file for an existing namespace, please keep intact the names and positions of the parameters.
Can I write my own files ?Yes you can, and you should !
★ Respect the JDom standard to place your file in the correct directory, depending on which namespace you choosed.
★ Defines the namespace level (first class property)
★ Register the parameters in the constructor.
★ Write the build() function wich return the rendered HTML.
Important note : Please don't write a file for an existing namespace.
Please consult the complete JDom namespace list (Comming soon), or simply download complete JDom.
If you rewrite an already used namespace, it could cause an incompatibility if you reuse it in a future Cook project.
Why modify JDom if I like it ?
If you are satisfacted of JDom default controls, don't change anything.But, if you already use some standards or renderers classes that you want to integrate in your component, you should write them in JDom. Doing this, the integration will be compatible to all your future Cook projects.
The only thing to do is to replace the dom directory.
You can also place it directly in the template, and it will be used for all Cook projects of your website.
Isn't it nice ?
Can I call JHTML inside JDOM ?Yes, it is possible.
Some of the JDom functionalities are just a JHTML call (calendar for exemple)
Is it compatible with templates ?A JDom call can be placed where you want, even in the files of the template.
JDom doesn't handle the global layouting. You can write your global structure as you want.
Is JDom indispensable ?Of course not.
If you delete the JDom files (dom directory), you must delete the calls of it and substitute them as you want. That's it.
Is it possible to distinct back and front renderers ?Of course yes. Even more.
JDom look for files overrides of itself in lot of places. Front-end component files, Back-end files, template, and even in specialized view directories of each.
You can also customize the places where to search overrides.