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

Commit

Permalink
Merge branch 'master' into rhbz757621
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Jan 5, 2012
2 parents eb45d0e + d139370 commit 2d21a73
Show file tree
Hide file tree
Showing 46 changed files with 475 additions and 207 deletions.
Expand Up @@ -4,7 +4,7 @@
xmlns:fui="urn:import:org.zanata.webtrans.client.ui">

<g:LayoutPanel>
<g:layer top="0px" height="20px" left="3px" right="3px">
<g:layer top="0px" height="20px" left="1px" right="3px">
<fui:ClearableTextBox ui:field="filterTextBox" />
</g:layer>
</g:LayoutPanel>
Expand Down
Expand Up @@ -65,17 +65,13 @@ public interface Display extends WidgetDisplay

void setSouthPanelViewVisible(boolean visible);

HasClickHandlers getHideSouthPanelButton();

HasClickHandlers getShowSouthPanelButton();

void setShowSouthPanelButtonVisible(boolean visible);

void setSidePanelViewVisible(boolean visible);

void updateWorkspaceUsersTitle(String title);

ToggleButton getToogleOptionsButton();

ToggleButton getToogleSouthButton();
}

private final DispatchAsync dispatcher;
Expand Down Expand Up @@ -177,50 +173,44 @@ public void onClick(ClickEvent event)
{
display.setSidePanelViewVisible(true);
display.getToogleOptionsButton().setTitle(messages.hideEditorOptions());
display.getToogleOptionsButton().setText(messages.showEditorOptionsLabel());
}
else if (!display.getToogleOptionsButton().isDown())
{
display.setSidePanelViewVisible(false);
display.getToogleOptionsButton().setTitle(messages.showEditorOptions());
display.getToogleOptionsButton().setText(messages.hideEditorOptionsLabel());
}
}
}));

registerHandler(display.getHideSouthPanelButton().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
display.setSouthPanelViewVisible(false);
transMemoryPresenter.unbind();
glossaryPresenter.unbind();
workspaceUsersPresenter.unbind();
display.setShowSouthPanelButtonVisible(true);
}
}));

display.setShowSouthPanelButtonVisible(false);
display.getShowSouthPanelButton().addClickHandler(new ClickHandler()
registerHandler(display.getToogleSouthButton().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
transMemoryPresenter.bind();
glossaryPresenter.bind();
workspaceUsersPresenter.bind();

display.setSouthPanelViewVisible(true);
display.setShowSouthPanelButtonVisible(false);
TransUnit tu = translationEditorPresenter.getSelectedTransUnit();
if (tu != null)
if (display.getToogleSouthButton().isDown())
{
transMemoryPresenter.showResultsFor(tu);
// glossaryPresenter.showResultsFor(tu);
display.setSouthPanelViewVisible(false);
transMemoryPresenter.unbind();
glossaryPresenter.unbind();
workspaceUsersPresenter.unbind();
}
else if (!display.getToogleSouthButton().isDown())
{
transMemoryPresenter.bind();
glossaryPresenter.bind();
workspaceUsersPresenter.bind();

display.setSouthPanelViewVisible(true);
TransUnit tu = translationEditorPresenter.getSelectedTransUnit();
if (tu != null)
{
transMemoryPresenter.showResultsFor(tu);
// glossaryPresenter.showResultsFor(tu);
}
}
}
});
}));


final CheckKey checkKey = new CheckKeyImpl(CheckKeyImpl.Context.Navigation);

Expand Down
Expand Up @@ -33,18 +33,6 @@ public interface Resources extends ClientBundle
@Source("org/zanata/webtrans/WebTransStyles.css")
WebTransStyles style();

@Source("org/zanata/webtrans/images/crystal_project/_16x16/actions/upArrow.png")
ImageResource upArrowButton();

@Source("org/zanata/webtrans/images/crystal_project/_16x16/actions/downArrow.png")
ImageResource downArrowButton();

@Source("org/zanata/webtrans/images/crystal_project/_16x16/actions/rightArrow.png")
ImageResource rightArrowButton();

// @Source("org/zanata/webtrans/images/configure.png")
// ImageResource configureButton();

