Return-Path: Delivered-To: apmail-labs-commits-archive@minotaur.apache.org Received: (qmail 38505 invoked from network); 8 Jul 2009 07:36:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Jul 2009 07:36:06 -0000 Received: (qmail 44177 invoked by uid 500); 8 Jul 2009 07:36:16 -0000 Delivered-To: apmail-labs-commits-archive@labs.apache.org Received: (qmail 44057 invoked by uid 500); 8 Jul 2009 07:36:16 -0000 Mailing-List: contact commits-help@labs.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: labs@labs.apache.org Delivered-To: mailing list commits@labs.apache.org Received: (qmail 44048 invoked by uid 99); 8 Jul 2009 07:36:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2009 07:36:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2009 07:36:02 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D121623888CC; Wed, 8 Jul 2009 07:35:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r792057 - in /labs/hupa: ./ src/main/java/org/apache/hupa/ src/main/java/org/apache/hupa/client/controller/ src/main/java/org/apache/hupa/client/model/ src/main/java/org/apache/hupa/client/mvp/ src/main/java/org/apache/hupa/client/rpc/ src/... Date: Wed, 08 Jul 2009 07:35:40 -0000 To: commits@labs.apache.org From: norman@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090708073540.D121623888CC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: norman Date: Wed Jul 8 07:35:39 2009 New Revision: 792057 URL: http://svn.apache.org/viewvc?rev=792057&view=rev Log: Completly remove gwt-mvc and only use MVP pattern Add missing license headers Removed: labs/hupa/src/main/java/org/apache/hupa/client/controller/ labs/hupa/src/main/java/org/apache/hupa/client/model/ labs/hupa/src/main/java/org/apache/hupa/client/view/ Modified: labs/hupa/pom.xml labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppView.java labs/hupa/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUser.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUserResult.java labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java labs/hupa/src/main/java/org/apache/hupa/server/LogoutUserHandler.java labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java Modified: labs/hupa/pom.xml URL: http://svn.apache.org/viewvc/labs/hupa/pom.xml?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/pom.xml (original) +++ labs/hupa/pom.xml Wed Jul 8 07:35:39 2009 @@ -48,11 +48,6 @@ http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/ - gwt-mvc - GWT MVC repository at googlecode - http://gwt-mvc.googlecode.com/svn/repository - - gwt-dispatch GWT Dispatch repository at googlecode http://gwt-dispatch.googlecode.com/svn/maven2 @@ -126,9 +121,7 @@ - + mergewebxml i18n compile - - - Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java Wed Jul 8 07:35:39 2009 @@ -1,6 +1,24 @@ -package org.apache.hupa.client.mvp; +/**************************************************************** + * 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. * + ****************************************************************/ + -import net.customware.gwt.dispatch.client.DispatchAsync; +package org.apache.hupa.client.mvp; import org.apache.hupa.client.events.EventBus; import org.apache.hupa.client.events.LoginEvent; Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppView.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppView.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppView.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/AppView.java Wed Jul 8 07:35:39 2009 @@ -1,3 +1,22 @@ +/**************************************************************** + * 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.mvp; import com.google.gwt.user.client.ui.Composite; Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java Wed Jul 8 07:35:39 2009 @@ -1,3 +1,22 @@ +/**************************************************************** + * 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.mvp; import net.customware.gwt.dispatch.client.DispatchAsync; Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java Wed Jul 8 07:35:39 2009 @@ -6,6 +6,7 @@ import java.util.List; import org.apache.hupa.client.data.IMAPFolder; +import org.apache.hupa.client.data.IMAPMessage; import org.apache.hupa.client.data.IMAPUser; import org.apache.hupa.client.events.EventBus; import org.apache.hupa.client.events.LoginEvent; @@ -14,20 +15,30 @@ import org.apache.hupa.client.events.LogoutEventHandler; import org.apache.hupa.client.rpc.FetchFolders; import org.apache.hupa.client.rpc.FetchFoldersResult; +import org.apache.hupa.client.rpc.FetchMessages; +import org.apache.hupa.client.rpc.FetchMessagesResult; import org.apache.hupa.client.rpc.LogoutUser; import org.apache.hupa.client.rpc.LogoutUserResult; import org.apache.hupa.client.widgets.IMAPTreeItem; import net.customware.gwt.dispatch.client.DispatchAsync; +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.HasAllKeyHandlers; import com.google.gwt.event.dom.client.HasClickHandlers; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.HasSelectionHandlers; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.HTMLTable; +import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.TreeItem; +import com.google.gwt.user.client.ui.HTMLTable.Cell; import com.google.inject.Inject; public class MainPresenter { @@ -36,13 +47,23 @@ public interface Display { public HasClickHandlers getLogoutClick(); public HasSelectionHandlers getTree(); + public HasClickHandlers getSearchClick(); + public HasValue getSearchValue(); + public HasAllKeyHandlers getRowsPerPage(); + public HasValue getRowsPerPageValue(); + public HasClickHandlers getTableClick(); public void bindTreeItems(List treeList); + public void bindMessages(List messageList); + } private DispatchAsync dispatcher; private EventBus bus; private Display display; private IMAPUser user; + private IMAPFolder folder; + private String searchValue = null; + protected Cell cell; @Inject public MainPresenter(DispatchAsync dispatcher, EventBus bus) { @@ -119,16 +140,16 @@ }); return tList; } - public void bind(Display display) { + public void bind(final Display display) { this.display = display; + reset(); display.getLogoutClick().addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dispatcher.execute(new LogoutUser(user), new AsyncCallback() { public void onFailure(Throwable caught) { - // TODO Auto-generated method stub - + GWT.log("ERROR",caught); } public void onSuccess(LogoutUserResult result) { @@ -144,9 +165,73 @@ public void onSelection(SelectionEvent event) { TreeItem item = event.getSelectedItem(); - IMAPFolder folder = (IMAPFolder) item.getUserObject(); + folder = (IMAPFolder) item.getUserObject(); + fetchMessages(); + + + } + + }); + + display.getSearchClick().addClickHandler(new ClickHandler() { + + public void onClick(ClickEvent event) { + + if (display.getSearchValue().getValue().trim().length() >0) { + searchValue = display.getSearchValue().getValue().trim(); + } + fetchMessages(); + + + } + + }); + + display.getRowsPerPage().addKeyUpHandler(new KeyUpHandler() { + + + public void onKeyUp(KeyUpEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + fetchMessages(); + } + } + + }); + + display.getTableClick().addClickHandler(new ClickHandler() { + + public void onClick(ClickEvent event) { + HTMLTable table = (HTMLTable) event.getSource(); + cell = table.getCellForEvent(event); + if (cell.getRowIndex() > 0 && cell.getCellIndex() != 0) { + + + } + + } + + }); + } + + private void fetchMessages() { + int rowsPerPage = Integer.parseInt(display.getRowsPerPageValue().getValue()); + dispatcher.execute(new FetchMessages(user,folder,0,0+rowsPerPage,searchValue), new AsyncCallback() { + + public void onFailure(Throwable caught) { + GWT.log("ERROR",caught); + } + + public void onSuccess(FetchMessagesResult result) { + display.bindMessages(result.getMessages()); } }); + + } + + private void reset() { + display.bindMessages(new ArrayList()); + display.bindTreeItems(new ArrayList()); + display.getSearchValue().setValue(""); } } Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java Wed Jul 8 07:35:39 2009 @@ -1,27 +1,38 @@ package org.apache.hupa.client.mvp; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.hupa.client.HupaConstants; import org.apache.hupa.client.bundles.IMAPTreeImages; +import org.apache.hupa.client.data.IMAPMessage; +import org.apache.hupa.client.data.IMAPMessage.IMAPFlag; import org.apache.hupa.client.widgets.IMAPTreeItem; import org.cobogw.gwt.user.client.ui.Button; +import org.cobogw.gwt.user.client.ui.ButtonBar; import org.cobogw.gwt.user.client.ui.RoundedPanel; 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.HasAllKeyHandlers; import com.google.gwt.event.dom.client.HasClickHandlers; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.HasSelectionHandlers; +import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.DockPanel; +import com.google.gwt.user.client.ui.FlexTable; +import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.MultiWordSuggestOracle; import com.google.gwt.user.client.ui.SuggestBox; +import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Tree; import com.google.gwt.user.client.ui.TreeItem; import com.google.gwt.user.client.ui.VerticalPanel; @@ -39,7 +50,13 @@ private SuggestBox searchBox = new SuggestBox(oracle); private Button searchButton = new Button(constants.searchButton()); private Button logoutButton = new Button(constants.logoutButton()); - + private VerticalPanel centerVP = new VerticalPanel(); + private TextBox rowsPerPageBox = new TextBox(); + private FlexTable mailTable = new FlexTable(); + private Map mMap = new HashMap(); + private RoundedPanel center; + private DateTimeFormat dFormat = DateTimeFormat.getShortDateTimeFormat(); + public MainView() { dockPanel = new DockPanel(); @@ -48,13 +65,13 @@ createNorth(); createWest(); - //createCenter(); + createCenter(); dockPanel.add(north, DockPanel.NORTH); dockPanel.add(west, DockPanel.WEST); - //dockPanel.add(center, DockPanel.CENTER); + dockPanel.add(center, DockPanel.CENTER); dockPanel.setCellHorizontalAlignment(north, DockPanel.ALIGN_RIGHT); - //dockPanel.setCellHorizontalAlignment(center, DockPanel.ALIGN_LEFT); + dockPanel.setCellHorizontalAlignment(center, DockPanel.ALIGN_LEFT); initWidget(dockPanel); } @@ -79,14 +96,7 @@ northTop.setWidth("100%"); northTop.add(new Label(constants.productName())); - - logoutButton.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - - } - - }); northTop.add(logoutButton); northTop.setCellHorizontalAlignment(logoutButton, VerticalPanel.ALIGN_RIGHT); @@ -110,28 +120,103 @@ hPanel.add(searchBox); - searchButton.addClickHandler(new ClickHandler() { + + hPanel.add(searchButton); + + north.add(hPanel); + + } + + private void createCenter() { + + centerVP.setSpacing(10); + + HorizontalPanel navPanel = new HorizontalPanel(); + navPanel.setSpacing(10); + navPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); + ButtonBar navigatorBar = new ButtonBar(); + Button newMailButton = new Button(constants.newMailButton()); + navigatorBar.add(newMailButton); + Button deleteMailButton = new Button(constants.deleteMailButton()); + navigatorBar.add(deleteMailButton); + + navPanel.add(navigatorBar); + + rowsPerPageBox.setWidth("40px"); + rowsPerPageBox.setValue("20"); + + navPanel.add(rowsPerPageBox); + navPanel.add(new Label(constants.rowsPerPageLabel())); + centerVP.add(navPanel); + + final CheckBox headerCheckbox = new CheckBox(); + headerCheckbox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { - String searchValue = null; - if (searchBox.getValue().trim().length() >0) { - searchValue = searchBox.getValue().trim(); + for (int i = 1; i < mailTable.getRowCount(); i++) { + ((CheckBox) mailTable.getWidget(i, 0)) + .setValue(headerCheckbox.getValue()); + if(headerCheckbox.getValue() == true) { + mailTable.getRowFormatter().setStyleName(i, "hupa-Mailtable-row-selected"); + } else { + mailTable.getRowFormatter().removeStyleName(i, "hupa-Mailtable-row-selected"); + + } + IMAPMessage message = mMap.get(i); + if (message.getIMAPFlags().contains(IMAPFlag.SEEN) == false) { + mailTable.getRowFormatter().addStyleName(i, + "hupa-Mailtable-row-notseen"); + } else { + mailTable.getRowFormatter().removeStyleName(i, "hupa-Mailtable-row-notseen"); + } } - - /* - controller.call(new Event( - HupaAction.FETCH_MESSAGES, - new MessageListModelData(user, folder, - 0, rowsPerPage,searchValue), masker)); - //searchBox.setValue(""); - */ } - + }); - hPanel.add(searchButton); - north.add(hPanel); + mailTable.setCellSpacing(0); + mailTable.setWidget(0, 0, headerCheckbox); + mailTable.getFlexCellFormatter().setWidth(0, 0, "15px"); + mailTable.setText(0, 1, constants.mailTableFrom()); + mailTable.getFlexCellFormatter().setWidth(0, 1, "200px"); + mailTable.setText(0, 2, constants.mailTableSubject()); + mailTable.getFlexCellFormatter().setWidth(0, 2, "500px"); + mailTable.setText(0, 3, constants.mailTableDate()); + mailTable.getFlexCellFormatter().setWidth(0, 3, "200px"); + mailTable.getRowFormatter().setStyleName(0,"hupa-Mailtable-Header"); + + mailTable.getFlexCellFormatter().addStyleName(0,0,"hupa-Mailtable-Header"); + mailTable.getFlexCellFormatter().addStyleName(0,1,"hupa-Mailtable-Header"); + mailTable.getFlexCellFormatter().addStyleName(0,2,"hupa-Mailtable-Header"); + mailTable.getFlexCellFormatter().addStyleName(0,3,"hupa-Mailtable-Header"); + + + centerVP.add(mailTable); + center = new RoundedPanel(); + center.add(centerVP); + center.setWidth("100%"); + } + private String truncate(String rawString) { + if (rawString.length() > 50) { + return rawString.substring(0, 50); + } else { + return rawString; + } + } + private void clearMailTableEntries() { + // clear table + int a = 0; + while ((a = mailTable.getRowCount()) != 1) { + mailTable.removeRow(a - 1); + } + + mMap.clear(); + } + + private void fillOracle(IMAPMessage msg) { + oracle.add(msg.getIMAPHeader().getFrom()); + oracle.add(msg.getIMAPHeader().getSubject()); } public HasClickHandlers getLogoutClick() { @@ -140,7 +225,21 @@ public HasSelectionHandlers getTree() { return folderTree; } - + + public HasClickHandlers getSearchClick() { + return searchButton; + } + public HasValue getSearchValue() { + return searchBox; + } + public HasValue getRowsPerPageValue() { + return rowsPerPageBox; + } + + public HasAllKeyHandlers getRowsPerPage() { + return rowsPerPageBox; + } + public void bindTreeItems(List treeList) { folderTree.clear(); @@ -149,4 +248,71 @@ } } + + public void bindMessages(List result) { + // clear table + clearMailTableEntries(); + + int rows = 1; + for (int i = 0; i < result.size(); i++) { + final CheckBox mCheckbox = new CheckBox(); + mCheckbox.addClickHandler(new ClickHandler() { + + public void onClick(ClickEvent event) { + int row = mailTable.getCellForEvent(event).getRowIndex(); + + if(mCheckbox.getValue() == true) { + mailTable.getRowFormatter().setStyleName(row, "hupa-Mailtable-row-selected"); + } else { + mailTable.getRowFormatter().removeStyleName(row, "hupa-Mailtable-row-selected"); + + } + + } + + }); + IMAPMessage message = result.get(i); + fillOracle(message); + mMap.put(rows, message); + mailTable.setWidget(rows, 0, mCheckbox); + mailTable.setText(rows, 1, truncate(message.getIMAPHeader() + .getFrom())); + mailTable.setText(rows, 2, truncate(message.getIMAPHeader() + .getSubject())); + mailTable.setText(rows, 3, dFormat.format(message + .getIMAPHeader().getReceivedDate())); + + if (rows % 2 == 0) { + mailTable.getRowFormatter().setStyleName(rows, + "hupa-Mailtable-row1"); + } else { + mailTable.getRowFormatter().setStyleName(rows, + "hupa-Mailtable-row2"); + } + if (message.getIMAPFlags().contains(IMAPFlag.SEEN) == false) { + mailTable.getRowFormatter().addStyleName(rows, + "hupa-Mailtable-row-notseen"); + } else { + mailTable.getRowFormatter().removeStyleName(rows, "hupa-Mailtable-row-notseen"); + } + mailTable.getCellFormatter().setWordWrap(rows, 1, + false); + mailTable.getCellFormatter().setWordWrap(rows, 2, + false); + mailTable.getCellFormatter().setWordWrap(rows, 3, + false); + mailTable.getFlexCellFormatter().addStyleName(rows,0,"hupa-Mailtable"); + mailTable.getFlexCellFormatter().addStyleName(rows,1,"hupa-Mailtable"); + mailTable.getFlexCellFormatter().addStyleName(rows,2,"hupa-Mailtable"); + mailTable.getFlexCellFormatter().addStyleName(rows,3,"hupa-Mailtable"); + mailTable.getFlexCellFormatter().addStyleName(rows,3,"hupa-Mailtable-cell-date"); + + + rows++; + } + } + + public HasClickHandlers getTableClick() { + return mailTable; + } } Modified: labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessages.java Wed Jul 8 07:35:39 2009 @@ -1,3 +1,22 @@ +/**************************************************************** + * 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.rpc; import net.customware.gwt.dispatch.shared.Action; Modified: labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchMessagesResult.java Wed Jul 8 07:35:39 2009 @@ -1,3 +1,22 @@ +/**************************************************************** + * 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.rpc; import java.util.ArrayList; Modified: labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java Wed Jul 8 07:35:39 2009 @@ -33,6 +33,8 @@ private String userName; private String password; + + @SuppressWarnings("unused") private LoginUser() {} public LoginUser(String userName,String password) { Modified: labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUser.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUser.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUser.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUser.java Wed Jul 8 07:35:39 2009 @@ -1,3 +1,22 @@ +/**************************************************************** + * 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.rpc; import org.apache.hupa.client.data.IMAPUser; Modified: labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUserResult.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUserResult.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUserResult.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/LogoutUserResult.java Wed Jul 8 07:35:39 2009 @@ -1,3 +1,22 @@ +/**************************************************************** + * 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.rpc; import org.apache.hupa.client.data.IMAPUser; Modified: labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java Wed Jul 8 07:35:39 2009 @@ -35,7 +35,6 @@ import org.apache.hupa.client.data.IMAPMessage.IMAPFlag; import org.apache.hupa.client.rpc.ExposeMessage; import org.apache.hupa.client.rpc.ExposeMessageResult; -import org.apache.hupa.client.services.IMAPServiceException; import org.columba.ristretto.coder.Base64DecoderInputStream; import org.columba.ristretto.coder.CharsetDecoderInputStream; import org.columba.ristretto.coder.QuotedPrintableDecoderInputStream; @@ -52,11 +51,7 @@ public ExposeMessageResult execute(ExposeMessage action, ExecutionContext arg1) throws ActionException { - try { return new ExposeMessageResult(exposeMessage(action.getUser(), action.getFolder(), action.getMessage())); - } catch (IMAPServiceException e) { - throw new ActionException(e); - } } public Class getActionType() { @@ -69,7 +64,7 @@ } - protected IMAPMessage exposeMessage(IMAPUser user, IMAPFolder folder, IMAPMessage msg) throws IMAPServiceException { + protected IMAPMessage exposeMessage(IMAPUser user, IMAPFolder folder, IMAPMessage msg) throws ActionException { if (msg.isExposed()) { return msg; } @@ -145,11 +140,11 @@ return msg; } catch (IOException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to expose msg for uid " + throw new ActionException("Unable to expose msg for uid " + msg.getUid()); } catch (IMAPException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to expose msg for uid " + throw new ActionException("Unable to expose msg for uid " + msg.getUid()); } finally { Modified: labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java Wed Jul 8 07:35:39 2009 @@ -27,7 +27,6 @@ import org.apache.hupa.client.data.IMAPUser; import org.apache.hupa.client.rpc.FetchFolders; import org.apache.hupa.client.rpc.FetchFoldersResult; -import org.apache.hupa.client.services.IMAPServiceException; import org.columba.ristretto.imap.IMAPException; import org.columba.ristretto.imap.IMAPProtocol; import org.columba.ristretto.imap.ListInfo; @@ -41,11 +40,8 @@ public FetchFoldersResult execute(FetchFolders action, ExecutionContext arg1) throws ActionException { - try { - return new FetchFoldersResult(getFolders(action.getUser())); - } catch (IMAPServiceException e) { - throw new ActionException(e); - } + return new FetchFoldersResult(getFolders(action.getUser())); + } public void rollback(FetchFolders arg0, FetchFoldersResult arg1, @@ -59,7 +55,7 @@ } protected ArrayList getFolders(IMAPUser user) - throws IMAPServiceException { + throws ActionException { ArrayList fList = new ArrayList(); IMAPProtocol protocol = null; try { @@ -93,11 +89,11 @@ return fList; } catch (IOException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to get folders for User " + throw new ActionException("Unable to get folders for User " + user); } catch (IMAPException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to get folders for User " + throw new ActionException("Unable to get folders for User " + user); } finally { if (protocol != null) { Modified: labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/FetchMessagesHandler.java Wed Jul 8 07:35:39 2009 @@ -35,7 +35,6 @@ import org.apache.hupa.client.data.IMAPMessage.IMAPFlag; import org.apache.hupa.client.rpc.FetchMessages; import org.apache.hupa.client.rpc.FetchMessagesResult; -import org.apache.hupa.client.services.IMAPServiceException; import org.columba.ristretto.imap.IMAPException; import org.columba.ristretto.imap.IMAPFlags; import org.columba.ristretto.imap.IMAPProtocol; @@ -49,11 +48,8 @@ public FetchMessagesResult execute(FetchMessages action, ExecutionContext arg1) throws ActionException { - try { - return new FetchMessagesResult(getMessages(action.getUser(), action.getFolder(), action.getStart(), action.getStart() + action.getOffset(), action.getSearchString()),action.getStart(),action.getOffset()); - } catch (IMAPServiceException e) { - throw new ActionException(e); - } + return new FetchMessagesResult(getMessages(action.getUser(), action.getFolder(), action.getStart(), action.getStart() + action.getOffset(), action.getSearchString()),action.getStart(),action.getOffset()); + } public Class getActionType() { @@ -65,7 +61,7 @@ // TODO Auto-generated method stub } - protected ArrayList getMessages(IMAPUser user,IMAPFolder folder, int start, int end,String searchString) throws IMAPServiceException { + protected ArrayList getMessages(IMAPUser user,IMAPFolder folder, int start, int end,String searchString) throws ActionException { ArrayList mList = new ArrayList(); IMAPProtocol proto = null; @@ -153,11 +149,11 @@ } return mList; } catch (IOException e) { - throw new IMAPServiceException( + throw new ActionException( "Error while fetching headers for user " + user.getName() + ": " + e.getMessage()); } catch (IMAPException e) { - throw new IMAPServiceException( + throw new ActionException( "Error while fetching headers for user " + user.getName() + ": " + e.getMessage()); } finally { Modified: labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java Wed Jul 8 07:35:39 2009 @@ -36,8 +36,6 @@ import org.apache.hupa.client.data.IMAPUser; import org.apache.hupa.client.data.ResultList; import org.apache.hupa.client.data.IMAPMessage.IMAPFlag; -import org.apache.hupa.client.services.IMAPService; -import org.apache.hupa.client.services.IMAPServiceException; import org.columba.ristretto.coder.Base64DecoderInputStream; import org.columba.ristretto.coder.CharsetDecoderInputStream; import org.columba.ristretto.coder.QuotedPrintableDecoderInputStream; @@ -57,17 +55,7 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet; -public class IMAPServiceImpl extends RemoteServiceServlet implements - IMAPService { - - private static IMAPService SERVICE; - - public static IMAPService getInstance() { - if (SERVICE == null) { - SERVICE = new IMAPServiceImpl(); - } - return SERVICE; - } +public class IMAPServiceImpl extends RemoteServiceServlet{ /** * @@ -75,7 +63,7 @@ private static final long serialVersionUID = -1853475303345399549L; public IMAPUser login(String username, String password) - throws IMAPServiceException { + throws Exception { try { IMAPUser user = new IMAPUser(); @@ -91,9 +79,9 @@ return user; } catch (IOException e) { - throw new IMAPServiceException(e.getMessage()); + throw new Exception(e.getMessage()); } catch (IMAPException e) { - throw new IMAPServiceException(e.getMessage()); + throw new Exception(e.getMessage()); } } @@ -108,7 +96,7 @@ } - public ResultList getMessages(IMAPUser user,IMAPFolder folder, int start, int end,String searchString) throws IMAPServiceException { + public ResultList getMessages(IMAPUser user,IMAPFolder folder, int start, int end,String searchString) throws Exception { ResultList mList = new ResultList(); IMAPProtocol proto = null; @@ -197,11 +185,11 @@ } return mList; } catch (IOException e) { - throw new IMAPServiceException( + throw new Exception( "Error while fetching headers for user " + user.getName() + ": " + e.getMessage()); } catch (IMAPException e) { - throw new IMAPServiceException( + throw new Exception( "Error while fetching headers for user " + user.getName() + ": " + e.getMessage()); } finally { @@ -216,7 +204,7 @@ } - public IMAPMessage exposeMessage(IMAPUser user, IMAPFolder folder, IMAPMessage msg) throws IMAPServiceException { + public IMAPMessage exposeMessage(IMAPUser user, IMAPFolder folder, IMAPMessage msg) throws Exception { if (msg.isExposed()) { return msg; } @@ -292,11 +280,11 @@ return msg; } catch (IOException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to expose msg for uid " + throw new Exception("Unable to expose msg for uid " + msg.getUid()); } catch (IMAPException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to expose msg for uid " + throw new Exception("Unable to expose msg for uid " + msg.getUid()); } finally { @@ -312,7 +300,7 @@ public ArrayList getFolders(IMAPUser user) - throws IMAPServiceException { + throws Exception { ArrayList fList = new ArrayList(); IMAPProtocol protocol = null; try { @@ -346,11 +334,11 @@ return fList; } catch (IOException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to get folders for User " + throw new Exception("Unable to get folders for User " + user); } catch (IMAPException e) { e.printStackTrace(); - throw new IMAPServiceException("Unable to get folders for User " + throw new Exception("Unable to get folders for User " + user); } finally { if (protocol != null) { @@ -379,36 +367,36 @@ } public void addFolder(IMAPUser user, IMAPFolder folder) - throws IMAPServiceException { + throws Exception { try { IMAPProtocol protocol = getProtocol(user); protocol.create(folder.getFullName()); protocol.subscribe(folder.getFullName()); } catch (IOException e) { e.printStackTrace(); - throw new IMAPServiceException("Error while removing folder " + throw new Exception("Error while removing folder " + folder + " for user " + user + ": " + e.toString()); } catch (IMAPException e) { e.printStackTrace(); - throw new IMAPServiceException("Error while removing folder " + throw new Exception("Error while removing folder " + folder + " for user " + user + ": " + e.toString()); } } public void removeFolder(IMAPUser user, IMAPFolder folder) - throws IMAPServiceException { + throws Exception { try { IMAPProtocol protocol = getProtocol(user); protocol.unsubscribe(folder.getFullName()); protocol.delete(folder.getFullName()); } catch (IOException e) { e.printStackTrace(); - throw new IMAPServiceException("Error while removing folder " + throw new Exception("Error while removing folder " + folder + " for user " + user + ": " + e.toString()); } catch (IMAPException e) { e.printStackTrace(); - throw new IMAPServiceException("Error while removing folder " + throw new Exception("Error while removing folder " + folder + " for user " + user+ ": " + e.toString()); } Modified: labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java Wed Jul 8 07:35:39 2009 @@ -28,7 +28,6 @@ import org.apache.hupa.client.data.IMAPUser; import org.apache.hupa.client.rpc.LoginUser; import org.apache.hupa.client.rpc.LoginUserResult; -import org.apache.hupa.client.services.IMAPServiceException; import org.columba.ristretto.imap.IMAPException; import org.columba.ristretto.imap.IMAPProtocol; @@ -37,12 +36,9 @@ public LoginUserResult execute(LoginUser action, ExecutionContext context) throws ActionException { - try { - return new LoginUserResult(login(action.getUserName(), action + return new LoginUserResult(login(action.getUserName(), action .getPassword())); - } catch (IMAPServiceException e) { - throw new ActionException(e); - } + } public void rollback(LoginUser user, LoginUserResult result, @@ -55,7 +51,7 @@ } protected IMAPUser login(String username, String password) - throws IMAPServiceException { + throws ActionException { try { IMAPUser user = new IMAPUser(); @@ -70,9 +66,9 @@ return user; } catch (IOException e) { - throw new IMAPServiceException(e.getMessage()); + throw new ActionException(e); } catch (IMAPException e) { - throw new IMAPServiceException(e.getMessage()); + throw new ActionException(e); } } } Modified: labs/hupa/src/main/java/org/apache/hupa/server/LogoutUserHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/LogoutUserHandler.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/LogoutUserHandler.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/LogoutUserHandler.java Wed Jul 8 07:35:39 2009 @@ -1,3 +1,23 @@ +/**************************************************************** + * 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.server; import net.customware.gwt.dispatch.server.ExecutionContext; Modified: labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java?rev=792057&r1=792056&r2=792057&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java Wed Jul 8 07:35:39 2009 @@ -19,9 +19,10 @@ package org.apache.hupa.server.gin; -import net.customware.gwt.dispatch.server.guice.ServerDispatchModule; +import net.customware.gwt.dispatch.server.guice.ActionHandlerModule; import org.apache.hupa.server.FetchFoldersHandler; +import org.apache.hupa.server.FetchMessagesHandler; import org.apache.hupa.server.LoginUserHandler; import org.apache.hupa.server.LogoutUserHandler; @@ -31,12 +32,14 @@ * @author norman * */ -public class ServerModul extends ServerDispatchModule{ +public class ServerModul extends ActionHandlerModule{ + @Override protected void configureHandlers() { bindHandler(LoginUserHandler.class); bindHandler(FetchFoldersHandler.class); + bindHandler(FetchMessagesHandler.class); bindHandler(LogoutUserHandler.class); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org For additional commands, e-mail: commits-help@labs.apache.org