Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions core/ui/src/main/java/org/phoebus/ui/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
*******************************************************************************/
package org.phoebus.ui;

import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.phoebus.framework.preferences.AnnotatedPreferences;
import org.phoebus.framework.preferences.Preference;

Expand All @@ -17,6 +21,8 @@

public class Preferences
{
public final static Logger logger = Logger.getLogger(Preferences.class.getPackageName());

/** splash */
public static final String SPLASH = "splash";
/** default_apps */
Expand Down Expand Up @@ -99,6 +105,8 @@ public class Preferences
@Preference public static String window_title_format;
/** default_window_title **/
@Preference public static String default_window_title;
/** Custom stylings file */
@Preference public static String custom_css_styling;

static
{
Expand All @@ -108,5 +116,19 @@ public class Preferences
// (PVASettings cannot use Preferences.max_array_formatting
// since the PVA library may be used standalone)
System.setProperty("EPICS_PVA_MAX_ARRAY_FORMATTING", Integer.toString(max_array_formatting));

// Check once if the custom style sheet is accessible
if (!custom_css_styling.isBlank())
{
try
{
new URI(custom_css_styling).toURL().openStream().close();
}
catch (Exception ex)
{
logger.log(Level.WARNING, custom_css_styling + " is inaccessible", ex);
custom_css_styling = "";
}
}
}
}
6 changes: 6 additions & 0 deletions core/ui/src/main/java/org/phoebus/ui/javafx/Styles.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
******************************************************************************/
package org.phoebus.ui.javafx;

import org.phoebus.ui.Preferences;

import javafx.scene.Node;
import javafx.scene.Scene;

Expand All @@ -24,6 +26,10 @@ public static void setSceneStyle(final Scene scene)
{
final String css = Styles.class.getResource("csstudio.css").toExternalForm();
set(scene, css);
if (!Preferences.custom_css_styling.isEmpty())
{
set(scene, Preferences.custom_css_styling);
}
}

/** Apply style sheet to scene (but only once)
Expand Down
6 changes: 6 additions & 0 deletions core/ui/src/main/resources/phoebus_ui_preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,9 @@ documentation_location=
# When there is no active tab, the default_window_title is used instead.
window_title_format=CS-Studio: %s
default_window_title=CS-Studio

# Custom stylings .css file allows users to override Phoebus and JavaFX
# default stylings.Set the full path to the .css file
# For a system file use syntax; 'file:</path/to/custom.css>'
# For a file served over http use syntax: 'http://<address:port/custom.css>'
custom_css_styling=