Merge "Omaha #5483 - fix Hydro GUI sizing issues." into omaha_16.2.1-lx
Former-commit-id: 3e8ba66a6ae1342be9abc52e478b63a732d6043c
This commit is contained in:
commit
522df34bca
6 changed files with 458 additions and 443 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Hydro Plug-in
|
Bundle-Name: Hydro Plug-in
|
||||||
Bundle-SymbolicName: com.raytheon.viz.hydro;singleton:=true
|
Bundle-SymbolicName: com.raytheon.viz.hydro;singleton:=true
|
||||||
Bundle-Version: 1.15.0.qualifier
|
Bundle-Version: 1.16.0.qualifier
|
||||||
Bundle-Activator: com.raytheon.viz.hydro.Activator
|
Bundle-Activator: com.raytheon.viz.hydro.Activator
|
||||||
Bundle-Vendor: Raytheon
|
Bundle-Vendor: Raytheon
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
|
@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174",
|
com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174",
|
||||||
com.raytheon.uf.viz.core.point;bundle-version="1.15.0",
|
com.raytheon.uf.viz.core.point;bundle-version="1.15.0",
|
||||||
com.raytheon.uf.common.auth;bundle-version="1.12.1174",
|
com.raytheon.uf.common.auth;bundle-version="1.12.1174",
|
||||||
com.google.guava;bundle-version="18.0.0"
|
com.google.guava;bundle-version="18.0.0",
|
||||||
|
org.apache.commons.lang;bundle-version="2.3.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.raytheon.viz.hydro,
|
Export-Package: com.raytheon.viz.hydro,
|
||||||
com.raytheon.viz.hydro.perspective,
|
com.raytheon.viz.hydro.perspective,
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
/**
|
||||||
|
* 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.hydro.flashfloodguidance;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POJO to store FFG information used by the Flash Flood Guidance dialog.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* May 10, 2016 5483 bkowal Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bkowal
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FFGGuidanceData {
|
||||||
|
/*
|
||||||
|
* Maps to id or type depending on selections in the Flash Flood Guidance
|
||||||
|
* dialog.
|
||||||
|
*/
|
||||||
|
private final String identifier;
|
||||||
|
|
||||||
|
private final int duration;
|
||||||
|
|
||||||
|
private final String formattedDuration;
|
||||||
|
|
||||||
|
private final Date dateTime;
|
||||||
|
|
||||||
|
private final String formattedDateTime;
|
||||||
|
|
||||||
|
private File xmrgFile;
|
||||||
|
|
||||||
|
public FFGGuidanceData(String identifier, int duration,
|
||||||
|
String formattedDuration, Date dateTime, String formattedDateTime) {
|
||||||
|
if (identifier == null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Required argument identifier cannot be NULL.");
|
||||||
|
}
|
||||||
|
this.identifier = identifier;
|
||||||
|
this.duration = duration;
|
||||||
|
this.formattedDuration = formattedDuration;
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
this.formattedDateTime = formattedDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdentifier() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDuration() {
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFormattedDuration() {
|
||||||
|
return formattedDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDateTime() {
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFormattedDateTime() {
|
||||||
|
return formattedDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getXmrgFile() {
|
||||||
|
return xmrgFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXmrgFile(File xmrgFile) {
|
||||||
|
this.xmrgFile = xmrgFile;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/**
|
||||||
|
* 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.hydro.flashfloodguidance;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.builder.CompareToBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares {@link FFGGuidanceData}s to ensure that they are supported by: 1)
|
||||||
|
* identifier in ascending 2) duration in ascending 3) date/time in descending.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* May 10, 2016 5483 bkowal Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bkowal
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FFGGuidanceDataComparator implements Comparator<FFGGuidanceData> {
|
||||||
|
|
||||||
|
public FFGGuidanceDataComparator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(FFGGuidanceData o1, FFGGuidanceData o2) {
|
||||||
|
return new CompareToBuilder()
|
||||||
|
.append(o1.getIdentifier(), o2.getIdentifier())
|
||||||
|
.append(o1.getDuration(), o2.getDuration())
|
||||||
|
.append(o2.getDateTime(), o1.getDateTime()).toComparison();
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,38 +20,47 @@
|
||||||
package com.raytheon.viz.hydro.flashfloodguidance;
|
package com.raytheon.viz.hydro.flashfloodguidance;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.regex.Matcher;
|
||||||
import java.util.TreeMap;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.StackLayout;
|
import org.eclipse.swt.custom.StackLayout;
|
||||||
|
import org.eclipse.swt.events.MouseAdapter;
|
||||||
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
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;
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.GC;
|
||||||
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.layout.RowData;
|
|
||||||
import org.eclipse.swt.layout.RowLayout;
|
import org.eclipse.swt.layout.RowLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Combo;
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Layout;
|
|
||||||
import org.eclipse.swt.widgets.List;
|
|
||||||
import org.eclipse.swt.widgets.MessageBox;
|
import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.swt.widgets.Table;
|
||||||
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.dataplugin.shef.tables.Admin;
|
||||||
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
|
import com.raytheon.uf.common.dataplugin.shef.tables.Colorvalue;
|
||||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||||
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
|
@ -76,6 +85,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Jul 21, 2015 4500 rjpeter Use Number in blind cast.
|
* Jul 21, 2015 4500 rjpeter Use Number in blind cast.
|
||||||
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
|
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
|
||||||
* Mar 15, 2016 5483 randerso Fix GUI sizing issues
|
* Mar 15, 2016 5483 randerso Fix GUI sizing issues
|
||||||
|
* Mar 15, 2016 5483 bkowal Fix GUI sizing issues
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -84,9 +94,14 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
|
private final IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(getClass());
|
||||||
|
|
||||||
/** Date format for the dates */
|
/** Date format for the dates */
|
||||||
private static SimpleDateFormat sdf = null;
|
private static SimpleDateFormat sdf = null;
|
||||||
|
|
||||||
|
private static SimpleDateFormat xmrgDateFormat;
|
||||||
|
|
||||||
/** List of RFC names */
|
/** List of RFC names */
|
||||||
private static final String[] RFC_NAMES = { "ABRFC", "AKRFC", "CBRFC",
|
private static final String[] RFC_NAMES = { "ABRFC", "AKRFC", "CBRFC",
|
||||||
"CNRFC", "LMRFC", "MARFC", "MBRFC", "NCRFC", "NERFC", "NWRFC",
|
"CNRFC", "LMRFC", "MARFC", "MBRFC", "NCRFC", "NERFC", "NWRFC",
|
||||||
|
@ -96,10 +111,52 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
private static final String[] DURATIONS = { "All", "01hr", "03hr", "06hr",
|
private static final String[] DURATIONS = { "All", "01hr", "03hr", "06hr",
|
||||||
"12hr", "24hr" };
|
"12hr", "24hr" };
|
||||||
|
|
||||||
|
private static final String FFG_AREA_WFO = "WFO";
|
||||||
|
|
||||||
|
private static final String FFG_AREA_RFC = "RFC";
|
||||||
|
|
||||||
|
private static final String[] FFG_AREAS = { FFG_AREA_WFO, FFG_AREA_RFC };
|
||||||
|
|
||||||
|
private static final int NUM_FFG_ROWS = 12;
|
||||||
|
|
||||||
|
private static final String ID_COLUMN_HEADER = "Id";
|
||||||
|
|
||||||
|
private static final String TYPE_COLUMN_HEADER = "Type";
|
||||||
|
|
||||||
|
private static final String FFG_NAME_REGEX = "^(.{3," + Admin.HSA_LENGTH
|
||||||
|
+ "})(\\d{10})(\\d{2})\\.ffg$";
|
||||||
|
|
||||||
|
private static final Pattern FFG_NAME_PATTERN = Pattern
|
||||||
|
.compile(FFG_NAME_REGEX);
|
||||||
|
|
||||||
|
private static final int FFG_WFO_GROUP = 1;
|
||||||
|
|
||||||
|
private static final int FFG_DATE_GROUP = 2;
|
||||||
|
|
||||||
|
private static final int FFG_DURATION_GROUP = 3;
|
||||||
|
|
||||||
|
private enum CONSTANT_FFG_COLUMNS {
|
||||||
|
DUR_HR("DurHr"), TIMEZ("Time(Z)");
|
||||||
|
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
private CONSTANT_FFG_COLUMNS(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Table ffgTable;
|
||||||
|
|
||||||
/* Initialize the date format */
|
/* Initialize the date format */
|
||||||
static {
|
static {
|
||||||
sdf = new SimpleDateFormat("EEE MM-dd HH");
|
sdf = new SimpleDateFormat("EEE MM-dd HH");
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
sdf.setTimeZone(TimeUtil.GMT_TIME_ZONE);
|
||||||
|
xmrgDateFormat = new SimpleDateFormat("yyyyMMddHH");
|
||||||
|
xmrgDateFormat.setTimeZone(TimeUtil.GMT_TIME_ZONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -122,21 +179,6 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private Button arealRdo;
|
private Button arealRdo;
|
||||||
|
|
||||||
/**
|
|
||||||
* Font used for list controls.
|
|
||||||
*/
|
|
||||||
private Font font;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FFG data list.
|
|
||||||
*/
|
|
||||||
private List dataList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ID Type label.
|
|
||||||
*/
|
|
||||||
private Label idTypeLbl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select button.
|
* Select button.
|
||||||
*/
|
*/
|
||||||
|
@ -218,7 +260,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
private Button closeBtn;
|
private Button closeBtn;
|
||||||
|
|
||||||
/** Bundle variables */
|
/** Bundle variables */
|
||||||
private final Map<String, String> parameters = new HashMap<String, String>();
|
private final Map<String, String> parameters = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The selected RFC.
|
* The selected RFC.
|
||||||
|
@ -240,16 +282,6 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private int duration = 3600;
|
private int duration = 3600;
|
||||||
|
|
||||||
/**
|
|
||||||
* Holds the display string and insert time for later use.
|
|
||||||
*/
|
|
||||||
private final Map<String, Date> dataMap = new HashMap<String, Date>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Holds the display string and the xmrg File object.
|
|
||||||
*/
|
|
||||||
private final Map<String, File> fileMap = new HashMap<String, File>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The wait mouse pointer.
|
* The wait mouse pointer.
|
||||||
*/
|
*/
|
||||||
|
@ -273,38 +305,16 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
arrowCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
|
arrowCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Layout constructShellLayout() {
|
|
||||||
// Create the main layout for the shell.
|
|
||||||
GridLayout mainLayout = new GridLayout(1, true);
|
|
||||||
mainLayout.marginHeight = 1;
|
|
||||||
mainLayout.marginWidth = 1;
|
|
||||||
return mainLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void disposed() {
|
|
||||||
font.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeComponents(Shell shell) {
|
protected void initializeComponents(Shell shell) {
|
||||||
font = new Font(shell.getDisplay(), "Monospace", 11, SWT.NORMAL);
|
|
||||||
|
|
||||||
createGridArealControls();
|
createGridArealControls();
|
||||||
createListLabels();
|
createFFGDataTable();
|
||||||
createDataListControl();
|
|
||||||
createDataListControlButtons();
|
createDataListControlButtons();
|
||||||
createOptionsGroup();
|
createOptionsGroup();
|
||||||
createColorLegend();
|
createColorLegend();
|
||||||
createBottomCloseButton();
|
createBottomCloseButton();
|
||||||
|
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void preOpened() {
|
|
||||||
shell.setMinimumSize(shell.getSize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -314,7 +324,6 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
Group gridArealGroup = new Group(shell, SWT.NONE);
|
Group gridArealGroup = new Group(shell, SWT.NONE);
|
||||||
gridArealGroup.setText("FFG Mode");
|
gridArealGroup.setText("FFG Mode");
|
||||||
RowLayout gridArealLayout = new RowLayout();
|
RowLayout gridArealLayout = new RowLayout();
|
||||||
gridArealLayout.spacing = 5;
|
|
||||||
gridArealGroup.setLayout(gridArealLayout);
|
gridArealGroup.setLayout(gridArealLayout);
|
||||||
gridArealGroup.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
|
gridArealGroup.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
|
||||||
false));
|
false));
|
||||||
|
@ -325,15 +334,13 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
griddedRdo.addSelectionListener(new SelectionAdapter() {
|
griddedRdo.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
idTypeLbl.setText("Id");
|
|
||||||
|
|
||||||
ffgArealOptGroup.setText(ffgOptionsStr);
|
ffgArealOptGroup.setText(ffgOptionsStr);
|
||||||
|
|
||||||
stackLayout.topControl = ffgOptionsComp;
|
stackLayout.topControl = ffgOptionsComp;
|
||||||
stackComposite.layout();
|
stackComposite.layout();
|
||||||
|
|
||||||
// Clear the data list and reload
|
// Clear the data table and reload
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -342,68 +349,98 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
arealRdo.addSelectionListener(new SelectionAdapter() {
|
arealRdo.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
idTypeLbl.setText("Type");
|
|
||||||
|
|
||||||
ffgArealOptGroup.setText(arealOptionsStr);
|
ffgArealOptGroup.setText(arealOptionsStr);
|
||||||
|
|
||||||
stackLayout.topControl = arealOptionsComp;
|
stackLayout.topControl = arealOptionsComp;
|
||||||
stackComposite.layout();
|
stackComposite.layout();
|
||||||
|
|
||||||
// Clear the data list and reload
|
// Clear the data table and reload
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void createFFGDataTable() {
|
||||||
* Create the labels for the data list.
|
Composite tableComp = new Composite(shell, SWT.NONE);
|
||||||
*/
|
GridLayout gl = new GridLayout(1, false);
|
||||||
private void createListLabels() {
|
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
Composite labelComp = new Composite(shell, SWT.NONE);
|
tableComp.setLayout(gl);
|
||||||
RowLayout layout = new RowLayout();
|
tableComp.setLayoutData(gd);
|
||||||
labelComp.setLayout(layout);
|
|
||||||
|
|
||||||
RowData rd = new RowData(40, SWT.DEFAULT);
|
|
||||||
idTypeLbl = new Label(labelComp, SWT.RIGHT);
|
|
||||||
idTypeLbl.setText("Id");
|
|
||||||
idTypeLbl.setLayoutData(rd);
|
|
||||||
|
|
||||||
rd = new RowData(65, SWT.DEFAULT);
|
|
||||||
Label durHrLbl = new Label(labelComp, SWT.RIGHT);
|
|
||||||
durHrLbl.setText("DurHr");
|
|
||||||
durHrLbl.setLayoutData(rd);
|
|
||||||
|
|
||||||
rd = new RowData(75, SWT.DEFAULT);
|
|
||||||
Label timeLbl = new Label(labelComp, SWT.RIGHT);
|
|
||||||
timeLbl.setText(" Time(Z)");
|
|
||||||
timeLbl.setLayoutData(rd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the data list control.
|
|
||||||
*/
|
|
||||||
private void createDataListControl() {
|
|
||||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
|
||||||
gd.widthHint = 255;
|
|
||||||
gd.heightHint = 250;
|
|
||||||
dataList = new List(shell, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
|
|
||||||
dataList.setLayoutData(gd);
|
|
||||||
|
|
||||||
dataList.setFont(font);
|
|
||||||
dataList.addSelectionListener(new SelectionAdapter() {
|
|
||||||
|
|
||||||
|
ffgTable = new Table(tableComp, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
|
||||||
|
ffgTable.setHeaderVisible(true);
|
||||||
|
ffgTable.setLinesVisible(true);
|
||||||
|
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
|
gd.heightHint = ffgTable.getItemHeight() * NUM_FFG_ROWS;
|
||||||
|
ffgTable.setLayoutData(gd);
|
||||||
|
ffgTable.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
public void mouseDoubleClick(MouseEvent e) {
|
||||||
// Display data on double click
|
|
||||||
// Clear the previous data
|
// Clear the previous data
|
||||||
clearData();
|
clearData();
|
||||||
// Display the new data
|
// Display the new data
|
||||||
displayData();
|
displayData();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void populateFFGDataTable() {
|
||||||
|
/*
|
||||||
|
* Clear any previous data.
|
||||||
|
*/
|
||||||
|
if (ffgTable.getItemCount() > 0) {
|
||||||
|
ffgTable.removeAll();
|
||||||
|
}
|
||||||
|
if (ffgTable.getColumnCount() > 0) {
|
||||||
|
for (TableColumn tc : ffgTable.getColumns()) {
|
||||||
|
tc.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the table column headers.
|
||||||
|
*/
|
||||||
|
final String firstColumnTxt = (griddedRdo.getSelection()) ? ID_COLUMN_HEADER
|
||||||
|
: TYPE_COLUMN_HEADER;
|
||||||
|
GC gc = new GC(ffgTable);
|
||||||
|
gc.setFont(ffgTable.getFont());
|
||||||
|
TableColumn tc = new TableColumn(ffgTable, SWT.CENTER);
|
||||||
|
tc.setText(firstColumnTxt);
|
||||||
|
tc.pack();
|
||||||
|
for (CONSTANT_FFG_COLUMNS ffgColumn : CONSTANT_FFG_COLUMNS.values()) {
|
||||||
|
tc = new TableColumn(ffgTable, SWT.CENTER);
|
||||||
|
tc.setText(ffgColumn.getText());
|
||||||
|
tc.pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
gc.dispose();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Populate the table with data.
|
||||||
|
*/
|
||||||
|
if (griddedRdo.getSelection()) {
|
||||||
|
readGriddedFfgProduct();
|
||||||
|
} else {
|
||||||
|
readArealFfgProduct();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTableRows(List<FFGGuidanceData> rowDataList) {
|
||||||
|
Collections.sort(rowDataList, new FFGGuidanceDataComparator());
|
||||||
|
|
||||||
|
for (FFGGuidanceData rowData : rowDataList) {
|
||||||
|
TableItem ti = new TableItem(ffgTable, SWT.NONE);
|
||||||
|
ti.setData(rowData);
|
||||||
|
final String[] tableItemValues = new String[] {
|
||||||
|
rowData.getIdentifier(), rowData.getFormattedDuration(),
|
||||||
|
rowData.getFormattedDateTime() };
|
||||||
|
ti.setText(tableItemValues);
|
||||||
|
}
|
||||||
|
for (TableColumn tc : ffgTable.getColumns()) {
|
||||||
|
tc.pack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the buttons that manipulate the data list control.
|
* Create the buttons that manipulate the data list control.
|
||||||
*/
|
*/
|
||||||
|
@ -415,18 +452,20 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
centeredComp.setLayoutData(gd);
|
centeredComp.setLayoutData(gd);
|
||||||
|
|
||||||
Composite dataControlComp = new Composite(centeredComp, SWT.NONE);
|
Composite dataControlComp = new Composite(centeredComp, SWT.NONE);
|
||||||
RowLayout layout = new RowLayout();
|
gl = new GridLayout(2, true);
|
||||||
layout.spacing = 20;
|
dataControlComp.setLayout(gl);
|
||||||
dataControlComp.setLayout(layout);
|
|
||||||
|
|
||||||
RowData rd = new RowData(80, SWT.DEFAULT);
|
final int minimumButtonWidth = dataControlComp.getDisplay().getDPI().x;
|
||||||
|
|
||||||
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = minimumButtonWidth;
|
||||||
selectBtn = new Button(dataControlComp, SWT.PUSH);
|
selectBtn = new Button(dataControlComp, SWT.PUSH);
|
||||||
selectBtn.setText("Select");
|
selectBtn.setText("Select");
|
||||||
selectBtn.setLayoutData(rd);
|
selectBtn.setLayoutData(gd);
|
||||||
selectBtn.addSelectionListener(new SelectionAdapter() {
|
selectBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
if (dataList.getSelectionIndex() < 0) {
|
if (ffgTable.getSelectionCount() <= 0) {
|
||||||
MessageBox mb = new MessageBox(getParent(),
|
MessageBox mb = new MessageBox(getParent(),
|
||||||
SWT.ICON_WARNING | SWT.OK);
|
SWT.ICON_WARNING | SWT.OK);
|
||||||
mb.setText("Selection Needed");
|
mb.setText("Selection Needed");
|
||||||
|
@ -441,18 +480,15 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rd = new RowData(80, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = minimumButtonWidth;
|
||||||
clearBtn = new Button(dataControlComp, SWT.PUSH);
|
clearBtn = new Button(dataControlComp, SWT.PUSH);
|
||||||
clearBtn.setText("Clear");
|
clearBtn.setText("Clear");
|
||||||
clearBtn.setLayoutData(rd);
|
clearBtn.setLayoutData(gd);
|
||||||
clearBtn.addSelectionListener(new SelectionAdapter() {
|
clearBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
clearData();
|
clearData();
|
||||||
// if ( isThereFfgDataToDraw ( ) != 0 )
|
|
||||||
// {
|
|
||||||
// turnOffFfgData ( ) ;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -492,22 +528,21 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
Label ffgAreaLbl = new Label(ffgOptionsComp, SWT.RIGHT);
|
Label ffgAreaLbl = new Label(ffgOptionsComp, SWT.RIGHT);
|
||||||
ffgAreaLbl.setText("FFG Area:");
|
ffgAreaLbl.setText("FFG Area:");
|
||||||
|
|
||||||
GridData gd = new GridData(100, SWT.DEFAULT);
|
GridData gd = new GridData(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
ffgAreaCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
ffgAreaCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
ffgAreaCbo.add("WFO");
|
ffgAreaCbo.setItems(FFG_AREAS);
|
||||||
ffgAreaCbo.add("RFC");
|
|
||||||
ffgAreaCbo.select(0);
|
ffgAreaCbo.select(0);
|
||||||
ffgAreaCbo.setLayoutData(gd);
|
ffgAreaCbo.setLayoutData(gd);
|
||||||
ffgAreaCbo.addSelectionListener(new SelectionAdapter() {
|
ffgAreaCbo.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
if (ffgAreaCbo.getText().compareTo("WFO") == 0) {
|
if (FFG_AREA_WFO.equals(ffgAreaCbo.getText())) {
|
||||||
ffgIdCbo.setEnabled(false);
|
ffgIdCbo.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ffgIdCbo.setEnabled(true);
|
ffgIdCbo.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -518,7 +553,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
// NOTE: The FFG ID combo box data may be dynamic
|
// NOTE: The FFG ID combo box data may be dynamic
|
||||||
// so the items in the list may change.
|
// so the items in the list may change.
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
gd = new GridData(100, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
ffgIdCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
ffgIdCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
ffgIdCbo.add("All");
|
ffgIdCbo.add("All");
|
||||||
for (String s : RFC_NAMES) {
|
for (String s : RFC_NAMES) {
|
||||||
|
@ -532,7 +567,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
selectedRFC = ffgIdCbo.getItem(ffgIdCbo.getSelectionIndex());
|
selectedRFC = ffgIdCbo.getItem(ffgIdCbo.getSelectionIndex());
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -540,7 +575,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
Label ffgDurLbl = new Label(ffgOptionsComp, SWT.RIGHT);
|
Label ffgDurLbl = new Label(ffgOptionsComp, SWT.RIGHT);
|
||||||
ffgDurLbl.setText("Duration:");
|
ffgDurLbl.setText("Duration:");
|
||||||
|
|
||||||
gd = new GridData(100, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
ffgDurCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
ffgDurCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
for (String s : DURATIONS) {
|
for (String s : DURATIONS) {
|
||||||
ffgDurCbo.add(s);
|
ffgDurCbo.add(s);
|
||||||
|
@ -548,19 +583,18 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
ffgDurCbo.select(0);
|
ffgDurCbo.select(0);
|
||||||
ffgDurCbo.setLayoutData(gd);
|
ffgDurCbo.setLayoutData(gd);
|
||||||
ffgDurCbo.addSelectionListener(new SelectionAdapter() {
|
ffgDurCbo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int index = ffgDurCbo.getSelectionIndex();
|
int index = ffgDurCbo.getSelectionIndex();
|
||||||
selectedDur = DURATIONS[index];
|
selectedDur = DURATIONS[index];
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Label ffgDisplayLbl = new Label(ffgOptionsComp, SWT.RIGHT);
|
Label ffgDisplayLbl = new Label(ffgOptionsComp, SWT.RIGHT);
|
||||||
ffgDisplayLbl.setText("Display As:");
|
ffgDisplayLbl.setText("Display As:");
|
||||||
|
|
||||||
gd = new GridData(100, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
ffgDisplayAsCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN
|
ffgDisplayAsCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN
|
||||||
| SWT.READ_ONLY);
|
| SWT.READ_ONLY);
|
||||||
ffgDisplayAsCbo.add("Grid");
|
ffgDisplayAsCbo.add("Grid");
|
||||||
|
@ -594,7 +628,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -613,12 +647,11 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
arealDurCbo.setLayoutData(gd);
|
arealDurCbo.setLayoutData(gd);
|
||||||
arealDurCbo.addSelectionListener(new SelectionAdapter() {
|
arealDurCbo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int index = arealDurCbo.getSelectionIndex();
|
int index = arealDurCbo.getSelectionIndex();
|
||||||
selectedDur = DURATIONS[index];
|
selectedDur = DURATIONS[index];
|
||||||
populateDataList();
|
populateFFGDataTable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -653,7 +686,6 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private void createColorLegend() {
|
private void createColorLegend() {
|
||||||
String user_id = System.getProperty("user.name");
|
String user_id = System.getProperty("user.name");
|
||||||
// String app_name = "hydroview";
|
|
||||||
|
|
||||||
java.util.List<Colorvalue> colorSet = HydroDisplayManager.getInstance()
|
java.util.List<Colorvalue> colorSet = HydroDisplayManager.getInstance()
|
||||||
.getFFGColorMap(user_id, "FFG", duration);
|
.getFFGColorMap(user_id, "FFG", duration);
|
||||||
|
@ -697,7 +729,8 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
centeredComp.setLayoutData(gd);
|
centeredComp.setLayoutData(gd);
|
||||||
|
|
||||||
gd = new GridData(70, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = centeredComp.getDisplay().getDPI().x;
|
||||||
closeBtn = new Button(centeredComp, SWT.NONE);
|
closeBtn = new Button(centeredComp, SWT.NONE);
|
||||||
closeBtn.setText("Close");
|
closeBtn.setText("Close");
|
||||||
closeBtn.setLayoutData(gd);
|
closeBtn.setLayoutData(gd);
|
||||||
|
@ -709,31 +742,17 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Populate the data list.
|
|
||||||
*/
|
|
||||||
private void populateDataList() {
|
|
||||||
dataList.removeAll();
|
|
||||||
|
|
||||||
if (griddedRdo.getSelection()) {
|
|
||||||
readGriddedFfgProduct();
|
|
||||||
} else { // must be areal
|
|
||||||
readArealFfgProduct();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Gridded FFG products for the data list.
|
* Get the Gridded FFG products for the data list.
|
||||||
*/
|
*/
|
||||||
private void readGriddedFfgProduct() {
|
private void readGriddedFfgProduct() {
|
||||||
FlashFloodGuidanceDataManager dman = FlashFloodGuidanceDataManager
|
FlashFloodGuidanceDataManager dman = FlashFloodGuidanceDataManager
|
||||||
.getInstance();
|
.getInstance();
|
||||||
java.util.List<String> list = new ArrayList<String>();
|
List<FFGGuidanceData> guidanceDataList = new LinkedList<>();
|
||||||
Map<String, String> sortedMap = new HashMap<String, String>();
|
|
||||||
dataMap.clear();
|
|
||||||
|
|
||||||
/* Check the FFG mode. */
|
/* Check the FFG mode. */
|
||||||
if (ffgAreaCbo.getItem(ffgAreaCbo.getSelectionIndex()).equals("RFC")) {
|
if (FFG_AREA_RFC.equals(ffgAreaCbo.getItem(ffgAreaCbo
|
||||||
|
.getSelectionIndex()))) {
|
||||||
java.util.List<Object[]> rs = dman.getGriddedDataList();
|
java.util.List<Object[]> rs = dman.getGriddedDataList();
|
||||||
|
|
||||||
if ((rs != null) && (rs.size() > 0)) {
|
if ((rs != null) && (rs.size() > 0)) {
|
||||||
|
@ -787,39 +806,10 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String line = String.format("%5s %2s %s", id, durHr,
|
guidanceDataList.add(new FFGGuidanceData(id, Integer
|
||||||
dateStr);
|
.parseInt(durHr), durHr, date, dateStr));
|
||||||
Calendar cal = Calendar.getInstance(TimeZone
|
|
||||||
.getTimeZone("GMT"));
|
|
||||||
cal.setTime(date);
|
|
||||||
int hr = cal.get(Calendar.HOUR_OF_DAY);
|
|
||||||
String hrStr = String.valueOf(hr);
|
|
||||||
if (hr < 10) {
|
|
||||||
hrStr = "0" + hr;
|
|
||||||
}
|
|
||||||
String sortLine = id + " " + durHr + " "
|
|
||||||
+ cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH)
|
|
||||||
+ cal.get(Calendar.DAY_OF_MONTH) + hrStr;
|
|
||||||
// + cal.get(Calendar.HOUR_OF_DAY);
|
|
||||||
|
|
||||||
// list.add(line);
|
|
||||||
sortedMap.put(sortLine, line);
|
|
||||||
dataMap.put(line, date);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the data, first by id asc, then duration asc
|
|
||||||
java.util.List<String> sortList = new ArrayList<String>(
|
|
||||||
sortedMap.keySet());
|
|
||||||
String[] data = sortList.toArray(new String[sortList.size()]);
|
|
||||||
|
|
||||||
java.util.Arrays.sort(data);
|
|
||||||
|
|
||||||
String[] sortedData = sort(data);
|
|
||||||
|
|
||||||
for (String s : sortedData) {
|
|
||||||
dataList.add(sortedMap.get(s));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// WFO Grided data, read xmrg directory
|
// WFO Grided data, read xmrg directory
|
||||||
String ffgDirToken = "gaff_mosaic_dir";
|
String ffgDirToken = "gaff_mosaic_dir";
|
||||||
|
@ -831,10 +821,10 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
String ffgDirPath = AppsDefaults.getInstance()
|
String ffgDirPath = AppsDefaults.getInstance()
|
||||||
.getToken(ffgDirToken);
|
.getToken(ffgDirToken);
|
||||||
if (ffgDirPath == null) {
|
if (ffgDirPath == null) {
|
||||||
// TODO error handling
|
statusHandler
|
||||||
System.err
|
.error("Error getting WFO FFG directory from token "
|
||||||
.println("Error getting WFO FFG directory from token "
|
|
||||||
+ ffgDirToken);
|
+ ffgDirToken);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
File ffgDir = new File(ffgDirPath);
|
File ffgDir = new File(ffgDirPath);
|
||||||
|
@ -846,115 +836,62 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
* Check to make sure that this is a FFG file. This is done
|
* Check to make sure that this is a FFG file. This is done
|
||||||
* by checking the extension on the file.
|
* by checking the extension on the file.
|
||||||
*/
|
*/
|
||||||
if (xmrg.getName().endsWith(".ffg")) {
|
final String fileName = xmrg.getName();
|
||||||
/* Parse the filename for the WFO identifier here. */
|
final Matcher matcher = FFG_NAME_PATTERN.matcher(fileName);
|
||||||
String fileWfo = xmrg.getName().substring(0, 3);
|
if (!matcher.matches()) {
|
||||||
int index = xmrg.getName().indexOf("20");
|
statusHandler.warn("Discovered unrecognized file: "
|
||||||
/* Parse the filename for duration and time stamp here. */
|
+ xmrg.toString()
|
||||||
String year = xmrg.getName()
|
+ " in the WFO FFG directory: "
|
||||||
.substring(index, index + 4);
|
+ ffgDirPath.toString() + ". Skipping file.");
|
||||||
String month = xmrg.getName().substring(index + 4,
|
continue;
|
||||||
index + 6);
|
|
||||||
String day = xmrg.getName().substring(index + 6,
|
|
||||||
index + 8);
|
|
||||||
String hour = xmrg.getName().substring(index + 8,
|
|
||||||
index + 10);
|
|
||||||
String durString = xmrg.getName().substring(index + 10,
|
|
||||||
index + 12);
|
|
||||||
// String year = xmrg.getName().substring(3, 7);
|
|
||||||
// String month = xmrg.getName().substring(7, 9);
|
|
||||||
// String day = xmrg.getName().substring(9, 11);
|
|
||||||
// String hour = xmrg.getName().substring(11, 13);
|
|
||||||
// String durString = xmrg.getName().substring(13, 15);
|
|
||||||
|
|
||||||
Calendar cal = Calendar.getInstance(TimeZone
|
|
||||||
.getTimeZone("GMT"));
|
|
||||||
cal.set(Calendar.YEAR, Integer.parseInt(year));
|
|
||||||
cal.set(Calendar.MONTH, Integer.parseInt(month) - 1);
|
|
||||||
cal.set(Calendar.DATE, Integer.parseInt(day));
|
|
||||||
cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour));
|
|
||||||
cal.set(Calendar.MINUTE, 0);
|
|
||||||
cal.set(Calendar.SECOND, 0);
|
|
||||||
cal.set(Calendar.MILLISECOND, 0);
|
|
||||||
|
|
||||||
// Dur is FFG03, FFG06, etc
|
|
||||||
// selectedDur is 1hr, 3hr, etc
|
|
||||||
if ((selectedDur != null)
|
|
||||||
&& !selectedDur.equalsIgnoreCase("All")) {
|
|
||||||
if (!durString.equalsIgnoreCase(selectedDur
|
|
||||||
.substring(0, selectedDur.indexOf("h")))) {
|
|
||||||
continue;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String dateStr = sdf.format(cal.getTime());
|
|
||||||
String line = String.format("%5s %2s %s",
|
|
||||||
fileWfo, durString, dateStr);
|
|
||||||
String sortLine = fileWfo + " " + durString + " "
|
|
||||||
+ year + month + day + hour;
|
|
||||||
sortedMap.put(sortLine, line);
|
|
||||||
list.add(line);
|
|
||||||
dataMap.put(line, cal.getTime());
|
|
||||||
fileMap.put(line, xmrg);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Sort the data, first by id asc, then duration asc, date desc
|
String fileWfo = matcher.group(FFG_WFO_GROUP);
|
||||||
java.util.List<String> sortList = new ArrayList<String>(
|
String xmrgDateString = matcher.group(FFG_DATE_GROUP);
|
||||||
sortedMap.keySet());
|
/*
|
||||||
String[] data = sortList.toArray(new String[sortList.size()]);
|
* Verify that a valid date/time can be parsed from the xmrg
|
||||||
|
* date/time String.
|
||||||
|
*/
|
||||||
|
Date xmrgDate = null;
|
||||||
|
try {
|
||||||
|
xmrgDate = xmrgDateFormat.parse(xmrgDateString);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
statusHandler.error(
|
||||||
|
"Failed to parse xmrg date/time: "
|
||||||
|
+ xmrgDateString + " for file: "
|
||||||
|
+ xmrg.toString() + ". Skipping file.",
|
||||||
|
e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String durationString = matcher.group(FFG_DURATION_GROUP);
|
||||||
|
/*
|
||||||
|
* Verify that the duration String is numeric.
|
||||||
|
*/
|
||||||
|
int duration = 0;
|
||||||
|
try {
|
||||||
|
duration = Integer.parseInt(durationString);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
statusHandler.error(
|
||||||
|
"Failed to parse xmrg duration: "
|
||||||
|
+ durationString + " for file: "
|
||||||
|
+ xmrg.toString() + ". Skipping file.",
|
||||||
|
e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
java.util.Arrays.sort(data);
|
String dateStr = sdf.format(xmrgDate);
|
||||||
String[] sortedData = sort(data);
|
FFGGuidanceData data = new FFGGuidanceData(fileWfo,
|
||||||
for (String s : sortedData) {
|
duration, durationString, xmrgDate, dateStr);
|
||||||
dataList.add(sortedMap.get(s));
|
data.setXmrgFile(xmrg);
|
||||||
|
guidanceDataList.add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
addTableRows(guidanceDataList);
|
||||||
* Sort the list of items in reverse by time.
|
|
||||||
*
|
|
||||||
* @param strArr
|
|
||||||
* The String[] sorted with time asc
|
|
||||||
* @return The String[] sorted with time desc
|
|
||||||
*/
|
|
||||||
private String[] sort(String[] strArr) {
|
|
||||||
java.util.List<String> strList = new ArrayList<String>();
|
|
||||||
java.util.List<String> holder = new ArrayList<String>();
|
|
||||||
String prevDur = "";
|
|
||||||
String prevId = "";
|
|
||||||
|
|
||||||
for (String s : strArr) {
|
|
||||||
String[] parts = s.split("\\s+", 3);
|
|
||||||
|
|
||||||
if ((prevDur.equals(parts[1]) == false)
|
|
||||||
|| (prevId.equals(parts[0]) == false)) {
|
|
||||||
for (int i = holder.size() - 1; i >= 0; i--) {
|
|
||||||
strList.add(holder.get(i));
|
|
||||||
}
|
|
||||||
holder.clear();
|
|
||||||
prevDur = parts[1];
|
|
||||||
prevId = parts[0];
|
|
||||||
holder.add(s);
|
|
||||||
} else {
|
|
||||||
holder.add(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = holder.size() - 1; i >= 0; i--) {
|
|
||||||
strList.add(holder.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return strList.toArray(new String[strList.size()]);
|
|
||||||
// return strArr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readArealFfgProduct() {
|
private void readArealFfgProduct() {
|
||||||
// Clear the map for areal data
|
|
||||||
dataMap.clear();
|
|
||||||
ResolutionLevel res = null;
|
ResolutionLevel res = null;
|
||||||
String selectedItem = arealTypeCbo.getItem(arealTypeCbo
|
String selectedItem = arealTypeCbo.getItem(arealTypeCbo
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
|
@ -969,7 +906,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
res = ResolutionLevel.ALL;
|
res = ResolutionLevel.ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> sortedMap = new TreeMap<String, String>();
|
List<FFGGuidanceData> guidanceDataList = new LinkedList<>();
|
||||||
if (res == ResolutionLevel.ALL) {
|
if (res == ResolutionLevel.ALL) {
|
||||||
for (ResolutionLevel level : ResolutionLevel.values()) {
|
for (ResolutionLevel level : ResolutionLevel.values()) {
|
||||||
if (level.getResolution().equals("All")
|
if (level.getResolution().equals("All")
|
||||||
|
@ -977,29 +914,13 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
continue; // Skip "All" and "Grid"
|
continue; // Skip "All" and "Grid"
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeMap<String, String> tmpMap = bldFfgList(level);
|
guidanceDataList.addAll(bldFfgList(level));
|
||||||
|
|
||||||
Iterator<String> iter = tmpMap.keySet().iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
String key = iter.next();
|
|
||||||
sortedMap.put(key, tmpMap.get(key));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sortedMap = bldFfgList(res);
|
guidanceDataList = bldFfgList(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<String> iter = sortedMap.keySet().iterator();
|
addTableRows(guidanceDataList);
|
||||||
java.util.List<String> strList = new ArrayList<String>();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
strList.add(iter.next());
|
|
||||||
}
|
|
||||||
|
|
||||||
String[] sa = sort(strList.toArray(new String[strList.size()]));
|
|
||||||
|
|
||||||
for (String s : sa) {
|
|
||||||
dataList.add(sortedMap.get(s));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1009,8 +930,8 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
*
|
*
|
||||||
* @param level
|
* @param level
|
||||||
*/
|
*/
|
||||||
private TreeMap<String, String> bldFfgList(ResolutionLevel level) {
|
private List<FFGGuidanceData> bldFfgList(ResolutionLevel level) {
|
||||||
TreeMap<String, String> map = new TreeMap<String, String>();
|
List<FFGGuidanceData> guidanceDataList = new LinkedList<>();
|
||||||
|
|
||||||
java.util.List<Object[]> rs = FlashFloodGuidanceDataManager
|
java.util.List<Object[]> rs = FlashFloodGuidanceDataManager
|
||||||
.getInstance().getContingencyValue(level.getResolution());
|
.getInstance().getContingencyValue(level.getResolution());
|
||||||
|
@ -1023,10 +944,8 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
// Dur is FFG03, FFG06, etc
|
// Dur is FFG03, FFG06, etc
|
||||||
// selectedDur is 1hr, 3hr, etc
|
// selectedDur is 1hr, 3hr, etc
|
||||||
if ((selectedDur != null) && !selectedDur.equalsIgnoreCase("All")) {
|
if ((selectedDur != null) && !selectedDur.equalsIgnoreCase("All")) {
|
||||||
String durCheck = String.valueOf(dur);
|
String durCheck = StringUtils.leftPad(String.valueOf(dur), 2,
|
||||||
if (dur < 10) {
|
"0");
|
||||||
durCheck = "0" + dur;
|
|
||||||
}
|
|
||||||
if (!String.valueOf(durCheck).equalsIgnoreCase(
|
if (!String.valueOf(durCheck).equalsIgnoreCase(
|
||||||
selectedDur.substring(0, selectedDur.indexOf("h")))
|
selectedDur.substring(0, selectedDur.indexOf("h")))
|
||||||
&& !String.valueOf(durCheck).equals(
|
&& !String.valueOf(durCheck).equals(
|
||||||
|
@ -1038,25 +957,14 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String dateStr = sdf.format(validTime);
|
String dateStr = sdf.format(validTime);
|
||||||
|
|
||||||
String id = level.getResolution();
|
String id = level.getResolution();
|
||||||
String durStr = String.valueOf(dur);
|
String durStr = StringUtils.leftPad(String.valueOf(dur), 2, "0");
|
||||||
if (dur < 10) {
|
|
||||||
durStr = "0" + dur;
|
|
||||||
}
|
|
||||||
String line = String
|
|
||||||
.format("%-6s %2s %s", id, durStr, dateStr);
|
|
||||||
|
|
||||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
guidanceDataList.add(new FFGGuidanceData(id, dur, durStr,
|
||||||
cal.setTime(validTime);
|
validTime, dateStr));
|
||||||
String sortLine = id + " " + dur + " " + cal.get(Calendar.YEAR)
|
|
||||||
+ cal.get(Calendar.MONTH) + cal.get(Calendar.DAY_OF_MONTH)
|
|
||||||
+ cal.get(Calendar.HOUR_OF_DAY);
|
|
||||||
map.put(sortLine, line);
|
|
||||||
dataMap.put(line, validTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return map;
|
return guidanceDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1068,17 +976,13 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
shell.setCursor(waitCursor);
|
shell.setCursor(waitCursor);
|
||||||
|
|
||||||
|
FFGGuidanceData selectedRowData = (FFGGuidanceData) ffgTable
|
||||||
|
.getSelection()[0].getData();
|
||||||
|
|
||||||
/* Get the selection from the list and break it up */
|
/* Get the selection from the list and break it up */
|
||||||
String s = dataList.getItem(dataList.getSelectionIndex());
|
String site = selectedRowData.getIdentifier();
|
||||||
String key = dataList.getItem(dataList.getSelectionIndex());
|
String durationStr = selectedRowData.getFormattedDuration();
|
||||||
s = s.replaceAll("\\s+", " ").trim();
|
duration = selectedRowData.getDuration()
|
||||||
String[] parts = s.split(" ");
|
|
||||||
String site = parts[0];
|
|
||||||
String durationStr = parts[1];
|
|
||||||
String day = parts[2];
|
|
||||||
String date = parts[3];
|
|
||||||
String hour = parts[4];
|
|
||||||
duration = Integer.parseInt(durationStr)
|
|
||||||
* FFGConstants.SECONDS_PER_HOUR;
|
* FFGConstants.SECONDS_PER_HOUR;
|
||||||
|
|
||||||
String paramAbr = "FFG" + durationStr + "24hr";
|
String paramAbr = "FFG" + durationStr + "24hr";
|
||||||
|
@ -1104,39 +1008,42 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
if (ffgDisplayAsCbo.getItem(ffgDisplayAsCbo.getSelectionIndex())
|
if (ffgDisplayAsCbo.getItem(ffgDisplayAsCbo.getSelectionIndex())
|
||||||
.equalsIgnoreCase("GRID")) {
|
.equalsIgnoreCase("GRID")) {
|
||||||
// Display the grid
|
// Display the grid
|
||||||
getParameters();
|
getParameters(selectedRowData);
|
||||||
|
|
||||||
if (rfcSelected) {
|
if (rfcSelected) {
|
||||||
HydroDisplayManager.getInstance().displayGriddedFFG(
|
HydroDisplayManager.getInstance().displayGriddedFFG(
|
||||||
dataMap.get(key), duration, paramAbr, rfc, res);
|
selectedRowData.getDateTime(), duration, paramAbr,
|
||||||
|
rfc, res);
|
||||||
} else {
|
} else {
|
||||||
HydroDisplayManager.getInstance().displayGriddedFFG(
|
HydroDisplayManager.getInstance().displayGriddedFFG(
|
||||||
fileMap.get(key), duration, res);
|
selectedRowData.getXmrgFile(), duration, res);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Display the areal basin */
|
/* Display the areal basin */
|
||||||
if (rfcSelected) {
|
if (rfcSelected) {
|
||||||
HydroDisplayManager.getInstance()
|
HydroDisplayManager.getInstance()
|
||||||
.displayRfcGriddedFFGBasin(dataMap.get(key),
|
.displayRfcGriddedFFGBasin(
|
||||||
duration, paramAbr, rfc, res);
|
selectedRowData.getDateTime(), duration,
|
||||||
|
paramAbr, rfc, res);
|
||||||
} else {
|
} else {
|
||||||
HydroDisplayManager.getInstance().displayGriddedFFGBasin(
|
HydroDisplayManager.getInstance().displayGriddedFFGBasin(
|
||||||
fileMap.get(key), duration, res, dataMap.get(key));
|
selectedRowData.getXmrgFile(), duration, res,
|
||||||
|
selectedRowData.getDateTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Areal Radio selected */
|
/* Areal Radio selected */
|
||||||
java.util.List<ArealData> arealList = buildFfgArea(site,
|
java.util.List<ArealData> arealList = buildFfgArea(site,
|
||||||
dataMap.get(key));
|
selectedRowData.getDateTime());
|
||||||
|
|
||||||
HydroDisplayManager.getInstance().displayArealFfg(arealList,
|
HydroDisplayManager.getInstance().displayArealFfg(arealList,
|
||||||
duration, site, dataMap.get(key), valuesChk.getSelection(),
|
duration, site, selectedRowData.getDateTime(),
|
||||||
idsChk.getSelection());
|
valuesChk.getSelection(), idsChk.getSelection());
|
||||||
}
|
}
|
||||||
// Create the legend strings
|
// Create the legend strings
|
||||||
// Build the string in the legend
|
// Build the string in the legend
|
||||||
String line = site + " " + durationStr + " hours " + day + " " + date
|
String line = site + " " + durationStr + " hours "
|
||||||
+ " " + hour + ":00";
|
+ selectedRowData.getFormattedDateTime() + ":00";
|
||||||
colorLegend.setDisplayText("FFG Grid", line);
|
colorLegend.setDisplayText("FFG Grid", line);
|
||||||
|
|
||||||
shell.setCursor(arrowCursor);
|
shell.setCursor(arrowCursor);
|
||||||
|
@ -1145,29 +1052,23 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
|
||||||
/**
|
/**
|
||||||
* Get the parameters for the bundle
|
* Get the parameters for the bundle
|
||||||
*/
|
*/
|
||||||
private void getParameters() {
|
private void getParameters(FFGGuidanceData selectedRowData) {
|
||||||
String data = dataList.getItem(dataList.getSelectionIndex());
|
|
||||||
String key = dataList.getItem(dataList.getSelectionIndex());
|
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
sdf.setTimeZone(TimeUtil.GMT_TIME_ZONE);
|
||||||
|
|
||||||
data = data.replaceAll("\\s+", " ");
|
|
||||||
data = data.trim();
|
|
||||||
String[] parts = data.split(" ");
|
|
||||||
String modelname = null;
|
String modelname = null;
|
||||||
|
|
||||||
String param = "FFG" + parts[1] + "24hr";
|
String param = "FFG" + selectedRowData.getFormattedDuration() + "24hr";
|
||||||
|
|
||||||
// Lookup the name
|
// Lookup the name
|
||||||
String s = FlashFloodGuidanceDataManager.getInstance().rfcSiteLookup(
|
String s = FlashFloodGuidanceDataManager.getInstance().rfcSiteLookup(
|
||||||
parts[0]);
|
selectedRowData.getIdentifier());
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
modelname = "FFG-" + s;
|
modelname = "FFG-" + s;
|
||||||
}
|
}
|
||||||
parameters.put("timespan", param);
|
parameters.put("timespan", param);
|
||||||
parameters.put("model", modelname);
|
parameters.put("model", modelname);
|
||||||
parameters.put("reftime", sdf.format(dataMap.get(key)));
|
parameters.put("reftime", sdf.format(selectedRowData.getDateTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private java.util.List<ArealData> buildFfgArea(String boundaryType,
|
private java.util.List<ArealData> buildFfgArea(String boundaryType,
|
||||||
|
|
|
@ -25,14 +25,12 @@ import java.util.Arrays;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
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.Font;
|
|
||||||
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.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
import org.eclipse.swt.widgets.DirectoryDialog;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Layout;
|
|
||||||
import org.eclipse.swt.widgets.List;
|
import org.eclipse.swt.widgets.List;
|
||||||
import org.eclipse.swt.widgets.MessageBox;
|
import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
@ -50,7 +48,8 @@ import com.raytheon.viz.hydro.CaveHydroSWTDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 28, 2011 mpduff Initial creation
|
* Mar 28, 2011 mpduff Initial creation
|
||||||
* Feb 06, 2013 1578 rferrel Code cleanup for non-blocking dialog.
|
* Feb 06, 2013 1578 rferrel Code cleanup for non-blocking dialog.
|
||||||
|
* May 09, 2016 5483 bkowal Fix GUI sizing issues.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -60,11 +59,6 @@ import com.raytheon.viz.hydro.CaveHydroSWTDialog;
|
||||||
|
|
||||||
public class SendConfigDlg extends CaveHydroSWTDialog {
|
public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
|
|
||||||
/**
|
|
||||||
* Font used for the list controls.
|
|
||||||
*/
|
|
||||||
private Font font;
|
|
||||||
|
|
||||||
/** Manager for handling the shef xml data. */
|
/** Manager for handling the shef xml data. */
|
||||||
private ShefIssueMgr shefIssueMgr;
|
private ShefIssueMgr shefIssueMgr;
|
||||||
|
|
||||||
|
@ -96,19 +90,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
shefIssueMgr = ShefIssueMgr.getInstance();
|
shefIssueMgr = ShefIssueMgr.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see
|
|
||||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
|
||||||
* .eclipse.swt.widgets.Shell)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeComponents(Shell shell) {
|
protected void initializeComponents(Shell shell) {
|
||||||
setReturnValue(false);
|
setReturnValue(false);
|
||||||
|
|
||||||
font = new Font(shell.getDisplay(), "Monospace", 11, SWT.NORMAL);
|
|
||||||
|
|
||||||
// Initialize all of the controls and layouts
|
// Initialize all of the controls and layouts
|
||||||
initializeComponents();
|
initializeComponents();
|
||||||
}
|
}
|
||||||
|
@ -122,21 +107,6 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
createBottomButtons();
|
createBottomButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Layout constructShellLayout() {
|
|
||||||
// Create the main layout for the shell.
|
|
||||||
GridLayout mainLayout = new GridLayout(1, true);
|
|
||||||
mainLayout.verticalSpacing = 3;
|
|
||||||
mainLayout.marginHeight = 1;
|
|
||||||
mainLayout.marginWidth = 1;
|
|
||||||
return mainLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createDistributionGroup() {
|
private void createDistributionGroup() {
|
||||||
String defSelection = AppsDefaults.getInstance().getToken(
|
String defSelection = AppsDefaults.getInstance().getToken(
|
||||||
"timeseries_dist_shef", "OFF");
|
"timeseries_dist_shef", "OFF");
|
||||||
|
@ -155,12 +125,13 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
GridLayout gl = new GridLayout(1, false);
|
GridLayout gl = new GridLayout(1, false);
|
||||||
distComp.setLayout(gl);
|
distComp.setLayout(gl);
|
||||||
|
|
||||||
gd = new GridData(150, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
distChk = new Button(distComp, SWT.CHECK);
|
distChk = new Button(distComp, SWT.CHECK);
|
||||||
distChk.setText("Distribute Product");
|
distChk.setText("Distribute Product");
|
||||||
distChk.setLayoutData(gd);
|
distChk.setLayoutData(gd);
|
||||||
distChk.setSelection(selected);
|
distChk.setSelection(selected);
|
||||||
|
|
||||||
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
directoryChk = new Button(distComp, SWT.CHECK);
|
directoryChk = new Button(distComp, SWT.CHECK);
|
||||||
directoryChk.setText("Internal Directory");
|
directoryChk.setText("Internal Directory");
|
||||||
directoryChk.setLayoutData(gd);
|
directoryChk.setLayoutData(gd);
|
||||||
|
@ -174,9 +145,6 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
|
|
||||||
private void createDirectoryGroup() {
|
private void createDirectoryGroup() {
|
||||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
|
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
|
||||||
gd.widthHint = 350;
|
|
||||||
gd.heightHint = 400;
|
|
||||||
|
|
||||||
Group dirGroup = new Group(shell, SWT.NONE);
|
Group dirGroup = new Group(shell, SWT.NONE);
|
||||||
dirGroup.setText("Distribution Directories");
|
dirGroup.setText("Distribution Directories");
|
||||||
GridLayout gridLayout = new GridLayout(1, false);
|
GridLayout gridLayout = new GridLayout(1, false);
|
||||||
|
@ -188,14 +156,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
dirComp.setLayout(gl);
|
dirComp.setLayout(gl);
|
||||||
|
|
||||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
|
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
|
||||||
gd.heightHint = 300;
|
|
||||||
|
|
||||||
directoryList = new List(dirGroup, SWT.BORDER | SWT.MULTI
|
directoryList = new List(dirGroup, SWT.BORDER | SWT.MULTI
|
||||||
| SWT.V_SCROLL | SWT.H_SCROLL);
|
| SWT.V_SCROLL | SWT.H_SCROLL);
|
||||||
|
gd.heightHint = directoryList.getItemHeight() * 15;
|
||||||
directoryList.setLayoutData(gd);
|
directoryList.setLayoutData(gd);
|
||||||
directoryList.setFont(font);
|
|
||||||
|
|
||||||
int buttonWidth = 100;
|
|
||||||
|
|
||||||
Composite buttonComp = new Composite(dirGroup, SWT.NONE);
|
Composite buttonComp = new Composite(dirGroup, SWT.NONE);
|
||||||
|
|
||||||
|
@ -203,7 +167,7 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
||||||
buttonComp.setLayoutData(gd);
|
buttonComp.setLayoutData(gd);
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
addBtn = new Button(buttonComp, SWT.PUSH);
|
addBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
addBtn.setText("Add");
|
addBtn.setText("Add");
|
||||||
addBtn.setLayoutData(gd);
|
addBtn.setLayoutData(gd);
|
||||||
|
@ -224,7 +188,7 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
removeBtn = new Button(buttonComp, SWT.PUSH);
|
removeBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
removeBtn.setText("Remove");
|
removeBtn.setText("Remove");
|
||||||
removeBtn.setLayoutData(gd);
|
removeBtn.setLayoutData(gd);
|
||||||
|
@ -241,7 +205,7 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
removeAllBtn = new Button(buttonComp, SWT.PUSH);
|
removeAllBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
removeAllBtn.setText("Remove All");
|
removeAllBtn.setText("Remove All");
|
||||||
removeAllBtn.setLayoutData(gd);
|
removeAllBtn.setLayoutData(gd);
|
||||||
|
@ -263,9 +227,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
||||||
buttonComp.setLayoutData(gd);
|
buttonComp.setLayoutData(gd);
|
||||||
|
|
||||||
int buttonWidth = 80;
|
final int buttonMinimumWidth = buttonComp.getDisplay().getDPI().x;
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
Button okBtn = new Button(buttonComp, SWT.PUSH);
|
Button okBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
okBtn.setText("OK");
|
okBtn.setText("OK");
|
||||||
okBtn.setLayoutData(gd);
|
okBtn.setLayoutData(gd);
|
||||||
|
@ -277,7 +242,8 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
Button applyBtn = new Button(buttonComp, SWT.PUSH);
|
Button applyBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
applyBtn.setText("Apply");
|
applyBtn.setText("Apply");
|
||||||
applyBtn.setLayoutData(gd);
|
applyBtn.setLayoutData(gd);
|
||||||
|
@ -288,7 +254,8 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
|
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
cancelBtn.setText("Cancel");
|
cancelBtn.setText("Cancel");
|
||||||
cancelBtn.setLayoutData(gd);
|
cancelBtn.setLayoutData(gd);
|
||||||
|
@ -300,11 +267,6 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#opened()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void opened() {
|
protected void opened() {
|
||||||
super.opened();
|
super.opened();
|
||||||
|
@ -345,19 +307,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog {
|
||||||
this.shefIssueMgr.saveXml();
|
this.shefIssueMgr.saveXml();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void disposed() {
|
protected void disposed() {
|
||||||
super.disposed();
|
super.disposed();
|
||||||
|
|
||||||
if (font.isDisposed() == false) {
|
|
||||||
font.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shefIssueMgr != null) {
|
if (shefIssueMgr != null) {
|
||||||
ShefIssueMgr.recycle();
|
ShefIssueMgr.recycle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
*
|
*
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
* This software product contains export-restricted data whose
|
* This software product contains export-restricted data whose
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
* an export license or other authorization.
|
* an export license or other authorization.
|
||||||
*
|
*
|
||||||
* Contractor Name: Raytheon Company
|
* Contractor Name: Raytheon Company
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
* Mail Stop B8
|
* Mail Stop B8
|
||||||
* Omaha, NE 68106
|
* Omaha, NE 68106
|
||||||
* 402.291.0100
|
* 402.291.0100
|
||||||
*
|
*
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.common.dataplugin.shef.tables;
|
package com.raytheon.uf.common.dataplugin.shef.tables;
|
||||||
// default package
|
|
||||||
// Generated Oct 17, 2008 2:22:17 PM by Hibernate Tools 3.2.2.GA
|
// Generated Oct 17, 2008 2:22:17 PM by Hibernate Tools 3.2.2.GA
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -41,6 +41,7 @@ import javax.persistence.TemporalType;
|
||||||
* Oct 17, 2008 Initial generation by hbm2java
|
* Oct 17, 2008 Initial generation by hbm2java
|
||||||
* Aug 19, 2011 10672 jkorman Move refactor to new project
|
* Aug 19, 2011 10672 jkorman Move refactor to new project
|
||||||
* Oct 07, 2013 2361 njensen Removed XML annotations
|
* Oct 07, 2013 2361 njensen Removed XML annotations
|
||||||
|
* May 16, 2016 5483 bkowal Added {@link #HSA_LENGTH}.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -50,10 +51,14 @@ import javax.persistence.TemporalType;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "admin")
|
@Table(name = "admin")
|
||||||
@com.raytheon.uf.common.serialization.annotations.DynamicSerialize
|
@com.raytheon.uf.common.serialization.annotations.DynamicSerialize
|
||||||
public class Admin extends com.raytheon.uf.common.dataplugin.persist.PersistableDataObject implements java.io.Serializable {
|
public class Admin extends
|
||||||
|
com.raytheon.uf.common.dataplugin.persist.PersistableDataObject
|
||||||
|
implements java.io.Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static final int HSA_LENGTH = 5;
|
||||||
|
|
||||||
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
|
@com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement
|
||||||
private String hsa;
|
private String hsa;
|
||||||
|
|
||||||
|
@ -111,7 +116,7 @@ public class Admin extends com.raytheon.uf.common.dataplugin.persist.Persistable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "hsa", unique = true, nullable = false, length = 5)
|
@Column(name = "hsa", unique = true, nullable = false, length = Admin.HSA_LENGTH)
|
||||||
public String getHsa() {
|
public String getHsa() {
|
||||||
return this.hsa;
|
return this.hsa;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue