From c7c4ef3f312faf9ec6bf47653ee23b5e0cedbd7c Mon Sep 17 00:00:00 2001 From: Bryan Kowal Date: Tue, 10 May 2016 13:16:19 -0500 Subject: [PATCH] Omaha #5483 - fix Hydro GUI sizing issues. Change-Id: Ibe0ead7fa2b24b80724b4dcb38ab8b0bc25decd6 Former-commit-id: 9c4bcf5d9896c5e3334ccd419ee929f56c06b0ec --- .../META-INF/MANIFEST.MF | 5 +- .../flashfloodguidance/FFGGuidanceData.java | 99 +++ .../FFGGuidanceDataComparator.java | 56 ++ .../FlashFloodGuidanceDlg.java | 617 ++++++++---------- .../viz/hydro/timeseries/SendConfigDlg.java | 77 +-- .../common/dataplugin/shef/tables/Admin.java | 47 +- 6 files changed, 458 insertions(+), 443 deletions(-) create mode 100644 cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceData.java create mode 100644 cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceDataComparator.java diff --git a/cave/com.raytheon.viz.hydro/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.hydro/META-INF/MANIFEST.MF index 71cd3955a6..5b09ef73bb 100644 --- a/cave/com.raytheon.viz.hydro/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.hydro/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Hydro Plug-in 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-Vendor: Raytheon 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.viz.core.point;bundle-version="1.15.0", 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 Export-Package: com.raytheon.viz.hydro, com.raytheon.viz.hydro.perspective, diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceData.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceData.java new file mode 100644 index 0000000000..1c71b854fd --- /dev/null +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceData.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 10, 2016 5483       bkowal      Initial creation
+ * 
+ * 
+ * + * @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; + } +} \ No newline at end of file diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceDataComparator.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceDataComparator.java new file mode 100644 index 0000000000..c1c29e92c5 --- /dev/null +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FFGGuidanceDataComparator.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 10, 2016 5483       bkowal      Initial creation
+ * 
+ * 
+ * + * @author bkowal + * @version 1.0 + */ + +public class FFGGuidanceDataComparator implements Comparator { + + 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(); + } +} \ No newline at end of file diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java index 4218c1f676..371a16f809 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java @@ -20,38 +20,47 @@ package com.raytheon.viz.hydro.flashfloodguidance; import java.io.File; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Calendar; +import java.util.Collections; import java.util.Date; import java.util.HashMap; -import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; import java.util.Map; -import java.util.TimeZone; -import java.util.TreeMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang.StringUtils; import org.eclipse.swt.SWT; 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.SelectionEvent; 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.GridLayout; -import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; 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.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.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.IDisplayPaneContainer; 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. * Aug 05, 2015 4486 rjpeter Changed Timestamp to Date. * Mar 15, 2016 5483 randerso Fix GUI sizing issues + * Mar 15, 2016 5483 bkowal Fix GUI sizing issues * * * @@ -84,9 +94,14 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * */ public class FlashFloodGuidanceDlg extends CaveSWTDialog { + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(getClass()); + /** Date format for the dates */ private static SimpleDateFormat sdf = null; + private static SimpleDateFormat xmrgDateFormat; + /** List of RFC names */ private static final String[] RFC_NAMES = { "ABRFC", "AKRFC", "CBRFC", "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", "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 */ static { 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; - /** - * Font used for list controls. - */ - private Font font; - - /** - * FFG data list. - */ - private List dataList; - - /** - * ID Type label. - */ - private Label idTypeLbl; - /** * Select button. */ @@ -218,7 +260,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { private Button closeBtn; /** Bundle variables */ - private final Map parameters = new HashMap(); + private final Map parameters = new HashMap<>(); /** * The selected RFC. @@ -240,16 +282,6 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { */ private int duration = 3600; - /** - * Holds the display string and insert time for later use. - */ - private final Map dataMap = new HashMap(); - - /** - * Holds the display string and the xmrg File object. - */ - private final Map fileMap = new HashMap(); - /** * The wait mouse pointer. */ @@ -273,38 +305,16 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { 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 protected void initializeComponents(Shell shell) { - font = new Font(shell.getDisplay(), "Monospace", 11, SWT.NORMAL); - createGridArealControls(); - createListLabels(); - createDataListControl(); + createFFGDataTable(); createDataListControlButtons(); createOptionsGroup(); createColorLegend(); createBottomCloseButton(); - populateDataList(); - } - - @Override - protected void preOpened() { - shell.setMinimumSize(shell.getSize()); + populateFFGDataTable(); } /** @@ -314,7 +324,6 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { Group gridArealGroup = new Group(shell, SWT.NONE); gridArealGroup.setText("FFG Mode"); RowLayout gridArealLayout = new RowLayout(); - gridArealLayout.spacing = 5; gridArealGroup.setLayout(gridArealLayout); gridArealGroup.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); @@ -325,15 +334,13 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { griddedRdo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - idTypeLbl.setText("Id"); - ffgArealOptGroup.setText(ffgOptionsStr); stackLayout.topControl = ffgOptionsComp; stackComposite.layout(); - // Clear the data list and reload - populateDataList(); + // Clear the data table and reload + populateFFGDataTable(); } }); @@ -342,68 +349,98 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { arealRdo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - idTypeLbl.setText("Type"); - ffgArealOptGroup.setText(arealOptionsStr); stackLayout.topControl = arealOptionsComp; stackComposite.layout(); - // Clear the data list and reload - populateDataList(); + // Clear the data table and reload + populateFFGDataTable(); } }); } - /** - * Create the labels for the data list. - */ - private void createListLabels() { - Composite labelComp = new Composite(shell, SWT.NONE); - RowLayout layout = new RowLayout(); - 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() { + private void createFFGDataTable() { + Composite tableComp = new Composite(shell, SWT.NONE); + GridLayout gl = new GridLayout(1, false); + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); + tableComp.setLayout(gl); + tableComp.setLayoutData(gd); + 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 - public void widgetDefaultSelected(SelectionEvent e) { - // Display data on double click + public void mouseDoubleClick(MouseEvent e) { // Clear the previous data clearData(); // Display the new data 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 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. */ @@ -415,18 +452,20 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { centeredComp.setLayoutData(gd); Composite dataControlComp = new Composite(centeredComp, SWT.NONE); - RowLayout layout = new RowLayout(); - layout.spacing = 20; - dataControlComp.setLayout(layout); + gl = new GridLayout(2, true); + dataControlComp.setLayout(gl); - 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.setText("Select"); - selectBtn.setLayoutData(rd); + selectBtn.setLayoutData(gd); selectBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (dataList.getSelectionIndex() < 0) { + if (ffgTable.getSelectionCount() <= 0) { MessageBox mb = new MessageBox(getParent(), SWT.ICON_WARNING | SWT.OK); 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.setText("Clear"); - clearBtn.setLayoutData(rd); + clearBtn.setLayoutData(gd); clearBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { clearData(); - // if ( isThereFfgDataToDraw ( ) != 0 ) - // { - // turnOffFfgData ( ) ; - // } } }); } @@ -492,22 +528,21 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { Label ffgAreaLbl = new Label(ffgOptionsComp, SWT.RIGHT); 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.add("WFO"); - ffgAreaCbo.add("RFC"); + ffgAreaCbo.setItems(FFG_AREAS); ffgAreaCbo.select(0); ffgAreaCbo.setLayoutData(gd); ffgAreaCbo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (ffgAreaCbo.getText().compareTo("WFO") == 0) { + if (FFG_AREA_WFO.equals(ffgAreaCbo.getText())) { ffgIdCbo.setEnabled(false); } else { ffgIdCbo.setEnabled(true); } - populateDataList(); + populateFFGDataTable(); } }); @@ -518,7 +553,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { // NOTE: The FFG ID combo box data may be dynamic // 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.add("All"); for (String s : RFC_NAMES) { @@ -532,7 +567,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { @Override public void widgetSelected(SelectionEvent e) { selectedRFC = ffgIdCbo.getItem(ffgIdCbo.getSelectionIndex()); - populateDataList(); + populateFFGDataTable(); } }); @@ -540,7 +575,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { Label ffgDurLbl = new Label(ffgOptionsComp, SWT.RIGHT); 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); for (String s : DURATIONS) { ffgDurCbo.add(s); @@ -548,19 +583,18 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { ffgDurCbo.select(0); ffgDurCbo.setLayoutData(gd); ffgDurCbo.addSelectionListener(new SelectionAdapter() { - @Override public void widgetSelected(SelectionEvent e) { int index = ffgDurCbo.getSelectionIndex(); selectedDur = DURATIONS[index]; - populateDataList(); + populateFFGDataTable(); } }); Label ffgDisplayLbl = new Label(ffgOptionsComp, SWT.RIGHT); ffgDisplayLbl.setText("Display As:"); - gd = new GridData(100, SWT.DEFAULT); + gd = new GridData(SWT.DEFAULT, SWT.DEFAULT); ffgDisplayAsCbo = new Combo(ffgOptionsComp, SWT.DROP_DOWN | SWT.READ_ONLY); ffgDisplayAsCbo.add("Grid"); @@ -594,7 +628,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { @Override public void widgetSelected(SelectionEvent e) { - populateDataList(); + populateFFGDataTable(); } }); @@ -613,12 +647,11 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { gd.horizontalSpan = 2; arealDurCbo.setLayoutData(gd); arealDurCbo.addSelectionListener(new SelectionAdapter() { - @Override public void widgetSelected(SelectionEvent e) { int index = arealDurCbo.getSelectionIndex(); selectedDur = DURATIONS[index]; - populateDataList(); + populateFFGDataTable(); } }); @@ -653,7 +686,6 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { */ private void createColorLegend() { String user_id = System.getProperty("user.name"); - // String app_name = "hydroview"; java.util.List colorSet = HydroDisplayManager.getInstance() .getFFGColorMap(user_id, "FFG", duration); @@ -697,7 +729,8 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); 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.setText("Close"); 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. */ private void readGriddedFfgProduct() { FlashFloodGuidanceDataManager dman = FlashFloodGuidanceDataManager .getInstance(); - java.util.List list = new ArrayList(); - Map sortedMap = new HashMap(); - dataMap.clear(); + List guidanceDataList = new LinkedList<>(); /* Check the FFG mode. */ - if (ffgAreaCbo.getItem(ffgAreaCbo.getSelectionIndex()).equals("RFC")) { + if (FFG_AREA_RFC.equals(ffgAreaCbo.getItem(ffgAreaCbo + .getSelectionIndex()))) { java.util.List rs = dman.getGriddedDataList(); if ((rs != null) && (rs.size() > 0)) { @@ -787,39 +806,10 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { } } - String line = String.format("%5s %2s %s", id, durHr, - 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); + guidanceDataList.add(new FFGGuidanceData(id, Integer + .parseInt(durHr), durHr, date, dateStr)); } } - - // Sort the data, first by id asc, then duration asc - java.util.List sortList = new ArrayList( - 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 { // WFO Grided data, read xmrg directory String ffgDirToken = "gaff_mosaic_dir"; @@ -831,10 +821,10 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { String ffgDirPath = AppsDefaults.getInstance() .getToken(ffgDirToken); if (ffgDirPath == null) { - // TODO error handling - System.err - .println("Error getting WFO FFG directory from token " + statusHandler + .error("Error getting WFO FFG directory from token " + ffgDirToken); + return; } 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 * by checking the extension on the file. */ - if (xmrg.getName().endsWith(".ffg")) { - /* Parse the filename for the WFO identifier here. */ - String fileWfo = xmrg.getName().substring(0, 3); - int index = xmrg.getName().indexOf("20"); - /* Parse the filename for duration and time stamp here. */ - String year = xmrg.getName() - .substring(index, index + 4); - String month = xmrg.getName().substring(index + 4, - 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); + final String fileName = xmrg.getName(); + final Matcher matcher = FFG_NAME_PATTERN.matcher(fileName); + if (!matcher.matches()) { + statusHandler.warn("Discovered unrecognized file: " + + xmrg.toString() + + " in the WFO FFG directory: " + + ffgDirPath.toString() + ". Skipping file."); + continue; } - } - // Sort the data, first by id asc, then duration asc, date desc - java.util.List sortList = new ArrayList( - sortedMap.keySet()); - String[] data = sortList.toArray(new String[sortList.size()]); + String fileWfo = matcher.group(FFG_WFO_GROUP); + String xmrgDateString = matcher.group(FFG_DATE_GROUP); + /* + * 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[] sortedData = sort(data); - for (String s : sortedData) { - dataList.add(sortedMap.get(s)); + String dateStr = sdf.format(xmrgDate); + FFGGuidanceData data = new FFGGuidanceData(fileWfo, + duration, durationString, xmrgDate, dateStr); + data.setXmrgFile(xmrg); + guidanceDataList.add(data); } } } - } - /** - * 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 strList = new ArrayList(); - java.util.List holder = new ArrayList(); - 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; + addTableRows(guidanceDataList); } private void readArealFfgProduct() { - // Clear the map for areal data - dataMap.clear(); ResolutionLevel res = null; String selectedItem = arealTypeCbo.getItem(arealTypeCbo .getSelectionIndex()); @@ -969,7 +906,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { res = ResolutionLevel.ALL; } - Map sortedMap = new TreeMap(); + List guidanceDataList = new LinkedList<>(); if (res == ResolutionLevel.ALL) { for (ResolutionLevel level : ResolutionLevel.values()) { if (level.getResolution().equals("All") @@ -977,29 +914,13 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { continue; // Skip "All" and "Grid" } - TreeMap tmpMap = bldFfgList(level); - - Iterator iter = tmpMap.keySet().iterator(); - while (iter.hasNext()) { - String key = iter.next(); - sortedMap.put(key, tmpMap.get(key)); - } + guidanceDataList.addAll(bldFfgList(level)); } } else { - sortedMap = bldFfgList(res); + guidanceDataList = bldFfgList(res); } - Iterator iter = sortedMap.keySet().iterator(); - java.util.List strList = new ArrayList(); - 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)); - } + addTableRows(guidanceDataList); } /** @@ -1009,8 +930,8 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { * * @param level */ - private TreeMap bldFfgList(ResolutionLevel level) { - TreeMap map = new TreeMap(); + private List bldFfgList(ResolutionLevel level) { + List guidanceDataList = new LinkedList<>(); java.util.List rs = FlashFloodGuidanceDataManager .getInstance().getContingencyValue(level.getResolution()); @@ -1023,10 +944,8 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { // Dur is FFG03, FFG06, etc // selectedDur is 1hr, 3hr, etc if ((selectedDur != null) && !selectedDur.equalsIgnoreCase("All")) { - String durCheck = String.valueOf(dur); - if (dur < 10) { - durCheck = "0" + dur; - } + String durCheck = StringUtils.leftPad(String.valueOf(dur), 2, + "0"); if (!String.valueOf(durCheck).equalsIgnoreCase( selectedDur.substring(0, selectedDur.indexOf("h"))) && !String.valueOf(durCheck).equals( @@ -1038,25 +957,14 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { } } String dateStr = sdf.format(validTime); - String id = level.getResolution(); - String durStr = String.valueOf(dur); - if (dur < 10) { - durStr = "0" + dur; - } - String line = String - .format("%-6s %2s %s", id, durStr, dateStr); + String durStr = StringUtils.leftPad(String.valueOf(dur), 2, "0"); - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - cal.setTime(validTime); - 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); + guidanceDataList.add(new FFGGuidanceData(id, dur, durStr, + validTime, dateStr)); } - return map; + return guidanceDataList; } /** @@ -1068,17 +976,13 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { shell.setCursor(waitCursor); + FFGGuidanceData selectedRowData = (FFGGuidanceData) ffgTable + .getSelection()[0].getData(); + /* Get the selection from the list and break it up */ - String s = dataList.getItem(dataList.getSelectionIndex()); - String key = dataList.getItem(dataList.getSelectionIndex()); - s = s.replaceAll("\\s+", " ").trim(); - 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) + String site = selectedRowData.getIdentifier(); + String durationStr = selectedRowData.getFormattedDuration(); + duration = selectedRowData.getDuration() * FFGConstants.SECONDS_PER_HOUR; String paramAbr = "FFG" + durationStr + "24hr"; @@ -1104,39 +1008,42 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { if (ffgDisplayAsCbo.getItem(ffgDisplayAsCbo.getSelectionIndex()) .equalsIgnoreCase("GRID")) { // Display the grid - getParameters(); + getParameters(selectedRowData); if (rfcSelected) { HydroDisplayManager.getInstance().displayGriddedFFG( - dataMap.get(key), duration, paramAbr, rfc, res); + selectedRowData.getDateTime(), duration, paramAbr, + rfc, res); } else { HydroDisplayManager.getInstance().displayGriddedFFG( - fileMap.get(key), duration, res); + selectedRowData.getXmrgFile(), duration, res); } } else { /* Display the areal basin */ if (rfcSelected) { HydroDisplayManager.getInstance() - .displayRfcGriddedFFGBasin(dataMap.get(key), - duration, paramAbr, rfc, res); + .displayRfcGriddedFFGBasin( + selectedRowData.getDateTime(), duration, + paramAbr, rfc, res); } else { HydroDisplayManager.getInstance().displayGriddedFFGBasin( - fileMap.get(key), duration, res, dataMap.get(key)); + selectedRowData.getXmrgFile(), duration, res, + selectedRowData.getDateTime()); } } } else { /* Areal Radio selected */ java.util.List arealList = buildFfgArea(site, - dataMap.get(key)); + selectedRowData.getDateTime()); HydroDisplayManager.getInstance().displayArealFfg(arealList, - duration, site, dataMap.get(key), valuesChk.getSelection(), - idsChk.getSelection()); + duration, site, selectedRowData.getDateTime(), + valuesChk.getSelection(), idsChk.getSelection()); } // Create the legend strings // Build the string in the legend - String line = site + " " + durationStr + " hours " + day + " " + date - + " " + hour + ":00"; + String line = site + " " + durationStr + " hours " + + selectedRowData.getFormattedDateTime() + ":00"; colorLegend.setDisplayText("FFG Grid", line); shell.setCursor(arrowCursor); @@ -1145,29 +1052,23 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { /** * Get the parameters for the bundle */ - private void getParameters() { - String data = dataList.getItem(dataList.getSelectionIndex()); - String key = dataList.getItem(dataList.getSelectionIndex()); - + private void getParameters(FFGGuidanceData selectedRowData) { 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 param = "FFG" + parts[1] + "24hr"; + String param = "FFG" + selectedRowData.getFormattedDuration() + "24hr"; // Lookup the name String s = FlashFloodGuidanceDataManager.getInstance().rfcSiteLookup( - parts[0]); + selectedRowData.getIdentifier()); if (s != null) { modelname = "FFG-" + s; } parameters.put("timespan", param); parameters.put("model", modelname); - parameters.put("reftime", sdf.format(dataMap.get(key))); + parameters.put("reftime", sdf.format(selectedRowData.getDateTime())); } private java.util.List buildFfgArea(String boundaryType, diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/SendConfigDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/SendConfigDlg.java index 0a1017f98c..2a99577d77 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/SendConfigDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/SendConfigDlg.java @@ -25,14 +25,12 @@ import java.util.Arrays; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DirectoryDialog; import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; @@ -50,7 +48,8 @@ import com.raytheon.viz.hydro.CaveHydroSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 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. * * * @@ -60,11 +59,6 @@ import com.raytheon.viz.hydro.CaveHydroSWTDialog; public class SendConfigDlg extends CaveHydroSWTDialog { - /** - * Font used for the list controls. - */ - private Font font; - /** Manager for handling the shef xml data. */ private ShefIssueMgr shefIssueMgr; @@ -96,19 +90,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog { shefIssueMgr = ShefIssueMgr.getInstance(); } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org - * .eclipse.swt.widgets.Shell) - */ @Override protected void initializeComponents(Shell shell) { setReturnValue(false); - font = new Font(shell.getDisplay(), "Monospace", 11, SWT.NORMAL); - // Initialize all of the controls and layouts initializeComponents(); } @@ -122,21 +107,6 @@ public class SendConfigDlg extends CaveHydroSWTDialog { 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() { String defSelection = AppsDefaults.getInstance().getToken( "timeseries_dist_shef", "OFF"); @@ -155,12 +125,13 @@ public class SendConfigDlg extends CaveHydroSWTDialog { GridLayout gl = new GridLayout(1, false); 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.setText("Distribute Product"); distChk.setLayoutData(gd); distChk.setSelection(selected); + gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false); directoryChk = new Button(distComp, SWT.CHECK); directoryChk.setText("Internal Directory"); directoryChk.setLayoutData(gd); @@ -174,9 +145,6 @@ public class SendConfigDlg extends CaveHydroSWTDialog { private void createDirectoryGroup() { GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true); - gd.widthHint = 350; - gd.heightHint = 400; - Group dirGroup = new Group(shell, SWT.NONE); dirGroup.setText("Distribution Directories"); GridLayout gridLayout = new GridLayout(1, false); @@ -188,14 +156,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog { dirComp.setLayout(gl); gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true); - gd.heightHint = 300; - directoryList = new List(dirGroup, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); + gd.heightHint = directoryList.getItemHeight() * 15; directoryList.setLayoutData(gd); - directoryList.setFont(font); - - int buttonWidth = 100; 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); 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.setText("Add"); 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.setText("Remove"); 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.setText("Remove All"); removeAllBtn.setLayoutData(gd); @@ -263,9 +227,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog { GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false); 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); okBtn.setText("OK"); 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); applyBtn.setText("Apply"); 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); cancelBtn.setText("Cancel"); cancelBtn.setLayoutData(gd); @@ -300,11 +267,6 @@ public class SendConfigDlg extends CaveHydroSWTDialog { }); } - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#opened() - */ @Override protected void opened() { super.opened(); @@ -345,19 +307,10 @@ public class SendConfigDlg extends CaveHydroSWTDialog { this.shefIssueMgr.saveXml(); } - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed() - */ @Override protected void disposed() { super.disposed(); - if (font.isDisposed() == false) { - font.dispose(); - } - if (shefIssueMgr != null) { ShefIssueMgr.recycle(); } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.shef/src/com/raytheon/uf/common/dataplugin/shef/tables/Admin.java b/edexOsgi/com.raytheon.uf.common.dataplugin.shef/src/com/raytheon/uf/common/dataplugin/shef/tables/Admin.java index ace0c6a7ef..873983a6e2 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.shef/src/com/raytheon/uf/common/dataplugin/shef/tables/Admin.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.shef/src/com/raytheon/uf/common/dataplugin/shef/tables/Admin.java @@ -1,24 +1,24 @@ /** -* 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. -**/ + * 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.uf.common.dataplugin.shef.tables; -// default package + // Generated Oct 17, 2008 2:22:17 PM by Hibernate Tools 3.2.2.GA import java.util.Date; @@ -41,6 +41,7 @@ import javax.persistence.TemporalType; * Oct 17, 2008 Initial generation by hbm2java * Aug 19, 2011 10672 jkorman Move refactor to new project * Oct 07, 2013 2361 njensen Removed XML annotations + * May 16, 2016 5483 bkowal Added {@link #HSA_LENGTH}. * * * @@ -50,10 +51,14 @@ import javax.persistence.TemporalType; @Entity @Table(name = "admin") @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; + public static final int HSA_LENGTH = 5; + @com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement private String hsa; @@ -111,7 +116,7 @@ public class Admin extends com.raytheon.uf.common.dataplugin.persist.Persistable } @Id - @Column(name = "hsa", unique = true, nullable = false, length = 5) + @Column(name = "hsa", unique = true, nullable = false, length = Admin.HSA_LENGTH) public String getHsa() { return this.hsa; }