@Source("org/zanata/webtrans/images/banner_bg.png")
DataResource bannerBackground();

Expand Down Expand Up @@ -75,12 +63,6 @@ public interface Resources extends ClientBundle
@Source("org/zanata/webtrans/images/prev_entry.png")
ImageResource prevEntry();

@Source("org/zanata/webtrans/images/next_fuzzy.png")
ImageResource nextFuzzy();

@Source("org/zanata/webtrans/images/prev_fuzzy.png")
ImageResource prevFuzzy();

@Source("org/zanata/webtrans/images/next_mode.png")
ImageResource nextState();

Expand All @@ -93,12 +75,6 @@ public interface Resources extends ClientBundle
@Source("org/zanata/webtrans/images/last_entry.png")
ImageResource lastEntry();

@Source("org/zanata/webtrans/images/next_approved.png")
ImageResource nextApproved();

@Source("org/zanata/webtrans/images/prev_approved.png")
ImageResource prevApproved();

@Source("org/zanata/webtrans/images/tm_view.png")
ImageResource tmViewButton();

Expand Down
Expand Up @@ -65,12 +65,18 @@ public interface WebTransMessages extends Messages
@DefaultMessage("Hide Editor Options")
String hideEditorOptions();

@DefaultMessage("Options >>")
@DefaultMessage("► Options")
String showEditorOptionsLabel();

@DefaultMessage("<< Options")
@DefaultMessage(" Options")
String hideEditorOptionsLabel();

@DefaultMessage("▼ Minimise")
String minimiseLabel();

@DefaultMessage("▲ Restore")
String restoreLabel();

@DefaultMessage("Find")
String findButton();

Expand Down
Expand Up @@ -9,8 +9,7 @@
display: inline;
vertical-align: middle;
border: 1px solid black;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
padding: 2px;
}
.xButton {
Expand All @@ -28,6 +27,7 @@
font-size: 12px;
padding: 0px;
margin: 0px;
outline:none;
}
</ui:style>

Expand Down
Expand Up @@ -18,25 +18,26 @@
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.TextBox;

public class Pager extends Composite implements HasPager
{

private static PagerUiBinder uiBinder = GWT.create(PagerUiBinder.class);

interface PagerUiBinder extends UiBinder<HTMLPanel, Pager>
interface PagerUiBinder extends UiBinder<HorizontalPanel, Pager>
{
}

@UiField
Image firstPage, lastPage, nextPage, prevPage;

@UiField
Image firstPageDisabled, lastPageDisabled, nextPageDisabled, prevPageDisabled;
@UiField(provided = true)
PushButton firstPage, lastPage, nextPage, prevPage;

@UiField
TextBox gotoPage;
Expand All @@ -55,6 +56,11 @@ interface PagerUiBinder extends UiBinder<HTMLPanel, Pager>

public Pager(final WebTransMessages messages, final Resources resources)
{
firstPage = new PushButton(new Image(resources.firstPageImage()));
lastPage = new PushButton(new Image(resources.lastPageImage()));
nextPage = new PushButton(new Image(resources.nextPageImage()));
prevPage = new PushButton(new Image(resources.prevPageImage()));

this.resources = resources;
initWidget(uiBinder.createAndBindUi(this));

Expand Down Expand Up @@ -111,10 +117,10 @@ private void refresh()
{
String page = pageCount == PAGECOUNT_UNKNOWN ? "" : "of " + pageCount;
pageCountLabel.setText(page);
setEnabled(firstPage, firstPageDisabled, currentPage != 1);
setEnabled(prevPage, prevPageDisabled, currentPage != 1);
setEnabled(nextPage, nextPageDisabled, currentPage != pageCount);
setEnabled(lastPage, lastPageDisabled, currentPage != pageCount && pageCount != PAGECOUNT_UNKNOWN);
setEnabled(firstPage, currentPage != 1);
setEnabled(prevPage, currentPage != 1);
setEnabled(nextPage, currentPage != pageCount);
setEnabled(lastPage, currentPage != pageCount && pageCount != PAGECOUNT_UNKNOWN);

gotoPage.setText(String.valueOf(currentPage));
}
Expand Down Expand Up @@ -189,10 +195,9 @@ else if (event.getSource() == prevPage)
}
};

