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

Commit

Permalink
Merge branch 'integration/master' of github.com:zanata/zanata into in…
Browse files Browse the repository at this point in the history
…tegration/master
  • Loading branch information
Carlos Munoz committed Jun 6, 2012
2 parents c45527f + 1ff6a9c commit 9a2f2df
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 54 deletions.
2 changes: 1 addition & 1 deletion copyright.txt
Expand Up @@ -17,7 +17,7 @@ Alex Eng <aeng@redhat.com> Project Contributor
David Mason <damason@redhat.com> Project Contributor
Carlos Munoz <camunoz@redhat.com> Project Contributor
Patrick Huang <pahuang@redhat.com> Project Contributor

Joyce Chang Project Contributor


Libraries
Expand Down
Expand Up @@ -62,8 +62,6 @@

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.cell.client.ActionCell.Delegate;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
Expand Down Expand Up @@ -108,6 +106,8 @@ public interface Display extends WidgetDisplay

void focusFilterTextBox();

HasClickHandlers getSearchButton();

HasValue<String> getReplacementTextBox();

void focusReplacementTextBox();
Expand All @@ -116,6 +116,8 @@ public interface Display extends WidgetDisplay

HasValue<Boolean> getCaseSensitiveChk();

HasValue<Boolean> getSelectAllChk();

HasChangeHandlers getSearchFieldSelector();

String getSelectedSearchField();
Expand Down Expand Up @@ -258,20 +260,13 @@ protected void onBind()
setUiForNothingSelected();
display.setReplaceAllButtonVisible(!workspaceContext.isReadOnly());

// TODO use explicit 'search' button and add enter key press event for
// text box
registerHandler(display.getFilterTextBox().addValueChangeHandler(new ValueChangeHandler<String>()
registerHandler(display.getSearchButton().addClickHandler(new ClickHandler()
{

@Override
public void onValueChange(ValueChangeEvent<String> event)
public void onClick(ClickEvent event)
{
HistoryToken token = HistoryToken.fromTokenString(history.getToken());
if (!event.getValue().equals(token.getProjectSearchText()))
{
token.setProjectSearchText(event.getValue());
history.newItem(token.toTokenString());
}
updateSearch();
}
}));

Expand All @@ -290,17 +285,22 @@ public void onValueChange(ValueChangeEvent<String> event)
}
}));

registerHandler(display.getCaseSensitiveChk().addValueChangeHandler(new ValueChangeHandler<Boolean>()
registerHandler(display.getSelectAllChk().addValueChangeHandler(new ValueChangeHandler<Boolean>()
{

@Override
public void onValueChange(ValueChangeEvent<Boolean> event)
{
HistoryToken token = HistoryToken.fromTokenString(history.getToken());
if (event.getValue() != token.getProjectSearchCaseSensitive())
if (event.getValue())
{
token.setProjectSearchCaseSensitive(event.getValue());
history.newItem(token.toTokenString());
selectAllTextFlows();
}
else
{
for (MultiSelectionModel<TransUnitReplaceInfo> selectionModel : documentSelectionModels.values())
{
selectionModel.clear();
}
}
}
}));
Expand All @@ -320,22 +320,6 @@ public void onValueChange(ValueChangeEvent<Boolean> event)
}
}));

registerHandler(display.getSearchFieldSelector().addChangeHandler(new ChangeHandler()
{

@Override
public void onChange(ChangeEvent event)
{
HistoryToken token = HistoryToken.fromTokenString(history.getToken());
String selected = display.getSelectedSearchField();
boolean searchSource = selected.equals("source") || selected.equals("both");
boolean searchTarget = selected.equals("target") || selected.equals("both");
token.setProjectSearchInSource(searchSource);
token.setProjectSearchInTarget(searchTarget);
history.newItem(token.toTokenString());
}
}));

registerHandler(display.getReplaceAllButton().addClickHandler(new ClickHandler()
{

Expand Down Expand Up @@ -568,6 +552,7 @@ public void onSuccess(GetProjectTransUnitListsResult result)
}
else
{
// TODO add case sensitivity and scope
display.getSearchResponseLabel().setText(messages.showingResultsForProjectWideSearch(result.getSearchAction().getSearchString(), textFlowCount, result.getDocumentIds().size()));
}
display.setSearching(false);
Expand Down Expand Up @@ -1331,6 +1316,45 @@ private void refreshReplacementEventInfoList()
}
}

