Merge "Omaha #3161 - Added SWT dialog trim to the dialogs for thin client." into omaha_14.4.1

Former-commit-id: b2de7b23fc [formerly 2c5dff13e5 [formerly b1bf50e2d89feb66a88a22cb42e1402561b25201]]
Former-commit-id: 2c5dff13e5
Former-commit-id: bfa81210c1
This commit is contained in:
Nate Jensen 2014-06-23 17:42:28 -05:00 committed by Gerrit Code Review
commit 6c794eea9d
3 changed files with 61 additions and 54 deletions

View file

@ -75,6 +75,7 @@ import com.raytheon.viz.ui.dialogs.ModeListener;
* Sep 20,2011 1196 rferrel Change dialogs so they do not block.
* Mar 05,2013 15173 mgamazaychikov Set the initial location and dimension of
* dialog as it is in A1.
* Jun 23, 2014 #3161 lvenable Added SWT dialog trim to the dialogs for thin client.
*
* </pre>
*
@ -121,7 +122,9 @@ public class AlarmAlertDlg extends CaveSWTDialog {
private static File currentFile;
private static final int HEIGHT_HINT = 150;
private static final int WIDTH_HINT = 500;
private static Point shellLocation = null;
private ILocalizationFileObserver listener = new ILocalizationFileObserver() {
@ -143,8 +146,8 @@ public class AlarmAlertDlg extends CaveSWTDialog {
* @param parentShell
*/
protected AlarmAlertDlg(Shell parentShell) {
super(parentShell, SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.DO_NOT_BLOCK);
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE,
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
setText("(init) Alarm/Alert and Proximity Alarm Products");
}
@ -197,18 +200,18 @@ public class AlarmAlertDlg extends CaveSWTDialog {
/**
* Sets the shell location.
*/
private void setLocation() {
int shellSizeX = getShell().getSize().x;
int shellSizeY = getShell().getSize().y;
Rectangle displayArea = shell.getDisplay().getClientArea();
int locationX = displayArea.width - shellSizeX;
int locationY = displayArea.y + shellSizeY;
shellLocation = new Point(locationX, locationY);
shell.setLocation(locationX, locationY);
return;
}
private void setLocation() {
int shellSizeX = getShell().getSize().x;
int shellSizeY = getShell().getSize().y;
Rectangle displayArea = shell.getDisplay().getClientArea();
int locationX = displayArea.width - shellSizeX;
int locationY = displayArea.y + shellSizeY;
shellLocation = new Point(locationX, locationY);
shell.setLocation(locationX, locationY);
return;
}
@Override
@Override
protected void initializeComponents(Shell shell) {
setReturnValue(false);
@ -222,11 +225,11 @@ public class AlarmAlertDlg extends CaveSWTDialog {
// Initialize all of the controls and layouts
initializeComponents();
// Set the shell location
if (shellLocation != null) {
shell.setLocation(shellLocation);
}
if (shellLocation != null) {
shell.setLocation(shellLocation);
}
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent event) {

View file

@ -62,6 +62,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Sep 6, 2012 13365 rferrel Accumulate and Display fix.
* Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow.Added DO_NOT_BLOCK.
* Nov 20, 2013 2488 randerso Changed to use DejaVu font
* Jun 23, 2014 #3161 lvenable Added SWT dialog trim to the dialogs for thin client.
*
* </pre>
*
@ -106,8 +107,9 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
protected AlarmDisplayWindow(Shell parentShell,
java.util.List<StdTextProduct> prodList,
ACCUMULATE_STATE accum_state) {
super(parentShell, SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK);
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE,
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL
| CAVE.DO_NOT_BLOCK);
setText("Alarm Display Window");
prods = prodList;
if (prods == null) {

View file

@ -98,7 +98,8 @@ import com.raytheon.viz.ui.dialogs.ModeListener;
* Sep 6, 2012 13365 rferrel Accumulate and Display fix.
* Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow.
* Mar 05,2013 15173 mgamazaychikov The dimensions and location of closed window
* are saved and set on the next open.
* are saved and set on the next open.
* Jun 23, 2014 #3161 lvenable Added SWT dialog trim to the dialogs for thin client.
*
* </pre>
*
@ -142,7 +143,7 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
* Location and dimensions of the dialog on the close.
*/
private static Point closeLocation = null;
private static Point closeDimensions = null;
/**
@ -151,12 +152,12 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
private boolean canRedraw = true;
/**
* Maximum width,initial height and offset of the window
* Maximum width,initial height and offset of the window
*/
private static final int SHELL_WIDTH = 350;
private static final int INIT_HEIGHT = 200;
private static final int INIT_OFFSET = 15;
/**
@ -164,8 +165,8 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
* @param style
*/
private CurrentAlarmQueue(Shell parentShell) {
super(parentShell, SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.DO_NOT_BLOCK);
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE,
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
setText("Current Alarm Queue");
}
@ -261,10 +262,10 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
shellComp = new Composite(shell, SWT.NONE);
shellComp.setLayout(constructShellLayout());
shellComp.setLayoutData(gd);
/*
* DR15173 - Create a listener to save the location
* and dimensions of closed window.
* DR15173 - Create a listener to save the location and dimensions of
* closed window.
*/
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent event) {
@ -289,11 +290,13 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
/*
* DR15173 - Enforce that the window width does not exceed the SHELL_WIDTH.
*/
shell.setBounds(location.x, location.y, SHELL_WIDTH, point.y);
shell.setMinimumSize(SHELL_WIDTH, 0);
/*
* DR15173 - Enforce that the window width does not
* exceed the SHELL_WIDTH.
*/
shell.setBounds(location.x, location.y, SHELL_WIDTH,
point.y);
shell.setMinimumSize(SHELL_WIDTH, 0);
canRedraw = true;
}
});
@ -302,7 +305,7 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
// Initialize all of the controls and layouts
initializeComponents();
// Set the shell location and dimensions.
setShellGeometry();
}
@ -310,26 +313,25 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
/**
* Sets the geometry for the Current Alarm Queue shell
*/
private void setShellGeometry() {
Rectangle displayArea = shell.getDisplay().getClientArea();
int locationX = displayArea.x + INIT_OFFSET;
int locationY = displayArea.y + INIT_OFFSET;
int width = SHELL_WIDTH;
int height = INIT_HEIGHT;
if (CurrentAlarmQueue.closeLocation != null) {
locationX = CurrentAlarmQueue.closeLocation.x;
locationY = CurrentAlarmQueue.closeLocation.y;
}
if (CurrentAlarmQueue.closeDimensions != null) {
height = CurrentAlarmQueue.closeDimensions.y;
}
shell.setMinimumSize(width, height);
shell.setLocation(locationX, locationY);
return;
}
private void setShellGeometry() {
Rectangle displayArea = shell.getDisplay().getClientArea();
int locationX = displayArea.x + INIT_OFFSET;
int locationY = displayArea.y + INIT_OFFSET;
int width = SHELL_WIDTH;
int height = INIT_HEIGHT;
if (CurrentAlarmQueue.closeLocation != null) {
locationX = CurrentAlarmQueue.closeLocation.x;
locationY = CurrentAlarmQueue.closeLocation.y;
}
if (CurrentAlarmQueue.closeDimensions != null) {
height = CurrentAlarmQueue.closeDimensions.y;
}
shell.setMinimumSize(width, height);
shell.setLocation(locationX, locationY);
return;
}
/**
/**
* Initializes each component of the shell
*/
private void initializeComponents() {