diff --git a/apps/experiments/Modena/src/modena/Modena.java b/apps/experiments/Modena/src/modena/Modena.java --- a/apps/experiments/Modena/src/modena/Modena.java +++ b/apps/experiments/Modena/src/modena/Modena.java @@ -79,6 +79,7 @@ import javafx.scene.control.ToggleButtonBuilder; import javafx.scene.control.ToggleGroup; import javafx.scene.control.ToolBar; +import javafx.scene.control.Tooltip; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.WritableImage; @@ -98,6 +99,7 @@ } private static final String testAppCssUrl = Modena.class.getResource("TestApp.css").toExternalForm(); private static String MODENA_STYLESHEET_URL; + private static String MODENA_EMBEDDED_STYLESHEET_URL; private static String MODENA_STYLESHEET_BASE; private static String CASPIAN_STYLESHEET_URL; private static String CASPIAN_STYLESHEET_BASE; @@ -121,6 +123,8 @@ com.sun.javafx.scene.control.skin.ButtonSkin.class.getResource("modena/modena.css").toExternalForm(); MODENA_STYLESHEET_BASE = MODENA_STYLESHEET_URL.substring(0,MODENA_STYLESHEET_URL.lastIndexOf('/')+1); CASPIAN_STYLESHEET_BASE = CASPIAN_STYLESHEET_URL.substring(0,CASPIAN_STYLESHEET_URL.lastIndexOf('/')+1); + MODENA_EMBEDDED_STYLESHEET_URL = MODENA_STYLESHEET_BASE + "modena-embedded-performance.css"; + System.out.println("MODENA_EMBEDDED_STYLESHEET_URL = " + MODENA_EMBEDDED_STYLESHEET_URL); } catch (MalformedURLException ex) { Logger.getLogger(Modena.class.getName()).log(Level.SEVERE, null, ex); } @@ -143,17 +147,18 @@ private int fontSize = 13; private String styleSheetContent = ""; private String styleSheetBase = ""; - private ToggleButton modenaButton,retinaButton,rtlButton; + private ToggleButton modenaButton,retinaButton,rtlButton,embeddedPerformanceButton; private TabPane contentTabs; private boolean test = false; + private boolean embeddedPerformanceMode = false; private final EventHandler rebuild = new EventHandler(){ - @Override public void handle(ActionEvent event) { + @Override public void handle(ActionEvent event) { Platform.runLater(new Runnable() { @Override public void run() { updateUserAgentStyleSheet(); - rebuildUI(modenaButton.isSelected(), retinaButton.isSelected(), - contentTabs.getSelectionModel().getSelectedIndex(), - samplePageNavigation.getCurrentSection()); + rebuildUI(modenaButton.isSelected(), retinaButton.isSelected(), + contentTabs.getSelectionModel().getSelectedIndex(), + samplePageNavigation.getCurrentSection()); } }); } @@ -253,6 +258,7 @@ styleSheetContent = modena ? loadUrl(MODENA_STYLESHEET_URL) : loadUrl(CASPIAN_STYLESHEET_URL); + if (modena && embeddedPerformanceMode) styleSheetContent += loadUrl(MODENA_EMBEDDED_STYLESHEET_URL); styleSheetBase = modena ? MODENA_STYLESHEET_BASE : CASPIAN_STYLESHEET_BASE; styleSheetContent += "\n.root {\n"; System.out.println("baseColor = "+baseColor); @@ -391,6 +397,17 @@ } }) .build(), + embeddedPerformanceButton = ToggleButtonBuilder.create() + .text("EP") + .selected(embeddedPerformanceMode) + .tooltip(new Tooltip("Apply Embedded Performance extra stylesheet")) + .onAction(new EventHandler() { + @Override public void handle(ActionEvent event) { + embeddedPerformanceMode = embeddedPerformanceButton.isSelected(); + rebuild.handle(event); + } + }) + .build(), new Separator(), retinaButton, new Label("Base:"), diff --git a/javafx-ui-common/src/com/sun/javafx/application/PlatformImpl.java b/javafx-ui-common/src/com/sun/javafx/application/PlatformImpl.java --- a/javafx-ui-common/src/com/sun/javafx/application/PlatformImpl.java +++ b/javafx-ui-common/src/com/sun/javafx/application/PlatformImpl.java @@ -25,6 +25,7 @@ package com.sun.javafx.application; +import com.sun.javafx.PlatformUtil; import com.sun.javafx.css.StyleManager; import com.sun.javafx.runtime.SystemProperties; @@ -544,6 +545,11 @@ StyleManager.getInstance().addUserAgentStylesheet( "com/sun/javafx/scene/control/skin/modena/touch.css"); } + // when running on embedded add a extra stylesheet to tune performance of modena theme + if (PlatformUtil.isEmbedded()) { + StyleManager.getInstance().addUserAgentStylesheet( + "com/sun/javafx/scene/control/skin/modena/modena-embedded-performance.css"); + } return null; } }); diff --git a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/modena/modena-embedded-performance.css b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/modena/modena-embedded-performance.css new file mode 100644 --- /dev/null +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/modena/modena-embedded-performance.css @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* This is a extra stylesheet for Modena theme that is enabled on Embedded + * to tune performance for lower powered devices */ + +/* ==== REMOVE ALL EFFECTS ================================================= */ +.slider .thumb, +.scroll-bar:horizontal > .decrement-button > .decrement-arrow, +.scroll-bar:horizontal > .increment-button > .increment-arrow, +.scroll-bar:vertical > .decrement-button > .decrement-arrow, +.scroll-bar:vertical > .increment-button > .increment-arrow, +.context-menu, +.menu-up-arrow, +.menu-down-arrow, +.tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-close-button, +.combo-box-popup > .list-view, +.titled-pane:focused > .title > .arrow-button > .arrow, +.color-palette, +.custom-color-dialog > .color-rect-pane #color-rect-indicator, +.custom-color-dialog > .color-rect-pane > .color-bar > #color-bar-indicator, +.tooltip { + -fx-effect: null; +} \ No newline at end of file