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

Commit

Permalink
Fix test unit, fix search and replace layout issue, implemented side …
Browse files Browse the repository at this point in the history
…tab for view
  • Loading branch information
alex-sl-eng committed Sep 21, 2012
1 parent 8c672aa commit c60263d
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 113 deletions.
Expand Up @@ -41,7 +41,7 @@
<g:layer left='0' width='100%'>
<g:FlowPanel ui:field='undefinedPanel' styleName="{style.undefined}"/>
</g:layer>
<g:layer left='100px' width="100px">
<g:layer left='102px' width="100px">
<g:Label ui:field='label' styleName='{style.label}'/>
</g:layer>
</g:LayoutPanel>
Expand Down
Expand Up @@ -82,7 +82,7 @@
font-style:normal;
}

.viewMenuSelection
.viewMenuTab
{
color:#595959;
border:1px solid #C9C9C9;
Expand All @@ -93,19 +93,28 @@
font-size:18px;
background:#ffffff;
cursor:pointer;
opacity:0.6;
}

.selectedTab
.viewMenuTab:hover
{
opacity:1;
color:#3B3B3B;
}

.selectedTab, .selectedTab:hover
{
background:#7E91A9;
color:#FFFFFF;
opacity:1;
}

.disableTab, .disableTab:hover
{
color:#777;
background:#bbb;
cursor:default;
opacity:1;
}
</ui:style>
<g:LayoutPanel stylePrimaryName="{style.rootContainer}" ui:field="rootContainer">
Expand Down Expand Up @@ -151,9 +160,9 @@

<g:layer left="0" width="24px" top="3px" height="82px">
<g:HTMLPanel>
<g:Label styleName="icon-list {style.viewMenuSelection}" ui:field="documentListTab"/>
<g:Label styleName="icon-edit {style.viewMenuSelection}" ui:field="editorTab"/>
<g:Label styleName="icon-search {style.viewMenuSelection}" ui:field="searchAndReplaceTab"/>
<g:Label styleName="icon-list {style.viewMenuTab}" ui:field="documentListTab"/>
<g:Label styleName="icon-edit {style.viewMenuTab}" ui:field="editorTab"/>
<g:Label styleName="icon-search {style.viewMenuTab}" ui:field="searchAndReplaceTab"/>
</g:HTMLPanel>
</g:layer>
</g:LayoutPanel>
Expand Down
@@ -1,59 +1,99 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:f="urn:import:org.zanata.webtrans.client"
xmlns:fui="urn:import:org.zanata.webtrans.client.ui"
xmlns:c="urn:import:com.google.gwt.user.cellview.client">

<g:LayoutPanel>
<g:layer top='0px' height='64px' left="0px" width="50%">
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE' width="100%" height="100%" styleName='projectWideSearchPanel' >
<g:cell width="200px">
<g:TextBox ui:field='filterTextBox' styleName='projectWideSearchBox' />
</g:cell>
<g:cell width="100px">
<g:Button ui:field='searchButton' styleName='projectWideSearchButton' ><ui:msg>Search</ui:msg></g:Button>
</g:cell>
<g:cell>
<g:VerticalPanel>
<g:CheckBox ui:field="caseSensitiveChk"><ui:msg>Case sensitive</ui:msg></g:CheckBox>
<g:ListBox ui:field="searchFieldsSelect" selectedIndex="0"/>
</g:VerticalPanel>
</g:cell>
</g:HorizontalPanel>
</g:layer>



<g:layer top='0px' height='64px' right="0px" width="50%">
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE' width="100%" height="100%" styleName='projectWideSearchPanel' >
<g:cell horizontalAlignment="ALIGN_RIGHT">
<g:TextBox ui:field='replacementTextBox' styleName='projectWideReplacementBox' />
</g:cell>
<g:cell horizontalAlignment="ALIGN_RIGHT" width="100px">
<g:Button ui:field='replaceAllButton' styleName='projectWideReplacementButton' >
<ui:msg>Replace</ui:msg>
</g:Button>
</g:cell>
<g:cell horizontalAlignment="ALIGN_RIGHT" width="120px">
<g:CheckBox ui:field="requirePreviewChk"><ui:msg>Require preview</ui:msg></g:CheckBox>
</g:cell>
</g:HorizontalPanel>
</g:layer>


