B4J Question [ABMaterial] - Code in ABMApplication

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
Sorry for this beginner question but I need understand.

In ABMApplication class we have the subs BuildPage () and BuildTheme().
Is that really necessary?

Why this code is executed if on WebSocket_Connected() the app is always directed to the Initial page?


See: ABMShared.NavigateToPage (ws, "", "./" & InitialPage)


Thank you.
 

alwaysbusy

Expert
Licensed User
Longtime User
In ABMApplication class we have the subs BuildPage () and BuildTheme().
Is that really necessary?
Yes both are VERY IMPORTANT. BuildTheme and BuildPage both 'build' the basic structure of the html page. They determine which CSS needs to be generated (BuildTheme) and how the grid of your page looks like (BuildPage). To keep the code clean, BuildTheme() is a seperate method, but is called in BuildPage but if you want to put all the code of BuildTheme in BuildPage, feel free to do so.

See more info on the flow of an ABM Web app here: http://prd.one-two.com:51042/demo/GettingStartedPage/abmaterial-getting-started.html

Why this code is executed if on WebSocket_Connected() the app is always directed to the Initial page?
This only happens when the session is new. So when someone enters your web app in a subpage, he is redirected to your home page. You can let it go wherever you want but the home page is the most logic.
 
Upvote 0

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
Understood partially.

If on my site I have a homepage. For example ABMPageHome. Everything works well here. This is my home page.

But what is the function of index.html generated in ABMApplication?

If ABMPageHome already has the site intro (Welcome and more ..., ..., ...) then what should be placed in the html of index.hml generated in ABMApplication?

Would it be like an offline page?

Thanks for your patience.
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
what should be placed in the html of index.hml
ABM creates dynamic Web Apps, so there is not a lot that should be put there. You add your components in connectpage (see the demo soource code for an example). If it is something that will not change (at all!), then you can put it in BuildPage, but generally most Web Apps show content depending on who logged in for example so ConnectPage() is the place to do this.

When the browser goes to your WebApp, it needs a html file to make the Websocket connection (among other things). But this does not mean everything should already be in there. Add the content in ConnectPage(). Not having a huge html file to start with also improves the user experience (loading times).

Note: ABM is build for mainly Webapps, not for Websites! (it is possible but I don't really see the advantage of using ABM/B4J to do that).
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Note: ABM is build for mainly Webapps, not for Websites!

Do you mind to elaborate a bit more? What will be wrong or limiting in using ABM to design a simple site where a few pages makes up the public area (you know, Home, Contacts, Policies...) and then a private area will be shaped after the login user? I'm thinking about a private area where the user not only finds the doc area where to upload/download private stuff, but also where interaction with what we can define a user-specialized webapp could happen.
Just as an example:
userA runs a restaurant; in the private area he/she can set the daily menu or can manage a complete list of images and descriptions of courses
userB needs time management; in his/her private area will find a time management "app"

Would you just discourage the use of ABM for a pure website? A simple, informative, "static" one? It that the meaning of your comment? Or am I missing some key points about ABM? TIA.
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Both examples would justify using ABM. They both change enough to have their own 'edit' elements (setting the daily menu, changing pictures, setting a schedule or record the time someone spend). What I mean with static is really 'static': a website where the content maybe changes once or twice a year, that does not use a database etc. In that case using ABM would be overkill and a normal website building tool like Dreamweaver would fit better.

ABM has its limits aesthetically: it looks more like a mobile app than on a conventional website. Very little fancy animations, limited control over where a component is positioned, fixed appearance of input elements etc. But that is why it was build: quickly create Web Apps, following the Google Guidelines as close as possible.
 
Last edited:
  • Like
Reactions: udg
Upvote 0

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
After little research to understand the difference between webapp and website I noticed what is not easy to make a difference.

However, let's use a general concept that I found:

- A website is more informative (static or not)
- A web application is more interactive

I believe ABMaterial with BJ4 could create a web app/site that is useful on desktop and at the same time functional on mobile devices.

I can create the application using asp.net now. I have good levels of knowledge. However, when I think how difficult it is to create ASP.NET pages that look good on mobile devices I think of using ABMaterial.
 
Upvote 0

mindful

Active Member
Licensed User
But what is the function of index.html generated in ABMApplication?
ABMApplication acts as a router, in here you can place logic that identifies if the user is logged in or if it's session is new ... or something like if user is part of company A then redirect to A page, if company B then redirect to B. So ABMApplication main purpose is where you place all server logic that the client will hit before he sees something visualy in the browser. I use ABMApplication page as the login page of my webapp, as my webapp si not open to the public only to registered user and here I handle different redirects like if user is admin (me) then redirect me to page X if user is client then redirect to page A and so on ....
 
Upvote 0
Top