Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshawn.f.cook2011-11-01 19:06:29 +0000
committerRoberto E. Escobar2011-11-01 19:06:29 +0000
commit5ce3a4e51c04bf1611ba61cee07f3a8479053996 (patch)
treea6260e66d1236eefa5ad99819ac89eed4e84e712 /plugins/org.eclipse.osee.display.view.web
parent70e521678d029ae282f517caaf80976ed0d3a6f5 (diff)
downloadorg.eclipse.osee-5ce3a4e51c04bf1611ba61cee07f3a8479053996.tar.gz
org.eclipse.osee-5ce3a4e51c04bf1611ba61cee07f3a8479053996.tar.xz
org.eclipse.osee-5ce3a4e51c04bf1611ba61cee07f3a8479053996.zip
feature[ats_36Z52]: Implement email dialog
Diffstat (limited to 'plugins/org.eclipse.osee.display.view.web')
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/CssConstants.java1
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java2
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeExceptionDialogComponent.java263
3 files changed, 231 insertions, 35 deletions
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/CssConstants.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/CssConstants.java
index ce378ec1f4a..d4630d42d19 100644
--- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/CssConstants.java
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/CssConstants.java
@@ -62,6 +62,7 @@ public final class CssConstants {
public static final String OSEE_EXCEPTION_ERROR_TITLE_TEXT = "osee-exception-error-title-text";
public static final String OSEE_EXCEPTION_WARNING_TITLE_TEXT = "osee-exception-warning-title-text";
public static final String OSEE_EXCEPTION_LONGMSG = "osee-exception-longmsg";
+ public static final String OSEE_EMAILDIALOG_TITLES = "osee-emaildialog-titles";
public static final String OSEE_WORKING_LABEL_1 = "osee-working-label-1";
public static final String OSEE_WORKING_LABEL_2 = "osee-working-label-2";
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java
index 267393b2b16..ac2849bb45b 100644
--- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java
@@ -78,7 +78,7 @@ public class OseeAttributeComponent extends VerticalLayout implements AttributeC
TextField attrValue = new TextField();
attrValue.setValue(value);
attrValue.setWidth(500, UNITS_PIXELS);
- attrValue.setHeight(150, UNITS_PIXELS);
+ attrValue.setHeight(100, UNITS_PERCENTAGE);
attributesLayout.setRows(attributesLayout.getRows() + 1);
attributesLayout.addComponent(attrValue, 2, rowIndex);
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeExceptionDialogComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeExceptionDialogComponent.java
index 802c7f07196..a9780e94aed 100644
--- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeExceptionDialogComponent.java
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeExceptionDialogComponent.java
@@ -10,8 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.display.view.web.components;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.osee.display.api.EmailView;
import org.eclipse.osee.display.api.components.DisplaysErrorComponent.MsgType;
import org.eclipse.osee.display.view.web.CssConstants;
+import com.vaadin.data.Property;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Alignment;
@@ -26,18 +31,31 @@ import com.vaadin.ui.Window;
* @author Shawn F. Cook
*/
@SuppressWarnings("serial")
-public class OseeExceptionDialogComponent extends Window {
+public class OseeExceptionDialogComponent extends Window implements EmailView {
private final Label msgTypeLabel = new Label();
+ private final Button closeButton = new Button();
private final Label shortMsgLabel = new Label();
private final TextField longMsgTextArea = new TextField();
private final Button showHideDetailsButton = new Button("Show Details");
- private final Button closeButton = new Button();
+ private final Button emailButton = new Button("Email Support");
+ private final Button emailSendButton = new Button("Send");
+ private final Label emailSubjectLabel = new Label();
+ private final TextField emailRecipTextArea = new TextField();
+ private final TextField emailBodyTextArea = new TextField();
+ private final Label emailStatusLabel = new Label();
+ private final Label emailDisplayMsgLabel = new Label();
+ private final VerticalLayout vLayout_Email = new VerticalLayout();
private final Window mainWindow;
private final int HEIGHT_CLOSED = 100;
private final int HEIGHT_OPEN = 210;
private final int WIDTH = 400;
private final int MARGIN = 15;
+ private String fromEmail = "";
+ private Collection<String> replyToEmails = new ArrayList<String>();
+ private Collection<String> recipientsEmails = new ArrayList<String>();
+ private final Collection<SendListener> sendListeners = new ArrayList<SendListener>();
+ private final Collection<Validator> validatorListeners = new ArrayList<Validator>();
public OseeExceptionDialogComponent(MsgType msgType, String shortMsg, String longMsg, Window mainWindow) {
this.mainWindow = mainWindow;
@@ -89,11 +107,45 @@ public class OseeExceptionDialogComponent extends Window {
private void createLayout() {
setWidth(WIDTH, UNITS_PIXELS);
- setHeight(HEIGHT_CLOSED, UNITS_PIXELS);
+ setHeight(HEIGHT_OPEN, UNITS_PIXELS);
setCloseShortcut(KeyCode.ESCAPE);
setScrollable(false);
setStyleName(CssConstants.OSEE_EXCEPTION);
+ VerticalLayout vLayout_body = new VerticalLayout();
+ HorizontalLayout hLayout_Row0 = new HorizontalLayout();
+ HorizontalLayout hLayout_Row1 = new HorizontalLayout();
+ HorizontalLayout hLayout_Row2 = new HorizontalLayout();
+ HorizontalLayout hLayout_Row3_Exception = new HorizontalLayout();
+ HorizontalLayout hLayout_Row3_Email = new HorizontalLayout();
+ HorizontalLayout hLayout_Row4_Email = new HorizontalLayout();
+ HorizontalLayout hLayout_Row5_Email = new HorizontalLayout();
+ HorizontalLayout hLayout_Row6_Email = new HorizontalLayout();
+
+ Label vSpacer_AboveButtons = new Label();
+ vSpacer_AboveButtons.setHeight(10, UNITS_PIXELS);
+ Label vSpacer_AboveDetails = new Label();
+ vSpacer_AboveDetails.setHeight(10, UNITS_PIXELS);
+ Label vSpacer_Email_1 = new Label();
+ vSpacer_Email_1.setHeight(10, UNITS_PIXELS);
+ Label vSpacer_Email_2 = new Label();
+ vSpacer_Email_2.setHeight(10, UNITS_PIXELS);
+ Label hSpacer_EmailSubject = new Label();
+ hSpacer_EmailSubject.setWidth(5, UNITS_PIXELS);
+ Label hSpacer_EmailRecip = new Label();
+ hSpacer_EmailRecip.setWidth(5, UNITS_PIXELS);
+
+ closeButton.setStyleName("link");
+ closeButton.setIcon(new ThemeResource("../osee/closebutton.png"));
+ closeButton.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ mainWindow.removeWindow(OseeExceptionDialogComponent.this);
+ }
+ });
+ msgTypeLabel.setSizeUndefined();
+ closeButton.setSizeUndefined();
+
shortMsgLabel.setWidth(null);
longMsgTextArea.setWidth(WIDTH - MARGIN, UNITS_PIXELS);
@@ -106,54 +158,197 @@ public class OseeExceptionDialogComponent extends Window {
public void buttonClick(Button.ClickEvent event) {
longMsgTextArea.setVisible(!longMsgTextArea.isVisible());
if (longMsgTextArea.isVisible()) {
+ showHideDetailsButton.setCaption("Hide Details");
OseeExceptionDialogComponent.this.setHeight(HEIGHT_OPEN, UNITS_PIXELS);
+ emailButton.setCaption("Email Support");
+ vLayout_Email.setVisible(false);
+ emailSendButton.setVisible(false);
} else {
+ showHideDetailsButton.setCaption("Show Details");
OseeExceptionDialogComponent.this.setHeight(HEIGHT_CLOSED, UNITS_PIXELS);
}
}
});
- closeButton.setStyleName("link");
- closeButton.setIcon(new ThemeResource("../osee/closebutton.png"));
- closeButton.addListener(new Button.ClickListener() {
+ Label emailSubjectTitle = new Label("Subject:");
+ Label emailRecipTitle = new Label("Recipients:");
+ vLayout_Email.setSizeFull();
+ vLayout_Email.setVisible(false);
+ emailSubjectTitle.setWidth(70, UNITS_PIXELS);
+ emailSubjectTitle.setStyleName(CssConstants.OSEE_EMAILDIALOG_TITLES);
+ emailRecipTitle.setWidth(70, UNITS_PIXELS);
+ emailRecipTitle.setStyleName(CssConstants.OSEE_EMAILDIALOG_TITLES);
+ emailSubjectLabel.setSizeFull();
+ emailRecipTextArea.setWidth(100, UNITS_PERCENTAGE);
+ emailBodyTextArea.setWidth(WIDTH - MARGIN, UNITS_PIXELS);
+ emailBodyTextArea.setHeight(HEIGHT_CLOSED, UNITS_PIXELS);
+ emailSendButton.setStyleName("link");
+ emailButton.setStyleName("link");
+ emailButton.addListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
- mainWindow.removeWindow(OseeExceptionDialogComponent.this);
+ vLayout_Email.setVisible(!vLayout_Email.isVisible());
+ if (vLayout_Email.isVisible()) {
+ emailButton.setCaption("Cancel");
+ OseeExceptionDialogComponent.this.setHeight(HEIGHT_OPEN + 70, UNITS_PIXELS);
+ emailSendButton.setVisible(true);
+ showHideDetailsButton.setCaption("Show Details");
+ longMsgTextArea.setVisible(false);
+ } else {
+ emailButton.setCaption("Email Support");
+ emailSendButton.setVisible(false);
+ OseeExceptionDialogComponent.this.setHeight(HEIGHT_CLOSED, UNITS_PIXELS);
+ }
}
});
-
- VerticalLayout vLayout_body = new VerticalLayout();
- HorizontalLayout row0 = new HorizontalLayout();
- HorizontalLayout row1 = new HorizontalLayout();
- HorizontalLayout row2 = new HorizontalLayout();
- HorizontalLayout row3 = new HorizontalLayout();
+ emailSendButton.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ //TODO: Send email.
+ }
+ });
+ emailStatusLabel.setSizeFull();
+ emailDisplayMsgLabel.setSizeFull();
vLayout_body.setStyleName(CssConstants.OSEE_EXCEPTION);
-
- row0.setSizeFull();
- row1.setSizeFull();
- row2.setSizeFull();
- row3.setSizeFull();
vLayout_body.setWidth(WIDTH - MARGIN, UNITS_PIXELS);
- msgTypeLabel.setSizeUndefined();
- closeButton.setSizeUndefined();
- Label vSpacer_AboveDetails = new Label();
- vSpacer_AboveDetails.setHeight(20, UNITS_PIXELS);
-
- row0.addComponent(msgTypeLabel);
- row0.addComponent(closeButton);
- row1.addComponent(shortMsgLabel);
- row2.addComponent(longMsgTextArea);
- row3.addComponent(showHideDetailsButton);
- vLayout_body.addComponent(row0);
- vLayout_body.addComponent(row1);
- vLayout_body.addComponent(row2);
+ hLayout_Row0.setSizeFull();
+ hLayout_Row1.setSizeFull();
+ hLayout_Row2.setSizeFull();
+ hLayout_Row3_Exception.setSizeFull();
+ hLayout_Row3_Email.setSizeFull();
+ hLayout_Row4_Email.setSizeFull();
+ hLayout_Row5_Email.setSizeFull();
+ vLayout_Email.setSizeFull();
+
+ hLayout_Row0.addComponent(msgTypeLabel);
+ hLayout_Row0.addComponent(closeButton);
+ hLayout_Row1.addComponent(shortMsgLabel);
+ hLayout_Row2.addComponent(showHideDetailsButton);
+ hLayout_Row2.addComponent(emailButton);
+ hLayout_Row2.addComponent(emailSendButton);
+
+ hLayout_Row3_Exception.addComponent(longMsgTextArea);
+
+ hLayout_Row3_Email.addComponent(emailSubjectTitle);
+ hLayout_Row3_Email.addComponent(hSpacer_EmailSubject);
+ hLayout_Row3_Email.addComponent(emailSubjectLabel);
+ hLayout_Row4_Email.addComponent(emailRecipTitle);
+ hLayout_Row4_Email.addComponent(hSpacer_EmailRecip);
+ hLayout_Row4_Email.addComponent(emailRecipTextArea);
+ hLayout_Row5_Email.addComponent(emailBodyTextArea);
+ hLayout_Row6_Email.addComponent(emailStatusLabel);
+ hLayout_Row6_Email.addComponent(emailDisplayMsgLabel);
+ vLayout_Email.addComponent(hLayout_Row3_Email);
+ vLayout_Email.addComponent(vSpacer_Email_1);
+ vLayout_Email.addComponent(hLayout_Row4_Email);
+ vLayout_Email.addComponent(vSpacer_Email_2);
+ vLayout_Email.addComponent(hLayout_Row5_Email);
+ vLayout_Email.addComponent(hLayout_Row6_Email);
+
+ vLayout_body.addComponent(hLayout_Row0);
+ vLayout_body.addComponent(hLayout_Row1);
+ vLayout_body.addComponent(vSpacer_AboveButtons);
+ vLayout_body.addComponent(hLayout_Row2);
vLayout_body.addComponent(vSpacer_AboveDetails);
- vLayout_body.addComponent(row3);
+ vLayout_body.addComponent(hLayout_Row3_Exception);
+ vLayout_body.addComponent(vLayout_Email);
setContent(vLayout_body);
- row0.setComponentAlignment(closeButton, Alignment.TOP_RIGHT);
- row3.setComponentAlignment(showHideDetailsButton, Alignment.BOTTOM_CENTER);
+ hLayout_Row0.setComponentAlignment(closeButton, Alignment.TOP_RIGHT);
+ hLayout_Row3_Email.setExpandRatio(emailSubjectLabel, 1.0f);
+ hLayout_Row4_Email.setExpandRatio(emailRecipTextArea, 1.0f);
+ }
+
+ private void emailListToPropertyValue(Property property, Collection<String> emails) {
+ StringBuilder sb = new StringBuilder();
+ Iterator<String> iter = emails.iterator();
+ while (iter.hasNext()) {
+ String email = iter.next();
+ sb.append(email);
+ if (iter.hasNext()) {
+ sb.append(", ");
+ }
+ }
+ }
+
+ @Override
+ public void setFrom(String email) {
+ fromEmail = email;
+ }
+
+ @Override
+ public String getFrom() {
+ return fromEmail;
+ }
+
+ @Override
+ public void setReplyTo(Collection<String> emails) {
+ replyToEmails.clear();
+ replyToEmails.addAll(emails);
+ }
+
+ @Override
+ public Collection<String> getReplyTos() {
+ return replyToEmails;
+ }
+
+ @Override
+ public void setRecipients(Collection<String> emails) {
+ recipientsEmails.clear();
+ recipientsEmails.addAll(emails);
+ emailListToPropertyValue(emailRecipTextArea, emails);
+ }
+
+ @Override
+ public Collection<String> getRecipients() {
+ return recipientsEmails;
+ }
+
+ @Override
+ public void setSubject(String subject) {
+ emailSubjectLabel.setValue(subject);
+ }
+
+ @Override
+ public String getSubject() {
+ return (String) emailSubjectLabel.getValue();
+ }
+
+ @Override
+ public void setBody(String body) {
+ emailBodyTextArea.setValue(body);
+ }
+
+ @Override
+ public String getBody() {
+ return (String) emailBodyTextArea.getValue();
+ }
+
+ @Override
+ public void setEmailStatus(EmailSendStatus status) {
+ emailStatusLabel.setValue(status);
+ }
+
+ @Override
+ public void addOnSendListener(SendListener listener) {
+ sendListeners.add(listener);
+ }
+
+ @Override
+ public void addEmailValidator(Validator validator) {
+ validatorListeners.add(validator);
+ }
+
+ @Override
+ public void displayMessage(String caption) {
+ emailDisplayMsgLabel.setValue(caption);
+ }
+
+ @Override
+ public void displayMessage(String caption, String description) {
+ emailDisplayMsgLabel.setValue(caption);
+ emailDisplayMsgLabel.setDescription(description);//tooltip
}
}

Back to the top