Author: hoang_to
Date: 2010-02-09 01:28:52 -0500 (Tue, 09 Feb 2010)
New Revision: 1577
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageBrowser.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java
Log:
GTNPORTAL-587: Still show messsage when create new page in add new node
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageBrowser.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageBrowser.gtmpl 2010-02-09
05:36:44 UTC (rev 1576)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageBrowser.gtmpl 2010-02-09
06:28:52 UTC (rev 1577)
@@ -1,4 +1,4 @@
-<% uicomponent.defaultValue(uicomponent.getLastQuery()); %>
+<% uicomponent.feedDataWithQuery(uicomponent.getLastQuery()); %>
<div class="UIPageBrowser"
id="<%=uicomponent.getId();%>">
<%/*Begin UIPageBrowser Content*/%>
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2010-02-09
05:36:44 UTC (rev 1576)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2010-02-09
06:28:52 UTC (rev 1577)
@@ -126,47 +126,50 @@
return lastQuery_;
}
- public void defaultValue(Query<Page> query) throws Exception
+ /**
+ * Update data feed in UIRepeater with a given query.
+ * Returns false if no result is found, true other wise
+ *
+ * @param query
+ * @return
+ * @throws Exception
+ */
+ public boolean feedDataWithQuery(Query<Page> query) throws Exception
{
lastQuery_ = query;
- // UIGrid uiGrid = findFirstComponentOfType(UIGrid.class);
- // UIPageIterator pageIterator = uiGrid.getUIPageIterator();
+
UIVirtualList virtualList = getChild(UIVirtualList.class);
- DataStorage service = getApplicationComponent(DataStorage.class);
- if (lastQuery_ == null)
+ DataStorage dataStorage = getApplicationComponent(DataStorage.class);
+ if(lastQuery_ == null)
{
lastQuery_ = new Query<Page>(null, null, null, null, Page.class);
}
-/*
- try
+ virtualList.dataBind(new PageQueryAccessList(lastQuery_, 10));
+
+ UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
+ PageList datasource = repeater.getDataSource();
+
+ if (datasource.getAvailable() > 0)
{
-*/
- //pagelist.setPageSize(10);
- //pageIterator.setPageList(pagelist);
- virtualList.dataBind(new PageQueryAccessList(lastQuery_, 10));
-/*
+ return true;
}
- catch (RepositoryException e)
+ else
{
- //pageIterator.setPageList(new ObjectPageList(new ArrayList<String>(),
0));
- virtualList.dataBind(new ObjectPageList(new ArrayList<String>(), 0));
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UISearchForm.msg.empty",
null));
-
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
- return;
+ return false;
}
-*/
-
-
- UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
- PageList datasource = repeater.getDataSource();
- if (datasource.getAvailable() > 0)
- return;
+ }
+
+ /**
+ * Show a popup informing that no result available for the last query
+ *
+ */
+ public static void showNoResultMessagePopup()
+ {
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UISearchForm.msg.empty",
null));
Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
}
-
+
public void quickSearch(UIFormInputSet quickSearchInput) throws Exception
{
UIFormStringInput input = (UIFormStringInput)quickSearchInput.getChild(0);
@@ -181,8 +184,14 @@
else if (selectBoxValue.equals("ownerId"))
query.setOwnerId(value);
query.setName(null);
+
lastQuery_ = query;
- defaultValue(lastQuery_);
+ boolean dataAvailable = feedDataWithQuery(lastQuery_);
+ if(!dataAvailable)
+ {
+ showNoResultMessagePopup();
+ }
+
if (this.<UIComponent> getParent() instanceof UIPopupWindow)
{
UIPopupWindow popupWindow = getParent();
@@ -224,19 +233,21 @@
{
}
- void reset() throws Exception
+ /*
+ public void reset() throws Exception
{
UIVirtualList virtualList = getChild(UIVirtualList.class);
UIRepeater repeater = (UIRepeater)virtualList.getDataFeed();
LazyPageList datasource = (LazyPageList)repeater.getDataSource();
int currentPage = datasource.getCurrentPage();
- defaultValue(null);
+ feedDataWithQuery(null);
if (currentPage > datasource.getAvailablePage())
currentPage = datasource.getAvailablePage();
if (currentPage > 0)
datasource.getPage(currentPage);
}
-
+ */
+
static public class DeleteActionListener extends EventListener<UIPageBrowser>
{
public void execute(Event<UIPageBrowser> event) throws Exception
@@ -277,7 +288,11 @@
}
else
{
- uiPageBrowser.defaultValue(uiPageBrowser.getLastQuery());
+ boolean dataAvailable =
uiPageBrowser.feedDataWithQuery(uiPageBrowser.getLastQuery());
+ if(!dataAvailable)
+ {
+ showNoResultMessagePopup();
+ }
if (currentPage > datasource.getAvailablePage())
currentPage = datasource.getAvailablePage();
datasource.getPage(currentPage);
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java 2010-02-09
05:36:44 UTC (rev 1576)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java 2010-02-09
06:28:52 UTC (rev 1577)
@@ -137,7 +137,7 @@
uiApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.NoPermission", new String[]{id}));;
}
uiPageSelector.setValue(id);
- uiPageBrowser.defaultValue(null);
+ uiPageBrowser.feedDataWithQuery(null);
UIForm uiForm = uiPageSelector.getAncestorOfType(UIForm.class);
if (uiForm != null)
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java 2010-02-09
05:36:44 UTC (rev 1576)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector2.java 2010-02-09
06:28:52 UTC (rev 1577)
@@ -167,7 +167,7 @@
uiApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.NoPermission", new String[]{id}));;
}
uiPageSelector.setValue(id);
- uiPageBrowser.defaultValue(null);
+ uiPageBrowser.feedDataWithQuery(null);
UIForm uiForm = uiPageSelector.getAncestorOfType(UIForm.class);
if (uiForm != null)
Show replies by date