<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='0'>
<g:ScrollPanel styleName='projectWideSearchResultsPanel' >
<g:VerticalPanel ui:field='searchResultsPanel' width="100%" />
</g:ScrollPanel>
</g:layer>

</g:LayoutPanel>
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:f="urn:import:org.zanata.webtrans.client"
xmlns:fui="urn:import:org.zanata.webtrans.client.ui" xmlns:c="urn:import:com.google.gwt.user.cellview.client">


<ui:style>
.projectWideSearchBox {
padding: 3px;
font-size: 20px;
border: 2px solid #C5C5C5;
border-radius: 3px;
width: 95%;
height: 28px;
margin-right: 3px;
}

.projectWideSearchButton
{
color: #444444;
font-size: 1.3em;
margin-right: 6px;
padding: 3px 10px;
}

.projectWideSearchPanel
{
color: #555555;
background-color: #f3f2f2;
border-bottom: 1px solid #d3d3d3;
padding: 0px 15px;
white-space: nowrap;
}

</ui:style>

<g:LayoutPanel>
<g:layer top='0px' height='64px' left="0px" width="50%">
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE' width="100%" height="100%" styleName="{style.projectWideSearchPanel}">
<g:cell>
<g:TextBox ui:field='filterTextBox' styleName="{style.projectWideSearchBox}"/>
</g:cell>
<g:cell width="80px">
<g:Button ui:field='searchButton' styleName="{style.projectWideSearchButton}">
<ui:msg>Search</ui:msg>
</g:Button>
</g:cell>
<g:cell>
<g:VerticalPanel>
<g:CheckBox ui:field="caseSensitiveChk">
<ui:msg>Case sensitive</ui:msg>
</g:CheckBox>
<g:ListBox ui:field="searchFieldsSelect" selectedIndex="0" />
</g:VerticalPanel>
</g:cell>
</g:HorizontalPanel>
</g:layer>



<g:layer top='0px' height='64px' right="0px" width="50%">
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE' width="100%" height="100%" styleName="{style.projectWideSearchPanel}">
<g:cell horizontalAlignment="ALIGN_LEFT">
<g:TextBox ui:field='replacementTextBox' styleName="{style.projectWideSearchBox}" />
</g:cell>
<g:cell horizontalAlignment="ALIGN_LEFT" width="80px">
<g:Button ui:field='replaceAllButton' styleName="{style.projectWideSearchButton}">
<ui:msg>Replace</ui:msg>
</g:Button>
</g:cell>
<g:cell horizontalAlignment="ALIGN_LEFT">
<g:CheckBox ui:field="requirePreviewChk">
<ui:msg>Require preview</ui:msg>
</g:CheckBox>
</g:cell>
</g:HorizontalPanel>
</g:layer>


<g:layer top='64px' height='32px' left="0px" right="0px">
<g:HorizontalPanel verticalAlignment='ALIGN_MIDDLE'
width="100%" height="100%" styleName="{style.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='0'>
<g:ScrollPanel styleName='projectWideSearchResultsPanel'>
<g:VerticalPanel ui:field='searchResultsPanel'
width="100%" />
</g:ScrollPanel>
</g:layer>

</g:LayoutPanel>

</ui:UiBinder>
Expand Up @@ -40,7 +40,7 @@
<g:layer left="15px" width="450px" top="7px" bottom="5px">
<g:LayoutPanel ui:field="filterPanelContainer"/>
</g:layer>
<g:layer width="44%" right="40px" top="9px" height="20px">
<g:layer width="45%" right="40px" top="9px" height="20px">
<g:HTMLPanel ui:field="transUnitNavigationContainer" styleName="{style.centerText}"/>
</g:layer>
</g:LayoutPanel>
Expand Down
Expand Up @@ -283,14 +283,7 @@ tr.ApprovedStateDecoration td.TableEditorCell-Target .TableEditorContent-Edit
* TODO arrange for these to share styles with editor table
*/

