Issue #2436 - disposed of the sort color
Former-commit-id:f27781b74e
[formerly8c8adf8be6
] [formerly9c97908f36
] [formerlyf27781b74e
[formerly8c8adf8be6
] [formerly9c97908f36
] [formerlyc4ddd46b44
[formerly9c97908f36
[formerly 4545de35a0fdbfc5817a8725bf07ae0c405efb39]]]] Former-commit-id:c4ddd46b44
Former-commit-id:ccbc44f9d3
[formerly2ed106cac4
] [formerly b50a8d2a19218358b07a31a6ee2f605c0ead6152 [formerly46db8998a6
]] Former-commit-id: d130264f10b1958114f77cf64c39663d19c8c154 [formerly1000147d0c
] Former-commit-id:b0af7745a6
This commit is contained in:
parent
9da45fbeba
commit
c328869516
1 changed files with 76 additions and 64 deletions
|
@ -64,6 +64,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 7, 2009 lvenable Initial creation
|
||||
* Oct 7, 2013 #2436 lvenable Disposed of the sort color.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -119,9 +120,13 @@ public abstract class TableComp extends Composite {
|
|||
protected boolean columnMinimumSize = false;
|
||||
|
||||
private int imageWidth = 0;
|
||||
|
||||
private int imageHeight = 0;
|
||||
|
||||
private int textWidth = 0;
|
||||
|
||||
private int textHeight = 0;
|
||||
|
||||
private Color sortColor;
|
||||
|
||||
/**
|
||||
|
@ -185,6 +190,7 @@ public abstract class TableComp extends Composite {
|
|||
tiFont.dispose();
|
||||
lineColor.dispose();
|
||||
sortImage.dispose();
|
||||
sortColor.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -207,7 +213,7 @@ public abstract class TableComp extends Composite {
|
|||
|
||||
String[] columnKeys = getColumnKeys(appName);
|
||||
|
||||
for ( String key : columnKeys ) {
|
||||
for (String key : columnKeys) {
|
||||
String columnName = getColumnAttribteData(key).getColumnName();
|
||||
|
||||
String[] nameArray = columnName.split("\n");
|
||||
|
@ -294,7 +300,7 @@ public abstract class TableComp extends Composite {
|
|||
|
||||
});
|
||||
|
||||
table.addMouseMoveListener(new MouseMoveListener () {
|
||||
table.addMouseMoveListener(new MouseMoveListener() {
|
||||
@Override
|
||||
public void mouseMove(MouseEvent event) {
|
||||
tableMouseHoverAction(event);
|
||||
|
@ -338,13 +344,15 @@ public abstract class TableComp extends Composite {
|
|||
for (int j = 0; j < cols.length; j++) {
|
||||
cols[j].setImage(null);
|
||||
cols[j].setWidth(defaultColWidth);
|
||||
cols[j].setText(getColumnAttribteData(colnkeys[j]).getColumnName());
|
||||
cols[j].setText(getColumnAttribteData(colnkeys[j])
|
||||
.getColumnName());
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the sort image, pack the column and sort the data.
|
||||
*/
|
||||
tc.setImage(getSortHeaderImage(getColumnAttribteData(sortCol).getColumnName()));
|
||||
tc.setImage(getSortHeaderImage(getColumnAttribteData(
|
||||
sortCol).getColumnName()));
|
||||
tc.setText("");
|
||||
tc.pack();
|
||||
|
||||
|
@ -358,14 +366,16 @@ public abstract class TableComp extends Composite {
|
|||
});
|
||||
|
||||
/**
|
||||
* DR#10701: The first column is selected for
|
||||
* sorting by default when a Zone table or Station
|
||||
* table is first displayed (not for History table)
|
||||
* DR#10701: The first column is selected for sorting by default
|
||||
* when a Zone table or Station table is first displayed (not for
|
||||
* History table)
|
||||
*/
|
||||
if ( i == 0 ) {
|
||||
if ( getColumnAttribteData(columns[i]).getSortDir() != SortDirection.None.getSortDir() ) {
|
||||
if (i == 0) {
|
||||
if (getColumnAttribteData(columns[i]).getSortDir() != SortDirection.None
|
||||
.getSortDir()) {
|
||||
tc.setText("");
|
||||
tc.setImage(getSortHeaderImage(getColumnAttribteData(columns[0]).getColumnName()));
|
||||
tc.setImage(getSortHeaderImage(getColumnAttribteData(
|
||||
columns[0]).getColumnName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,8 +424,8 @@ public abstract class TableComp extends Composite {
|
|||
|
||||
for (int i = 0; i < cellData.length; i++) {
|
||||
ti.setText(i, cellData[i].displayString());
|
||||
Color c = new Color(parent.getDisplay(), cellData[i]
|
||||
.getBackgroungRGB());
|
||||
Color c = new Color(parent.getDisplay(),
|
||||
cellData[i].getBackgroungRGB());
|
||||
ti.setBackground(i, c);
|
||||
c.dispose();
|
||||
}
|
||||
|
@ -462,8 +472,8 @@ public abstract class TableComp extends Composite {
|
|||
|
||||
int columnIndex = getColumnIndex(appName, sortCol);
|
||||
|
||||
if ( sortCol == "SSZT_SwellPeriod" || sortCol == "SSZT_Swell2Period" ) {
|
||||
if ( MonitorConfigConstants.isRankSwellPeriodHigh() ) {
|
||||
if (sortCol == "SSZT_SwellPeriod" || sortCol == "SSZT_Swell2Period") {
|
||||
if (MonitorConfigConstants.isRankSwellPeriodHigh()) {
|
||||
sortDir = SWT.DOWN;
|
||||
} else {
|
||||
sortDir = SWT.UP;
|
||||
|
@ -502,19 +512,21 @@ public abstract class TableComp extends Composite {
|
|||
gc.fillRectangle(0, 0, imageWidth, imageHeight);
|
||||
int xCoord = 0;
|
||||
int yCoord = 0;
|
||||
if ( header.indexOf("\n") > 0 ) {
|
||||
String [] tmpArray = header.split("\n");
|
||||
if (header.indexOf("\n") > 0) {
|
||||
String[] tmpArray = header.split("\n");
|
||||
int maxTextLen = tmpArray[0].length();
|
||||
for ( int j = 1; j < tmpArray.length; j++ ) {
|
||||
if ( tmpArray[j].length() > maxTextLen ) {
|
||||
for (int j = 1; j < tmpArray.length; j++) {
|
||||
if (tmpArray[j].length() > maxTextLen) {
|
||||
maxTextLen = tmpArray[j].length();
|
||||
}
|
||||
}
|
||||
xCoord = Math.round( (imageWidth / 2) - (maxTextLen*textWidth / 2) ) - 2;
|
||||
xCoord = Math
|
||||
.round((imageWidth / 2) - (maxTextLen * textWidth / 2)) - 2;
|
||||
yCoord = 0;
|
||||
} else {
|
||||
xCoord = Math.round( (imageWidth / 2) - (header.length()*textWidth / 2) ) - 2;
|
||||
yCoord = imageHeight / 2 - textHeight /2 - 1;
|
||||
xCoord = Math.round((imageWidth / 2)
|
||||
- (header.length() * textWidth / 2)) - 2;
|
||||
yCoord = imageHeight / 2 - textHeight / 2 - 1;
|
||||
}
|
||||
gc.drawText(header, xCoord, yCoord, true);
|
||||
return image;
|
||||
|
|
Loading…
Add table
Reference in a new issue