Example usage for javafx.application Application STYLESHEET_MODENA

List of usage examples for javafx.application Application STYLESHEET_MODENA

Introduction

In this page you can find the example usage for javafx.application Application STYLESHEET_MODENA.

Prototype

String STYLESHEET_MODENA

To view the source code for javafx.application Application STYLESHEET_MODENA.

Click Source Link

Document

Constant for user agent stylesheet for the "Modena" theme.

Usage

From source file:wpdisplaytest.WPDisplayTest.java

@Override
public void start(Stage primaryStage)
        throws InterruptedException, JSONException, FileNotFoundException, IOException {
    final Parameters params = getParameters();
    final List<String> parameters = params.getRaw();
    SettingsHandler settings = ServiceHandler.getInstance().getSettings();
    try {/*w w w  .  ja  va2s . co m*/
        settings.loadProps(parameters.get(0));
    } catch (Exception ex) {
        settings.loadProps("display.cfg");
    }

    //        File f = new File("wpstyle.css");
    //        System.out.println(f.getCanonicalPath()+":"+f.canRead()+":"+f.exists());
    Application.setUserAgentStylesheet(Application.STYLESHEET_MODENA);
    StyleManager.getInstance().addUserAgentStylesheet(
            Paths.get(settings.getProperty("css_path"), "wpstyle.css").toUri().toURL().toExternalForm());
    //System.out.printf(this.getClass().getClassLoader().getResource("").getPath()+":"+java.nio.file.Paths.get("display.cfg"));
    //System.out.println(new File(".").getAbsoluteFile());

    // Set root logger level to DEBUG and its only appender to A1.
    //String jsonstr = "{\"numlegs\":2,\"legduration\":40000,\"numovertimes\":0,\"overtimeduration\":20000}";
    BasicConfigurator.configure();
    Postgres db = new Postgres();
    db.connect(
            "jdbc:postgresql://" + settings.getProperty("database_url") + "/"
                    + settings.getProperty("database_db") + "?tcpKeepAlive=true",
            settings.getProperty("database_user"), settings.getProperty("database_pass"));
    ServiceHandler.getInstance().setDb(db);

    FileService fs = FileService.getInst();
    fs.setDb(db);

    ThriftConnector<WPDisplayServer, WPTalkBackClient> tc = new ThriftConnector<WPDisplayServer, WPTalkBackClient>();
    ServiceHandler.getInstance().setThriftconnector(tc);
    try {
        ServiceHandler.getInstance().setSenderthread(
                new SenderThread(settings.getProperty("pyramid_ip"), settings.getIntProperty("pyramid_port")));
    } catch (UnknownHostException ex) {
        Logger.getLogger(WPDisplayTest.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SocketException ex) {
        Logger.getLogger(WPDisplayTest.class.getName()).log(Level.SEVERE, null, ex);
    }
    ServiceHandler.getInstance().setHorn(new Horn(ServiceHandler.getInstance().getSenderthread(),
            settings.getIntProperty("shorthorntime"), settings.getIntProperty("longhorntime")));

    ControllerScreen root = new ControllerScreen(db, primaryStage);
    ScoreBoardScreen sbc = new ScoreBoardScreen(db);
    root.addScreen(sbc, "scoreboard");
    root.addScreen(new SplashScreen(db), "splash");
    //ServiceHandler.getInstance().setOrganizer(OrganizerBuilder.build(jsonstr, sbc));
    root.switchScreen("splash");

    ServiceHandler.getInstance().registerCleanup(primaryStage);
    //ResultWrapper rw = root.sendCommand(new LoadTeams(1,2));
    //if (rw.isError()){
    //    System.out.println(rw.get("error"));
    //}
    Scene scene = new Scene(root, 1024, 768);
    //Scene scene = new Scene(root);        
    primaryStage.setScene(scene);

    this.moveToSecondaryIfExists(primaryStage);
    //primaryStage.setFullScreen(true);        
    primaryStage.show();

}