.projectWideSearchPanel
{
color: #555555;
background-color: #f3f2f2;
border-bottom: 1px solid #d3d3d3;
padding: 0px 20px;
white-space: nowrap;
}


.gwt-ListBox
{
Expand All @@ -303,36 +296,6 @@ tr.ApprovedStateDecoration td.TableEditorCell-Target .TableEditorContent-Edit
margin-left: 30px;
}

.projectWideSearchBox
{
padding: 3px;
font-size: 20px;
border: 2px solid #C5C5C5;
border-radius: 3px;
width:300px;
height:30px;
margin-right:3px;
}

.projectWideSearchButton
{
color: #444444;
font-size: 1.4em;
margin-right: 15px;
padding: 3px 10px;
}

.projectWideReplacementBox
{
padding: 3px;
font-size: 20px;
border: 2px solid #C5C5C5;
border-radius: 3px;
width:300px;
height:30px;
margin-right:3px;
}

.projectWideSearchReportLabel
{
margin-left: 40px;
Expand All @@ -359,13 +322,6 @@ tr.ApprovedStateDecoration td.TableEditorCell-Target .TableEditorContent-Edit
white-space: nowrap;
}

.projectWideReplacementButton
{
color: #444444;
padding: 3px 10px;
font-size: 1.4em;
}

.projectWideReplacButton-Disabled
{
color: #777777;
Expand Down
Expand Up @@ -30,6 +30,8 @@
import org.zanata.webtrans.shared.model.WorkspaceId;
import org.zanata.webtrans.shared.rpc.HasWorkspaceContextUpdateData;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.logical.shared.BeforeSelectionEvent;
import com.google.gwt.event.logical.shared.BeforeSelectionHandler;
import com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers;
Expand Down Expand Up @@ -100,11 +102,13 @@ public void onBind()
when(location.getParameter("title")).thenReturn("blah");
when(messages.windowTitle2(userWorkspace.getWorkspaceContext().getWorkspaceName(), userWorkspace.getWorkspaceContext().getLocaleName(), "blah")).thenReturn("new title");

HasSelectionHandlers<Integer> contentBodySelection = mock(HasSelectionHandlers.class);
HasBeforeSelectionHandlers<Integer> contentBodyBeforeSelection = mock(HasBeforeSelectionHandlers.class);
HasClickHandlers documentListTabHandler = mock(HasClickHandlers.class);
HasClickHandlers editorTabHandler = mock(HasClickHandlers.class);
HasClickHandlers searchAndReplaceTabHandler = mock(HasClickHandlers.class);

when(display.getContentBodySelection()).thenReturn(contentBodySelection);
when(display.getContentBodyBeforeSelection()).thenReturn(contentBodyBeforeSelection);
when(display.getDocumentListTab()).thenReturn(documentListTabHandler);
when(display.getEditorTab()).thenReturn(editorTabHandler);
when(display.getSearchReplaceTab()).thenReturn(searchAndReplaceTabHandler);

presenter.onBind();

Expand All @@ -123,8 +127,9 @@ public void onBind()
WorkspaceId workspaceId = userWorkspace.getWorkspaceContext().getWorkspaceId();
String localeId = workspaceId.getLocaleId().getId();

verify(contentBodySelection).addSelectionHandler(isA(SelectionHandler.class));
verify(contentBodyBeforeSelection).addBeforeSelectionHandler(isA(BeforeSelectionHandler.class));
verify(documentListTabHandler).addClickHandler(isA(ClickHandler.class));
verify(editorTabHandler).addClickHandler(isA(ClickHandler.class));
verify(searchAndReplaceTabHandler).addClickHandler(isA(ClickHandler.class));

verify(display).setProjectLinkLabel(workspaceId.getProjectIterationId().getProjectSlug());
verify(display).setIterationFilesLabel(workspaceId.getProjectIterationId().getIterationSlug() + " [" + localeId + "]");
Expand Down

0 comments on commit c60263d

Please sign in to comment.