Skip to content
Snippets Groups Projects
Commit 14acd83a authored by buczekp's avatar buczekp
Browse files

[LMS-1358] fixed 'Custom Column Filter buggy'

SVN: 14334
parent 83168c67
No related branches found
No related tags found
No related merge requests found
...@@ -182,7 +182,7 @@ public class HelpPageIdentifier ...@@ -182,7 +182,7 @@ public class HelpPageIdentifier
// If there is no message for the key return the key as the title, // If there is no message for the key return the key as the title,
// otherwise return the message. // otherwise return the message.
return messageProvider.containsKey(messageKey) ? messageProvider.getMessage(messageKey) return messageProvider.containsKey(messageKey) ? messageProvider.getMessage(messageKey)
: messageKey; // TODO 2010-01-12, Piotr Buczek: is it better to return null? : messageKey;
} }
} }
......
...@@ -72,7 +72,7 @@ public class AttachmentFileUploadField extends FileUploadField ...@@ -72,7 +72,7 @@ public class AttachmentFileUploadField extends FileUploadField
} }
private String getFilePathValue() private String getFilePathValue()
{// FIXME: correct? {// FIXME: this is only relative path, not absolute
return getFileInput().getValue(); // its not only file name, but full file path return getFileInput().getValue(); // its not only file name, but full file path
} }
......
...@@ -205,6 +205,8 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod ...@@ -205,6 +205,8 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
// finished. // finished.
private ResultSetFetchConfig<String> pendingFetchConfigOrNull; private ResultSetFetchConfig<String> pendingFetchConfigOrNull;
private boolean disableFetch = false;
private IDataRefreshCallback refreshCallback; private IDataRefreshCallback refreshCallback;
private LayoutContainer bottomToolbars; private LayoutContainer bottomToolbars;
...@@ -379,10 +381,6 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod ...@@ -379,10 +381,6 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
{ {
if (resultSetKeyOrNull != null && pendingFetchConfigOrNull == null) if (resultSetKeyOrNull != null && pendingFetchConfigOrNull == null)
{ {
// TODO 2009-09-16, Piotr Buczek: reload of data is not needed in some cases
// - when filters with no text are removed,
// - when new filters are created,
// but when filter with text is removed it is needed.
ResultSetFetchConfig<String> fetchConfig = ResultSetFetchConfig<String> fetchConfig =
ResultSetFetchConfig.createFetchFromCache(resultSetKeyOrNull); ResultSetFetchConfig.createFetchFromCache(resultSetKeyOrNull);
reloadData(fetchConfig); reloadData(fetchConfig);
...@@ -504,7 +502,7 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod ...@@ -504,7 +502,7 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
{ {
if (pendingFetchConfigOrNull == null) if (pendingFetchConfigOrNull == null)
{ {
// this can happen when we user wants to sort data - the refresh method is not called // this can happen when user wants to sort data - the refresh method is not called
if (resultSetKeyOrNull == null) if (resultSetKeyOrNull == null)
{ {
// data are not yet cached, so we ignore this call - should not really happen // data are not yet cached, so we ignore this call - should not really happen
...@@ -911,11 +909,18 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod ...@@ -911,11 +909,18 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
pagingToolbar.disableExportButton(); pagingToolbar.disableExportButton();
pagingToolbar.updateDefaultConfigButton(false); pagingToolbar.updateDefaultConfigButton(false);
// We don't want to fetch data from cache when filters are reset.
// refresh() invokes fetching of data from DB and would be ignored because of a
// pending fetch.
disableFetch();
// Need to reset filter fields *before* refreshing the grid so the list can be // Need to reset filter fields *before* refreshing the grid so the list can be
// correctly retrieved // correctly retrieved
filterToolbar.resetFilterFields(); filterToolbar.resetFilterFields();
filterToolbar.resetFilterSelection(); filterToolbar.resetFilterSelection();
enableFetch();
// export and config buttons are enabled when ListEntitiesCallback is complete // export and config buttons are enabled when ListEntitiesCallback is complete
refresh(); refresh();
...@@ -1056,10 +1061,12 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod ...@@ -1056,10 +1061,12 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
// Refreshes the data, does not clear the cache. Does not change the column model. // Refreshes the data, does not clear the cache. Does not change the column model.
private void reloadData(ResultSetFetchConfig<String> resultSetFetchConfig) private void reloadData(ResultSetFetchConfig<String> resultSetFetchConfig)
{ {
if (pendingFetchConfigOrNull != null) if (isFetchDisabled() || pendingFetchConfigOrNull != null)
{ {
debug("Cannot reload the data with the mode '" + resultSetFetchConfig final String reason =
+ "', there is an unfinished request already: " + pendingFetchConfigOrNull); isFetchDisabled() ? "fetch is disabled"
: "there is an unfinished request already: " + pendingFetchConfigOrNull;
debug("Cannot reload the data with the mode '" + resultSetFetchConfig + "'; " + reason);
return; return;
} }
pendingFetchConfigOrNull = resultSetFetchConfig; pendingFetchConfigOrNull = resultSetFetchConfig;
...@@ -1352,6 +1359,26 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod ...@@ -1352,6 +1359,26 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
return new InternalLinkCellRenderer(); return new InternalLinkCellRenderer();
} }
protected final boolean isFetchDisabled()
{
return disableFetch;
}
protected final void disableFetch()
{
setDisableFetch(true);
}
protected final void enableFetch()
{
setDisableFetch(false);
}
private void setDisableFetch(boolean disableFetch)
{
this.disableFetch = disableFetch;
}
// ------- generic static helpers // ------- generic static helpers
private static List<String> getFilteredColumnIds(List<ColumnDataModel> result) private static List<String> getFilteredColumnIds(List<ColumnDataModel> result)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment