Jaxcent component

52 views
Skip to first unread message

Dév

unread,
Oct 26, 2011, 6:07:28 AM10/26/11
to Jaxcent
Hello,

I started to use Jaxcent 2-3 months ago. I like it very much.
I am thinking about these problems. I am looking for ideas.
Do you have any idea to solve them nicely?

Is there any suggested way to develop components in Jaxcent?

1, For example I would like to create a TinyMCE component with label.
I would give that component a name and it
would render/generate the html elements and add some extra javascript
to the page.

2, I want to reuse some "complex" components.
For example password changer (2 pass field, they check each other)
I can generate the html elements from Java, but what if I want to
change the layout of components?

A html template for the component would be nice with ID-s and I would
put it to the currently used page in real time.
I would not see the component template details in design time. So I
could focus on the unique content of the page. And I would add just an
ID to my page like PasswordCom1.

Do you have any idea how to solve this problem?

3, I created 2-3 pages and there are a lot of redundancy in the HTML-s
like: header, footer, scripts.
Do you have a good idea, how can I create template html-s and include
them to all page. So I would need to maintain the code in one place.

Mukesh

unread,
Nov 16, 2011, 6:46:11 PM11/16/11
to jaxcen...@googlegroups.com
1.  How about creating a Java class, then your main Jaxcent page contains an object of that class, and uses its "createComponent" methods to generate the elements.  You would have to pass the HtmlPage in the ctor of the TinyMCE class.
 
2.  Same thing, make a base class, then derive from it if you want to change the layout.  You would also read a properties file from this class.
 
3.  Same answer, make a class to contain all of the redundancy!
 
Jaxcent lets you do all the HTML from Java, so you can use the full power of Java OOP to manage your code.
 

Mukesh

unread,
Nov 16, 2011, 6:46:45 PM11/16/11
to jaxcen...@googlegroups.com
>>  You would also read a properties file from this class.
 
You *could* also read a properties file from this class.

David

unread,
Nov 20, 2011, 2:55:04 AM11/20/11
to jaxcen...@googlegroups.com
Thank you for the response.

Hmm. What would you put into the property file?

I created a component to handle redundancy. The html content stored in the database and it has a unique id like: footerContent. Admin can modify the html content in change mode.
I use the HtmlElement.setInnerHtml(String htmlString) method to fill the content from the database.

It is not very nice solution, but it can be easily maintain by Admin users.

Is it possible to set the innerHtml content and than manipulte the content of it through HtmlElement classes?

Please note that: htmlString is more complicated and this link is inside of it.
String htmlString = "<Lots of html content ><tag_x id='myLink' ref='XY'>Create_Customer_Message_Link</tag_x> <lots of html content>";
htmlElement.setInnerHtml(htmlString);

I want to change the Create_Customer_Message_Link innerText to the language dependent label.

I tried this:
A,
HtmlElement link = new HtmlElement(page, "myLink");
link.setInnerText("Language dependent label");
-> Jaxcent Error: Element with ID "myLink" was not found


Ohh ok... the Id was wrong. I can do it...
Jaxcent is Coool!

 

Mukesh

unread,
Nov 22, 2011, 9:46:04 AM11/22/11
to jaxcen...@googlegroups.com
The property file idea is the same as what you are putting in the db.  I think the db is a nice solution - as it is easier to maintain for an admin type.  I guess you could even give them a nice program to change the db...  But storing the "content description" in a db or other storage, can give you dynamic control of the page layout from some sort of a textual description.

David

unread,
Dec 6, 2011, 10:38:59 AM12/6/11
to Jaxcent
Hello Mukesh,

I did good progress on Jaxcent components. Thanks again.

I faced with that there are 2 class HtmlElement and
JaxcentHtmlElement, and they don't have any shared super class.
So it is hard to handle JaxcentHtmlElement extended form elements.

I use HtmlElements because it is easy to generate and handle them. I
generate form elements as HtmlElement (textfields, buttons etc.).
Do you see any side effect or limitation if I use HtmlElement class
instead of JaxcentHtmlElement extended classes like HtmlInputText?

Thank you,
David

Mukesh

unread,
Dec 6, 2011, 8:59:51 PM12/6/11
to jaxcen...@googlegroups.com
Hi David.   I guess you could do that.  But originally I intended JaxcentHtmlElement to be the one to use as base.  The HtmlElement was originally just meant to be a "catch-all" convenience class.
 
Not to say that the original purposes have to be always followed - if the HtmlElement does a lot of what you need (and JaxcentHtmlElement doesn't), it would make more sense to derive from it.  But first, I would look in the source code at the implementation of something like HtmlAnchor or HtmlTable or HtmlSelect and how they extend JaxcentHtmlElement.  Then if you decide deriving from HtmlElement makes more sense, go for it.  / Mukesh

David

unread,
Dec 6, 2011, 11:28:45 PM12/6/11
to jaxcen...@googlegroups.com
Hi Mukesh,

I will do that. Thanks!
David

Reply all
Reply to author
Forward
0 new messages