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

@ -28,8 +28,8 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 7, 2012 jpiatt Initial creation. * May 7, 2012 jpiatt Initial creation.
* * Sep 26, 2013 2417 mpduff Add clearSelection method.
* </pre> * </pre>
* *
* @author jpiatt * @author jpiatt
@ -40,17 +40,24 @@ public interface ITableFind {
/** /**
* handleFind call * handleFind call
*/ */
public void handlePageSelection(); void handlePageSelection();
/** /**
* handleFind call * handleFind call
* @param index *
* @param index
*/ */
public void selectIndex(int index); void selectIndex(int index);
/** /**
* handleFind call * handleFind call
* @param indices *
* @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.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; 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. * Jun 07, 2012 687 lvenable Table data refactor.
* Dec 12. 2012 1418 mpduff Change label. * Dec 12. 2012 1418 mpduff Change label.
* Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs. * 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> * </pre>
* *
@ -182,6 +185,12 @@ public class FindDlg extends CaveSWTDialog {
*/ */
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
callback.selectIndices(null);
}
});
createFindLayout(); createFindLayout();
createBottomButtons(); createBottomButtons();
} }
@ -305,6 +314,7 @@ public class FindDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
callback.selectIndices(null);
close(); close();
} }
}); });
@ -490,6 +500,7 @@ public class FindDlg extends CaveSWTDialog {
mb.setMessage("No item matching your search was found."); mb.setMessage("No item matching your search was found.");
mb.open(); mb.open();
tableIndex = 0; 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. * Apr 25, 2013 1820 mpduff Get the column list every time.
* Aug 30, 2013 2314 mpduff Sort the table data on load. * Aug 30, 2013 2314 mpduff Sort the table data on load.
* Sep 16, 2013 2375 mpduff Removed initial sorting. * Sep 16, 2013 2375 mpduff Removed initial sorting.
* Sep 26, 2013 2417 mpduff Fix the find all row selection.
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -1150,7 +1151,7 @@ public class NotificationTableComp extends TableComp implements ITableFind {
if (startIndex == 0) { if (startIndex == 0) {
highlightIndex = index; highlightIndex = index;
} else if (selectedPage > 0) { } else if (selectedPage > 0) {
int extra = (selectedPage * pageConfig); int extra = ((selectedPage - 1) * pageConfig);
highlightIndex = index - extra; highlightIndex = index - extra;
} else { } else {
highlightIndex = index - pageConfig; highlightIndex = index - pageConfig;
@ -1311,10 +1312,11 @@ public class NotificationTableComp extends TableComp implements ITableFind {
@Override @Override
public void selectIndices(int[] indices) { public void selectIndices(int[] indices) {
this.indices = indices; this.indices = indices;
if (indices != null && indices.length > 0) {
// highlight table rows // highlight table rows
table.select(indices); table.select(indices);
handlePageSelection(); handlePageSelection();
}
} }
/** /**
@ -1345,4 +1347,9 @@ public class NotificationTableComp extends TableComp implements ITableFind {
public boolean isLocked() { public boolean isLocked() {
return pauseButton.getSelection(); return pauseButton.getSelection();
} }
@Override
public void clearSelections() {
table.deselectAll();
}
} }