com.openfin.desktop.MonitorInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openfin-desktop-java-adapter Show documentation
Show all versions of openfin-desktop-java-adapter Show documentation
The Java API for OpenFin Runtime
package com.openfin.desktop;
import java.awt.Point;
import java.util.List;
import org.json.JSONObject;
public class MonitorInfo extends JsonBean {
private Point dpi;
private MonitorDetails primaryMonitor;
private List nonPrimaryMonitors;
public MonitorInfo(JSONObject json) {
super(json);
}
public double getDeviceScaleFactor() {
return json.optDouble("deviceScaleFactor", 1);
}
public Point getDpi() {
if (this.dpi == null && json.has("dpi")) {
JSONObject jsonDpi = json.getJSONObject("dpi");
this.dpi = new Point(jsonDpi.getInt("x"), jsonDpi.getInt("y"));
}
return this.dpi;
}
public MonitorDetails getPrimaryMonitor() {
if (this.primaryMonitor == null && this.json.has("primaryMonitor")) {
this.primaryMonitor = this.getJsonBean("primaryMonitor", MonitorDetails.class);
}
return this.primaryMonitor;
}
public List getNonPrimaryMonitors() {
if (this.nonPrimaryMonitors == null && this.json.has("nonPrimaryMonitors")) {
this.nonPrimaryMonitors = this.getJsonBeanList("nonPrimaryMonitors", MonitorDetails.class);
}
return this.nonPrimaryMonitors;
}
}