Issue #2342 - fixed color memory leak and NPE
Change-Id: I34c6bf75f3901f7304ef392a4549f51f599752ff Former-commit-id: 68411a30159f8251937f78d77f561c20a4822e48
This commit is contained in:
parent
13c7ae968b
commit
b71b2c4208
1 changed files with 56 additions and 30 deletions
|
@ -72,6 +72,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* 11 Mar 2013 15065 lbousaidi fixed issue with both color legend
|
* 11 Mar 2013 15065 lbousaidi fixed issue with both color legend
|
||||||
* disappearing after save
|
* disappearing after save
|
||||||
* 01 Jul 2013 2088 rferrel Changes for non-blocking dialogs.
|
* 01 Jul 2013 2088 rferrel Changes for non-blocking dialogs.
|
||||||
|
* 06 Sep 2013 #2342 lvenable Fixed color memory leaks and a null point exception.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
|
@ -125,6 +126,11 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private java.util.List<ColorValueLabels> usedColorValLblArray;
|
private java.util.List<ColorValueLabels> usedColorValLblArray;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browse Color/Value array of color and value labels.
|
||||||
|
*/
|
||||||
|
private java.util.List<ColorValueLabels> browseColorValLblArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source combo box.
|
* Source combo box.
|
||||||
*/
|
*/
|
||||||
|
@ -236,8 +242,6 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private Combo browseDurationCbo;
|
private Combo browseDurationCbo;
|
||||||
|
|
||||||
private java.util.List<ColorValueLabels> browseColorValLblArray;
|
|
||||||
|
|
||||||
private Composite browseLabelComp;
|
private Composite browseLabelComp;
|
||||||
|
|
||||||
private Integer selectedDurationInSeconds = 0;
|
private Integer selectedDurationInSeconds = 0;
|
||||||
|
@ -248,21 +252,6 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
private Button saveAsUserBtn, saveAsOfficeBtn;
|
private Button saveAsUserBtn, saveAsOfficeBtn;
|
||||||
|
|
||||||
/**
|
|
||||||
* Common mouse listener for labels in the Color Value Label Bar.
|
|
||||||
*/
|
|
||||||
private final MouseListener lableMouseListener = new MouseAdapter() {
|
|
||||||
@Override
|
|
||||||
public void mouseDown(MouseEvent e) {
|
|
||||||
Label lbl = (Label) e.getSource();
|
|
||||||
ColorValueLabels cvl = (ColorValueLabels) lbl.getData();
|
|
||||||
updateEditControlsValueSelected(cvl);
|
|
||||||
updateEditControlsColorSelected(cvl);
|
|
||||||
String source = getSource();
|
|
||||||
changeColor(cvl.getRgbColor(), source);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -300,6 +289,17 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void disposed() {
|
||||||
|
if (currentColor != null) {
|
||||||
|
currentColor.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
disposeLabelsInArray(colorValLblArray);
|
||||||
|
disposeLabelsInArray(usedColorValLblArray);
|
||||||
|
disposeLabelsInArray(browseColorValLblArray);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the tab folder container.
|
* Create the tab folder container.
|
||||||
*/
|
*/
|
||||||
|
@ -900,6 +900,21 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common mouse listener for labels in the Color Value Label Bar.
|
||||||
|
*/
|
||||||
|
private final MouseListener lableMouseListener = new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseDown(MouseEvent e) {
|
||||||
|
Label lbl = (Label) e.getSource();
|
||||||
|
ColorValueLabels cvl = (ColorValueLabels) lbl.getData();
|
||||||
|
updateEditControlsValueSelected(cvl);
|
||||||
|
updateEditControlsColorSelected(cvl);
|
||||||
|
String source = getSource();
|
||||||
|
changeColor(cvl.getRgbColor(), source);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the color label on the display
|
* Update the color label on the display
|
||||||
*
|
*
|
||||||
|
@ -1443,11 +1458,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
* adding/updating/deleting color/value pairs or when the data type changes.
|
* adding/updating/deleting color/value pairs or when the data type changes.
|
||||||
*/
|
*/
|
||||||
private void updateColorValueLabelBar() {
|
private void updateColorValueLabelBar() {
|
||||||
for (int i = 0; i < colorValLblArray.size(); i++) {
|
|
||||||
colorValLblArray.get(i).disposeLabels();
|
|
||||||
}
|
|
||||||
|
|
||||||
colorValLblArray.clear();
|
disposeLabelsInArray(colorValLblArray);
|
||||||
|
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
|
|
||||||
|
@ -1492,11 +1504,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
* same as updateColorValueLabelBar but for Browse Color Sets tab
|
* same as updateColorValueLabelBar but for Browse Color Sets tab
|
||||||
*/
|
*/
|
||||||
private void updateBrowseColorValueLabelBar() {
|
private void updateBrowseColorValueLabelBar() {
|
||||||
for (int i = 0; i < browseColorValLblArray.size(); i++) {
|
|
||||||
browseColorValLblArray.get(i).disposeLabels();
|
|
||||||
}
|
|
||||||
|
|
||||||
browseColorValLblArray.clear();
|
disposeLabelsInArray(browseColorValLblArray);
|
||||||
|
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
|
|
||||||
|
@ -1537,11 +1546,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
* adding/updating/deleting color/value pairs or when the data type changes.
|
* adding/updating/deleting color/value pairs or when the data type changes.
|
||||||
*/
|
*/
|
||||||
private void updateUsedColorValueLabelBar() {
|
private void updateUsedColorValueLabelBar() {
|
||||||
for (int i = 0; i < usedColorValLblArray.size(); i++) {
|
|
||||||
usedColorValLblArray.get(i).disposeLabels();
|
|
||||||
}
|
|
||||||
|
|
||||||
usedColorValLblArray.clear();
|
disposeLabelsInArray(usedColorValLblArray);
|
||||||
|
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
|
|
||||||
|
@ -1610,6 +1616,22 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispose of the labels/colors in the specified array.
|
||||||
|
*
|
||||||
|
* @param array
|
||||||
|
* Array of color value labels.
|
||||||
|
*/
|
||||||
|
private void disposeLabelsInArray(java.util.List<ColorValueLabels> array) {
|
||||||
|
if (array != null) {
|
||||||
|
for (ColorValueLabels cvl : array) {
|
||||||
|
cvl.disposeLabels();
|
||||||
|
}
|
||||||
|
|
||||||
|
array.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update to user's selected color value.
|
* Update to user's selected color value.
|
||||||
*
|
*
|
||||||
|
@ -1901,7 +1923,11 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||||
// add a check in case there is a typo in dataType the it will be
|
// add a check in case there is a typo in dataType the it will be
|
||||||
// null
|
// null
|
||||||
if (!dt.contains("null")) {
|
if (!dt.contains("null")) {
|
||||||
dataTypeCbo.add(colorManager.getDescription(dt));
|
String description = colorManager.getDescription(dt);
|
||||||
|
|
||||||
|
if (description != null) {
|
||||||
|
dataTypeCbo.add(description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue