Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@113472 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
20979efbc8
commit
c971a44c1d
|
@ -29,10 +29,12 @@ import com.google.gwt.event.logical.shared.HasSelectionHandlers;
|
||||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.event.shared.HandlerRegistration;
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
import com.sencha.gxt.core.client.XTemplates;
|
||||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
import com.sencha.gxt.data.shared.ListStore;
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
@ -74,10 +76,16 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
public class TabResourcesSelectionPanel extends ContentPanel implements
|
public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
HasSelectionHandlers<TabResource> {
|
HasSelectionHandlers<TabResource> {
|
||||||
|
|
||||||
|
interface NameTooltipTemplates extends XTemplates {
|
||||||
|
@XTemplate("<span qtip=\"{value}\" qtitle=\"Format {desc}\">{value}</span>")
|
||||||
|
SafeHtml format(String value, String desc);
|
||||||
|
|
||||||
protected Grid<TabResource> grid;
|
}
|
||||||
protected ResourceBundle res;
|
|
||||||
protected Menu contextMenu;
|
|
||||||
|
private Grid<TabResource> grid;
|
||||||
|
private ResourceBundle res;
|
||||||
|
private Menu contextMenu;
|
||||||
|
|
||||||
private TabResource removableTR;
|
private TabResource removableTR;
|
||||||
|
|
||||||
|
@ -127,9 +135,51 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
TabResourcesProperties properties = GWT
|
TabResourcesProperties properties = GWT
|
||||||
.create(TabResourcesProperties.class);
|
.create(TabResourcesProperties.class);
|
||||||
|
|
||||||
|
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
|
||||||
|
properties.id());
|
||||||
|
|
||||||
|
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||||
|
|
||||||
|
public void onKeyUp(KeyUpEvent event) {
|
||||||
|
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
||||||
|
store.applyFilters();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.addFilter(new StoreFilter<TabResource>() {
|
||||||
|
|
||||||
|
public boolean select(Store<TabResource> store, TabResource parent,
|
||||||
|
TabResource item) {
|
||||||
|
String searchTerm = searchField.getCurrentValue();
|
||||||
|
if (searchTerm == null)
|
||||||
|
return true;
|
||||||
|
return TabResourcesSelectionPanel.this.select(item, searchTerm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.setEnableFilters(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
||||||
properties.name(), 90, "Name");
|
properties.name(), 90, "Name");
|
||||||
|
/*
|
||||||
|
nameColumn.setCell(
|
||||||
|
new AbstractCell<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||||
|
TabResource tabResource=store.get(context.getIndex());
|
||||||
|
|
||||||
|
final NameTooltipTemplates nameToolTipTemplates = GWT
|
||||||
|
.create(NameTooltipTemplates.class);
|
||||||
|
sb.append(nameToolTipTemplates.format(value, tabResource.getDescription()));
|
||||||
|
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
||||||
properties.tabResourceType(), 30, "Type");
|
properties.tabResourceType(), 30, "Type");
|
||||||
ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
|
ColumnConfig<TabResource, String> tableTypeNameColumn = new ColumnConfig<TabResource, String>(
|
||||||
|
@ -175,30 +225,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
|
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
|
||||||
|
|
||||||
|
|
||||||
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
|
|
||||||
properties.id());
|
|
||||||
|
|
||||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
|
||||||
|
|
||||||
public void onKeyUp(KeyUpEvent event) {
|
|
||||||
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
|
||||||
store.applyFilters();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
store.addFilter(new StoreFilter<TabResource>() {
|
|
||||||
|
|
||||||
public boolean select(Store<TabResource> store, TabResource parent,
|
|
||||||
TabResource item) {
|
|
||||||
String searchTerm = searchField.getCurrentValue();
|
|
||||||
if (searchTerm == null)
|
|
||||||
return true;
|
|
||||||
return TabResourcesSelectionPanel.this.select(item, searchTerm);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
store.setEnableFilters(true);
|
|
||||||
|
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<TabResource>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<TabResource>>() {
|
RpcProxy<ListLoadConfig, ListLoadResult<TabResource>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<TabResource>>() {
|
||||||
|
|
||||||
public void load(ListLoadConfig loadConfig,
|
public void load(ListLoadConfig loadConfig,
|
||||||
|
@ -224,6 +251,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
grid.setLoader(loader);
|
grid.setLoader(loader);
|
||||||
|
|
Loading…
Reference in New Issue