Issue #1790 Last of the bug fixes. Reviewer changes

Change-Id: I451799e34e9621723c9d652f339c880da3aa7caa

Former-commit-id: 20f6baba0e [formerly 8f4492c63c] [formerly 463407a40e [formerly 336427570fba81616b8d02f3ed2948042d7dbf41]]
Former-commit-id: 463407a40e
Former-commit-id: ec5f32aec6
This commit is contained in:
Roger Ferrel 2013-03-29 10:00:22 -05:00
parent dcd36e64a6
commit 8c1116eaae
7 changed files with 90 additions and 202 deletions

View file

@ -117,6 +117,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Feb 28, 2013 1729 dhladky Adjusted the way in which the dialog load thread rejoins the main GUI thread.
* Mar 01, 2013 13228 gzhang Adding field rowName for VGB in County
* Mar 24, 2013 1818 mpduff Fixed Attributes dialog on multiple opens, needed an isDisposed check.
* Mar 29, 2013 1790 rferrel Bug fix for non-blocking dialogs.
* </pre>
*
* @author lvenable
@ -1311,15 +1312,19 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (attributeDlg == null || attributeDlg.isDisposed()) {
attrData = ffmpTable.getVisibleColumns();
attributeDlg = new AttributesDlg(shell, resource, attrData, this);
attributeDlg.open();
} else {
attributeDlg.bringToTop();
}
attributeDlg.open();
}
private void displayThresholdsDialog(ThreshColNames colName) {
if (attrThreshDlg == null) {
if (attrThreshDlg == null || attrThreshDlg.isDisposed()) {
attrThreshDlg = new AttributeThresholdDlg(shell, colName, this);
attrThreshDlg.open();
} else {
attrThreshDlg.bringToTop();
}
attrThreshDlg.open();
attrThreshDlg.newThreshold(colName);
}

View file

@ -58,7 +58,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
/**
* The product generation scripts dialog.
*
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
@ -71,9 +71,10 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* Nov 13, 2012 1298 rferrel Code changes for non-blocking UserEntryDialog.
* Jan 9, 2013 15635 jdynina Allowed to mix and match entry dialogs. Changed order
* of dialogs to match A1 displaying entry fields first.
*
* Mar 29, 2013 1790 rferrel Bug fix for non-blocking dialogs.
*
* </pre>
*
*
* @author ebabin
* @version 1.0
*/
@ -198,10 +199,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
cmd = cmd.replace("{productDB}", productDB.toString());
cmd = cmd.replace("{SEstart}", gmtTime.format(seStart));
cmd = cmd.replace("{SEend}", gmtTime.format(seEnd));
cmd = cmd.replace("{SelectedStart}",
gmtTime.format(selStart));
cmd = cmd.replace("{SelectedEnd}",
gmtTime.format(selEnd));
cmd = cmd.replace("{SelectedStart}", gmtTime.format(selStart));
cmd = cmd.replace("{SelectedEnd}", gmtTime.format(selEnd));
cmd = cmd.replace("{time}", curLocalTime);
cmd = cmd.replace("{ztime}", curGMTTime);
cmd = cmd.replace("{home}", gfeHome);
@ -219,43 +218,37 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
// {startTime}
// {endTime}
// The user is prompted for a named variable, same as the
// user-supplied variables above, but for non-standard
// variables.
int entryIdx = cmd.indexOf("{entry:");
if (entryIdx >= 0) {
run = true;
run = true;
int endEntryIdx = cmd.indexOf("}", entryIdx);
String[] entry = cmd.substring(entryIdx + 1, endEntryIdx)
.split(":");
String [] configFile = new String [] { entry[2] };
String[] configFile = new String[] { entry[2] };
// The dialog being opened is modal to the parent dialog.
// This will prevent the launching of another dialog until
// the modal dialog is closed.
// Keep this a blocking dialog so the loop will only display
// one dialog at a time.
fieldDefs
.add(new FieldDefinition(
(Object) entry[1],
entry[1],
FieldType.ALPHANUMERIC,
(Object) entry[2],
Arrays.asList(Arrays
.asList(configFile)
.toArray(
new Object[configFile.length])),
(float) 1.0, (int) 3));
fieldDefs.add(new FieldDefinition((Object) entry[1],
entry[1], FieldType.ALPHANUMERIC,
(Object) entry[2], Arrays.asList(Arrays.asList(
configFile).toArray(
new Object[configFile.length])),
(float) 1.0, (int) 3));
if (start == 0) {
start = entryIdx;
} else if ((start > 0) && (start > entryIdx)) {
start = entryIdx;
start = entryIdx;
}
}
}
// The user is prompted for a list of radio button values.
// {entryButtons: <name of variable>: <list of values separated
// by commas>}
@ -286,8 +279,9 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
(float) 1.0, (int) 3));
if (start == 0) {
start = entryIdx;
} else if ((start > 0) && (start > entryIdx) && (i == 0)) {
start = entryIdx;
} else if ((start > 0) && (start > entryIdx)
&& (i == 0)) {
start = entryIdx;
}
entryIdx = endEntryIdx + 1;
i++;
@ -301,7 +295,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
// commas>}
count = cmd.split("entryChecks").length - 1;
if (count > 0) {
entryIdx = 0;
entryIdx = 0;
int i = 0;
run = true;
@ -326,8 +320,9 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
(float) 1.0, (int) 3));
if (start == 0) {
start = entryIdx;
} else if ((start > 0) && (start > entryIdx) && (i == 0)) {
start = entryIdx;
} else if ((start > 0) && (start > entryIdx)
&& (i == 0)) {
start = entryIdx;
}
entryIdx = endEntryIdx + 1;
i++;
@ -336,25 +331,33 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
}
// Open the script dialog to allow the user to make selections;
// then run the script using dialog selections as script arguments
// then run the script using dialog selections as script
// arguments
if (run) {
ValuesDialog scriptDlg = new ValuesDialog(name,
fieldDefs, dataManager);
// TODO This is a modal blocking dialog. Making it
// non-blocking could cause other selections from the loop
// to popup a modal dialog. Need to determine if the loop
// can be taken off the UI thread and a wait performed at
// the top of the loop waiting for a call back method to
// perform the work then do a notify.
//
ValuesDialog scriptDlg = new ValuesDialog(getShell(), name,
fieldDefs, dataManager);
int dlgOpen = scriptDlg.open();
if (dlgOpen <= 0) {
Map<Object, Object> map = scriptDlg.getValues();
Map<Object, Object> map = scriptDlg.getValues();
String returnMsg = "";
for (Map.Entry<Object, Object> entry : map.entrySet()) {
returnMsg = returnMsg + entry.getValue().toString() + " ";
for (Map.Entry<Object, Object> entry : map.entrySet()) {
returnMsg = returnMsg + entry.getValue().toString()
+ " ";
}
start = start - 3;
start = start - 3;
cmd = cmd.substring(0, start) + returnMsg;
TaskManager.getInstance().createScriptTask(name, cmd);
TaskManager.getInstance().createScriptTask(name, cmd);
}
}
@ -418,7 +421,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
/*
* (non-Javadoc)
*
*
* @see
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
* .Shell)

View file

@ -35,6 +35,7 @@ import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.msgs.IActivatedParmChangedListener;
import com.raytheon.viz.gfe.core.msgs.IDisplayedParmListChangedListener;
import com.raytheon.viz.gfe.core.parm.Parm;
@ -53,6 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* ------------ ---------- ----------- --------------------------
* Sep 16, 2011 dgilling Initial creation
* Nov 13, 2012 1298 rferrel Code clean up for non-blocking dialog.
* Mar 29, 2013 1790 rferrel Bug fix for non-blocking dialogs.
*
* </pre>
*
@ -123,14 +125,17 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
* Allow only one instance of the dialog to exist at any given time.
*/
public static void openDialog() {
// close nulls dialog so no need to check for dispose.
if (dialog == null) {
Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
DataManager dataManager = DataManager.getCurrentInstance();
DataManager dataManager = DataManagerUIFactory.getCurrentInstance();
dialog = new SetDeltaDialog(parent, dataManager);
dialog.setBlockOnOpen(false);
dialog.open();
} else {
dialog.bringToTop();
}
dialog.open();
}
/**

View file

@ -37,6 +37,7 @@ import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.msgs.IActivatedParmChangedListener;
import com.raytheon.viz.gfe.core.msgs.IDisplayedParmListChangedListener;
import com.raytheon.viz.gfe.core.parm.Parm;
@ -54,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* ------------ ---------- ----------- --------------------------
* Jun 18, 2009 #1318 randerso Ported AWIPS I pickup value dialogs
* Nov 13, 2012 #1298 rferrel Changes for non-blocking dialog.
* Mar 29, 2013 #1790 rferrel Bug fix for non-blocking dialogs.
*
* </pre>
*
@ -83,14 +85,17 @@ public class SetValueDialog extends CaveJFACEDialog implements
private Composite valueFrame;
public static void openDialog() {
// close nulls dialog so no need to check for disposed.
if (dialog == null) {
Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
DataManager dataManager = DataManager.getCurrentInstance();
DataManager dataManager = DataManagerUIFactory.getCurrentInstance();
dialog = new SetValueDialog(parent, dataManager);
dialog.setBlockOnOpen(false);
dialog.open();
} else {
dialog.bringToTop();
}
dialog.open();
}
/**

View file

@ -1,145 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.gfe.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* Dialog to get user text.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 16, 2010 lvenable Initial creation
* Nov 14, 2012 1298 rferrel Convert to CaveSWTDialog for non-blocking.
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class UserEntryDialog extends CaveSWTDialog {
private String message;
private String inputText;
private Text inputTF;
public UserEntryDialog(Shell parentShell, String title, String message,
String defaultText) {
super(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL, CAVE.NONE);
if (title != null) {
setText(title);
}
this.message = message;
this.inputText = defaultText;
}
@Override
protected void initializeComponents(Shell shell) {
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
shell.setLayout(mainLayout);
// Initialize data and all of the controls and layouts
initializeComponents();
}
private void initializeComponents() {
createInputControls();
createBottomButtons();
}
private void createInputControls() {
Composite controlComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
controlComp.setLayout(gl);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
controlComp.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Label messageLbl = new Label(controlComp, SWT.NONE);
messageLbl.setLayoutData(gd);
if (this.message != null) {
messageLbl.setText(message);
}
gd = new GridData(400, SWT.DEFAULT);
inputTF = new Text(controlComp, SWT.BORDER);
inputTF.setLayoutData(gd);
if (inputText != null) {
inputTF.setText(inputText);
}
}
private void createBottomButtons() {
Composite buttonComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
buttonComp.setLayout(gl);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
buttonComp.setLayoutData(gd);
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
gd.widthHint = 80;
Button okBtn = new Button(buttonComp, SWT.PUSH);
okBtn.setText("OK");
okBtn.setLayoutData(gd);
okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String inputText = inputTF.getText().trim();
setReturnValue(inputText);
close();
}
});
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
gd.widthHint = 80;
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setReturnValue(null);
close();
}
});
}
}

View file

@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* Jun 3, 2008 1164 jelkins Initial creation
* Oct 15, 2008 njensen Static methods to keep UI
* thread working
* Mar 28, 2013 1790 rferrel Make dialog modal except when the static openDialog is used.
*
* </pre>
*
@ -83,9 +84,9 @@ public class ValuesDialog extends CaveJFACEDialog {
* a list of field definitions this dialog will display.
* @param dataMgr
*/
public ValuesDialog(String title, List<FieldDefinition> fieldDefs,
DataManager dataMgr) {
super(new Shell());
public ValuesDialog(Shell parentShell, String title,
List<FieldDefinition> fieldDefs, DataManager dataMgr) {
super(parentShell);
this.title = title + " Values";
this.fieldDefs = fieldDefs;
this.dataMgr = dataMgr;
@ -93,7 +94,7 @@ public class ValuesDialog extends CaveJFACEDialog {
this.values = new HashMap<Object, Object>();
this.closeAfterRun = false;
this.setShellStyle(SWT.MODELESS | SWT.TITLE | SWT.RESIZE);
this.setShellStyle(SWT.APPLICATION_MODAL | SWT.TITLE | SWT.RESIZE);
}
/*
@ -284,13 +285,24 @@ public class ValuesDialog extends CaveJFACEDialog {
return ValuesDialog.class.getClassLoader();
}
/**
* This method used by python to create a blocking, non-modal dialog.
*
* @param title
* @param fieldDefs
* @param dataMgr
* @return
*/
public static ValuesDialog openDialog(final String title,
final List<FieldDefinition> fieldDefs, final DataManager dataMgr) {
VizApp.runSync(new Runnable() {
@Override
public void run() {
syncedDialog = new ValuesDialog(title, fieldDefs, dataMgr);
syncedDialog = new ValuesDialog(new Shell(), title, fieldDefs,
dataMgr);
syncedDialog.setShellStyle(SWT.MODELESS | SWT.TITLE
| SWT.RESIZE);
syncedDialog.open();
}
});

View file

@ -114,6 +114,7 @@ import com.raytheon.viz.ui.statusline.StatusStore;
* 03 Dec 2012 1353 rferrel Changes for non-blocking GhgFilterDlg.
* Changes for non-blocking GhgSaveDeleteFilterDlg.
* 16 Jan 2013 1492 rferrel Changes for non-blocking GhgFontDlg.
* 29 Mar 2013 1790 rferrel Bug fix for non-blocking dialogs.
*
* </pre>
*
@ -1158,8 +1159,10 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
alertDlg = null;
}
});
alertDlg.open();
} else {
alertDlg.bringToTop();
}
alertDlg.open();
}
/**