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' of github.com:zanata/zanata
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Feb 15, 2012
2 parents 2799632 + c8873b1 commit 52b555e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
Expand Up @@ -36,6 +36,7 @@

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseDownEvent;
Expand Down Expand Up @@ -234,7 +235,7 @@ public void renderRowValue(TransUnit rowValue, ColumnDefinition<TransUnit, Trans
@Override
public void onMouseDown(MouseDownEvent event)
{
if (!isReadOnly)
if (!isReadOnly && event.getNativeButton() == NativeEvent.BUTTON_LEFT)
{
eventBus.fireEvent(new OpenEditorEvent(rowIndex));
}
Expand Down
Expand Up @@ -82,6 +82,8 @@ public interface Display extends WidgetDisplay
HasData<DocumentNode> getDocumentListTable();

ListDataProvider<DocumentNode> getDataProvider();

void renderTable();
}

private final DispatchAsync dispatcher;
Expand Down Expand Up @@ -122,6 +124,7 @@ public DocumentListPresenter(Display display, EventBus eventBus, WorkspaceContex
this.windowLocation = windowLocation;

dataProvider = display.getDataProvider();
display.renderTable();
nodes = new HashMap<DocumentId, DocumentNode>();
}

Expand Down Expand Up @@ -414,7 +417,7 @@ private void setList(ArrayList<DocumentInfo> sortedList)
}
Log.info("Time to create DocumentNodes: " + String.valueOf(System.currentTimeMillis() - start) + "ms");
display.setPageSize(dataProvider.getList().size());
dataProvider.addDataDisplay(display.getDocumentListTable());
dataProvider.refresh();
}

/**
Expand Down Expand Up @@ -488,4 +491,9 @@ private void setSelection(final DocumentId documentId)
display.getDocumentListTable().getSelectionModel().setSelected(node, true);
}
}

public ListDataProvider<DocumentNode> getDataProvider()
{
return dataProvider;
}
}
Expand Up @@ -68,19 +68,22 @@ interface DocumentListViewUiBinder extends UiBinder<LayoutPanel, DocumentListVie
@UiField
CheckBox exactSearchCheckBox;

@UiField(provided = true)
final CellTable<DocumentNode> documentListTable;
CellTable<DocumentNode> documentListTable;

private final Resources resources;
private final WebTransMessages messages;

private ListDataProvider<DocumentNode> dataProvider;

@Inject
public DocumentListView(Resources resources, WebTransMessages messages, UiMessages uiMessages, final CachingDispatchAsync dispatcher, EventBus eventBus)
{

this.resources = resources;
this.messages = messages;

filterTextBox = new ClearableTextBox(resources, uiMessages);
// TODO set this from the presenter if possible
dataProvider = new ListDataProvider<DocumentNode>();
documentListTable = DocumentListTable.initDocumentListTable(this, resources, messages, dataProvider);

initWidget(uiBinder.createAndBindUi(this));
}
Expand Down Expand Up @@ -133,4 +136,14 @@ public HasValue<Boolean> getExactSearchCheckbox()
{
return exactSearchCheckBox;
}

@Override
public void renderTable()
{
documentListTable = DocumentListTable.initDocumentListTable(this, resources, messages, dataProvider);
dataProvider.addDataDisplay(documentListTable);

documentScrollPanel.clear();
documentScrollPanel.add(documentListTable);
}
}
Expand Up @@ -33,9 +33,7 @@
</g:LayoutPanel>
</g:layer>
<g:layer top='50px' bottom="2px">
<g:ScrollPanel ui:field='documentScrollPanel'>
<c:CellTable ui:field='documentListTable' />
</g:ScrollPanel>
<g:ScrollPanel ui:field='documentScrollPanel'/>
</g:layer>

</g:LayoutPanel>
Expand Down

0 comments on commit 52b555e

Please sign in to comment.