ASM #528 Updated DrawPolygonDlg to remember location when opened and closed.

Change-Id: I19ec2f2e1898506387d053b8ada80d2d2d67cf7c

Former-commit-id: ae0616b0b71e0d1952f2c3e8f461a4d8e79e934f
This commit is contained in:
steve.naples 2014-04-28 13:55:21 +00:00
parent 24316a7f66
commit 760fc00028

View file

@ -24,6 +24,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.Cursor;
@ -60,6 +62,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leak. * Sep 11, 2013 #2353 lvenable Fixed cursor memory leak.
* Jan 29, 2014 16561 snaples Updated processDrawPrecipValue to remove polygon wireframe after setting value. * Jan 29, 2014 16561 snaples Updated processDrawPrecipValue to remove polygon wireframe after setting value.
* Feb 2, 2014 16201 snaples Added saved data flag support * Feb 2, 2014 16201 snaples Added saved data flag support
* Apr 28, 2014 16707 snaples Added code to save and set location of dialog box when moved.
* *
* *
* </pre> * </pre>
@ -114,6 +117,12 @@ public class DrawPolygonDlg extends CaveSWTDialog {
/** The polygon resource */ /** The polygon resource */
private final MPEPolygonResource resource; private final MPEPolygonResource resource;
/** Point to hold location of dialog */
private static org.eclipse.swt.graphics.Point dlgLoc = null;
/** Status of dialog opened or not */
private boolean dialogOpened = false;
/** /**
* Constructor. * Constructor.
* *
@ -144,13 +153,28 @@ public class DrawPolygonDlg extends CaveSWTDialog {
} }
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(final Shell shell) {
setReturnValue(false); setReturnValue(false);
boldFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.BOLD); boldFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.BOLD);
font = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL); font = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
// Initialize all of the controls and layoutsendCal // Initialize all of the controls and layoutsendCal
initializeComponents(); initializeComponents();
shell.addControlListener(new ControlAdapter() {
@Override
public void controlMoved(ControlEvent e) {
if (!dialogOpened) {
return;
}
if (dlgLoc == null) {
return;
}
dlgLoc.x = shell.getBounds().x;
dlgLoc.y = shell.getBounds().y;
}
});
} }
/** /**
@ -162,6 +186,18 @@ public class DrawPolygonDlg extends CaveSWTDialog {
createCloseBtn(); createCloseBtn();
} }
@Override
protected void opened() {
if (dlgLoc == null) {
dlgLoc = new org.eclipse.swt.graphics.Point(shell.getBounds().x, shell.getBounds().y);
}
else {
shell.setLocation(dlgLoc);
}
dialogOpened = true;
}
/** /**
* Create the persistent group. * Create the persistent group.
*/ */