Use FXML to add the gauge's sections

Create issue
Issue #27 closed
Marlon Trujillo created an issue

Hey Gerrit, i was thinking about the concept of put all code related to view in fxml and let the java code to just handle the dynamic data changes. In this way, let me ask you the following question:

There is any way to add the sections of the gauge in the FXML? Something like this:

        <Section start="0" stop="100" color="RED"/>

PD: I modified the Section class to choose the color of the section:

Comments (3)

  1. Gerrit Grunwald repo owner

    Hey Marlon, Well that's a good question, I don't use fxml at all so I really don't know. You might want to check the OpenJFX source to see how this was implemented for the standard controls. If you figure out a way I might will modify the controls so that one can use your approach too...depends on the amount of work it needs :) Cheers, Gerrit

  2. Marlon Trujillo reporter

    it works men, you have to import the section in the FXML with: <?import Section?>

    and, you can use, as it's showed in the next code fragment:

    <Gauge fx:id="gaugeKVA" angleRange="300.0" majorTickSpace="1000.0" maxValue="6000.0" minorTickSpace="250.0" startAngle="330.0" threshold="2100.0" title="volt-ampere" unit="kVA" >
            <Section start="4000" stop="4500" color="#c38145"/>
            <Section start="4500" stop="6000" color="#c94b4d"/>

    PS: The sad part is that adding sections to FXML makes the file incompatible with Scene Builder, because Scene Builder does not have the Section Class, therefore i can't open the file with Scene Builder program. I am looking the way to import the class Section to Scene Builder...

  3. Log in to comment