Add a button to go back to current date

51 views
Skip to first unread message

samir.ha...@gmail.com

unread,
Jun 1, 2015, 12:35:25 PM6/1/15
to jfxtr...@googlegroups.com
Hi guys,

I'm currently using JfXtras Calendars and I came across a need so I would like to have your opinion.

Basically, I would need a button (maybe a label) in order to go back to the current date. Apparently, some users may lost themselves by wandering into the Calendars and they want to quickly go back to the current date.

I know that Windows has that for the Date and time settings, a clickable label is displayed above in order to go back to the current date:


What do you think of that? If you are interested in such a feature, I'll be ready to implement it for all calendars. This could be optional and deactivated by default.


Let me know,

Sam'

tbeernot

unread,
Jun 1, 2015, 12:38:53 PM6/1/15
to jfxtr...@googlegroups.com
There already is such a button, if you click in the space between the weeknumber and daylabels, it will go back to today. I have not found a good way to visualize it, still in search of a nice icon, but the functionality is there. If you have a nice idea about visualizing it, I'm open to suggestions.

Of course there is nothing to stop anyone from creating a clickable label which calls setDisplayedCalendar(Calendar.newInstance()). But a whole label is too much for such a simple functionality IMHO.

samir.ha...@gmail.com

unread,
Jun 2, 2015, 7:26:39 AM6/2/15
to jfxtr...@googlegroups.com
Alrighty I have found the feature! It is well hidden ^^


Of course there is nothing to stop anyone from creating a clickable label which calls setDisplayedCalendar(Calendar.
newInstance())

 In fact, if I wanted to do like you said, it would be quite difficult no? For example, for the CalendarTextField, the popup is built inside the skin, so if I wanted to add such a Label inside the Popup, I would need to rewrite completely the skin no?

I agree with you that a whole label is maybe too much. I'll try to see if I find a suitable icon. That would be a shame not to expose such a feature because of a lack of icon.

tbeernot

unread,
Jun 2, 2015, 7:31:33 AM6/2/15
to jfxtr...@googlegroups.com

On 2-6-2015 12:08, samir.ha...@gmail.com wrote:


Of course there is nothing to stop anyone from creating a clickable label which calls setDisplayedCalendar(Calendar.
newInstance())

 In fact, if I wanted to do like you said, it would be quite difficult no? For example, for the CalendarTextField, the popup is built inside the skin, so if I wanted to add such a Label inside the Popup, I would need to rewrite completely the skin no?

Nope, because the CalendarTextField has a displayedCalendar property.



I agree with you that a whole label is maybe too much. I'll try to see if I find a suitable icon. That would be a shame not to expose such a feature because of a lack of icon.

I was thinking about something with two pointy brackets and a dot in between, like ">-<" but instead of the minus a dot. It suggests a move back to the center thing. Maybe creating a SVG path and put that in the CSS, so it is easily scale- and changable.


tbeernot

unread,
Jun 2, 2015, 7:33:15 AM6/2/15
to jfxtr...@googlegroups.com
On 2-6-2015 12:08, samir.ha...@gmail.com wrote:
>
> In fact, if I wanted to do like you said, it would be quite difficult no? For example, for the CalendarTextField, the popup is built inside the skin, so if I wanted to add such a Label inside the Popup, I would need to rewrite completely the skin no?

Oh, hold on, you want it to be in the skin, I envisioned it outside. Clicking on it would make the CalendarTextField go back to today, not the popup. But yes, then you would need to rewrite the skin, but as it turns out that is not necessary. :-)

Tom

samir.ha...@gmail.com

unread,
Jun 2, 2015, 8:44:03 AM6/2/15
to jfxtr...@googlegroups.com
Yes I wanted it to go back to today in the popup :)

The CSS idea seems good. This would mean that someone could easily change the SVG path or replace it by an Image?

tbeernot

unread,
Jun 2, 2015, 8:45:27 AM6/2/15
to jfxtr...@googlegroups.com
On 2-6-2015 14:12, samir.ha...@gmail.com wrote:
>
> The CSS idea seems good. This would mean that someone could easily change the SVG path or replace it by an Image?
>

One could change the SVG.

samir.ha...@gmail.com

unread,
Jun 24, 2015, 12:30:14 PM6/24/15
to jfxtr...@googlegroups.com
But if it's associated with a styleClass, one could specify another SVG path through the "fx-shape" property.

But it could also specify a "-fx-background-image" in order to place a tiny image here no?

tbeernot

unread,
Jun 24, 2015, 1:02:19 PM6/24/15
to jfxtr...@googlegroups.com
Give it a try; it's standard JavaFX, I haven' t tried it myself yet.
--
You received this message because you are subscribed to the Google Groups "JFXtras Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jfxtras-dev...@googlegroups.com.
To post to this group, send email to jfxtr...@googlegroups.com.
Visit this group at http://groups.google.com/group/jfxtras-dev.
For more options, visit https://groups.google.com/d/optout.

samir.ha...@gmail.com

unread,
Jun 26, 2015, 3:09:08 PM6/26/15
to jfxtr...@googlegroups.com
Allright I am not good at SVG path so what I suggest is :

Transform the Label into a Button. Why do we want to double click on it? Shouldn't a simple click activate that feature?
The cursor will then change when hovering the button.

Add a styleClass on the button in order to customize it. Default behavior would be to remove all artifice in order to have it appear like today. Then people could specify a background image or an SVG path.

tbeernot

unread,
Jun 29, 2015, 8:37:51 AM6/29/15
to jfxtr...@googlegroups.com
If a button supports both image and SVG: great idea!

Tom

samir.ha...@gmail.com

unread,
Jun 29, 2015, 10:12:34 AM6/29/15
to jfxtr...@googlegroups.com
Yes a button can support SVG and Image.

I just have to verify if the space if enough because I think we need at least 16x16 pixels in order to show something in a decent way and I'm not sure this is the case right now.

I'll prepare the pull request and we can review it then
Reply all
Reply to author
Forward
0 new messages