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

Commit

Permalink
Fix bug: Ghost translation in search results: https://bugzilla.redhat…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Nov 9, 2011
1 parent 60cfdf9 commit a97b026
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
Expand Up @@ -36,6 +36,8 @@ public class TransFilterPresenter extends WidgetPresenter<TransFilterPresenter.D
public interface Display extends WidgetDisplay
{
HasValue<String> getFilterText();

boolean isFocused();
}

@Inject
Expand Down
Expand Up @@ -69,4 +69,10 @@ public TextBox getFilterText()
return filterTextBox.getTextBox();
}

@Override
public boolean isFocused()
{
return filterTextBox.isFocused();
}

}
Expand Up @@ -36,6 +36,7 @@
import org.zanata.webtrans.client.editor.CheckKeyImpl;
import org.zanata.webtrans.client.editor.DocumentEditorPresenter;
import org.zanata.webtrans.client.editor.HasPageNavigation;
import org.zanata.webtrans.client.editor.filter.TransFilterPresenter;
import org.zanata.webtrans.client.events.ButtonDisplayChangeEvent;
import org.zanata.webtrans.client.events.ButtonDisplayChangeEventHandler;
import org.zanata.webtrans.client.events.CopySourceEvent;
Expand Down Expand Up @@ -148,6 +149,8 @@ public interface Display extends WidgetDisplay, HasPageNavigation

private DocumentId documentId;

private TransFilterPresenter.Display transFilterDisplay;

private final CachingDispatchAsync dispatcher;
private final Identity identity;
private TransUnit selectedTransUnit;
Expand Down Expand Up @@ -552,7 +555,8 @@ else if (checkKey.isEnterKey())
{
if (selectedTransUnit != null)
{
if(!display.getTargetCellEditor().isCancelButtonFocused()){
if (!display.getTargetCellEditor().isCancelButtonFocused() && !transFilterDisplay.isFocused())
{
Log.info("open editor");
stopDefaultAction(event);
tableModelHandler.gotoRow(curRowIndex);
Expand Down Expand Up @@ -1117,4 +1121,9 @@ public void selectTransUnit(TransUnit transUnit)
eventBus.fireEvent(new TransUnitSelectionEvent(selectedTransUnit));
}
}

public void setTransFilterView(TransFilterPresenter.Display display)
{
transFilterDisplay = display;
}
}
Expand Up @@ -82,15 +82,16 @@ public TranslationEditorPresenter(Display display, EventBus eventBus, final Cach
@Override
protected void onBind()
{
transFilterPresenter.bind();
display.setFilterView(transFilterPresenter.getDisplay().asWidget());

tableEditorPresenter.bind();
tableEditorPresenter.setTransFilterView(transFilterPresenter.getDisplay());
display.setEditorView(tableEditorPresenter.getDisplay().asWidget());

transUnitNavigationPresenter.bind();
display.setTransUnitNavigation(transUnitNavigationPresenter.getDisplay().asWidget());

transFilterPresenter.bind();
display.setFilterView(transFilterPresenter.getDisplay().asWidget());

// undoRedoPresenter.bind();
// display.setUndoRedo(undoRedoPresenter.getDisplay().asWidget());
// Label spacer = new Label();
Expand Down
Expand Up @@ -5,8 +5,10 @@

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
Expand All @@ -32,6 +34,7 @@ interface Styles extends CssResource
String emptyBox();
}

private boolean isFocused;
String emptyText;

@UiField
Expand All @@ -55,6 +58,25 @@ public ClearableTextBox(final Resources resources, final UiMessages messages)
xButton.setVisible(!textBox.getValue().isEmpty());
textBox.setText(emptyText);
textBox.addStyleName(style.emptyBox());

textBox.addFocusHandler(new FocusHandler()
{
@Override
public void onFocus(FocusEvent event)
{
isFocused = true;
}
});

textBox.addBlurHandler(new BlurHandler()
{

@Override
public void onBlur(BlurEvent event)
{
isFocused = false;
}
});
}

@UiHandler("xButton")
Expand Down Expand Up @@ -108,4 +130,9 @@ public TextBox getTextBox()
return textBox;
}

public boolean isFocused()
{
return isFocused;
}

}

0 comments on commit a97b026

Please sign in to comment.