forked from I2P_Developers/i2p.i2p
Console: Move JRobin default color and font changes into SummaryRenderer
This ensures these changes are applied to Debian installs, where we get JRobin from the package manager instead of our bundled source. The padding and grid stroke changes to RrdGraphConstants have not been reverted, because there is no API provided to alter those values. This will result in a minor difference between Debian and non-Debian graphs, and if a user shares those graphs, it will reveal the fact that they have installed the Debian package. This is acceptable, given that the graphs themselves inherently reveal significantly more private information than that.
This commit is contained in:
@ -161,12 +161,12 @@ public interface RrdGraphConstants {
|
|||||||
/**
|
/**
|
||||||
* Default minor grid color
|
* Default minor grid color
|
||||||
*/
|
*/
|
||||||
Color DEFAULT_GRID_COLOR = new Color(100, 100, 100, 75);
|
Color DEFAULT_GRID_COLOR = new Color(171, 171, 171, 95);
|
||||||
// Color DEFAULT_GRID_COLOR = new Color(140, 140, 140);
|
// Color DEFAULT_GRID_COLOR = new Color(140, 140, 140);
|
||||||
/**
|
/**
|
||||||
* Default major grid color
|
* Default major grid color
|
||||||
*/
|
*/
|
||||||
Color DEFAULT_MGRID_COLOR = new Color(255, 91, 91, 110);
|
Color DEFAULT_MGRID_COLOR = new Color(255, 91, 91, 95);
|
||||||
// Color DEFAULT_MGRID_COLOR = new Color(130, 30, 30);
|
// Color DEFAULT_MGRID_COLOR = new Color(130, 30, 30);
|
||||||
/**
|
/**
|
||||||
* Default font color
|
* Default font color
|
||||||
@ -251,7 +251,7 @@ public interface RrdGraphConstants {
|
|||||||
* Default font name, determined based on the current operating system
|
* Default font name, determined based on the current operating system
|
||||||
*/
|
*/
|
||||||
String DEFAULT_FONT_NAME = System.getProperty("os.name").toLowerCase().contains("windows") ?
|
String DEFAULT_FONT_NAME = System.getProperty("os.name").toLowerCase().contains("windows") ?
|
||||||
"Lucida Console" : "Monospaced";
|
"Lucida Sans Typewriter" : "Monospaced";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default graph small font
|
* Default graph small font
|
||||||
|
@ -132,11 +132,11 @@ public class RrdGraphDef implements RrdGraphConstants {
|
|||||||
fontDir = new File(fontdirProperty);
|
fontDir = new File(fontdirProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
fonts[FONTTAG_DEFAULT] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10);
|
fonts[FONTTAG_DEFAULT] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 8);
|
||||||
fonts[FONTTAG_TITLE] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10);
|
fonts[FONTTAG_TITLE] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 9);
|
||||||
fonts[FONTTAG_AXIS] = new Font("Droid Sans Mono", Font.PLAIN, 10);
|
fonts[FONTTAG_AXIS] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 7);
|
||||||
fonts[FONTTAG_UNIT] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10);
|
fonts[FONTTAG_UNIT] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 8);
|
||||||
fonts[FONTTAG_LEGEND] = new Font("Droid Sans Mono", Font.PLAIN, 10);
|
fonts[FONTTAG_LEGEND] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 8);
|
||||||
fonts[FONTTAG_WATERMARK] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 1).deriveFont(5.5F);
|
fonts[FONTTAG_WATERMARK] = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 1).deriveFont(5.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ public class RrdGraphDef implements RrdGraphConstants {
|
|||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
System.err.println(exception.getLocalizedMessage());
|
System.err.println(exception.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
font = new Font("Monospaced", Font.PLAIN, 10);
|
font = new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font == null) {
|
if (font == null) {
|
||||||
|
@ -35,9 +35,13 @@ class SummaryRenderer {
|
|||||||
private final Log _log;
|
private final Log _log;
|
||||||
private final SummaryListener _listener;
|
private final SummaryListener _listener;
|
||||||
private final I2PAppContext _context;
|
private final I2PAppContext _context;
|
||||||
|
private static final Color GRID_COLOR = new Color(100, 100, 100, 75);
|
||||||
|
private static final Color MGRID_COLOR = new Color(255, 91, 91, 110);
|
||||||
private static final Color AREA_COLOR = new Color(100, 160, 200, 200);
|
private static final Color AREA_COLOR = new Color(100, 160, 200, 200);
|
||||||
private static final Color LINE_COLOR = new Color(0, 30, 110, 255);
|
private static final Color LINE_COLOR = new Color(0, 30, 110, 255);
|
||||||
private static final Color RESTART_BAR_COLOR = new Color(223, 13, 13, 255);
|
private static final Color RESTART_BAR_COLOR = new Color(223, 13, 13, 255);
|
||||||
|
private static final String DEFAULT_FONT_NAME = System.getProperty("os.name").toLowerCase().contains("windows") ?
|
||||||
|
"Lucida Console" : "Monospaced";
|
||||||
|
|
||||||
public SummaryRenderer(I2PAppContext ctx, SummaryListener lsnr) {
|
public SummaryRenderer(I2PAppContext ctx, SummaryListener lsnr) {
|
||||||
_log = ctx.logManager().getLog(SummaryRenderer.class);
|
_log = ctx.logManager().getLog(SummaryRenderer.class);
|
||||||
@ -125,6 +129,16 @@ class SummaryRenderer {
|
|||||||
ImageOutputStream ios = null;
|
ImageOutputStream ios = null;
|
||||||
try {
|
try {
|
||||||
RrdGraphDef def = new RrdGraphDef();
|
RrdGraphDef def = new RrdGraphDef();
|
||||||
|
|
||||||
|
// Override defaults
|
||||||
|
def.setColor(RrdGraphDef.COLOR_GRID, GRID_COLOR);
|
||||||
|
def.setColor(RrdGraphDef.COLOR_MGRID, MGRID_COLOR);
|
||||||
|
def.setFont(RrdGraphDef.FONTTAG_DEFAULT, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10));
|
||||||
|
def.setFont(RrdGraphDef.FONTTAG_TITLE, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10));
|
||||||
|
def.setFont(RrdGraphDef.FONTTAG_AXIS, new Font("Droid Sans Mono", Font.PLAIN, 10));
|
||||||
|
def.setFont(RrdGraphDef.FONTTAG_UNIT, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10));
|
||||||
|
def.setFont(RrdGraphDef.FONTTAG_LEGEND, new Font("Droid Sans Mono", Font.PLAIN, 10));
|
||||||
|
|
||||||
// improve text legibility
|
// improve text legibility
|
||||||
String lang = Messages.getLanguage(_context);
|
String lang = Messages.getLanguage(_context);
|
||||||
Font small = def.getSmallFont();
|
Font small = def.getSmallFont();
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
2017-07-25 str4d
|
||||||
|
* Console: Move JRobin default color and font changes into SummaryRenderer
|
||||||
|
|
||||||
2017-07-15 zzz
|
2017-07-15 zzz
|
||||||
* Console: Fix compile error with Jetty 9.2.22 (ticket #2019)
|
* Console: Fix compile error with Jetty 9.2.22 (ticket #2019)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user