Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@90715 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-01-29 19:17:07 +00:00
parent 5b987104e6
commit 47b34ff37e
4 changed files with 1403 additions and 106 deletions

View File

@ -254,3 +254,131 @@ Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 3 seconds)
60% complete (ETR: 3 seconds)
70% complete (ETR: 2 seconds)
80% complete (ETR: 1 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 19.89 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
50% complete (ETR: 5 seconds)
50% complete (ETR: 5 seconds)
50% complete (ETR: 5 seconds)
50% complete (ETR: 5 seconds)
50% complete (ETR: 5 seconds)
50% complete (ETR: 5 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 2 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 15.85 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
50% complete (ETR: 4 seconds)
60% complete (ETR: 4 seconds)
70% complete (ETR: 2 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 14.67 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
10% complete (ETR: 27 seconds)
10% complete (ETR: 27 seconds)
20% complete (ETR: 23 seconds)
30% complete (ETR: 17 seconds)
40% complete (ETR: 13 seconds)
50% complete (ETR: 10 seconds)
60% complete (ETR: 9 seconds)
70% complete (ETR: 6 seconds)
80% complete (ETR: 4 seconds)
90% complete (ETR: 2 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 18.63 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes

10
pom.xml
View File

@ -152,7 +152,15 @@
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -5,7 +5,6 @@ import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import com.allen_sauer.gwt.log.client.Log;
@ -20,14 +19,9 @@ import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.IdentityValueProvider;
import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.data.client.loader.RpcProxy;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.Store;
import com.sencha.gxt.data.shared.Store.StoreFilter;
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
import com.sencha.gxt.data.shared.loader.ListLoadResult;
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
import com.sencha.gxt.data.shared.loader.PagingLoadConfig;
import com.sencha.gxt.data.shared.loader.PagingLoadResult;
@ -35,12 +29,9 @@ import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
import com.sencha.gxt.data.shared.loader.PagingLoader;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.TextField;
@ -49,6 +40,7 @@ import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid;
import com.sencha.gxt.widget.core.client.grid.LiveGridView;
import com.sencha.gxt.widget.core.client.grid.LiveToolItem;
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
@ -56,7 +48,7 @@ public class DialogCodelistSelection extends Window {
protected static final int WIDTH = 550;
protected static final int HEIGHT = 520;
protected static final int CACHE_SIZE = 200;
private static final TabResourcesProperties properties = GWT
.create(TabResourcesProperties.class);
@ -68,6 +60,8 @@ public class DialogCodelistSelection extends Window {
properties.date(), 50, "Date");
protected Grid<TabResource> grid;
protected ExtendedLiveGridView liveGridView;
protected ResourceBundle res;
public DialogCodelistSelection() {
@ -76,7 +70,7 @@ public class DialogCodelistSelection extends Window {
setHeight(HEIGHT);
res = ResourceBundle.INSTANCE;
setBodyBorder(false);
setResizable(false);
setResizable(true);
setHeadingText("Select Codelist");
FramedPanel panel = new FramedPanel();
@ -85,14 +79,14 @@ public class DialogCodelistSelection extends Window {
VerticalLayoutContainer v = new VerticalLayoutContainer();
// ////
// Search
ToolBar toolBar = new ToolBar();
toolBar.add(new LabelToolItem("Search: "));
final TextField searchField = new TextField();
toolBar.add(searchField);
TextButton btnReload = new TextButton();
// btnReload.setText("Reload");
btnReload.setText("Reload");
btnReload.setIcon(res.refresh());
btnReload.setToolTip("Reload");
toolBar.add(btnReload);
@ -105,52 +99,42 @@ public class DialogCodelistSelection extends Window {
List<ColumnConfig<TabResource, ?>> columns = Arrays
.<ColumnConfig<TabResource, ?>> asList(nameColumn,
agencyColumn, dateColumn);
ColumnConfig<TabResource, ?> autoexpandColumn = nameColumn;
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
final ExtendedListStore<TabResource> store = new ExtendedListStore<TabResource>(
final ListStore<TabResource> store = new ListStore<TabResource>(
properties.id());
searchField.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
Log.trace("searchTerm: " + searchField.getCurrentValue());
store.applyFilters();
//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 DialogCodelistSelection.this.select(item, searchTerm);
}
});
store.setEnableFilters(true);
RpcProxy<PagingLoadConfig, PagingLoadResult<TabResource>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<TabResource>>() {
public void load(PagingLoadConfig loadConfig,
final AsyncCallback<PagingLoadResult<TabResource>> callback) {
loadData(loadConfig, callback);
}
};
final PagingLoader<PagingLoadConfig, PagingLoadResult<TabResource>> loader = new PagingLoader<PagingLoadConfig, PagingLoadResult<TabResource>>(
proxy);
loader.setRemoteSort(true);
loader.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, TabResource, PagingLoadResult<TabResource>>(
store));
final LiveGridView<TabResource> liveGridView = new LiveGridView<TabResource>();
liveGridView = new ExtendedLiveGridView();
liveGridView.setForceFit(true);
liveGridView.setEmptyText("No Matching Results.");
liveGridView.setCacheSize(CACHE_SIZE);
liveGridView.setEmptyText("No Matching Results.");
liveGridView.setCacheSize(CACHE_SIZE);
grid = new Grid<TabResource>(store, cm) {
@Override
@ -163,15 +147,11 @@ public class DialogCodelistSelection extends Window {
});
}
};
sm.setSelectionMode(SelectionMode.SINGLE);
grid.setLoader(loader);
grid.setSelectionModel(sm);
grid.setView(liveGridView);
//grid.getView().setAutoExpandColumn(autoexpandColumn);
//grid.getView().setStripeRows(false);
//grid.getView().setColumnLines(true);
//grid.getView().setAutoFill(true);
grid.setBorders(false);
grid.setLoadMask(true);
grid.setColumnReordering(true);
@ -184,8 +164,14 @@ public class DialogCodelistSelection extends Window {
btnReload.addSelectHandler(sh);
v.add(toolBar, new VerticalLayoutData(1, -1));
ToolBar baseToolBar = new ToolBar();
baseToolBar.add(new LiveToolItem(grid));
baseToolBar.addStyleName(ThemeStyles.getStyle().borderTop());
baseToolBar.getElement().getStyle().setProperty("borderBottom", "none");
v.add(toolBar, new VerticalLayoutData(-1, -1));
v.add(grid, new VerticalLayoutData(1, 1));
v.add(baseToolBar, new VerticalLayoutData(1, 25));
panel.add(v);
panel.addButton(new TextButton("Select"));
@ -218,73 +204,36 @@ public class DialogCodelistSelection extends Window {
*
* });
*/
ArrayList<TabResource> trs = new ArrayList<TabResource>();
ArrayList<TabResource> trs = new ArrayList<TabResource>(1000);
int totalLength = loadConfig.getOffset() + loadConfig.getLimit();
int offset = loadConfig.getOffset();
Log.debug("Offset: " + offset);
Log.debug("Limit:" + loadConfig.getLimit());
Log.debug("TotalLength:" + totalLength);
int cur = 0;
for (int i = offset; i < totalLength; i++) {
TabResource tr = new TabResource();
tr.setId(String.valueOf(i));
tr.setName("Number" + i);
tr.setAgency("Agency" + i);
tr.setDate("2013/11/01");
trs.add(tr);
try {
cur = i + 1;
TabResource tr = new TabResource();
tr.setId(String.valueOf(i));
tr.setName("Number" + cur);
tr.setAgency("Agency" + cur);
tr.setDate("2013/11/01");
trs.add(tr);
} catch (IndexOutOfBoundsException e) {
Log.debug("OutOfBounds size:" + trs.size() + " index: " + i
+ " Error:" + e.getMessage() + "\n");
}
}
callback.onSuccess(new PagingLoadResultBean<TabResource>(trs, totalLength,
callback.onSuccess(new PagingLoadResultBean<TabResource>(trs, 1000,
offset));
}
protected boolean select(TabResource item, String searchTerm) {
if (item.getName() != null
&& item.getName().toLowerCase()
.contains(searchTerm.toLowerCase()))
return true;
if (item.getAgency() != null
&& item.getAgency().toLowerCase()
.contains(searchTerm.toLowerCase()))
return true;
if (item.getDate() != null
&& item.getDate().toLowerCase()
.contains(searchTerm.toLowerCase()))
return true;
return false;
}
protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback<ListLoadResult<TabResource>> callback) {
TDGWTServiceAsync.INSTANCE
.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
public void onFailure(Throwable caught) {
callback.onFailure(caught);
AlertMessageBox d = new AlertMessageBox("Error!",
"Details: " + caught.getLocalizedMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
//
}
});
d.show();
}
public void onSuccess(ArrayList<TabResource> result) {
Log.debug("loaded " + result.size()
+ " TabularResources");
/*
* for(TabResource tr:result){ Log.debug("TR:"+tr); }
*/
callback.onSuccess(new ListLoadResultBean<TabResource>(
result));
}
});
}
protected HandlerRegistration addSelectionHandler(
SelectionHandler<TabResource> handler) {
SelectionHandler<TabResource> hand = new SelectionHandler<TabResource>() {
@ -303,16 +252,14 @@ public class DialogCodelistSelection extends Window {
return grid.getSelectionModel().getSelectedItem();
}
protected class ExtendedListStore<M> extends ListStore<M> {
protected class ExtendedLiveGridView extends LiveGridView<TabResource> {
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
super(keyProvider);
@Override
public void refresh(boolean headerToo) {
preventScrollToTopOnRefresh = true;
super.refresh(headerToo);
}
public void applyFilters() {
super.applyFilters();
}
}
};
}

File diff suppressed because it is too large Load Diff