B4J Library jAgenda

Hello,

I would like to share this library I created. It's a Google-Calendar-style calendar that allows you to show your events in a fully customizable calendar.

How to use it:
  1. Copy the jAgenda.jar and jAgenda.xml to your libraries folder.
  2. Copy the jAgenda.fxml to your project/Files folder.
  3. In the Process_Globals, create a variable as jAgenda.
  4. Create a pane control in the Designer. The Agenda will be loaded in this pane.
  5. Don't forget to call "agenda.Resize(Width, Height)" In the resize event of the pane (Otherwise the events won't resize properly).
Some pictures:
jAgenda.PNG


Enjoy!

[Update 4: December 13th, 2016]
  • Fixed error messages when starting
  • initialize method now needs a pane (previously anchorpane)
  • fixed resizing problem

[Update 3: August 25th, 2015]

  • Fixed the crash when using B4J 3.50. Please download the file "jAgenda_v2_B4J_3_50.zip" and replace your existing libraries.
There is still an error at the application start. I don't have time to look into it right now, so just change the code :
B4X:
agenda.Resize(Width, Height)
with
B4X:
Try
    agenda.Resize(Width, Height)
Catch
    Log(LastException.Message)
End Try
In your resize sub.

[Update 2: March 3rd, 2014]
  • Fixed the overlapping events
  • Added new methods: StyleHeaderToday, StyleHeaderOtherMonths, StyleHeaderThisMonth to set the style for the day headers
  • Removed the day colors methods
  • Different signature for the _DayClicked and _EventClicked events:
    B4X:
    Sub agenda_EventClicked (EventData As MouseEvent, ClickData As jAgendaUserEvent)
        '
    End Sub
    Sub agenda_DayClicked (EventData As MouseEvent, ClickData As jAgendaDate)
        '
    End Sub
  • More info required for the addEvent method: Time, place, category, tag. This is because in a future update I plan to have a filter by category method. Think of categories like calendars in Google calendars, that you can show or hide.
  • Possibility to add a Tag to the events
[Update 1]
  • Removed the unnecessary need for the expressionevaluator.jar
  • Display the Year next to the month's name in the header
  • Display (Today) next to today's date
  • added GoToToday method
 

Attachments

  • jAgenda_Example.zip
    3.6 KB · Views: 692
  • jAgenda_20161213.zip
    15.8 KB · Views: 732
Last edited:

jmon

Well-Known Member
Licensed User
Longtime User
Hi,

Yes, I also get the same errors. I think it's caused by a modification of the pane behavior in 3.50. I'm trying to fix it at the moment, but no luck yet, and the error is not very helpful.
I also got the same error on several other libraries I did...

I'll keep you updated.
Jmon
 

jmon

Well-Known Member
Licensed User
Longtime User
Unfortunately, I got the same results as Luca when I ran it in 3.50.
The example (with B4J 3.50) does not work:
Hi,

I fixed the crash when using B4J 3.50. Please download the file "jAgenda_v2_B4J_3_50.zip" and replace your existing libraries.

Note:
But there is still 1 error at the application start (but it doesn't crash the app). I don't have much time to look into it right now, so please just change the code :
B4X:
agenda.Resize(Width, Height)
with
B4X:
Try
    agenda.Resize(Width, Height)
Catch
    Log(LastException.Message)
End Try
In your resize sub.

It will log 1 error when the application starts and then no more error. I'm trying to understand where the error comes from, but no luck so far. It appearently is caused by "paneParent.LoadLayout("jAgenda")" in my code, so there must be something wrong with the layout.

This is a temporary fix, so you can update to B4J 3.61. When I get time, I'll work on a definitive solution.

Regards
Jmon.
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Hello, @jmon,

I tried it with 3.61 and it works.

Found another bug - click on Add without a date entry, the app abends...

Thank you,

Sandy
 

jmon

Well-Known Member
Licensed User
Longtime User
I've updated the library, to fix some problems:
or what is wrong?
Hi, I fixed the problem. I've updated the first post with the latest library.
The example (with B4J 3.50) does not work:
Hi, I fixed the problem, now works properly.
Unfortunately, I got the same results as Luca when I ran it in 3.50.
I fixed this problem too :)

Sorry to all of you, it took me very long time to get back to this project and fix those errors. :(

I've also changed the initialize function. Now you will have to pass a Pane, instead of an anchorpane. This is because the internal designer doesn't have anchorpanes.
 

LucaMs

Expert
Licensed User
Longtime User
B4J 4.70 - debug mode:

Program started.
Error occurred on line: 99 (Main)
java.lang.NullPointerException
at b4j.example.jagenda._resize(jagenda.java:1168)
at b4j.example.main._paneagenda_resize(main.java:369)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

If I comment that line:
B4X:
    agenda.Resize(Width, Height) '!Important. call this method to resize the agenda with your window.

I get:
Error occurred on line: 32 (Main)
java.lang.ClassCastException: javafx.scene.layout.Pane cannot be cast to javafx.scene.layout.AnchorPane
at b4j.example.main._appstart(main.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Line 32:
B4X:
    agenda.Initialize(Me, MainForm, paneAgenda, "Agenda")
 

jmon

Well-Known Member
Licensed User
Longtime User
java.lang.NullPointerException
at b4j.example.jagenda._resize(jagenda.java:1168)
This should be fixed with the new library.

Error occurred on line: 32 (Main)
java.lang.ClassCastException: javafx.scene.layout.Pane cannot be cast to javafx.scene.layout.AnchorPane
Did you replace the old library with the new one? Because I have changed the anchorpane to a pane to support the layouts created with the internal designer, which doesn't have the anchorpane. So now the 3rd item in the Initialize function should be a pane.

Which java version are you using? I'm using 8_u101 and no error here.

I've re-uploaded the library to the first post, just to make sure I didn't upload an old version by mistake. Could you download it again and tell me if it works?
 

jmon

Well-Known Member
Licensed User
Longtime User
Top