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

Commit

Permalink
Browse files Browse the repository at this point in the history
prevent webtrans doclist colun header clicks from opening editor
  • Loading branch information
davidmason committed Aug 24, 2011
1 parent d926af1 commit 256fe12
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
Expand Up @@ -7,6 +7,7 @@
import org.zanata.webtrans.client.Resources;
import org.zanata.webtrans.client.TransUnitCountGraph;
import org.zanata.webtrans.client.WebTransMessages;
import org.zanata.webtrans.shared.util.ObjectUtil;

import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.IconCellDecorator;
Expand All @@ -20,7 +21,6 @@
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.Event;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SingleSelectionModel;
Expand Down Expand Up @@ -141,7 +141,20 @@ public String getValue(DocumentNode object)

public static CellTable<DocumentNode> initDocumentListTable(final DocumentListView documentListView, final Resources resources, final WebTransMessages messages, final ListDataProvider<DocumentNode> dataProvider)
{
final SingleSelectionModel<DocumentNode> selectionModel = new SingleSelectionModel<DocumentNode>();

final SingleSelectionModel<DocumentNode> selectionModel = new SingleSelectionModel<DocumentNode>()
{
@Override
public void setSelected(DocumentNode object, boolean selected)
{
if (selected && ObjectUtil.equals(object, super.getSelectedObject()))
{
// fire event on re-selection
SelectionChangeEvent.fire(this);
}
super.setSelected(object, selected);
}
};
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler()
{
public void onSelectionChange(SelectionChangeEvent event)
Expand All @@ -154,18 +167,7 @@ public void onSelectionChange(SelectionChangeEvent event)
}
});

final CellTable<DocumentNode> documentListTable = new CellTable<DocumentNode>()
{
@Override
public void onBrowserEvent2(Event event)
{
if (event.getType().equals("click"))
{
SelectionChangeEvent.fire(selectionModel);
}
super.onBrowserEvent2(event);
}
};
final CellTable<DocumentNode> documentListTable = new CellTable<DocumentNode>();

documentListTable.setStylePrimaryName("DocumentListTable");
documentListTable.setSelectionModel(selectionModel);
Expand Down
@@ -0,0 +1,9 @@
package org.zanata.webtrans.shared.util;

public class ObjectUtil
{
public static boolean equals(Object object1, Object object2)
{
return (object1 == null ? object2 == null : object1.equals(object2));
}
}

0 comments on commit 256fe12

Please sign in to comment.