### Eclipse Workspace Patch 1.0 #P hupa-trunk Index: client/src/main/java/org/apache/hupa/client/mvp/MainView.java =================================================================== --- client/src/main/java/org/apache/hupa/client/mvp/MainView.java (revision 823751) +++ client/src/main/java/org/apache/hupa/client/mvp/MainView.java (working copy) @@ -260,7 +260,7 @@ } /** - * Bind a IMAPFolderDropController to the given Item and all its childs + * Bind a IMAPFolderDropController to the given Item and all its children * * @param item */ Index: client/src/main/java/org/apache/hupa/client/HupaConstants.java =================================================================== --- client/src/main/java/org/apache/hupa/client/HupaConstants.java (revision 823751) +++ client/src/main/java/org/apache/hupa/client/HupaConstants.java (working copy) @@ -111,4 +111,7 @@ public String markSeen(); public String markUnseen(); + + public String errorDialogTitle(); + public String errorDialogButtonLabel(); } Index: client/src/main/java/org/apache/hupa/client/widgets/ErrorDialogBox.java =================================================================== --- client/src/main/java/org/apache/hupa/client/widgets/ErrorDialogBox.java (revision 0) +++ client/src/main/java/org/apache/hupa/client/widgets/ErrorDialogBox.java (revision 0) @@ -0,0 +1,80 @@ +/**************************************************************** + * 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.widgets; + +import org.apache.hupa.client.HupaConstants; + +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.user.client.ui.Button; +import com.google.gwt.user.client.ui.DialogBox; + +/** + * This class acts as a simple Error Dialog Box. It reads its error Messages from the + * MessageBundle. + * + * TODO: Make this a static class, and provide a way to quickly generate common error messages + * + * This class is mainly for requirements of https://issues.apache.org/jira/browse/HUPA-26 + * + * @author Juergen Hoffmann + * + */ +public class ErrorDialogBox extends DialogBox { + + /** + * Access to Localization + */ + private HupaConstants constants = GWT.create(HupaConstants.class); + + /** + * Creates a DialogBox with the Label for errorDialogTitle as its Title. + * This DialogBox contains a Button which is labeled with the text from errorDialogButtonLabel. + * The Message to display can be set individually by setting the setText(...) Property + * of this DialogBox. + */ + public ErrorDialogBox() { + setTitle(constants.errorDialogTitle()); + + Button okButton = new Button(constants.errorDialogButtonLabel()); + okButton.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent event) { + hide(); + } + }); + setWidget(okButton); + } + + /** + * Creates a DialogBox with the Label for errorDialogTitle as its Title. + * This DialogBox contains a Button which is labeled with the text from errorDialogButtonLabel. + * + * @param errorMessage The Message to be displayed as this dialogs text property. + */ + public ErrorDialogBox(String errorMessage) { + this(); + setText(errorMessage); + } + + + + +} Index: client/src/main/java/org/apache/hupa/client/HupaConstants.properties =================================================================== --- client/src/main/java/org/apache/hupa/client/HupaConstants.properties (revision 823751) +++ client/src/main/java/org/apache/hupa/client/HupaConstants.properties (working copy) @@ -66,3 +66,6 @@ sessionTimedOut=Your session is timed out. Please login again! markSeen=Mark seen markUnseen=Mark unseen + +errorDialogTitle=Error Message +errorDialogButtonLabel=Ok