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: 698
  • jAgenda_20161213.zip
    15.8 KB · Views: 740
Last edited:

magoandroid

Member
Licensed User
Longtime User
Hi jmon,
thank you very much for your sharing.

At this time I needed a calendar as your own.

Greetings.
MAgo
 

jmon

Well-Known Member
Licensed User
Longtime User
I just updated the library:
  • 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
 

jmon

Well-Known Member
Licensed User
Longtime User
I have updated the library. There are some script breaking changes:

[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)
    Sub agenda_DayClicked (EventData As MouseEvent, ClickData As jAgendaDate)
  • 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
I may have skipped some changes. If you run into any issue, please post your messages here.

Note that the new return values for the events will return more information, such as the time, text, place etc... Also you can now test for number of clicks with the mouseevents.
 

imbault

Well-Known Member
Licensed User
Longtime User
Hi @jmon , your library is great, I have only one pb, when I run my application, Days are filled with number of events, I have to press escape to see all the events:
At launch:
upload_2015-4-26_1-44-18.png


After pressing escape or modify the window, this is correct:
upload_2015-4-26_1-45-5.png


What I am missing? or what is wrong?

Thanks a lot

Patrick
 

Attachments

  • upload_2015-4-26_1-41-23.png
    upload_2015-4-26_1-41-23.png
    97.5 KB · Views: 405

wineos

Member
Licensed User
Longtime User
Hi, I don't know if it is a place to ask this question: can this library support B4A and B4i?

Anyway, it's a great library. :)
 

jmon

Well-Known Member
Licensed User
Longtime User
What I am missing? or what is wrong?
Hi, you could try calling "agenda.refresh", just after inputting all your events. In the example I provided I don't get the problem. Do you?

can this library support B4A and B4i?
No, it uses Javafx! :-(
 

imbault

Well-Known Member
Licensed User
Longtime User
I think it depends when you have more events in a day, it can show, in that case it show +(number), and if you resize more vertically, you can see them.
Can we do something about the height of an vent in the calendar?

Thank you
 

jmon

Well-Known Member
Licensed User
Longtime User
I think it depends when you have more events in a day, it can show, in that case it show +(number), and if you resize more vertically, you can see them.
Can we do something about the height of an vent in the calendar?

Thank you
Hi,
I will do something about it, tomorrow because I'm quite busy at the moment :)
 

imbault

Well-Known Member
Licensed User
Longtime User
Weird, I can't reproduce your error.
Would you want to send me your project? I could try on my side and see how I could fix the problem.
I can, but you will see nothing, the application is linked to a database, the events come from the database, so you will see just connection error and no events
 

jmon

Well-Known Member
Licensed User
Longtime User
I can, but you will see nothing, the application is linked to a database, the events come from the database, so you will see just connection error and no events
Ok, you can send it to me, I'll se what I can do.
 

Descartex

Well-Known Member
Licensed User
Longtime User
Hi everybody..
Is there any way to sincronize to an Google Calendar??
 

jmon

Well-Known Member
Licensed User
Longtime User
Hi everybody..
Is there any way to sincronize to an Google Calendar??
No, it doesn't sync to Google Calendar. :-( But if someone can write a google sync library that would be awesome :)
 

LucaMs

Expert
Licensed User
Longtime User
The example (with B4J 3.50) does not work:

Program started.
Error occurred on line: 102 (main).
java.lang.NullPointerException
at b4j.example.jagenda._resize(jagenda.java:1168)
at b4j.example.main._apagenda_resize(main.java:171)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:221)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at anywheresoftware.b4j.objects.PaneWrapper$1.run(PaneWrapper.java:95)
at anywheresoftware.b4j.objects.PaneWrapper$ResizeEventManager$1.run(PaneWrapper.java:116)
at anywheresoftware.b4j.objects.PaneWrapper$ResizeEventManager$3.changed(PaneWrapper.java:139)
at anywheresoftware.b4j.objects.PaneWrapper$ResizeEventManager$3.changed(PaneWrapper.java:1)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ReadOnlyDoubleWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyDoubleWrapper.java:177)
at javafx.beans.property.ReadOnlyDoubleWrapper.fireValueChangedEvent(ReadOnlyDoubleWrapper.java:143)
at javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:113)
at javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:147)
at javafx.scene.layout.Region.setHeight(Region.java:917)
at javafx.scene.layout.Region.resize(Region.java:1365)
at javafx.scene.Node.resizeRelocate(Node.java:2920)
at javafx.scene.layout.AnchorPane.layoutChildren(AnchorPane.java:363)
at javafx.scene.Parent.layout(Parent.java:1076)
at javafx.scene.Parent.layout(Parent.java:1082)
at javafx.scene.Scene.doLayoutPass(Scene.java:552)
at javafx.scene.Scene.preferredSize(Scene.java:1646)
at javafx.scene.Scene.impl_preferredSize(Scene.java:1720)
at javafx.stage.Window$9.invalidated(Window.java:834)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
at javafx.stage.Window.setShowing(Window.java:910)
at javafx.stage.Window.show(Window.java:925)
at javafx.stage.Stage.show(Stage.java:256)
at anywheresoftware.b4j.objects.Form.Show(Form.java:198)
at b4j.example.main._appstart(main.java:189)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.start(main.java:36)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$54/1937420425.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/186276003.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$49/627611319.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/237061348.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
at com.sun.glass.ui.win.WinApplication$$Lambda$37/2117255219.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
java.lang.RuntimeException: java.lang.NoSuchMethodError: anywheresoftware.b4j.objects.PaneWrapper$AnchorPaneWrapper.LoadLayout(Lanywheresoftware/b4a/BA;Ljava/lang/String;)V
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.start(main.java:36)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$54/1937420425.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/186276003.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$49/627611319.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/237061348.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
at com.sun.glass.ui.win.WinApplication$$Lambda$37/2117255219.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: anywheresoftware.b4j.objects.PaneWrapper$AnchorPaneWrapper.LoadLayout(Lanywheresoftware/b4a/BA;Ljava/lang/String;)V
at b4j.example.jagenda._initialize(jagenda.java:702)
at b4j.example.main._appstart(main.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 17 more


Also:
upload_2015-8-15_15-20-13.png
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Thank you, jmon, for your generosity in providing this valuable tool.

Unfortunately, I got the same results as Luca when I ran it in 3.50.

Could you take a look at it, please?

Best regards.

Sandy
 
Top