This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Patrick Huang
committed
May 17, 2013
1 parent
5ae7f3f
commit ca1bbf2
Showing
11 changed files
with
156 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
zanata-war/src/main/java/org/zanata/webtrans/client/ui/ReviewContentWidget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package org.zanata.webtrans.client.ui; | ||
|
||
import java.util.List; | ||
|
||
import org.zanata.webtrans.client.view.NeedsRefresh; | ||
import com.allen_sauer.gwt.log.client.Log; | ||
import com.google.gwt.core.client.GWT; | ||
import com.google.gwt.resources.client.CssResource; | ||
import com.google.gwt.uibinder.client.UiBinder; | ||
import com.google.gwt.uibinder.client.UiField; | ||
import com.google.gwt.user.client.ui.Composite; | ||
import com.google.gwt.user.client.ui.HTMLPanel; | ||
import com.google.gwt.user.client.ui.HasText; | ||
import com.google.gwt.user.client.ui.Widget; | ||
|
||
public class ReviewContentWidget extends Composite implements ReviewContentWrapper | ||
{ | ||
private static ReviewContentWidgetUiBinder ourUiBinder = GWT.create(ReviewContentWidgetUiBinder.class); | ||
|
||
@UiField | ||
HTMLPanel root; | ||
@UiField | ||
CodeMirrorReadOnlyWidget textArea; | ||
@UiField | ||
Style style; | ||
|
||
public ReviewContentWidget() | ||
{ | ||
initWidget(ourUiBinder.createAndBindUi(this)); | ||
} | ||
|
||
@Override | ||
public void updateValidationWarning(List<String> errors) | ||
{ | ||
if (errors.isEmpty()) | ||
{ | ||
root.removeStyleName(style.hasValidationError()); | ||
} | ||
else | ||
{ | ||
Log.info("add error to root"); | ||
root.addStyleName(style.hasValidationError()); | ||
} | ||
} | ||
|
||
@Override | ||
public String getText() | ||
{ | ||
return textArea.getText(); | ||
} | ||
|
||
@Override | ||
public void setText(String text) | ||
{ | ||
textArea.setText(text); | ||
} | ||
|
||
@Override | ||
public void refresh() | ||
{ | ||
textArea.refresh(); | ||
} | ||
|
||
interface ReviewContentWidgetUiBinder extends UiBinder<HTMLPanel, ReviewContentWidget> | ||
{ | ||
} | ||
|
||
interface Style extends CssResource | ||
{ | ||
|
||
String hasValidationError(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
zanata-war/src/main/java/org/zanata/webtrans/client/ui/ReviewContentWidget.ui.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' | ||
xmlns:fui="urn:import:org.zanata.webtrans.client.ui" | ||
xmlns:g='urn:import:com.google.gwt.user.client.ui'> | ||
<ui:style field="style" type="org.zanata.webtrans.client.ui.ReviewContentWidget.Style"> | ||
.hasValidationError { | ||
border: 1px solid #ff0000; | ||
} | ||
</ui:style> | ||
|
||
<g:HTMLPanel styleName="TableEditorCell-Target" ui:field="root" width="99%" height="100%"> | ||
<fui:CodeMirrorReadOnlyWidget ui:field="textArea" /> | ||
|
||
</g:HTMLPanel> | ||
</ui:UiBinder> |
10 changes: 10 additions & 0 deletions
10
zanata-war/src/main/java/org/zanata/webtrans/client/ui/ReviewContentWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.zanata.webtrans.client.ui; | ||
|
||
import org.zanata.webtrans.client.view.NeedsRefresh; | ||
import com.google.gwt.user.client.ui.HasText; | ||
import com.google.inject.ImplementedBy; | ||
|
||
@ImplementedBy(ReviewContentWidget.class) | ||
public interface ReviewContentWrapper extends HasUpdateValidationWarning, HasText, NeedsRefresh | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters