I am so sorry Geert. I hope you can forgive me for calling you by the wrong
name. I double checked your name when I send out the first email and somehow
I just managed to screw up. Sorry again.
And thank you very much for your detailed answers. I am currently evaluating
this framework and trying to figure out if it's easier (less coding &
simpler) to use it to provide a web interface to do database operations. We
may need to provide more complicated user interfaces than the default ones
and I want to know how much work will be involved with customization and to
figure out if it's still much easier than just using other web based
frameworks which does not have crud operation support.
About changing the database structure if the model changes. I think it's
kind of hard to do because there are different kind of changes. I am not
sure if it's achieveable by adding meta data to the element. When we change
the model, we should specify what kind of change(changes that the framework
supports) we'd like to do to the datastructer. I am just thinking loud so
please ignore it if it doesn't make sense.
Thanks again,
Jing or Maggie (the same person)
Hi Greet,
Ok, just to set things straight, my name is Geert ;-)
I've been playing around the example for RIFE/CRUD and I have some
questions about the customization:
1. The default CRUD impl does not provide dropping a table. If I want to
drop a table, I need to implement a Drop element and a template for
layout. Is this correct?
Yes, this is simply done like this:
ContentQueryManager<YourClass> manager = new
ContentQueryManager<YourClass>(datasource, YourClass.class);
manager.remove();
Ideally I'd like RIFE/Crud to be able to migrate your database
structure when your models change. I haven't found a good way to do
so yet though. If you have any ideas, please tell!
2. If I don't want the layout of the default menu. For example, if I have
a lot of tables, I don't want to show all the table names on the top-level
menu. I want to be able to select them from a drop down box, can a
customized menu element/transformer/template acheive this?
Yes, it can do anything you like. If you want this to be totally
dynamic and automatically adapting to changes, you'll need to delving
into the internals of RIFE's site structure. However, you don't need
to do so, it can be totally static too.
3. If I don't specify template name as a property to the element, from the
src code it seems that RIFE will throw an exception. By looking at
PrintCrudTemplate, it behaves the same as PrintTemplate. But in the
example most of the elements do not specify template name as a property.
How does the framework figure out which template to transform?
RIFE itself doesn't automatically select a template, RIFE/Crud does.
It does this by automatically generating the templates and the names
according to your bean class name and the base template name (add,
edit, browse, delete, menu). The method that does this is getTemplate
() in this file: https://svn.rifers.org/rife-crud/trunk/src/
implementations/com/uwyn/rife/crud/elements/admin/CrudElement.java
Most of the work is done in the custom template transformer, which
implicitly also caches the transformation.
Using templates in RIFE is just one way to output text content, you
can use anything else, this means that you normally always need to
instantiate a template yourself if you want to use it. You can
however inject an instance through IoC though.
4. Based on my guessing about 3, For the CRUD example, if I added a new
bean (NewTest) and I want to use my own template for add & edit. all I
need to do is to define the following:
<subsite id="NEWTEST" file="crud:com.uwyn.rife.crud.samples.beans.NewTest"
urlprefix="/ newtest">
<property name="crud_template_name-add">admin.new_add</property>
<property name="crud_template_name-edit">admin.new_edit</property>
</subsite>
Is this correct?
Yes, beware though that the creation of these templates is not
trivial, since you need to escape the actual template tags that need
to be available after the transformation. The reason for this is that
the templates you provide like this are generic blueprints that have
to contain all the elements to build the final transformed templates
according to the constraints and beans.
Geert
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users