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
seanf committed May 29, 2012
2 parents 464b328 + 6939b32 commit 97175f6
Showing 1 changed file with 26 additions and 2 deletions.
Expand Up @@ -33,6 +33,7 @@
import com.google.common.collect.Collections2;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.ActionCell;
import com.google.gwt.cell.client.CheckboxCell;
import com.google.gwt.cell.client.ValueUpdater;
import com.google.gwt.cell.client.ActionCell.Delegate;
import com.google.gwt.cell.client.Cell.Context;
Expand Down Expand Up @@ -64,8 +65,8 @@
*/
public class SearchResultsDocumentTable extends CellTable<TransUnitReplaceInfo>
{
private static final int PREVIEW_COLUMN_INDEX = 3;
private static final int REPLACE_COLUMN_INDEX = 4;
private static final int PREVIEW_COLUMN_INDEX = 4;
private static final int REPLACE_COLUMN_INDEX = 5;

private static CellTableResources cellTableResources;
private WebTransMessages messages;
Expand All @@ -76,6 +77,7 @@ public class SearchResultsDocumentTable extends CellTable<TransUnitReplaceInfo>
private static String highlightString = null;
private static boolean requirePreview = true;

private CheckColumn checkboxColumn;
private TextColumn<TransUnitReplaceInfo> rowIndexColumn;
private Column<TransUnitReplaceInfo, List<String>> sourceColumn;
private Column<TransUnitReplaceInfo, TransUnitReplaceInfo> targetColumn;
Expand Down Expand Up @@ -108,6 +110,8 @@ public SearchResultsDocumentTable(Delegate<TransUnitReplaceInfo> previewDelegate
{
spinner = new ImageResourceRenderer().render(resources.spinner());
}

checkboxColumn = new CheckColumn(selectionModel);
rowIndexColumn = buildRowIndexColumn();
sourceColumn = buildSourceColumn();
targetColumn = buildTargetColumn();
Expand All @@ -116,13 +120,15 @@ public SearchResultsDocumentTable(Delegate<TransUnitReplaceInfo> previewDelegate

setWidth("100%", true);

addColumn(checkboxColumn, "");
addColumn(rowIndexColumn, messages.rowIndex());
addColumn(sourceColumn, messages.source());
addColumn(targetColumn, messages.target());
addColumn(previewButtonColumn, messages.actions());
// allowing preview header to refer to this also
addColumn(replaceButtonColumn);

setColumnWidth(checkboxColumn, 50.0, Unit.PX);
setColumnWidth(rowIndexColumn, 70.0, Unit.PX);
setColumnWidth(sourceColumn, 50.0, Unit.PCT);
setColumnWidth(targetColumn, 50.0, Unit.PCT);
Expand Down Expand Up @@ -249,6 +255,24 @@ else if (info.getTransUnit().getStatus() == ContentState.NeedReview)
};
}

private class CheckColumn extends Column<TransUnitReplaceInfo, Boolean>
{

private SelectionModel<TransUnitReplaceInfo> selectionModel;

public CheckColumn(SelectionModel<TransUnitReplaceInfo> selectionModel)
{
super(new CheckboxCell(true, false));
this.selectionModel = selectionModel;
}

@Override
public Boolean getValue(TransUnitReplaceInfo info)
{
return selectionModel.isSelected(info);
}

}

private class ActionColumn extends Column<TransUnitReplaceInfo, TransUnitReplaceInfo>
{
Expand Down

0 comments on commit 97175f6

Please sign in to comment.