private void updateSearch()
{
boolean changed = false;
HistoryToken token = HistoryToken.fromTokenString(history.getToken());

Boolean caseSensitive = display.getCaseSensitiveChk().getValue();
if (caseSensitive != token.getProjectSearchCaseSensitive())
{
token.setProjectSearchCaseSensitive(caseSensitive);
changed = true;
}

String searchPhrase = display.getFilterTextBox().getValue();
if (!searchPhrase.equals(token.getProjectSearchText()))
{
token.setProjectSearchText(searchPhrase);
changed = true;
}

String selected = display.getSelectedSearchField();
boolean searchSource = selected.equals("source") || selected.equals("both");
boolean searchTarget = selected.equals("target") || selected.equals("both");
if (searchSource != token.isProjectSearchInSource())
{
token.setProjectSearchInSource(searchSource);
changed = true;
}
if (searchTarget != token.isProjectSearchInTarget())
{
token.setProjectSearchInTarget(searchTarget);
changed = true;
}

if (changed)
{
history.newItem(token.toTokenString());
}
}

private class ReplacementEventInfo
{
private String message;
Expand Down
Expand Up @@ -322,4 +322,13 @@ public interface WebTransMessages extends Messages

@DefaultMessage("Show project-wide search view")
String showProjectWideSearch();

@DefaultMessage("Only show documents that contain the search text with matching case")
String docListFilterCaseSensitiveDescription();

@DefaultMessage("Only show documents with full path and name in the search text")
String docListFilterExactMatchDescription();

@DefaultMessage("Enter text to filter the document list. Use commas (,) to separate multiple searches")
String docListFilterDescription();
}
Expand Up @@ -79,14 +79,18 @@ interface DocumentListViewUiBinder extends UiBinder<LayoutPanel, DocumentListVie
@Inject
public DocumentListView(Resources resources, WebTransMessages messages, UiMessages uiMessages, final CachingDispatchAsync dispatcher, EventBus eventBus)
{

this.resources = resources;
this.messages = messages;


dataProvider = new ListDataProvider<DocumentNode>();
filterTextBox = new ClearableTextBox(resources, uiMessages);
initWidget(uiBinder.createAndBindUi(this));
filterTextBox.setTitle(messages.docListFilterDescription());
// TODO set this from the presenter if possible
dataProvider = new ListDataProvider<DocumentNode>();
caseSensitiveCheckBox.setTitle(messages.docListFilterCaseSensitiveDescription());
exactSearchCheckBox.setTitle(messages.docListFilterExactMatchDescription());

initWidget(uiBinder.createAndBindUi(this));
}

@Override
Expand Down
Expand Up @@ -32,9 +32,12 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
Expand Down Expand Up @@ -76,10 +79,10 @@ interface SearchResultsViewUiBinder extends UiBinder<LayoutPanel, SearchResultsV
InlineLabel searchResponseLabel, selectAllLink, selectionInfoLabel;

@UiField
CheckBox caseSensitiveChk, requirePreviewChk;
CheckBox caseSensitiveChk, selectAllChk, requirePreviewChk;

@UiField
Button replaceAllButton;
Button searchButton, replaceAllButton;

@UiField
ListBox searchFieldsSelect;
Expand Down Expand Up @@ -132,6 +135,21 @@ public void focusFilterTextBox()
filterTextBox.setSelectionRange(0, filterTextBox.getText().length());
}

@UiHandler("filterTextBox")
void onFilterTextBoxKeyUp(KeyUpEvent event)
{
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
{
searchButton.click();
}
}

@Override
public HasClickHandlers getSearchButton()
{
return searchButton;
}

@Override
public HasValue<String> getReplacementTextBox()
{
Expand All @@ -157,6 +175,12 @@ public HasValue<Boolean> getCaseSensitiveChk()
return caseSensitiveChk;
}

@Override
public HasValue<Boolean> getSelectAllChk()
{
return selectAllChk;
}

