public void positionWindow(boolean resetToDefault) { String mapWindow; mapShellBounds = mapShell.getBounds(); mapWindow = prefs.get(RadarConsts.PREF_KEY_MAP_WINDOW, ""); if (mapWindow.equals("") || resetToDefault) { Rectangle dispBounds, tableBounds; dispBounds = ((Display.getCurrent()).getPrimaryMonitor()).getClientArea(); tableBounds = display.getShells()[1].getBounds(); mapShellBounds.width = dispBounds.width - tableBounds.width; mapShellBounds.height = dispBounds.height; mapShellBounds.x = dispBounds.x + tableBounds.width; mapShellBounds.y = dispBounds.y; } else { String[] tokens = mapWindow.split(","); mapShellBounds = new Rectangle( new Integer(tokens[0]), // X value new Integer(tokens[1]), // Y value new Integer(tokens[2]), // Width new Integer(tokens[3]) // Height ); } mapShell.setBounds(mapShellBounds); }
public void setBoundaryScalers() { int demoWidth = 1, demoHeight = 1; mapShellBounds = mapShell.getBounds(); if (dp != null) { demoWidth = (dp.maxX - dp.minX) + (RadarConsts.WINDOW_BUFFER * 2); demoHeight = (dp.maxY - dp.minY) + (RadarConsts.WINDOW_BUFFER * 2); } boundsXScale = (float) mapShellBounds.width / demoWidth; boundsYScale = (float) mapShellBounds.height / demoHeight; }
public void saveWindowPosition() { String prefLine; mapShellBounds = mapShell.getBounds(); prefLine = "" + mapShellBounds.x + "," + mapShellBounds.y + "," + mapShellBounds.width + "," + mapShellBounds.height; prefs.put(RadarConsts.PREF_KEY_MAP_WINDOW, prefLine); }