Technical question please about jmesa toolbar

152 views
Skip to first unread message

Hanen Ben Rhouma

unread,
Nov 30, 2011, 9:08:38 AM11/30/11
to JMesa
Hello there,

Please I have a question: Is it possible to add another toolbar at the
end of the jmesa table in order to make it easier for users to jump
from one page to another without being obliged to scroll up each time?

Thanks in advance,
Hanen

AMRAOUI Marouane

unread,
Nov 30, 2011, 9:19:24 AM11/30/11
to jm...@googlegroups.com
Hello ,
yes its possible.

Step 1 : create new implementation toolbar view class 
  1. package com.myapp.view
  2. public class BottomToolbarView extends HtmlView {
  3. @Override
  4. public Object render() {
  5. HtmlSnippets snippets = getHtmlSnippets();
  6. HtmlBuilder html = new HtmlBuilder();
  7. html.append(snippets.themeStart());
  8. html.append(snippets.tableStart());
  9. html.append(snippets.theadStart());
  10. html.append(snippets.toolbar());
  11. html.append(snippets.filter());
  12. html.append(snippets.header());
  13. html.append(snippets.theadEnd());
  14. html.append(snippets.tbodyStart());
  15. html.append(snippets.body());
  16. html.append(snippets.tbodyEnd());
  17. html.append(snippets.footer());
  18. html.append(snippets.statusBar());
  19. html.append(snippets.toolbar());
  20. html.append(snippets.tableEnd());
  21. html.append(snippets.themeEnd());
  22. html.append(snippets.initJavascriptLimit());
  23. return html.toString();
  24. }
  25. }

Step 2 : use this new view in your jmessa table html

  1. <jmesa:tableFacade
  2. id="tag"
  3. .....

  4. view="com.myapp.view.BottomToolbarView"
  5. >
  6. <jmesa:htmlTable
  7. caption=""
  8. width="1100"
  9. >
  10. <jmesa:htmlRow uniqueProperty="refUsrAuthTableId">


hope this help you.



--
You received this message because you are subscribed to the Google Groups "JMesa" group.
To post to this group, send email to jm...@googlegroups.com.
To unsubscribe from this group, send email to jmesa+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jmesa?hl=en.


Hanen Ben Rhouma

unread,
Dec 1, 2011, 11:48:24 AM12/1/11
to jm...@googlegroups.com
Hey Folks,

Again having issues with this customization thing: Actually the issue I'm facing now is that the second time we invoke html.append(snippets.toolbar()
);  within the class BottomToolbarView we'll get an append of the previous toolbar with a new one which makes the count to 2 toolbars at the bottom, such issue needs an override of the toolbar() method but adding wrappers everywhere isn't a performant solution and most importantly it's not working.


Any suggestions please..
--
Regards,
Hanen

Jeff Johnston

unread,
Dec 1, 2011, 12:08:01 PM12/1/11
to jm...@googlegroups.com
Are you putting the toolbars next to each other in the view? The toolbar will show up where you place it (take a closer look at AMRAOUI example). It might help to look at the snippets class to take the mystery out of what is happening. If it is still happening could you post your view?

-Jeff

Hanen Ben Rhouma

unread,
Dec 1, 2011, 12:17:35 PM12/1/11
to jm...@googlegroups.com
No, I'm trying to show two toolbars separately, one at the top the other in the bottom.

What I'm getting is one toolbar on the top and two close to each other in the bottom, and yes I'm following the same example given by AMRAOUI.

What I noticed in the implementation of the method toolbar() is:


 public String toolbar() {

        HtmlBuilder html = new HtmlBuilder();

        HtmlRow row = table.getRow();
        List<Column> columns = row.getColumns();

        String toolbarClass = getCoreContext().getPreference(HtmlConstants.TOOLBAR_CLASS);
        html.tr(1).styleClass(toolbarClass).close();
        html.td(2).colspan(String.valueOf(columns.size())).close();

        html.append(toolbar.render());

        html.tdEnd();
        html.trEnd(1);

        return html.toString();
    }

The toolbar.render() keeps track of the previous toolbars and increment their number each time we invoke it. We need to reinitialize it somehow without loosing the rest of the snippet components.

Jeff Johnston

unread,
Dec 1, 2011, 2:36:24 PM12/1/11
to jm...@googlegroups.com
I just tried it out in one of my projects and it worked fine...

What version of JMesa are you using? Do you have other custom code?



The toolbar.render() keeps track of the previous toolbars and increment their number each time we invoke it.

This is not quite right. When you ask the toolbar to render itself it does it each time with no knowledge of previous render attempts.

Can you post your view?

-Jeff

Hanen Ben Rhouma

unread,
Dec 2, 2011, 3:24:00 AM12/2/11
to jm...@googlegroups.com
I'm using 2.2.8

Hanen Ben Rhouma

unread,
Dec 2, 2011, 3:30:24 AM12/2/11
to jm...@googlegroups.com
I don't know if I can attach a screenshot in here but I'm trying. Please let me know if you can download it.
--
Regards,
Hanen

Bottom_Toolbar.JPG

Jeff Johnston

unread,
Dec 2, 2011, 9:00:38 AM12/2/11
to jm...@googlegroups.com
I would not be able to support the 2.2.8 release. You should be able to move to the 3.0.4 release fairly easy though as things that changed were deprecated. If you are using the tags its really easy as you mostly just need to change from using <jmesa:tableFacade /> to <jmesa:tableModel />. If you are using the API you can still use the TableFacade, but the TableModel makes things much easier.

Still, I would only move if you can carve out enough time to do the upgrade. I am sure the upgrade is fairly straightforward, but like anything there may be little things that you need to work through.

-Jeff

Hanen Ben Rhouma

unread,
Dec 6, 2011, 8:19:47 AM12/6/11
to jm...@googlegroups.com
Hello again,

Are there any known issues for migrating from 2.2.8 (prototype-based) to 3.0.4 (jquery-based)? I heard they're exclusive so we can't use them in the same project context.

Please clarify.

Jeff Johnston

unread,
Dec 6, 2011, 4:15:42 PM12/6/11
to jm...@googlegroups.com
You would have to move everything at once. But, that said, unless you have custom JavaScript you should be able to move to the 3.0.4 release pretty easy. I tried very hard to keep thing backwards compatible. Your best bet is to just take one table and see how it goes.

-Jeff

Hanen Ben Rhouma

unread,
Dec 7, 2011, 3:49:34 AM12/7/11
to jm...@googlegroups.com
Too many missing dependencies and conflicts, we're using Maven 2 for build and deployment, seems old for such API. Isn't there any intermediate version which encapsulates the main recent features without having to migrate radically from prototype to jquery and from maven 2 to maven 3, that's a huge time/effort investment that's gonna enlarge our refactoring scope (till now 7 files needed to be modified) as well as several non regression test scenarios.
Reply all
Reply to author
Forward
0 new messages