Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar custom style #204

Open
NegusSugus opened this issue Jul 17, 2023 · 5 comments
Open

Calendar custom style #204

NegusSugus opened this issue Jul 17, 2023 · 5 comments

Comments

@NegusSugus
Copy link

Hi,
I'm creating a Calendarview in which I could have more than 7 styles, and they can be customized, so the backgorund color will be saved in the database. Is there the possibility to set customized styles for calendars taking into consideration that I can't have them specified in a stylesheet because they will come from a database?

Thanks

@dlemmermann
Copy link
Collaborator

no built in option, sorry, but you can implement your own entry view factory and use whatever you like. Subclass from EntryView(Base?) and set the background via API. entryView.setBackground(new Background(.....

@NegusSugus
Copy link
Author

Thank you!
And how can I set the entry view factory?
What about the different entry views that exists by default (day entry view, all day entry view and month entry view)?

@NegusSugus
Copy link
Author

NegusSugus commented Jul 20, 2023

So I have this:
calendarView.getDayPage().getDetailedDayView().getDayView().setEntryViewFactory(param -> { DayEntryView dev = new DayEntryView(param); BackgroundFill bf = new BackgroundFill(Paint.valueOf("#CC88E3"), null, null); dev.setBackground(new Background(bf)); return dev; });

But the background color doesn't change

@dlemmermann
Copy link
Collaborator

You have to create a subclass of the superclass of DayEntryView. Otherwise CSS will override your settings.

@NegusSugus
Copy link
Author

public class DayEntryViewPersonalizada extends DayEntryView{ public DayEntryViewPersonalizada(Entry<?> entry) { super(entry); } public void setColor(String colorhex) { BackgroundFill bf = new BackgroundFill(Color.web(colorhex), null, getInsets()); setBackground(new Background(bf)); } }

calendarView.getDayPage().getDetailedDayView().getDayView().setEntryViewFactory(param -> { DayEntryViewPersonalizada dev = new DayEntryViewPersonalizada(param); dev.setColor("#CC88E3"); return dev; });

It doesn't change the color neither. But using dev.setStyle("-fx-background-color: #CC88E3;"); makes it.
But, I can make it work only for the DetailedDayView, the DetailedWeekView and the entries that lasts more than one day in the month view.
There is any way to change the circle color from the agenda view and the one day entries from the month view? What about year view?

Again, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants