Issue #2417 - Fix the highlight all button in the notification center's find dialog

Change-Id: Ia39e049045116a4766ed989612f6ab9a3d994efd

Former-commit-id: b0fac5792b [formerly 01d92017a3db5aafc4b6d6a9f00abbf64481cfe7]
Former-commit-id: 43e2b5c156
This commit is contained in:
Mike Duff 2013-09-26 13:18:13 -05:00
parent ae23948831
commit a966d4ce97
3 changed files with 39 additions and 14 deletions

View file

@ -29,7 +29,7 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 7, 2012 jpiatt Initial creation.
*
* Sep 26, 2013 2417 mpduff Add clearSelection method.
* </pre>
*
* @author jpiatt
@ -40,17 +40,24 @@ public interface ITableFind {
/**
* handleFind call
*/
public void handlePageSelection();
void handlePageSelection();
/**
* handleFind call
*
* @param index
*/
public void selectIndex(int index);
void selectIndex(int index);
/**
* handleFind call
*
* @param indices
*/
public void selectIndices(int[] indices);
void selectIndices(int[] indices);
/**
* Clear any table selections.
*/
void clearSelections();
}

View file

@ -30,9 +30,11 @@ 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.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@ -56,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Jun 07, 2012 687 lvenable Table data refactor.
* Dec 12. 2012 1418 mpduff Change label.
* Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs.
* Sep 26, 2013 2417 mpduff Reset the highlight all indices on close.
*
* </pre>
*
@ -182,6 +185,12 @@ public class FindDlg extends CaveSWTDialog {
*/
@Override
protected void initializeComponents(Shell shell) {
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
callback.selectIndices(null);
}
});
createFindLayout();
createBottomButtons();
}
@ -305,6 +314,7 @@ public class FindDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
callback.selectIndices(null);
close();
}
});
@ -490,6 +500,7 @@ public class FindDlg extends CaveSWTDialog {
mb.setMessage("No item matching your search was found.");
mb.open();
tableIndex = 0;
callback.clearSelections();
}
}

View file

@ -80,6 +80,7 @@ import com.raytheon.uf.viz.datadelivery.utils.NotificationHandler;
* Apr 25, 2013 1820 mpduff Get the column list every time.
* Aug 30, 2013 2314 mpduff Sort the table data on load.
* Sep 16, 2013 2375 mpduff Removed initial sorting.
* Sep 26, 2013 2417 mpduff Fix the find all row selection.
* </pre>
*
* @author lvenable
@ -1150,7 +1151,7 @@ public class NotificationTableComp extends TableComp implements ITableFind {
if (startIndex == 0) {
highlightIndex = index;
} else if (selectedPage > 0) {
int extra = (selectedPage * pageConfig);
int extra = ((selectedPage - 1) * pageConfig);
highlightIndex = index - extra;
} else {
highlightIndex = index - pageConfig;
@ -1311,11 +1312,12 @@ public class NotificationTableComp extends TableComp implements ITableFind {
@Override
public void selectIndices(int[] indices) {
this.indices = indices;
if (indices != null && indices.length > 0) {
// highlight table rows
table.select(indices);
handlePageSelection();
}
}
/**
* Returns a string with a count of the messages received while paused.
@ -1345,4 +1347,9 @@ public class NotificationTableComp extends TableComp implements ITableFind {
public boolean isLocked() {
return pauseButton.getSelection();
}
@Override
public void clearSelections() {
table.deselectAll();
}
}