Author |
Message |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/10/2016 09:28:31
|
levy
Power User
Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline
|
Hi CaptainCasa,
I want to use the schedule component, something like:
SCHEDULENode sn = new SCHEDULENode();
sn.setBackground("#f0f0f0");
sn.setHeight("100%");
sn.setNumberofblocks(24);
sn.setOrientation("vertical");
sn.setSchedulemax(1440);
sn.setWidth(width);
Besides the background color, I must color some time blocks in the schedule with different color.
The blocks are arbitrary, not corresponding to the 24 grid blocks.
E.g, I want to indicate with a different color than background that from 13.15 to 14.10 is siesta time
My first thought was to use bgpaint, something like:
sn.setBgpaint("rectangle(0, y , 100%, top, #e0e0e0)");
But the parameters "y" and "top" are pixel units or percentage.
Percentage is not accurate enough.
For pixel units, I would need some conversion ratio from minutes.
What do you recommend?
Best regards, Daniel
|
|
![](/forum/templates/default/images/spacer.gif) |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 24/10/2016 15:52:11
|
CaptainCasa
Power User
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.jpg)
Joined: 21/11/2007 12:23:06
Messages: 5538
Offline
|
Hi Daniel,
I cannot provide a solution "out of the box" right now - but just have to think about it... It would be nice to just be able to draw boxes as in the former BGPAINT, I agree...
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
![](/forum/templates/default/images/spacer.gif) |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 14/03/2017 08:21:24
|
CaptainCasa
Power User
![[Avatar]](/forum/images/avatar/eccbc87e4b5ce2fe28308fd9f2a7baf3.jpg)
Joined: 21/11/2007 12:23:06
Messages: 5538
Offline
|
Hi,
sorry - I did not come back to this message... But the problem was "solved". There is a new component DRAWAREA which was introduced with 20170220. Please check the change log there, and please also check the example that is given there - which exactly shows the usage with a SCHEDULE.
Regards, Björn
|
Björn Müller, CaptainCasa GmbH |
|
![](/forum/templates/default/images/spacer.gif) |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 16/03/2017 12:35:10
|
jdeschutter
Active
Joined: 21/11/2013 10:20:51
Messages: 8
Location: Belgium
Offline
|
Hello,
Can you use JavaFx styling on the scheduleitem:
<tag name="scheduleitem" variant="default">
<set attribute="align" value="center" />
<set attribute="fxstyleseq" value="levy-scheduleitem" />
<set attribute="invokeevent" value="doubleclick" />
<set attribute="sizeratbothsides" value="true" />
</tag>
In fx.css
.levy-scheduleitem_sp {
-fx-background-insets: 2 0 2 0;
-fx-background-color: #009933;
-fx-text-fill: #FFFFFF;
-fx-border-width: 0px;
}
.levy-scheduleitem_sp .label {
-fx-text-fill: #FFFFFF;
}
.levy-scheduleitem {
-fx-background-color: transparent;
-fx-border-width: 0px;
}
Johan
|
|
![](/forum/templates/default/images/spacer.gif) |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 16/03/2017 12:47:34
|
jdeschutter
Active
Joined: 21/11/2013 10:20:51
Messages: 8
Location: Belgium
Offline
|
Sorry, I sent the styling of the items in a schedule.
This is the styling of the schedule itself:
<tag name="schedule" variant="default">
<set attribute="fxstyleseq" value="time-schedule" />
<set attribute="height" value="20" />
<set attribute="numberofblocks" value="0" />
<set attribute="padding" value="0" />
</tag>
.time-schedule_sp {
-fx-background-color: #FFFFFF;
-fx-border-color: #808080;
-fx-border-width: 1px;
-fx-text-fill: #FFFFFF;
}
There is a lot of stuff that can be done with the -fx-background-color, -fx-background-inset, -fx-shape
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#region
|
|
![](/forum/templates/default/images/spacer.gif) |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 16/03/2017 12:52:10
|
jdeschutter
Active
Joined: 21/11/2013 10:20:51
Messages: 8
Location: Belgium
Offline
|
Other option:
Use a layeredpane.
The first pane in the layeredpane contains the colored time blocks and has the background color of "#f0f0f0"
And the second pane contains the schedule. Make sure that both the pane and the schedule have a transparent background stylevariant (the value #00000000)
Because the second pane and schedule are transparent, you see the colored timeblocks together with the scheduleitems in the schedule.
|
|
![](/forum/templates/default/images/spacer.gif) |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 30/03/2017 14:54:19
|
levy
Power User
Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline
|
Hi,
Thank you for the hints.
I have now realized that percentage parameters for rectangle function can have decimals. So they are accurate enough in SCHEDULENode's "Bgpaint".
Regards, Daniel
|
|
![](/forum/templates/default/images/spacer.gif) |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 16/01/2018 12:57:48
|
levy
Power User
Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline
|
Hi jdeschutter
Thank you very much for the hint about layeredpane.
Now that I am migrating to RISC, bgpaint didn't work any more.
A layered pane is exactly the solution in my case.
Kind regards, Daniel
|
|
![](/forum/templates/default/images/spacer.gif) |
|