B4J Question [BANano] The Designer - BANanoDesignElement

Declan

Well-Known Member
Licensed User
Longtime User
I am using this Tutorial to set the Designer in my B4J BANano app:
B4X:
https://www.b4x.com/android/forum/threads/banano-the-designer.100618/#content
I am somewhat (a lot) confused.
I keep getting the following error:
B4X:
B4J Version: 8.10
Java Version: 11
Parsing code.    Error
Error parsing program.
Error description: Unknown type: bananominicssbuilder
Are you missing a library reference?
Error occurred on line: 6 (Main)
Private Builder As BANanoMiniCSSBuilder '<-------- defining our BANano Library
How exactly do I set this up?
 

Declan

Well-Known Member
Licensed User
Longtime User
@alwaysbusy
Many Thanks
Looking at:
B4X:
https://www.b4x.com/android/forum/threads/banano-v2-1-b4j-abstract-designer.101531/
I must create a Custom View for each "control" I would like to use in my Designer layout?
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
I must create a Custom View for each "control" I would like to use in my Designer layout?
Yes. This is the whole purpose of BANano compared toh ABMaterial: it is independent from all CSS frameworks. An example is the Skeleton CSS library. At this moment, I'm extending this library so that it has a lot more components (like tabs, chips, date picker, modal sheets, sidebars, bread crumbs, toasts, pagination, floating button, qrcode maker, editor, etc...) so one could get started quickly.

It is very easy to make BAnano UI frameworks, but if one is not careful, it quickly turns into a bloated monster that gives a bad user experience because of e.g. its loading time. It is a fact that users turn away from your WebApp if it is slow and takes to long to load. BANanoSkeleton is foremost super light and blistering fast. I spend a lot of time fine-tuning the javascript and CSS and in many cases just re-write existing libraries to get an optimal result.

And it works with the B4J abstract designer. :)

Some screenshots of the upcoming BANano update:
Image4.jpg


Image1.jpg


Image2.jpg


Image3.jpg


Image5.jpg


Alwaysbusy
 
Last edited:
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
@alwaysbusy AWESOME STUFF.
I am busy going through the Tutorials.
When I go through:
B4X:
https://www.b4x.com/android/forum/threads/banano-v2-2-b4j-abstract-designer.101544/
So to summerize: you will now have the following files in your Additional Libraries folder:
B4X:
yourlib.js
yourlib.dependsOn
yourlib.jar
yourlib.xml
yourlib.php (if you have used inline php in your library)
yourlib_Files.zip (if you had assets in your Files tab)

I only have the yourlib.jar and yourlib.xml in the Additional Libraries folder
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
Is there a Library that will allow this.
I have gone through the Tutorial in creating the library a number of times with no success:
B4X:
https://www.b4x.com/android/forum/threads/banano-v2-b4j-abstract-designer-part-1.101531/#post-637557
and also the test example:
B4X:
https://www.b4x.com/android/forum/threads/banano-v2-2-b4j-abstract-designer.101544/
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
I receive the following error:
B4X:
Waiting for debugger to connect...
Program started.
C:\B4X\Additional Libraries\sktext.js is missing!
C:\B4X\Additional Libraries\sktext.dependsOn is missing!
java.io.FileNotFoundException: C:\B4X\Additional Libraries\sktext.dependsOn (The system cannot find the file specified)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at java.base/java.io.FileReader.<init>(FileReader.java:75)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.Build(Unknown Source)
    at b4j.example.main._appstart(main.java:82)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)
C:\B4X\Additional Libraries\sktext.js is missing!
C:\B4X\Additional Libraries\sktext.dependsOn is missing!
java.io.FileNotFoundException: C:\B4X\Additional Libraries\sktext.dependsOn (The system cannot find the file specified)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at java.base/java.io.FileReader.<init>(FileReader.java:75)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.Build(Unknown Source)
    at b4j.example.main._appstart(main.java:82)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)
C:\B4X\Additional Libraries\sktext.js is missing!
C:\B4X\Additional Libraries\sktext.dependsOn is missing!
java.io.FileNotFoundException: C:\B4X\Additional Libraries\sktext.dependsOn (The system cannot find the file specified)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at java.base/java.io.FileReader.<init>(FileReader.java:75)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.a(Unknown Source)
    at com.ab.banano.BANano.Build(Unknown Source)
    at b4j.example.main._appstart(main.java:82)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)
java.io.FileNotFoundException: skeleton-all.min.css
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209)
    at anywheresoftware.b4a.objects.streams.File.Copy(File.java:336)
    at com.ab.banano.BANano.Build(Unknown Source)
    at b4j.example.main._appstart(main.java:82)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.example.main.start(main.java:38)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)
Done!
Copying CSS files to WebApp assets...
Problem copying skeleton-all.min.css
Copying Javascript files to WebApp assets...
Building C:\B4X\Objects\BANanoSkeleton\index.html

Both B4J projects are attached:
SKText - EditText library
Test1 - test Library/Designer
 

Attachments

  • SKText.zip
    3.1 KB · Views: 128
  • Test1.zip
    2.2 KB · Views: 130
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
I suggest you try to use the existing SkeletonCSS library before trying to write your own library so you can get the hang of how a BANano WebApp works.

There are a couple of things wrong. I reduced the code to the absolute minimum so it may be easier to follow.

First of all, the library you made doesn't do anything: it just creates an empty div to the body. You don't do anything with e.g. the mText property.

1. Changes in your library:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    ' you can change some output params here
    BANano.Initialize("SKText", "SKText",1)  '<--- The AppShortName was wrong. Do not reuse the one from the BANanoSkeleton library for your own library
    
    BANano.Header.AddCSSFile("skeleton-all.min.css") ' <--- the skeleton-all.min.css file is missing in the Files Manager tab.
 
    ' start the build
   #if release
           BANano.BuildAsB4Xlib("1.01") '<--- works only in release mode and will build your lib in your Additional Libraries folder as a .b4xlib
   #else
           BANano.Build(File.DirApp) ' <--- in Debug mode, you can use this to test your lib, will not make a .b4xlib 
   #end if
 
    ExitApplication
End Sub

2. For this example, I added the mText property to this line so at least it shows something
B4X:
mElement = mTarget.Append($"<div id="${mName}" class="${mClasses}" style="${exStyle}${mStyle}">${mText}</div>"$).Get("#" & mName)

3. Run in RELEASE mode to make your .b4xlib
B4X:
Reading B4J INI in C:\Users\pi\AppData\Roaming\Anywhere Software\B4J to find Additional Libraries folder...
Found Additional Libraries folder: K:\B4J\AddLibraries
Building K:\B4J\AddLibraries\SKText.b4xlib
Building K:\B4J\AddLibraries\SKText\SKText.dependsOn
----------------------------------------------------------
K:\B4J\AddLibraries/SKText.b4xlib created!
----------------------------------------------------------

4. In your Test1 project.

a. you are using the wrong properties: only the Custom Properties can be used in BANano views so here we must put 'HELLO' in this Text property, NOT the Text under 'Text Properties'

b. Changes in the Test1 AppStart

B4X:
Sub AppStart (Form1 As Form, Args() As String)
    ' you can change some output params here
    BANano.Initialize("BANano", "SKTextDemo",1) '<--- The AppShortName was wrong. Do not reuse the one from the BANanoSkeleton library for your own WebApp
    
    BANano.Header.Title="BANano SKText demo"
    
    ' start the build
    BANano.Build(File.DirApp)
 
    ExitApplication
End Sub

' HERE STARTS YOUR APP
Sub BANano_Ready()
    BANano.LoadLayout("#body", "layout1")
End Sub

5. Run the App
B4X:
Waiting for debugger to connect...
Program started.
Reading B4J INI in C:\Users\pi\AppData\Roaming\Anywhere Software\B4J to find Additional Libraries folder...
Found Additional Libraries folder: K:\B4J\AddLibraries
Building D:\Test1\B4X\Objects\SKTextDemo\scripts\app.js
Loading layout layout1...
Processing b4xlib: sktext
Copying CSS files to WebApp assets...
Copying Javascript files to WebApp assets...
Building D:\Test1\B4X\Objects\SKTextDemo\index.html
Done!

The result in the browser:

1587964438785.png


Alwaysbusy
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
@alwaysbusy
Many Thanks.
I am running the SketetonCSS Demo and runs great.
I have a couple of questions:
The demo code has a number of "Log" statements and I cannot read the Log as when I run in Debug mode, I see nothing?
I am trying to see the "SKNavigationBar1_Click (event As BANanoEvent, menu As String)" event, as a start.
 
Upvote 0
Top