Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
allow choice of substring or fulltext match for document filter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Dec 1, 2011
1 parent 4d5c591 commit c7359ed
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
Expand Up @@ -49,6 +49,9 @@
import org.zanata.webtrans.shared.rpc.GetDocumentListResult;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
Expand All @@ -58,6 +61,7 @@
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.view.client.HasData;
import com.google.gwt.view.client.ListDataProvider;
Expand All @@ -76,6 +80,8 @@ public interface Display extends WidgetDisplay

HasData<DocumentNode> getDocumentListTable();

HasClickHandlers getFullTextSearchCheckbox();

ListDataProvider<DocumentNode> getDataProvider();
}

Expand Down Expand Up @@ -172,9 +178,7 @@ public void onValueChange(ValueChangeEvent<String> event)
}
else
{
boolean fakeFullTextFlag = false;

filter.setFullText(fakeFullTextFlag);
filter.setFullText(((CheckBox) display.getFullTextSearchCheckbox()).getValue());
filter.setPattern(event.getValue());
runFilter();
}
Expand All @@ -192,6 +196,18 @@ public void onTransUnitUpdated(TransUnitUpdatedEvent event)
handler.onTransUnitUpdated(event);
}
}));

registerHandler(display.getFullTextSearchCheckbox().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
filter.setFullText(((CheckBox) display.getFullTextSearchCheckbox()).getValue());
filter.setPattern(display.getFilterTextBox().getValue());
runFilter();
}
}));

loadDocumentList();
}

Expand Down
Expand Up @@ -33,13 +33,15 @@
import org.zanata.webtrans.shared.model.DocumentInfo;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.LayoutPanel;
Expand All @@ -64,6 +66,9 @@ interface DocumentListViewUiBinder extends UiBinder<LayoutPanel, DocumentListVie
@UiField(provided = true)
ClearableTextBox filterTextBox;

@UiField
CheckBox fullTextSearchCheckBox;

@UiField(provided = true)
final CellTable<DocumentNode> documentListTable;

Expand Down Expand Up @@ -123,4 +128,10 @@ public ListDataProvider<DocumentNode> getDataProvider()
{
return dataProvider;
}

@Override
public HasClickHandlers getFullTextSearchCheckbox()
{
return fullTextSearchCheckBox;
}
}
Expand Up @@ -17,14 +17,20 @@
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}


</ui:style>
<g:LayoutPanel>
<g:layer top="0px" bottom="8px">
<g:LayoutPanel styleName="{style.mainPanel}">
<g:layer top='2px' height='20px' left="2px" right="205px">
<fui:ClearableTextBox ui:field='filterTextBox'/>
<g:layer top='2px' height='20px' left="2px" right="2px">
<g:LayoutPanel>
<g:layer top="0px" height="20px" left="0px" right="210px">
<fui:ClearableTextBox ui:field='filterTextBox'/>
</g:layer>
<g:layer top="0px" height="20px" right="0px" width="200px">
<g:CheckBox ui:field="fullTextSearchCheckBox"><ui:msg>Full-text match only</ui:msg></g:CheckBox>
</g:layer>
</g:LayoutPanel>
</g:layer>
<g:layer top='50px' bottom="2px">
<g:ScrollPanel ui:field='documentScrollPanel'>
Expand Down

0 comments on commit c7359ed

Please sign in to comment.