diff --git a/src/PamView/ScreenSize.java b/src/PamView/ScreenSize.java index d5c03b9c..a51863a2 100644 --- a/src/PamView/ScreenSize.java +++ b/src/PamView/ScreenSize.java @@ -10,6 +10,7 @@ import javax.swing.SwingUtilities; import com.sun.glass.ui.Screen; +import PamController.PamGUIManager; import javafx.scene.layout.Pane; /** @@ -138,40 +139,49 @@ public class ScreenSize { private static Rectangle findScreenBounds() { Rectangle virtualBounds = new Rectangle(); - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice[] gs =ge.getScreenDevices(); - nScreens = gs.length; - screenDimensions = new Rectangle[nScreens]; - for (int j = 0; j < gs.length; j++) { - GraphicsDevice gd = gs[j]; - //Think to get screen sizes on multiple monitors - //can just use getDefaultConfiguration for - //each device rather than looping over - //all configurations. Hopefully should - //let PAMGUARD start up a little quicker - //CJB 2009-06-15 - GraphicsConfiguration dgc = gd.getDefaultConfiguration(); -// System.out.printf("", dgc.getBufferCapabilities().) -// System.out.println(dgc); - screenDimensions[j] = dgc.getBounds(); - virtualBounds = virtualBounds.union(dgc.getBounds()); - - } -// new Pane(); -// List screens = Screen.getScreens(); -// if (screens != null) { -// for (Screen aScreen : screens) { -// System.out.printf("Screen resX %d, resY %d\n", -// aScreen.getResolutionX(), -// aScreen.getResolutionY()); -// } -// } + if (PamGUIManager.getGUIType() == PamGUIManager.NOGUI) { + virtualBounds = new Rectangle(0,0,1024,768); + nScreens = 1; + screenDimensions = new Rectangle[nScreens]; + screenDimensions[0] = virtualBounds; + } + else { + + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gs =ge.getScreenDevices(); + nScreens = gs.length; + screenDimensions = new Rectangle[nScreens]; + for (int j = 0; j < gs.length; j++) { + GraphicsDevice gd = gs[j]; + //Think to get screen sizes on multiple monitors + //can just use getDefaultConfiguration for + //each device rather than looping over + //all configurations. Hopefully should + //let PAMGUARD start up a little quicker + //CJB 2009-06-15 + GraphicsConfiguration dgc = gd.getDefaultConfiguration(); + // System.out.printf("", dgc.getBufferCapabilities().) + // System.out.println(dgc); + screenDimensions[j] = dgc.getBounds(); + virtualBounds = virtualBounds.union(dgc.getBounds()); + + } + } + // new Pane(); + // List screens = Screen.getScreens(); + // if (screens != null) { + // for (Screen aScreen : screens) { + // System.out.printf("Screen resX %d, resY %d\n", + // aScreen.getResolutionX(), + // aScreen.getResolutionY()); + // } + // } //System.out.println("virtualBounds="+virtualBounds); return virtualBounds; } -// /** -// * Thread to obtain the screen bounds. + // /** + // * Thread to obtain the screen bounds. // * @author Doug // * // */ diff --git a/src/angleVetoes/AngleVetoes.java b/src/angleVetoes/AngleVetoes.java index 514e898b..b0126f67 100644 --- a/src/angleVetoes/AngleVetoes.java +++ b/src/angleVetoes/AngleVetoes.java @@ -9,6 +9,7 @@ import javax.swing.JMenuItem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; +import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; @@ -35,7 +36,10 @@ public class AngleVetoes extends Object implements PamSettings { super(); this.pamControlledUnit = pamControlledUnit; - angleVetoDisplay = new AngleVetoDisplay(this); + + if (PamGUIManager.getGUIType() != PamGUIManager.NOGUI) { + angleVetoDisplay = new AngleVetoDisplay(this); + } PamSettingManager.getInstance().registerSettings(this); } @@ -96,7 +100,9 @@ public class AngleVetoes extends Object implements PamSettings { AngleVetoParameters newParams = AngleVetoesDialog.showDialog(frame, this); if (newParams != null) { angleVetoParameters = newParams.clone(); - angleVetoDisplay.repaint(); + if (angleVetoDisplay != null) { + angleVetoDisplay.repaint(); + } } } @@ -132,7 +138,9 @@ public class AngleVetoes extends Object implements PamSettings { } private void displayAction(Frame frame) { - angleVetoDisplay.setVisible(true); + if (angleVetoDisplay != null) { + angleVetoDisplay.setVisible(true); + } } /** @@ -205,7 +213,9 @@ public class AngleVetoes extends Object implements PamSettings { * @param angle angle in degrees */ public void addAngleData(double angle) { - angleVetoDisplay.newAngle(angle); + if (angleVetoDisplay != null) { + angleVetoDisplay.newAngle(angle); + } } /** @@ -213,6 +223,8 @@ public class AngleVetoes extends Object implements PamSettings { * @param pass true if there was a pass, false for a fail. */ public void addPassData(boolean pass) { - angleVetoDisplay.newPassData(pass); + if (angleVetoDisplay != null) { + angleVetoDisplay.newPassData(pass); + } } } diff --git a/src/clickTrainDetector/ClickTrainControl.java b/src/clickTrainDetector/ClickTrainControl.java index c9d9e1b3..9465f24e 100644 --- a/src/clickTrainDetector/ClickTrainControl.java +++ b/src/clickTrainDetector/ClickTrainControl.java @@ -246,7 +246,10 @@ public class ClickTrainControl extends PamControlledUnit implements PamSettings this.ctLocalisationProcess.setTMlocParams(this.clickTrainParams); - this.getGUI(PamGUIManager.getGUIType()).notifyGUIChange(ClickTrainControl.NEW_PARAMS); + PamControlledUnitGUI gui = this.getGUI(PamGUIManager.getGUIType()); + if (gui != null) { + gui.notifyGUIChange(ClickTrainControl.NEW_PARAMS); + } } /**