Author: norman
Date: Tue Nov 10 18:51:30 2009
New Revision: 834596
URL: http://svn.apache.org/viewvc?rev=834596&view=rev
Log:
Forward/Backward button now work for page navigation (mailtable)
Added:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/IMAPMessageListPresenterPlace.java
Added:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java?rev=834596&view=auto
==============================================================================
---
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java
(added)
+++
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java
Tue Nov 10 18:51:30 2009
@@ -0,0 +1,37 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.hupa.client;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+
+
+
+public class HandlerRegistrationAdapter implements HandlerRegistration{
+ com.google.gwt.gen2.event.shared.HandlerRegistration registration;
+
+ public
HandlerRegistrationAdapter(com.google.gwt.gen2.event.shared.HandlerRegistration
registration) {
+ this.registration = registration;
+ }
+
+
+ public void removeHandler() {
+ registration.removeHandler();
+ }
+}
\ No newline at end of file
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java?rev=834596&r1=834595&r2=834596&view=diff
==============================================================================
---
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
(original)
+++
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
Tue Nov 10 18:51:30 2009
@@ -26,6 +26,7 @@
import net.customware.gwt.presenter.client.widget.WidgetDisplay;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;
+import org.apache.hupa.client.HandlerRegistrationAdapter;
import org.apache.hupa.client.HupaCallback;
import org.apache.hupa.client.widgets.HasDialog;
import org.apache.hupa.shared.data.IMAPFolder;
@@ -49,12 +50,16 @@
import org.apache.hupa.shared.rpc.SetFlag;
import org.apache.hupa.widgets.ui.HasEnable;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.gen2.event.shared.HandlerRegistration;
+import com.google.gwt.gen2.table.event.client.HasPageChangeHandlers;
import com.google.gwt.gen2.table.event.client.HasPageLoadHandlers;
import com.google.gwt.gen2.table.event.client.HasRowSelectionHandlers;
+import com.google.gwt.gen2.table.event.client.PageChangeEvent;
+import com.google.gwt.gen2.table.event.client.PageChangeHandler;
import com.google.gwt.gen2.table.event.client.RowSelectionEvent;
import com.google.gwt.gen2.table.event.client.RowSelectionHandler;
import com.google.gwt.user.client.ui.SourcesTableEvents;
@@ -95,6 +100,9 @@
public HasEnable getMarkUnseenEnable();
public HasClickHandlers getRefreshClick();
public void redraw();
+ public HasPageChangeHandlers getDataTablePageChange();
+ public void goToPage(int page);
+ public int getCurrentPage();
}
private ArrayList<HandlerRegistration> regList = new
ArrayList<HandlerRegistration>();
@@ -284,7 +292,13 @@
}
}));
-
+ registerHandler(new
HandlerRegistrationAdapter(display.getDataTablePageChange().addPageChangeHandler(new
PageChangeHandler() {
+
+ public void onPageChange(PageChangeEvent event) {
+ firePresenterRevealedEvent(true);
+ }
+
+ })));
display.addTableListener(tableListener);
}
@@ -342,8 +356,6 @@
@Override
protected void onRevealDisplay() {
- //display.reset();
- //display.deselectAllMessages();
display.reloadData();
}
@@ -355,7 +367,6 @@
display.deselectAllMessages();
}
this.folder = folder;
- firePresenterChangedEvent();
revealDisplay();
}
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java?rev=834596&r1=834595&r2=834596&view=diff
==============================================================================
---
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
(original)
+++
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
Tue Nov 10 18:51:30 2009
@@ -61,6 +61,7 @@
import com.google.gwt.gen2.table.client.AbstractScrollTable.SortPolicy;
import com.google.gwt.gen2.table.client.SelectionGrid.SelectionPolicy;
import com.google.gwt.gen2.table.client.TableDefinition.AbstractCellView;
+import com.google.gwt.gen2.table.event.client.HasPageChangeHandlers;
import com.google.gwt.gen2.table.event.client.HasPageLoadHandlers;
import com.google.gwt.gen2.table.event.client.HasRowSelectionHandlers;
import com.google.gwt.gen2.table.event.client.PageLoadEvent;
@@ -672,4 +673,16 @@
public HasClickHandlers getRefreshClick() {
return refreshLink;
}
+
+ public void goToPage(int page) {
+ mailTable.gotoPage(page, false);
+ }
+
+ public int getCurrentPage() {
+ return mailTable.getCurrentPage();
+ }
+
+ public HasPageChangeHandlers getDataTablePageChange() {
+ return mailTable;
+ }
}
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java?rev=834596&r1=834595&r2=834596&view=diff
==============================================================================
---
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
(original)
+++
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
Tue Nov 10 18:51:30 2009
@@ -33,7 +33,7 @@
@Inject
public HupaPlaceManager(EventBus eventBus, LoginPresenterPlace
loginPresenterPlace, MainPresenterPlace
mainPresenterPlace,IMAPMessageListPresenterPlace messageListPresenterPlace,
IMAPMessagePresenterPlace imapMessagePresenterPlace, MessageSendPresenterPlace
sendPresenterPlace) {
- super(eventBus, loginPresenterPlace, mainPresenterPlace,
messageListPresenterPlace, imapMessagePresenterPlace, sendPresenterPlace);
+ super(eventBus, loginPresenterPlace, messageListPresenterPlace,
imapMessagePresenterPlace, sendPresenterPlace);
}
}
Modified:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/IMAPMessageListPresenterPlace.java
URL:
http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/IMAPMessageListPresenterPlace.java?rev=834596&r1=834595&r2=834596&view=diff
==============================================================================
---
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/IMAPMessageListPresenterPlace.java
(original)
+++
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/IMAPMessageListPresenterPlace.java
Tue Nov 10 18:51:30 2009
@@ -20,6 +20,7 @@
import org.apache.hupa.client.mvp.IMAPMessageListPresenter;
+import com.google.gwt.core.client.GWT;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -40,27 +41,24 @@
@Override
protected void preparePresenter(PlaceRequest request,
IMAPMessageListPresenter presenter) {
- int count = 20;
- try {
- count = Integer.parseInt(request.getParameter("count", "20"));
- } catch (NumberFormatException e) {
- // ignore
- }
int page = 0;
try {
page = Integer.parseInt(request.getParameter("page", "0"));
} catch (NumberFormatException e) {
+ e.printStackTrace();
// ignore
}
- String folder = request.getParameter("folder", "INBOX");
- presenter.getDisplay();
- super.preparePresenter(request, presenter);
+ presenter.getDisplay().goToPage(page);
+ GWT.log("PRES="+request.toString(),null);
+
}
@Override
protected PlaceRequest prepareRequest(PlaceRequest request,
IMAPMessageListPresenter presenter) {
- // TODO Auto-generated method stub
- return super.prepareRequest(request, presenter);
+ request = request.with("page", presenter.getDisplay().getCurrentPage()
+"");
+ GWT.log("REQ="+request.toString(),null);
+
+ return request;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]