@Override
public HasClickHandlers getReplaceAllButton()
{
Expand Down
Expand Up @@ -8,8 +8,8 @@
<g:LayoutPanel>
<g:layer top='0px' height='64px' left="0px" right="0px">
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE' width="100%" height="100%" styleName='projectWideSearchPanel' >
<g:InlineLabel styleName='projectWideSearchBoxLabel' ><ui:msg>Search:</ui:msg></g:InlineLabel>
<g:TextBox ui:field='filterTextBox' styleName='projectWideSearchBox' />
<g:Button ui:field='searchButton' styleName='projectWideSearchButton' ><ui:msg>Search</ui:msg></g:Button>
<g:VerticalPanel>
<g:CheckBox ui:field="caseSensitiveChk"><ui:msg>Case sensitive</ui:msg></g:CheckBox>
<g:ListBox ui:field="searchFieldsSelect" selectedIndex="0">
Expand All @@ -19,11 +19,17 @@
</g:ListBox>
</g:VerticalPanel>
<g:cell width="100%" >
<g:InlineLabel ui:field="searchResponseLabel" styleName='projectWideSearchReportLabel' ></g:InlineLabel>
<g:InlineLabel></g:InlineLabel>
</g:cell>
</g:HorizontalPanel>
</g:layer>
<g:layer top='64px' bottom='120px'>
<g:layer top='64px' height='32px' left="0px" right="0px">
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE' width="100%" height="100%" styleName='projectWideSearchPanel' >
<g:CheckBox ui:field="selectAllChk" styleName='projectWideSearchSelectAllChk'><ui:msg>Select all</ui:msg></g:CheckBox>
<g:InlineLabel ui:field="searchResponseLabel" styleName='projectWideSearchReportLabel' ></g:InlineLabel>
</g:HorizontalPanel>
</g:layer>
<g:layer top='96px' bottom='120px'>
<g:ScrollPanel styleName='projectWideSearchResultsPanel' >
<g:VerticalPanel ui:field='searchResultsPanel' width="100%" />
</g:ScrollPanel>
Expand Down
Expand Up @@ -476,9 +476,10 @@ tr.ApprovedStateDecoration td.TableEditorCell-Target .TableEditorContent-Edit

.projectWideSearchPanel
{
color: #666666;
color: #999999;
background-color: #f3f2f2;
border-bottom: 1px solid lightgrey;
padding-left: 20px;
}

.gwt-ListBox
Expand All @@ -496,21 +497,34 @@ tr.ApprovedStateDecoration td.TableEditorCell-Target .TableEditorContent-Edit
{
color: #000000;
padding: 3px;
margin: 15px;
margin: 10px;
font-size: 1.3em;
border: 3px solid lightgrey;
border-radius: 6px;
outline: none;
-moz-border-radius: 6px;
}

.projectWideSearchButton
{
color: #444444;
font-size: 1.3em;
margin-right: 15px;
padding: 2px 8px;
}

.projectWideSearchReportLabel
{
margin-left: 40px;
color: #555588;
font-size: 1.1em;
}

.projectWideSearchSelectAllChk
{
margin-left: 27px;
}

.projectWideReplacementPanel
{
background-color: #667788;
Expand Down
23 changes: 13 additions & 10 deletions zanata-war/src/main/webapp/WEB-INF/liquibase
Expand Up @@ -3,19 +3,22 @@
# convenience script to run liquibase with suitable Zanata settings
# see http://liquibase.org/manual/command_line

# If you need mysql/slf4j jars: yum install mysql-connector-java slf4j

SCRIPT_PATH=`dirname ${BASH_SOURCE[0]}`
war=$SCRIPT_PATH/..

if [ -z $JBOSS_HOME ]; then
echo "Error: JBOSS_HOME not set. For instance: export JBOSS_HOME=/opt/jboss-ewp-5.1/jboss-as-web"
exit 1
fi

classpath=\
$(echo $war/WEB-INF/lib/*.jar \
$war/WEB-INF/classes/ \
$JBOSS_HOME/server/default/lib/mysql-connector-java*.jar \
$JBOSS_HOME/lib/log4j-boot.jar | sed 's/ /:/g')
$(echo \
$war/WEB-INF/classes/ \
/usr/share/java/mysql-connector-java.jar \
/usr/share/java/slf4j/simple.jar \
/usr/share/java/slf4j/api.jar \
$war/WEB-INF/lib/*.jar \
| sed 's/ /:/g')

# slf4j simple.jar needs to be before api.jar due to
# https://bugzilla.redhat.com/show_bug.cgi?id=828644

if [ -r liquibase.properties ]; then
defs=
Expand All @@ -26,7 +29,7 @@ fi
java \
-jar $war/WEB-INF/lib/liquibase-core*.jar \
--classpath $classpath \
--changeLogFile=db/db.changelog.xml \
--changeLogFile db/db.changelog.xml \
$defs \
"$@"

Expand Down

0 comments on commit 9a2f2df

Please sign in to comment.