Merge "Omaha #5512 - Minimal updates to fix GUI sizing issues." into omaha_16.2.1-lx
Former-commit-id: 08e68d51ed17e060ff677594b9c3abc572c85c23
This commit is contained in:
commit
05cd627d8b
1 changed files with 114 additions and 209 deletions
|
@ -80,6 +80,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* 04 Sep 2014 14448 cgobs Make MPE redisplay after save of color settings in ColorScaleMgr
|
* 04 Sep 2014 14448 cgobs Make MPE redisplay after save of color settings in ColorScaleMgr
|
||||||
* 26 Feb 2015 16848 cgobs Fix merging of color sets by deleting existing set before saving new set.
|
* 26 Feb 2015 16848 cgobs Fix merging of color sets by deleting existing set before saving new set.
|
||||||
* Updated to include fix of error when saving a new source.
|
* Updated to include fix of error when saving a new source.
|
||||||
|
* 08 Apr 2016 5512 bkowal Minimal updates to fix GUI sizing issues.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
|
@ -104,8 +105,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
private ColorChooserDlg colorDlg;
|
private ColorChooserDlg colorDlg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* callback to be execute upon saving of a color set
|
* callback to be execute upon saving of a color set generally used to
|
||||||
* generally used to update the display with the newly-saved color set
|
* update the display with the newly-saved color set
|
||||||
*/
|
*/
|
||||||
private ISaveCallback saveCallback;
|
private ISaveCallback saveCallback;
|
||||||
|
|
||||||
|
@ -115,7 +116,6 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User's name.
|
* User's name.
|
||||||
*/
|
*/
|
||||||
|
@ -139,17 +139,17 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
/**
|
/**
|
||||||
* Updated Color/Value array of color and value labels.
|
* Updated Color/Value array of color and value labels.
|
||||||
*/
|
*/
|
||||||
private java.util.List<ColorValueLabels> colorValLblArray;
|
private List<ColorValueLabels> colorValLblArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used Color/Value array of color and value labels.
|
* Used Color/Value array of color and value labels.
|
||||||
*/
|
*/
|
||||||
private java.util.List<ColorValueLabels> usedColorValLblArray;
|
private List<ColorValueLabels> usedColorValLblArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse Color/Value array of color and value labels.
|
* Browse Color/Value array of color and value labels.
|
||||||
*/
|
*/
|
||||||
private java.util.List<ColorValueLabels> browseColorValLblArray;
|
private List<ColorValueLabels> browseColorValLblArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source combo box.
|
* Source combo box.
|
||||||
|
@ -460,14 +460,17 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
// Create the navigation arrow buttons container
|
// Create the navigation arrow buttons container
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
Composite arraowBtnComp = new Composite(topControlComp, SWT.BOTTOM);
|
Composite arrowBtnComp = new Composite(topControlComp, SWT.BOTTOM);
|
||||||
gl = new GridLayout(2, false);
|
gl = new GridLayout(2, true);
|
||||||
gl.verticalSpacing = 100;
|
arrowBtnComp.setLayout(gl);
|
||||||
arraowBtnComp.setLayout(gl);
|
arrowBtnComp.setLayoutData(gd);
|
||||||
arraowBtnComp.setLayoutData(gd);
|
|
||||||
|
|
||||||
gd = new GridData(50, SWT.DEFAULT);
|
final int buttonMinimumWidth = (int) (arrowBtnComp.getDisplay()
|
||||||
Button leftArrowBtn = new Button(arraowBtnComp, SWT.ARROW | SWT.LEFT);
|
.getDPI().x * 0.5);
|
||||||
|
|
||||||
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
|
Button leftArrowBtn = new Button(arrowBtnComp, SWT.ARROW | SWT.LEFT);
|
||||||
leftArrowBtn.setLayoutData(gd);
|
leftArrowBtn.setLayoutData(gd);
|
||||||
leftArrowBtn.addSelectionListener(new SelectionAdapter() {
|
leftArrowBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -485,8 +488,9 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(50, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
Button rightArrowBtn = new Button(arraowBtnComp, SWT.ARROW | SWT.RIGHT);
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
|
Button rightArrowBtn = new Button(arrowBtnComp, SWT.ARROW | SWT.RIGHT);
|
||||||
rightArrowBtn.setLayoutData(gd);
|
rightArrowBtn.setLayoutData(gd);
|
||||||
rightArrowBtn.addSelectionListener(new SelectionAdapter() {
|
rightArrowBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -695,13 +699,17 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
// Create the navigation arrow buttons container
|
// Create the navigation arrow buttons container
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
Composite arraowBtnComp = new Composite(topControlComp, SWT.NONE);
|
Composite arrowBtnComp = new Composite(topControlComp, SWT.NONE);
|
||||||
gl = new GridLayout(2, false);
|
gl = new GridLayout(2, false);
|
||||||
arraowBtnComp.setLayout(gl);
|
arrowBtnComp.setLayout(gl);
|
||||||
arraowBtnComp.setLayoutData(gd);
|
arrowBtnComp.setLayoutData(gd);
|
||||||
|
|
||||||
gd = new GridData(50, SWT.DEFAULT);
|
final int buttonMinimumWidth = (int) (arrowBtnComp.getDisplay()
|
||||||
leftArrowBtn = new Button(arraowBtnComp, SWT.ARROW | SWT.LEFT);
|
.getDPI().x * 0.5);
|
||||||
|
|
||||||
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
|
leftArrowBtn = new Button(arrowBtnComp, SWT.ARROW | SWT.LEFT);
|
||||||
leftArrowBtn.setLayoutData(gd);
|
leftArrowBtn.setLayoutData(gd);
|
||||||
leftArrowBtn.addSelectionListener(new SelectionAdapter() {
|
leftArrowBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -719,8 +727,9 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(50, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
rightArrowBtn = new Button(arraowBtnComp, SWT.ARROW | SWT.RIGHT);
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
|
rightArrowBtn = new Button(arrowBtnComp, SWT.ARROW | SWT.RIGHT);
|
||||||
rightArrowBtn.setLayoutData(gd);
|
rightArrowBtn.setLayoutData(gd);
|
||||||
rightArrowBtn.addSelectionListener(new SelectionAdapter() {
|
rightArrowBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -827,13 +836,14 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
Composite btnComp = new Composite(editControlsComp, SWT.NONE);
|
Composite btnComp = new Composite(editControlsComp, SWT.NONE);
|
||||||
gl = new GridLayout(4, false);
|
gl = new GridLayout(3, true);
|
||||||
btnComp.setLayout(gl);
|
btnComp.setLayout(gl);
|
||||||
btnComp.setLayoutData(gd);
|
btnComp.setLayoutData(gd);
|
||||||
|
|
||||||
int buttonWidth = 100;
|
final int buttonMinimumWidth = btnComp.getDisplay().getDPI().x;
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
Button addBtn = new Button(btnComp, SWT.PUSH);
|
Button addBtn = new Button(btnComp, SWT.PUSH);
|
||||||
addBtn.setText("Add/Update");
|
addBtn.setText("Add/Update");
|
||||||
addBtn.setToolTipText("Add/Update Color-Value Pair");
|
addBtn.setToolTipText("Add/Update Color-Value Pair");
|
||||||
|
@ -849,7 +859,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
Button undoBtn = new Button(btnComp, SWT.PUSH);
|
Button undoBtn = new Button(btnComp, SWT.PUSH);
|
||||||
undoBtn.setText("Undo");
|
undoBtn.setText("Undo");
|
||||||
undoBtn.setToolTipText("Undo unsaved changes");
|
undoBtn.setToolTipText("Undo unsaved changes");
|
||||||
|
@ -862,7 +873,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = buttonMinimumWidth;
|
||||||
Button deleteBtn = new Button(btnComp, SWT.PUSH);
|
Button deleteBtn = new Button(btnComp, SWT.PUSH);
|
||||||
deleteBtn.setText("Delete");
|
deleteBtn.setText("Delete");
|
||||||
deleteBtn.setToolTipText("Delete Color-Value Pair");
|
deleteBtn.setToolTipText("Delete Color-Value Pair");
|
||||||
|
@ -935,7 +947,6 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the color label on the display
|
* Update the color label on the display
|
||||||
*
|
*
|
||||||
|
@ -1029,11 +1040,14 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||||
Composite buttonComp = new Composite(dbControlGroup, SWT.NONE);
|
Composite buttonComp = new Composite(dbControlGroup, SWT.NONE);
|
||||||
gl = new GridLayout(4, false);
|
gl = new GridLayout(4, true);
|
||||||
buttonComp.setLayout(gl);
|
buttonComp.setLayout(gl);
|
||||||
buttonComp.setLayoutData(gd);
|
buttonComp.setLayoutData(gd);
|
||||||
|
|
||||||
gd = new GridData(120, SWT.DEFAULT);
|
final int minimumButtonWidth = buttonComp.getDisplay().getDPI().x;
|
||||||
|
|
||||||
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = minimumButtonWidth;
|
||||||
saveAsUserBtn = new Button(buttonComp, SWT.PUSH);
|
saveAsUserBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
saveAsUserBtn.setText("Save as:\n" + userName);
|
saveAsUserBtn.setText("Save as:\n" + userName);
|
||||||
saveAsUserBtn.setLayoutData(gd);
|
saveAsUserBtn.setLayoutData(gd);
|
||||||
|
@ -1059,7 +1073,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(120, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = minimumButtonWidth;
|
||||||
saveAsOfficeBtn = new Button(buttonComp, SWT.PUSH);
|
saveAsOfficeBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
saveAsOfficeBtn.setText("Save as:\nOffice");
|
saveAsOfficeBtn.setText("Save as:\nOffice");
|
||||||
saveAsOfficeBtn.setLayoutData(gd);
|
saveAsOfficeBtn.setLayoutData(gd);
|
||||||
|
@ -1084,7 +1099,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(120, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = minimumButtonWidth;
|
||||||
deleteAsUserBtn = new Button(buttonComp, SWT.PUSH);
|
deleteAsUserBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
deleteAsUserBtn.setText("Delete as:\n" + userName);
|
deleteAsUserBtn.setText("Delete as:\n" + userName);
|
||||||
deleteAsUserBtn.setLayoutData(gd);
|
deleteAsUserBtn.setLayoutData(gd);
|
||||||
|
@ -1109,7 +1125,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gd = new GridData(120, SWT.DEFAULT);
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = minimumButtonWidth;
|
||||||
deleteAsOfficeBtn = new Button(buttonComp, SWT.PUSH);
|
deleteAsOfficeBtn = new Button(buttonComp, SWT.PUSH);
|
||||||
deleteAsOfficeBtn.setText("Delete as:\nOffice");
|
deleteAsOfficeBtn.setText("Delete as:\nOffice");
|
||||||
deleteAsOfficeBtn.setLayoutData(gd);
|
deleteAsOfficeBtn.setLayoutData(gd);
|
||||||
|
@ -1458,8 +1475,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private void updateBrowseDurationCombo() {
|
private void updateBrowseDurationCombo() {
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
java.util.List<String> durations;
|
List<String> durations;
|
||||||
if (source.equals(DEFAULT)) {
|
if (DEFAULT.equals(source)) {
|
||||||
durations = new ArrayList<String>();
|
durations = new ArrayList<String>();
|
||||||
durations.add("0");
|
durations.add("0");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1484,12 +1501,9 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
|
|
||||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
List<ColorScaleData> updatedColorSet = editColorData
|
||||||
.getColorScaleDataArray(source, selectedDurationInSeconds + "_"
|
.getColorScaleDataArray(source, selectedDurationInSeconds + "_"
|
||||||
+ dataTypeCbo.getText());
|
+ dataTypeCbo.getText());
|
||||||
// java.util.List<ColorScaleData> updatedColorSet = editColorData
|
|
||||||
// .getColorScaleDataArray(source, durationCbo.getText() + "_"
|
|
||||||
// + dataTypeCbo.getText());
|
|
||||||
|
|
||||||
if (updatedColorSet.size() == 0) {
|
if (updatedColorSet.size() == 0) {
|
||||||
updatedColorSet = editColorData.getColorScaleDataArray(source, 0
|
updatedColorSet = editColorData.getColorScaleDataArray(source, 0
|
||||||
|
@ -1530,7 +1544,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
|
|
||||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
List<ColorScaleData> updatedColorSet = editColorData
|
||||||
.getColorScaleDataArray(source, selectedBrowseDurationInSeconds
|
.getColorScaleDataArray(source, selectedBrowseDurationInSeconds
|
||||||
+ "_" + browseDataTypeCbo.getText());
|
+ "_" + browseDataTypeCbo.getText());
|
||||||
if (updatedColorSet == null) {
|
if (updatedColorSet == null) {
|
||||||
|
@ -1572,10 +1586,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
|
|
||||||
// java.util.List<ColorScaleData> updatedColorSet = editColorData
|
List<ColorScaleData> updatedColorSet = editColorData
|
||||||
// .getUsedColorScaleDataArray(source, durationCbo.getText() + "_"
|
|
||||||
// + dataTypeCbo.getText());
|
|
||||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
|
||||||
.getUsedColorScaleDataArray(source, selectedDurationInSeconds
|
.getUsedColorScaleDataArray(source, selectedDurationInSeconds
|
||||||
+ "_" + dataTypeCbo.getText());
|
+ "_" + dataTypeCbo.getText());
|
||||||
|
|
||||||
|
@ -1643,7 +1654,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
* @param array
|
* @param array
|
||||||
* Array of color value labels.
|
* Array of color value labels.
|
||||||
*/
|
*/
|
||||||
private void disposeLabelsInArray(java.util.List<ColorValueLabels> array) {
|
private void disposeLabelsInArray(List<ColorValueLabels> array) {
|
||||||
if (array != null) {
|
if (array != null) {
|
||||||
for (ColorValueLabels cvl : array) {
|
for (ColorValueLabels cvl : array) {
|
||||||
cvl.disposeLabels();
|
cvl.disposeLabels();
|
||||||
|
@ -1691,12 +1702,6 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
* Populate the source combo box.
|
* Populate the source combo box.
|
||||||
*/
|
*/
|
||||||
private void populateSourceCombo() {
|
private void populateSourceCombo() {
|
||||||
// Set<String> keys = editColorData.getSourceKeys();
|
|
||||||
//
|
|
||||||
// for (Iterator<String> iterator = keys.iterator();
|
|
||||||
// iterator.hasNext();) {
|
|
||||||
// sourceCbo.add(iterator.next());
|
|
||||||
// }
|
|
||||||
sourceCbo.add(DEFAULT);
|
sourceCbo.add(DEFAULT);
|
||||||
sourceCbo.add(USER);
|
sourceCbo.add(USER);
|
||||||
sourceCbo.add(OFFICE);
|
sourceCbo.add(OFFICE);
|
||||||
|
@ -1802,8 +1807,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
// for each datatype in database...
|
// for each datatype in database...
|
||||||
for (String dataType : userDataTypes) {
|
for (String dataType : userDataTypes) {
|
||||||
// get all durations for this datatype and this user
|
// get all durations for this datatype and this user
|
||||||
java.util.List<String> durations = colorManager.getDurations(
|
List<String> durations = colorManager
|
||||||
userId, dataType);
|
.getDurations(userId, dataType);
|
||||||
|
|
||||||
// for each duration for datatype
|
// for each duration for datatype
|
||||||
for (String duration : durations) {
|
for (String duration : durations) {
|
||||||
|
@ -1816,13 +1821,13 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// actually get the data from database
|
// actually get the data from database
|
||||||
java.util.List<ColorValueData> data = manager.getData(cvd);
|
List<ColorValueData> data = manager.getData(cvd);
|
||||||
// sort data by double value because data is stored as
|
// sort data by double value because data is stored as
|
||||||
// String
|
// String
|
||||||
// see ColorValueData class for compareTo function
|
// see ColorValueData class for compareTo function
|
||||||
Collections.sort(data);
|
Collections.sort(data);
|
||||||
ColorScaleSets colorScaleSets = new ColorScaleSets();
|
ColorScaleSets colorScaleSets = new ColorScaleSets();
|
||||||
java.util.List<ColorScaleData> origList = new ArrayList<ColorScaleData>();
|
List<ColorScaleData> origList = new ArrayList<ColorScaleData>();
|
||||||
|
|
||||||
for (ColorValueData colorValue : data) {
|
for (ColorValueData colorValue : data) {
|
||||||
ColorScaleData csd = new ColorScaleData();
|
ColorScaleData csd = new ColorScaleData();
|
||||||
|
@ -1841,7 +1846,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
origList.add(csd);
|
origList.add(csd);
|
||||||
}
|
}
|
||||||
java.util.List<ColorScaleData> usedList = new ArrayList<ColorScaleData>();
|
List<ColorScaleData> usedList = new ArrayList<ColorScaleData>();
|
||||||
usedList.addAll(origList);
|
usedList.addAll(origList);
|
||||||
|
|
||||||
colorScaleSets.setOriginalArray(origList);
|
colorScaleSets.setOriginalArray(origList);
|
||||||
|
@ -1875,8 +1880,9 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
centeredComp.setLayoutData(gd);
|
centeredComp.setLayoutData(gd);
|
||||||
|
|
||||||
gd = new GridData(90, SWT.DEFAULT);
|
|
||||||
Button closeBtn = new Button(centeredComp, SWT.NONE);
|
Button closeBtn = new Button(centeredComp, SWT.NONE);
|
||||||
|
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||||
|
gd.minimumWidth = closeBtn.getDisplay().getDPI().x;
|
||||||
closeBtn.setText("Close");
|
closeBtn.setText("Close");
|
||||||
closeBtn.setLayoutData(gd);
|
closeBtn.setLayoutData(gd);
|
||||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@ -1891,8 +1897,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
* Creates the default color data
|
* Creates the default color data
|
||||||
*/
|
*/
|
||||||
private void createDefaultData() {
|
private void createDefaultData() {
|
||||||
java.util.List<String> defaultDataTypes = colorManager
|
List<String> defaultDataTypes = colorManager.getDefaultDataTypes();
|
||||||
.getDefaultDataTypes();
|
|
||||||
|
|
||||||
editColorData = new EditColorData();
|
editColorData = new EditColorData();
|
||||||
|
|
||||||
|
@ -1900,7 +1905,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
for (int i = 0; i < defaultDataTypes.size(); i++) {
|
for (int i = 0; i < defaultDataTypes.size(); i++) {
|
||||||
ColorScaleSets colorScaleSets = new ColorScaleSets();
|
ColorScaleSets colorScaleSets = new ColorScaleSets();
|
||||||
java.util.List<ColorScaleData> origList = colorManager
|
List<ColorScaleData> origList = colorManager
|
||||||
.getDefaultColorScaleData(defaultDataTypes.get(i));
|
.getDefaultColorScaleData(defaultDataTypes.get(i));
|
||||||
|
|
||||||
colorScaleSets.setOriginalArray(origList);
|
colorScaleSets.setOriginalArray(origList);
|
||||||
|
@ -1961,20 +1966,19 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteDataFromDb(String applicationName, String colorUseName,
|
||||||
private void deleteDataFromDb(String applicationName, String colorUseName, String userId, String durationString) {
|
String userId, String durationString) {
|
||||||
HydroDBDataManager manager = HydroDBDataManager.getInstance();
|
HydroDBDataManager manager = HydroDBDataManager.getInstance();
|
||||||
|
|
||||||
String whereClause = " WHERE application_name = '" + applicationName + "' AND " +
|
String whereClause = " WHERE application_name = '" + applicationName
|
||||||
"color_use_name = '" + colorUseName + "' AND " +
|
+ "' AND " + "color_use_name = '" + colorUseName + "' AND "
|
||||||
"userId = '" + userId + "' AND " +
|
+ "userId = '" + userId + "' AND " + "duration = '"
|
||||||
"duration = '" + durationString + "' AND " +
|
+ durationString + "' AND " + "threshold_unit = 'E' ";
|
||||||
"threshold_unit = 'E' ";
|
|
||||||
String statement = "delete from colorValue " + whereClause;
|
String statement = "delete from colorValue " + whereClause;
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DirectDbQuery.executeStatement(statement,HydroConstants.IHFS, QueryLanguage.SQL);
|
DirectDbQuery.executeStatement(statement, HydroConstants.IHFS,
|
||||||
|
QueryLanguage.SQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (VizException e) {
|
catch (VizException e) {
|
||||||
|
@ -1984,16 +1988,15 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
// 0. Collect data to delete (user, dataType, duration
|
// 0. Collect data to delete (user, dataType, duration
|
||||||
|
|
||||||
java.util.List<ColorScaleData> usedColorData = null;
|
List<ColorScaleData> usedColorData = null;
|
||||||
try
|
try {
|
||||||
{
|
usedColorData = editColorData.getUsedColorScaleDataArray(userId,
|
||||||
usedColorData = editColorData
|
durationString + "_" + colorUseName);
|
||||||
.getUsedColorScaleDataArray(userId, durationString + "_" + colorUseName);
|
} catch (Exception e) {
|
||||||
}
|
statusHandler
|
||||||
catch (Exception e)
|
.handle(Priority.DEBUG,
|
||||||
{
|
"No problem. Color set doesn't exist yet, can't delete it. ",
|
||||||
statusHandler.handle(Priority.DEBUG,
|
e);
|
||||||
"No problem. Color set doesn't exist yet, can't delete it. ", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usedColorData != null) {
|
if (usedColorData != null) {
|
||||||
|
@ -2003,8 +2006,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
cvd.setUserId(userId);
|
cvd.setUserId(userId);
|
||||||
cvd.setDuration(durationString);
|
cvd.setDuration(durationString);
|
||||||
|
|
||||||
System.out.println("Attempting to delete data from cvd = " +
|
statusHandler.debug("Attempting to delete data from cvd = "
|
||||||
getStringFromColorValueData(cvd) );
|
+ getStringFromColorValueData(cvd));
|
||||||
|
|
||||||
// 1. Delete each record from database
|
// 1. Delete each record from database
|
||||||
for (ColorScaleData csd : usedColorData) {
|
for (ColorScaleData csd : usedColorData) {
|
||||||
|
@ -2015,23 +2018,19 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
statusHandler.handle(Priority.ERROR,
|
statusHandler.handle(Priority.ERROR,
|
||||||
"Error deleting Color Value Data: ", e);
|
"Error deleting Color Value Data: ", e);
|
||||||
}
|
}
|
||||||
} //end for
|
} // end for
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getStringFromColorValueData(ColorValueData cvd) {
|
||||||
private String getStringFromColorValueData(ColorValueData cvd)
|
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("appName: " + cvd.getApplicationName() +
|
builder.append("appName: " + cvd.getApplicationName()
|
||||||
" colorUseName: " + cvd.getColorUseName() +
|
+ " colorUseName: " + cvd.getColorUseName() + " userId: "
|
||||||
" userId: " + cvd.getUserId() +
|
+ cvd.getUserId() + " duration: " + cvd.getDuration());
|
||||||
" duration: " + cvd.getDuration());
|
|
||||||
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* save the data to the database
|
* save the data to the database
|
||||||
*
|
*
|
||||||
|
@ -2079,8 +2078,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DEFAULT.equals(sourceCbo.getText())) {
|
||||||
if (sourceCbo.getText().equals(DEFAULT)) {
|
|
||||||
createDefaultData();
|
createDefaultData();
|
||||||
} else {
|
} else {
|
||||||
createColorData(user);
|
createColorData(user);
|
||||||
|
@ -2095,100 +2093,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
setReturnValue(true);
|
setReturnValue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setSaveCallback(ISaveCallback iSaveCallback) {
|
||||||
* save the data to the database
|
|
||||||
*
|
|
||||||
* @param user
|
|
||||||
* user to save current data as
|
|
||||||
*/
|
|
||||||
private void saveDataOrig(String user) {
|
|
||||||
setSelectedDuration(durationCbo.getText());
|
|
||||||
|
|
||||||
HydroDBDataManager manager = HydroDBDataManager.getInstance();
|
|
||||||
|
|
||||||
String userId = user;
|
|
||||||
String applicationName = colorManager.getApplicationName();
|
|
||||||
String colorUseName = colorManager.getDataTypeName(saveDataTypeCbo
|
|
||||||
.getText());
|
|
||||||
String duration = selectedDurationInSeconds.toString();
|
|
||||||
|
|
||||||
ColorValueData cvd = new ColorValueData();
|
|
||||||
for (ColorValueLabels cvls : colorValLblArray) {
|
|
||||||
String threshold = cvls.getValueText();
|
|
||||||
String colorName = cvls.getColorName();
|
|
||||||
String thresholdUnit = "E";
|
|
||||||
if (ColorScaleData.MISSING.equals(threshold)) {
|
|
||||||
threshold = "-9999";
|
|
||||||
} else if (ColorScaleData.LESS_THAN_MIN.equals(threshold)) {
|
|
||||||
threshold = "-8888";
|
|
||||||
}
|
|
||||||
cvd.setApplicationName(applicationName);
|
|
||||||
cvd.setUserId(userId);
|
|
||||||
cvd.setColorName(colorName);
|
|
||||||
cvd.setColorUseName(colorUseName);
|
|
||||||
cvd.setDuration(duration);
|
|
||||||
cvd.setThresholdUnit(thresholdUnit);
|
|
||||||
cvd.setThresholdValue(threshold);
|
|
||||||
|
|
||||||
try {
|
|
||||||
manager.putData(cvd);
|
|
||||||
} catch (VizException e1) {
|
|
||||||
statusHandler.handle(Priority.ERROR,
|
|
||||||
"Error saving Color Value Data: ", e1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//delete all old records
|
|
||||||
|
|
||||||
for (ColorValueLabels cvls : usedColorValLblArray) {
|
|
||||||
|
|
||||||
System.out.printf(" value = %s, colorName = %s\n", cvls.getValueText(), cvls.getColorName() );
|
|
||||||
|
|
||||||
boolean found = false;
|
|
||||||
for (int i = 0; (i < colorValLblArray.size()) && !found; ++i) {
|
|
||||||
String val = colorValLblArray.get(i).getValueText();
|
|
||||||
if (val.equals(cvls.getValueText())) {
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.printf("found = %b\n", found);
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
cvd.setApplicationName(applicationName);
|
|
||||||
cvd.setUserId(userId);
|
|
||||||
cvd.setColorName(cvls.getColorName());
|
|
||||||
cvd.setColorUseName(colorUseName);
|
|
||||||
cvd.setDuration(duration);
|
|
||||||
cvd.setThresholdUnit("E");
|
|
||||||
cvd.setThresholdValue(cvls.getValueText());
|
|
||||||
try {
|
|
||||||
manager.deleteRecord(cvd);
|
|
||||||
} catch (VizException e1) {
|
|
||||||
statusHandler.handle(Priority.ERROR,
|
|
||||||
"Error deleting Color Value Data: ", e1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceCbo.getText().equals(DEFAULT)) {
|
|
||||||
createDefaultData();
|
|
||||||
} else {
|
|
||||||
createColorData(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateDurationCombo();
|
|
||||||
updateColorValueLabelBar();
|
|
||||||
|
|
||||||
if (this.saveCallback != null) {
|
|
||||||
this.saveCallback.execute();
|
|
||||||
}
|
|
||||||
setReturnValue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSaveCallback(ISaveCallback iSaveCallback)
|
|
||||||
{
|
|
||||||
this.saveCallback = iSaveCallback;
|
this.saveCallback = iSaveCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2230,10 +2135,10 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
* update delete buttons based on source/user
|
* update delete buttons based on source/user
|
||||||
*/
|
*/
|
||||||
private void updateButtons() {
|
private void updateButtons() {
|
||||||
if (sourceCbo.getText().equals(OFFICE)) {
|
if (OFFICE.equals(sourceCbo.getText())) {
|
||||||
deleteAsOfficeBtn.setEnabled(true);
|
deleteAsOfficeBtn.setEnabled(true);
|
||||||
deleteAsUserBtn.setEnabled(false);
|
deleteAsUserBtn.setEnabled(false);
|
||||||
} else if (sourceCbo.getText().equals(USER)) {
|
} else if (USER.equals(sourceCbo.getText())) {
|
||||||
deleteAsOfficeBtn.setEnabled(false);
|
deleteAsOfficeBtn.setEnabled(false);
|
||||||
if (userIdCbo.getText().equals(userName)) {
|
if (userIdCbo.getText().equals(userName)) {
|
||||||
deleteAsUserBtn.setEnabled(true);
|
deleteAsUserBtn.setEnabled(true);
|
||||||
|
@ -2253,8 +2158,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
// 0. Collect data to delete (user, dataType, duration
|
// 0. Collect data to delete (user, dataType, duration
|
||||||
String dataType = dataTypeCbo.getText();
|
String dataType = dataTypeCbo.getText();
|
||||||
String duration = selectedDurationInSeconds.toString();
|
String duration = selectedDurationInSeconds.toString();
|
||||||
java.util.List<ColorScaleData> data = editColorData
|
List<ColorScaleData> data = editColorData.getUsedColorScaleDataArray(
|
||||||
.getUsedColorScaleDataArray(source, duration + "_" + dataType);
|
source, duration + "_" + dataType);
|
||||||
ColorValueData cvd = new ColorValueData();
|
ColorValueData cvd = new ColorValueData();
|
||||||
cvd.setApplicationName(colorManager.getApplicationName());
|
cvd.setApplicationName(colorManager.getApplicationName());
|
||||||
cvd.setColorUseName(colorManager.getDataTypeName(dataType));
|
cvd.setColorUseName(colorManager.getDataTypeName(dataType));
|
||||||
|
@ -2274,7 +2179,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
// 2. Update editColorData
|
// 2. Update editColorData
|
||||||
boolean dataLeft = true;
|
boolean dataLeft = true;
|
||||||
if (source.equals(DEFAULT)) {
|
if (DEFAULT.equals(source)) {
|
||||||
createDefaultData();
|
createDefaultData();
|
||||||
} else {
|
} else {
|
||||||
dataLeft = createColorData(source);
|
dataLeft = createColorData(source);
|
||||||
|
@ -2315,9 +2220,9 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
public String getSource() {
|
public String getSource() {
|
||||||
sourceColor = sourceCbo.getText();
|
sourceColor = sourceCbo.getText();
|
||||||
|
|
||||||
if (sourceColor.equals(OFFICE)) {
|
if (OFFICE.equals(sourceColor)) {
|
||||||
sourceColor = OFFICE_DEFAULT;
|
sourceColor = OFFICE_DEFAULT;
|
||||||
} else if (sourceColor.equals(USER)) {
|
} else if (USER.equals(sourceColor)) {
|
||||||
sourceColor = userIdCbo.getItem(userIdCbo.getSelectionIndex());
|
sourceColor = userIdCbo.getItem(userIdCbo.getSelectionIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue