Merge "Issue #1353 Changes for non-blocking FFMPSplash and LoadSaveConfigDlg dialogs." into development
Former-commit-id:abb4cb535a
[formerly6a8ae7c255
] [formerlyee2572e7c0
] [formerlyabb4cb535a
[formerly6a8ae7c255
] [formerlyee2572e7c0
] [formerly650420354f
[formerlyee2572e7c0
[formerly c94fde29a1e43467378bc11100fbe0fdfcf7a51a]]]] Former-commit-id:650420354f
Former-commit-id:59a002705f
[formerlydfb7dfc55a
] [formerly 5803c9d1d198a1e506572941e9572feb2c55dab4 [formerlye5cf7d4ba5
]] Former-commit-id: e8810097b52b40a7b41d2d8241670e60815d97c9 [formerlycdc302da70
] Former-commit-id:051cf6dcdd
This commit is contained in:
commit
3757702bbc
5 changed files with 185 additions and 135 deletions
|
@ -87,6 +87,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 04/03/10 4494 D. Hladky Initial release
|
* 04/03/10 4494 D. Hladky Initial release
|
||||||
|
* 12/07/12 1353 rferrel Changes for non-blocking FFMPSplash.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -150,6 +151,11 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(FFMPMonitor.class);
|
.getHandler(FFMPMonitor.class);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.uf.viz.monitor.ResourceMonitor#nullifyMonitor()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void nullifyMonitor() {
|
public void nullifyMonitor() {
|
||||||
|
|
||||||
|
@ -182,7 +188,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ffmpData = null;
|
ffmpData = null;
|
||||||
ffmpAvailableUriQueryDates = null;
|
ffmpAvailableUriQueryDates = null;
|
||||||
ffmpAvailableUris = null;
|
ffmpAvailableUris = null;
|
||||||
|
@ -193,11 +199,25 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.uf.viz.monitor.ResourceMonitor#thresholdUpdate(com.raytheon
|
||||||
|
* .uf.viz.monitor.events.IMonitorThresholdEvent)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void thresholdUpdate(IMonitorThresholdEvent me) {
|
public void thresholdUpdate(IMonitorThresholdEvent me) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.raytheon.uf.viz.monitor.ResourceMonitor#configUpdate(com.raytheon
|
||||||
|
* .uf.viz.monitor.events.IMonitorConfigurationEvent)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void configUpdate(IMonitorConfigurationEvent me) {
|
public void configUpdate(IMonitorConfigurationEvent me) {
|
||||||
// updates the config
|
// updates the config
|
||||||
|
@ -388,9 +408,10 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
|
|
||||||
boolean dupOverride = false;
|
boolean dupOverride = false;
|
||||||
if (getSourceConfig().getSource(source).getSourceType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
if (getSourceConfig().getSource(source).getSourceType()
|
||||||
|
.equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||||
dupOverride = true;
|
dupOverride = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +546,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
SourceXML sourceXML = fscm.getSource(fsource);
|
SourceXML sourceXML = fscm.getSource(fsource);
|
||||||
FFMPCacheRecord ffmpRec = populateFFMPRecord(true,
|
FFMPCacheRecord ffmpRec = populateFFMPRecord(true,
|
||||||
fdataUri, fsiteKey, fsource, fhuc);
|
fdataUri, fsiteKey, fsource, fhuc);
|
||||||
//FFMPRecord ffmpRec = loadRecordFromDatabase(fdataUri);
|
// FFMPRecord ffmpRec =
|
||||||
|
// loadRecordFromDatabase(fdataUri);
|
||||||
File loc = HDF5Util.findHDF5Location(ffmpRec);
|
File loc = HDF5Util.findHDF5Location(ffmpRec);
|
||||||
IDataStore dataStore = DataStoreFactory
|
IDataStore dataStore = DataStoreFactory
|
||||||
.getDataStore(loc);
|
.getDataStore(loc);
|
||||||
|
@ -545,9 +567,10 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
ffmpRec.getSourceName(), fbasin);
|
ffmpRec.getSourceName(), fbasin);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler
|
||||||
"FFMP Can't retrieve FFMP URI, "
|
.handle(Priority.PROBLEM,
|
||||||
+ fdataUri, e);
|
"FFMP Can't retrieve FFMP URI, "
|
||||||
|
+ fdataUri, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -605,7 +628,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
statusHandler.handle(Priority.WARN,
|
statusHandler.handle(Priority.WARN,
|
||||||
"FFMP Can't find availble URI list for, " + sourceName, e);
|
"FFMP Can't find availble URI list for, " + sourceName, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return uris;
|
return uris;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,12 +670,12 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
Date previousQueryTime = ffmpAvailableUriQueryDates.get(siteKey).get(
|
Date previousQueryTime = ffmpAvailableUriQueryDates.get(siteKey).get(
|
||||||
sourceName);
|
sourceName);
|
||||||
SourceXML source = getSourceConfig().getSource(sourceName);
|
SourceXML source = getSourceConfig().getSource(sourceName);
|
||||||
|
|
||||||
if (source.getSourceType().equals(
|
if (source.getSourceType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||||
SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
// Always look back for guidance types because of long expiration
|
||||||
// Always look back for guidance types because of long expiration times,
|
// times,
|
||||||
// prevents mosaic brittleness from occurring.
|
// prevents mosaic brittleness from occurring.
|
||||||
retrieveNew = true;
|
retrieveNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retrieveNew
|
if (retrieveNew
|
||||||
|
@ -945,14 +968,16 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
FFMPResourceData frd = resource.getResourceData();
|
FFMPResourceData frd = resource.getResourceData();
|
||||||
|
|
||||||
if (loadType == LOADER_TYPE.SECONDARY) {
|
if (loadType == LOADER_TYPE.SECONDARY) {
|
||||||
//hucsToLoad.remove("ALL");
|
// hucsToLoad.remove("ALL");
|
||||||
//hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
|
// hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
|
||||||
timeBack = new Date(resource.getMostRecentTime().getTime() - (6 * 1000 * 24));
|
timeBack = new Date(resource.getMostRecentTime().getTime()
|
||||||
|
- (6 * 1000 * 24));
|
||||||
frd.timeBack = timeBack;
|
frd.timeBack = timeBack;
|
||||||
} else if (loadType == LOADER_TYPE.TERTIARY) {
|
} else if (loadType == LOADER_TYPE.TERTIARY) {
|
||||||
hucsToLoad.clear();
|
hucsToLoad.clear();
|
||||||
hucsToLoad.add("ALL");
|
hucsToLoad.add("ALL");
|
||||||
timeBack = new Date(resource.getMostRecentTime().getTime() - (3600 * 1000 * 24));
|
timeBack = new Date(resource.getMostRecentTime().getTime()
|
||||||
|
- (3600 * 1000 * 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
frd.floader = new FFMPDataLoader(frd, timeBack, startTime, loadType,
|
frd.floader = new FFMPDataLoader(frd, timeBack, startTime, loadType,
|
||||||
|
@ -974,6 +999,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
|
|
||||||
if (ffmpSplash == null) {
|
if (ffmpSplash == null) {
|
||||||
ffmpSplash = new FFMPSplash(fshell);
|
ffmpSplash = new FFMPSplash(fshell);
|
||||||
|
ffmpSplash.open();
|
||||||
// latch
|
// latch
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (!getTemplates(fsiteKey).done) {
|
while (!getTemplates(fsiteKey).done) {
|
||||||
|
@ -981,14 +1007,14 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
try {
|
try {
|
||||||
count++;
|
count++;
|
||||||
if (count == 50) {
|
if (count == 50) {
|
||||||
ffmpSplash.disposeDialog();
|
ffmpSplash.close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if (ffmpSplash != null) {
|
if (ffmpSplash != null) {
|
||||||
ffmpSplash.disposeDialog();
|
ffmpSplash.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1042,7 +1068,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
resource.basinTableDlg.getShell().setActive();
|
resource.basinTableDlg.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,7 +1086,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
|
|
||||||
public synchronized void splashDisposeAndDataLoad(FFMPResource resource) {
|
public synchronized void splashDisposeAndDataLoad(FFMPResource resource) {
|
||||||
if (ffmpSplash != null) {
|
if (ffmpSplash != null) {
|
||||||
ffmpSplash.disposeDialog();
|
ffmpSplash.close();
|
||||||
ffmpSplash = null;
|
ffmpSplash = null;
|
||||||
|
|
||||||
if (resource.isFirst) {
|
if (resource.isFirst) {
|
||||||
|
@ -1080,7 +1106,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
|
|
||||||
public void forceKillFFMPSplash() {
|
public void forceKillFFMPSplash() {
|
||||||
if (ffmpSplash != null) {
|
if (ffmpSplash != null) {
|
||||||
ffmpSplash.disposeDialog();
|
ffmpSplash.close();
|
||||||
ffmpSplash = null;
|
ffmpSplash = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1122,9 +1148,10 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
}
|
}
|
||||||
res.getResourceData().floader = null;
|
res.getResourceData().floader = null;
|
||||||
int val = siteCount.get(res.getSiteKey());
|
int val = siteCount.get(res.getSiteKey());
|
||||||
|
|
||||||
// clear out the cache
|
// clear out the cache
|
||||||
for (Entry<String, FFMPCacheRecord> entry: ffmpData.get(res.getSiteKey()).entrySet()){
|
for (Entry<String, FFMPCacheRecord> entry : ffmpData.get(
|
||||||
|
res.getSiteKey()).entrySet()) {
|
||||||
entry.getValue().closeCache();
|
entry.getValue().closeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2121,15 +2148,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
// based on "duration". A horizontal line (composed of two
|
// based on "duration". A horizontal line (composed of two
|
||||||
// points) will be drawn to represent the precip during
|
// points) will be drawn to represent the precip during
|
||||||
// each "duration" period.
|
// each "duration" period.
|
||||||
if ((secondsL < 0) || (secondsR > t1.getTime() / 1000)) { // gage
|
if ((secondsL < 0) || (secondsR > t1.getTime() / 1000)) {
|
||||||
// data
|
// gage data ahead of or beyond radar time range
|
||||||
// ahead
|
|
||||||
// of
|
|
||||||
// or
|
|
||||||
// beyond
|
|
||||||
// radar
|
|
||||||
// time
|
|
||||||
// range
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
gageAccu += (Float) data1Dur.get(i)[5];
|
gageAccu += (Float) data1Dur.get(i)[5];
|
||||||
|
@ -2347,7 +2367,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
if (fffmpRec != null) {
|
if (fffmpRec != null) {
|
||||||
|
|
||||||
ConcurrentMap<String, String> uris = getUriMap(fsiteKey,
|
ConcurrentMap<String, String> uris = getUriMap(fsiteKey,
|
||||||
|
@ -2378,7 +2398,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
curRecord = ffmpData.get(fsiteKey).get(mySource);
|
curRecord = ffmpData.get(fsiteKey).get(mySource);
|
||||||
if (curRecord == null) {
|
if (curRecord == null) {
|
||||||
curRecord = new FFMPCacheRecord(fffmpRec,
|
curRecord = new FFMPCacheRecord(fffmpRec,
|
||||||
mySource, getRunConfig().getRunner(wfo).getCacheDir());
|
mySource, getRunConfig().getRunner(wfo)
|
||||||
|
.getCacheDir());
|
||||||
ffmpData.get(fsiteKey).put(mySource, curRecord);
|
ffmpData.get(fsiteKey).put(mySource, curRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2409,7 +2430,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
"Retrieving and Populating URI: , "
|
"Retrieving and Populating URI: , "
|
||||||
+ dataUri);
|
+ dataUri);
|
||||||
curRecord.retrieveMapFromDataStore(dataStore,
|
curRecord.retrieveMapFromDataStore(dataStore,
|
||||||
dataUri, getTemplates(fffmpRec.getSiteKey()), fhuc,
|
dataUri,
|
||||||
|
getTemplates(fffmpRec.getSiteKey()), fhuc,
|
||||||
fffmpRec.getDataTime().getRefTime(),
|
fffmpRec.getDataTime().getRefTime(),
|
||||||
fffmpRec.getSourceName());
|
fffmpRec.getSourceName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -2492,7 +2514,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
SourceXML source = getSourceConfig().getSource(fsourceName);
|
SourceXML source = getSourceConfig().getSource(fsourceName);
|
||||||
|
|
||||||
if (furiMap != null) {
|
if (furiMap != null) {
|
||||||
|
|
|
@ -31,20 +31,32 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Canvas;
|
import org.eclipse.swt.widgets.Canvas;
|
||||||
import org.eclipse.swt.widgets.Dialog;
|
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Monitor;
|
import org.eclipse.swt.widgets.Monitor;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
public class FFMPSplash extends Dialog {
|
/**
|
||||||
/**
|
* Display FFMP Basin Table's splash page dialog.
|
||||||
* Dialog shell.
|
*
|
||||||
*/
|
* <pre>
|
||||||
private Shell shell;
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Initial creation
|
||||||
|
* Dec 7, 2012 1353 rferrel Covert to CaveSWTDialog and make non-blocking.
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author rferrel
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
public class FFMPSplash extends CaveSWTDialog {
|
||||||
/**
|
/**
|
||||||
* The display control.
|
* The display control.
|
||||||
*/
|
*/
|
||||||
|
@ -70,20 +82,19 @@ public class FFMPSplash extends Dialog {
|
||||||
private Image loadImage = null;
|
private Image loadImage = null;
|
||||||
|
|
||||||
public FFMPSplash(Shell parent) {
|
public FFMPSplash(Shell parent) {
|
||||||
super(parent, 0);
|
super(parent, SWT.NO_TRIM | SWT.ON_TOP, CAVE.DO_NOT_BLOCK);
|
||||||
|
|
||||||
open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Open method to show the dialog.
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @return Null.
|
* @see
|
||||||
|
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||||
|
* .eclipse.swt.widgets.Shell)
|
||||||
*/
|
*/
|
||||||
public Object open() {
|
@Override
|
||||||
Shell parent = getParent();
|
protected void initializeComponents(Shell shell) {
|
||||||
display = parent.getDisplay();
|
display = shell.getDisplay();
|
||||||
shell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP);
|
|
||||||
|
|
||||||
// Create the main layout for the shell.
|
// Create the main layout for the shell.
|
||||||
GridLayout mainLayout = new GridLayout(1, false);
|
GridLayout mainLayout = new GridLayout(1, false);
|
||||||
|
@ -93,14 +104,17 @@ public class FFMPSplash extends Dialog {
|
||||||
|
|
||||||
// Initialize all of the controls and layouts
|
// Initialize all of the controls and layouts
|
||||||
initializeComponents();
|
initializeComponents();
|
||||||
|
}
|
||||||
|
|
||||||
shell.pack();
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void preOpened() {
|
||||||
|
super.preOpened();
|
||||||
centerOnScreen();
|
centerOnScreen();
|
||||||
|
|
||||||
shell.setVisible(true);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeComponents() {
|
private void initializeComponents() {
|
||||||
|
@ -185,11 +199,15 @@ public class FFMPSplash extends Dialog {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disposeDialog() {
|
/*
|
||||||
if (shell != null) {
|
* (non-Javadoc)
|
||||||
textFont.dispose();
|
*
|
||||||
loadImage.dispose();
|
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||||
shell.dispose();
|
*/
|
||||||
}
|
@Override
|
||||||
|
protected void disposed() {
|
||||||
|
textFont.dispose();
|
||||||
|
loadImage.dispose();
|
||||||
|
shell.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataLoader;
|
||||||
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate;
|
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate;
|
||||||
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main FFMP dialog.
|
* Main FFMP dialog.
|
||||||
|
@ -102,6 +103,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* ColorCell is true.
|
* ColorCell is true.
|
||||||
* Dec 06, 2012 1353 rferrel Code clean up.
|
* Dec 06, 2012 1353 rferrel Code clean up.
|
||||||
* Changes for non-blocking AttributesDlg.
|
* Changes for non-blocking AttributesDlg.
|
||||||
|
* Changes for non-blocking AttributeThresholdDlg.
|
||||||
|
* Changes for non-blocking LoadSaveConfigDlg.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -115,6 +118,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
||||||
private final IUFStatusHandler statusHandler = UFStatus
|
private final IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(FfmpBasinTableDlg.class);
|
.getHandler(FfmpBasinTableDlg.class);
|
||||||
|
|
||||||
|
private LoadSaveConfigDlg loadDlg;
|
||||||
|
|
||||||
|
private LoadSaveConfigDlg saveDlg;
|
||||||
|
|
||||||
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
|
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
|
||||||
|
|
||||||
private MenuItem linkToFrameMI;
|
private MenuItem linkToFrameMI;
|
||||||
|
@ -1714,36 +1721,47 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void retrieveConfiguration() {
|
private void retrieveConfiguration() {
|
||||||
|
if (loadDlg == null) {
|
||||||
|
|
||||||
LoadSaveConfigDlg loadDlg = new LoadSaveConfigDlg(shell,
|
loadDlg = new LoadSaveConfigDlg(shell, DialogType.OPEN);
|
||||||
DialogType.OPEN);
|
loadDlg.setCloseCallback(new ICloseCallback() {
|
||||||
LocalizationFile fileName = (LocalizationFile) loadDlg.open();
|
|
||||||
|
|
||||||
if (fileName == null) {
|
@Override
|
||||||
return;
|
public void dialogClosed(Object returnValue) {
|
||||||
|
if (returnValue instanceof LocalizationFile) {
|
||||||
|
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||||
|
ffmpConfig.loadNewConfig(fileName);
|
||||||
|
|
||||||
|
refreshDisplay(false);
|
||||||
|
} else {
|
||||||
|
shell.setCursor(null);
|
||||||
|
}
|
||||||
|
loadDlg = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
loadDlg.open();
|
||||||
ffmpConfig.loadNewConfig(fileName);
|
|
||||||
|
|
||||||
refreshDisplay(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveConfiguration() {
|
private void saveConfiguration() {
|
||||||
|
|
||||||
LoadSaveConfigDlg saveDlg = new LoadSaveConfigDlg(shell,
|
if (saveDlg == null) {
|
||||||
DialogType.SAVE_AS);
|
|
||||||
LocalizationFile fileName = (LocalizationFile) saveDlg.open();
|
|
||||||
|
|
||||||
if (fileName == null) {
|
saveDlg = new LoadSaveConfigDlg(shell, DialogType.SAVE_AS);
|
||||||
return;
|
saveDlg.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dialogClosed(Object returnValue) {
|
||||||
|
if (returnValue instanceof LocalizationFile) {
|
||||||
|
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||||
|
fileName.getFile().getParentFile().mkdirs();
|
||||||
|
ffmpConfig.saveFFMPBasinConfig(fileName);
|
||||||
|
}
|
||||||
|
saveDlg = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
saveDlg.open();
|
||||||
if (fileName.getFile().getParentFile().mkdirs() == false) {
|
|
||||||
System.out.println("Did not not create directory(ies): "
|
|
||||||
+ fileName.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
ffmpConfig.saveFFMPBasinConfig(fileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,10 +47,37 @@ import com.raytheon.uf.common.localization.LocalizationFile;
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display FFMP Basin Table's Load/Save dialog.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Initial creation
|
||||||
|
* Dec 6, 2012 1353 rferrel Make dialog non-blocking.
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author rferrel
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class LoadSaveConfigDlg extends CaveSWTDialog {
|
public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
public static enum DialogType {
|
public static enum DialogType {
|
||||||
OPEN, SAVE_AS
|
OPEN("Load Configuration"), SAVE_AS("Save Configuration");
|
||||||
|
|
||||||
|
private final String title;
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogType(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final DialogType dialogType;
|
private final DialogType dialogType;
|
||||||
|
@ -59,8 +86,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
private List cfgFileList;
|
private List cfgFileList;
|
||||||
|
|
||||||
private LocalizationFile selectedFile;
|
|
||||||
|
|
||||||
private LocalizationFile[] locFiles;
|
private LocalizationFile[] locFiles;
|
||||||
|
|
||||||
private TreeMap<String, LocalizationFile> locFileMap;
|
private TreeMap<String, LocalizationFile> locFileMap;
|
||||||
|
@ -73,16 +98,9 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
private Button userBtn;
|
private Button userBtn;
|
||||||
|
|
||||||
// private String selectedFileName = null;
|
|
||||||
|
|
||||||
public LoadSaveConfigDlg(Shell parent, DialogType type) {
|
public LoadSaveConfigDlg(Shell parent, DialogType type) {
|
||||||
super(parent, SWT.TITLE);
|
super(parent, SWT.TITLE, CAVE.DO_NOT_BLOCK);
|
||||||
if (type == DialogType.OPEN) {
|
setText(type.getTitle());
|
||||||
setText("Load Configuration");
|
|
||||||
} else {
|
|
||||||
setText("Save Configuration");
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogType = type;
|
dialogType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +117,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
@Override
|
@Override
|
||||||
protected void disposed() {
|
protected void disposed() {
|
||||||
controlFont.dispose();
|
controlFont.dispose();
|
||||||
setReturnValue(selectedFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -237,8 +254,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
selectedFile = null;
|
close();
|
||||||
shell.dispose();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -246,8 +262,8 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
private void openAction() {
|
private void openAction() {
|
||||||
int selectedIndex = cfgFileList.getSelectionIndex();
|
int selectedIndex = cfgFileList.getSelectionIndex();
|
||||||
String str = cfgFileList.getItem(selectedIndex);
|
String str = cfgFileList.getItem(selectedIndex);
|
||||||
selectedFile = locFileMap.get(str);
|
setReturnValue(locFileMap.get(str));
|
||||||
shell.dispose();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveAction() {
|
private void saveAction() {
|
||||||
|
@ -261,10 +277,12 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
LocalizationContext context = pm.getContext(
|
LocalizationContext context = pm.getContext(
|
||||||
LocalizationType.CAVE_STATIC, level);
|
LocalizationType.CAVE_STATIC, level);
|
||||||
String newFileName = "ffmp/guiConfig/" + fileName;
|
String newFileName = "ffmp/guiConfig/" + fileName;
|
||||||
selectedFile = pm.getLocalizationFile(context, newFileName);
|
LocalizationFile selectedFile = pm.getLocalizationFile(context,
|
||||||
|
newFileName);
|
||||||
|
|
||||||
FFMPConfig.getInstance().saveFFMPBasinConfig(selectedFile);
|
FFMPConfig.getInstance().saveFFMPBasinConfig(selectedFile);
|
||||||
shell.dispose();
|
setReturnValue(selectedFile);
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateFileName() {
|
private boolean validateFileName() {
|
||||||
|
@ -287,27 +305,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String[] listItems = cfgFileList.getItems();
|
|
||||||
//
|
|
||||||
// for (String listItem : listItems) {
|
|
||||||
// int idx = listItem.lastIndexOf("/");
|
|
||||||
// String fn = listItem.substring(idx + 1);
|
|
||||||
//
|
|
||||||
// if (fn.compareTo(strBuf.toString()) == 0) {
|
|
||||||
// if (listItem.compareTo(strBuf.toString()) == 0) {
|
|
||||||
// MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.YES
|
|
||||||
// | SWT.NO);
|
|
||||||
// mb.setText("Warning");
|
|
||||||
// mb.setMessage("File name already exists. Do you wish to overwrite\n"
|
|
||||||
// + "the existing file?.");
|
|
||||||
// int result = mb.open();
|
|
||||||
//
|
|
||||||
// if (result == SWT.NO) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (strBuf.toString().endsWith(".xml") == false) {
|
if (strBuf.toString().endsWith(".xml") == false) {
|
||||||
strBuf.append(".xml");
|
strBuf.append(".xml");
|
||||||
newFileNameTF.setText(strBuf.toString().trim());
|
newFileNameTF.setText(strBuf.toString().trim());
|
||||||
|
@ -330,8 +327,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
locFiles = pm.listFiles(contextList
|
locFiles = pm.listFiles(contextList
|
||||||
.toArray(new LocalizationContext[contextList.size()]),
|
.toArray(new LocalizationContext[contextList.size()]),
|
||||||
"ffmp/guiConfig", extensions, false, true);
|
"ffmp/guiConfig", extensions, false, true);
|
||||||
// locFiles = PathManagerFactory.getPathManager().listStaticFiles(
|
|
||||||
// "ffmp/guiConfig", extensions, true, true);
|
|
||||||
|
|
||||||
if (locFiles == null) {
|
if (locFiles == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -350,8 +345,4 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||||
cfgFileList.setSelection(0);
|
cfgFileList.setSelection(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalizationFile getSelectedFile() {
|
|
||||||
return selectedFile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,7 @@ import com.vividsolutions.jts.geom.Point;
|
||||||
* 11 Apr. 2012 DR 14522 gzhang Fixing invalid thread error.
|
* 11 Apr. 2012 DR 14522 gzhang Fixing invalid thread error.
|
||||||
* 31 July 2012 14517 mpduff Fix for blanking map on update.
|
* 31 July 2012 14517 mpduff Fix for blanking map on update.
|
||||||
* 14 Sep 2012 1048 njensen Code cleanup
|
* 14 Sep 2012 1048 njensen Code cleanup
|
||||||
|
* 07 Dec 2012 1353 rferrel Changes for non-blocking FFMPSplash dialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -1225,7 +1226,7 @@ public class FFMPResource extends
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getResourceData().getMonitor().ffmpSplash != null) {
|
if (getResourceData().getMonitor().ffmpSplash != null) {
|
||||||
getResourceData().getMonitor().ffmpSplash.disposeDialog();
|
getResourceData().getMonitor().ffmpSplash.close();
|
||||||
getResourceData().getMonitor().ffmpSplash = null;
|
getResourceData().getMonitor().ffmpSplash = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue