wh1ter0se/PowerUp-2018

View on GitHub
wpilib18/tools/plugins/built-in/command/command.fxml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import dashfx.lib.controls.*?>
<?import dashfx.controls.*?>
<?language javascript?>


<DataHBox fx:id="base" dataMode="Nested" onRegisterRequest="replaced()" xmlns:fx="http://javafx.com/fxml">
    <fx:script>
        var stopp = null
        var startt = null;
        var swapper = function(ov, old, running) {
            stopp.setVisible(running);
            startt.setVisible(!running);
        };
        var runnerVp = null;
        function replaced()
        {
            /*if (runnerVp != null)
             {
             runnerVp["removeListener(javafx.beans.value.ChangeListener)"](swapper);
             }*/
            runnerVp = base.getObservable("running");
            runnerVp["addListener(javafx.beans.value.ChangeListener)"](swapper);
            startt = start;
            stopp = stop;
            if (typeof runnerVp == "boolean")
            {
                swapper(null, null, runnerVp.getValue());
            }
            else
            {
                swapper(null, null, false);
            }
        }

        function run_command()
        {
            runnerVp.setValue(true);
        }
        function stop_command()
        {
            runnerVp.setValue(false);
        }
    </fx:script>
    <ui style="/*Intentionally blank*/" alignment="CENTER_LEFT" >
        <children>
            <dashfx.lib.controls.fxmlutils.CollapsableHBox>
                <children>
                    <Button fx:id="start" style="-fx-background-color: transparent; -fx-margin: 0; -fx-padding: 0;" contentDisplay="GRAPHIC_ONLY" maxHeight="1.7976931348623157E308" mnemonicParsing="false" onAction="run_command();" prefWidth="48.0" text="Run">
                        <graphic>
                            <ImageView fitHeight="32" fitWidth="32" mouseTransparent="true" pickOnBounds="true" preserveRatio="true">
                                <image>
                                    <Image url="@media-playback-start.png" />
                                </image>
                            </ImageView>
                        </graphic>
                    </Button>
                    <Button fx:id="stop" style="-fx-background-color: transparent; -fx-margin: 0; -fx-padding: 0;" contentDisplay="GRAPHIC_ONLY" maxHeight="1.7976931348623157E308" mnemonicParsing="false" onAction="stop_command();" prefWidth="48.0" text="Stop">
                        <graphic>
                            <ImageView fitHeight="32" fitWidth="32" mouseTransparent="true" pickOnBounds="true" preserveRatio="true">
                                <image>
                                    <Image url="@media-playback-stop.png" />
                                </image>
                            </ImageView>
                        </graphic>
                    </Button>
                </children>
            </dashfx.lib.controls.fxmlutils.CollapsableHBox>
            <Placeholder fx:id="Name" controlPath="Label" propList="name: name" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS" />
        </children>
    </ui>
</DataHBox>