private void setEnabled(Image enabledLink, Image disabledLink, boolean enabled)
private void setEnabled(PushButton button, boolean enabled)
{
enabledLink.setVisible(enabled);
disabledLink.setVisible(!enabled);
button.setEnabled(enabled);
}

public boolean isFocused()
Expand Down
Expand Up @@ -20,31 +20,57 @@
}

.inline-label {
display: inline;
margin-top:1px;
margin-right:3px;
margin-left:2px;

}

.link {
cursor: pointer;
margin-right:5px;
}

</ui:style>
.nav-button {
width:16px;
height:10px;
border-radius:3px;
margin-right:3px;
border-style:solid;
outline:none;
}

.nav-button img {
padding-bottom:2px;

<g:HTMLPanel>
}

.rootContainer {
margin:auto;
padding-top:5px;
}

.textBox {
border:1px inset #CCC;
outline:none;
border-radius:3px;
width:40px;
height:14px;
}


<g:Image ui:field="firstPage" resource="{resources.firstPageImage}" visible="false" styleName="{style.link}" />
<g:Image ui:field="firstPageDisabled" resource="{resources.firstPageDisabledImage}" visible="false" />

<g:Image ui:field="prevPage" resource="{resources.prevPageImage}" visible="false" styleName="{style.link}" />
<g:Image ui:field="prevPageDisabled" resource="{resources.prevPageDisabledImage}" visible="false" />

<g:TextBox ui:field="gotoPage" maxLength="8" width="40px" />
<g:Label ui:field="pageCountLabel" styleName="{style.inline-label}">of 0</g:Label>
</ui:style>

<g:HorizontalPanel styleName="{style.rootContainer}">

<g:PushButton ui:field="firstPage" addStyleNames="{style.nav-button}"/>
<g:PushButton ui:field="prevPage" addStyleNames="{style.nav-button}"/>

<g:TextBox ui:field="gotoPage" maxLength="8" styleName="{style.textBox}" />
<g:Label ui:field="pageCountLabel" styleName="{style.inline-label}">of 0</g:Label>

<g:Image ui:field="nextPage" resource="{resources.nextPageImage}" visible="false" styleName="{style.link}" />
<g:Image ui:field="nextPageDisabled" resource="{resources.nextPageDisabledImage}" visible="false" />

<g:Image ui:field="lastPage" resource="{resources.lastPageImage}" visible="false" styleName="{style.link}" />
<g:Image ui:field="lastPageDisabled" resource="{resources.lastPageDisabledImage}" visible="false" />
<g:PushButton ui:field="nextPage" addStyleNames="{style.nav-button}"/>
<g:PushButton ui:field="lastPage" addStyleNames="{style.nav-button}"/>

</g:HTMLPanel>
</g:HorizontalPanel>
</ui:UiBinder>
Expand Up @@ -36,6 +36,7 @@
import org.zanata.webtrans.shared.validation.action.HtmlXmlTagValidation;
import org.zanata.webtrans.shared.validation.action.NewlineLeadTrailValidation;
import org.zanata.webtrans.shared.validation.action.ValidationAction;
import org.zanata.webtrans.shared.validation.action.VariablesValidation;

import com.google.inject.Inject;

Expand All @@ -57,11 +58,14 @@ public ValidationService(final EventBus eventBus, final TableEditorMessages mess
this.eventBus = eventBus;
this.messages = messages;


HtmlXmlTagValidation htmlxmlValidation = new HtmlXmlTagValidation("HTML/XML tag", "Matching HTML/XML tag validation");
NewlineLeadTrailValidation newlineLeadTrailValidation = new NewlineLeadTrailValidation("Newline lead/trail", "Newline lead/trail validation");
VariablesValidation variablesValidation = new VariablesValidation("Variables check", "Variables check validation");

validationMap.put(htmlxmlValidation.getId(), htmlxmlValidation);
validationMap.put(newlineLeadTrailValidation.getId(), newlineLeadTrailValidation);
validationMap.put(variablesValidation.getId(), variablesValidation);
}

/**
Expand Down

0 comments on commit 2d21a73

Please sign in to comment.