diff options
Diffstat (limited to 'plugins/org.eclipse.osee.display.view.web/src')
9 files changed, 179 insertions, 101 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 48571e06214..3eb9adf1969 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 @@ -55,6 +55,9 @@ public final class CssConstants { public static final String OSEE_ATTRIBUTESBORDER = "osee-attributesborder"; public static final String OSEE_CURRENTPAGELABEL = "osee-currentpagelabel"; - public static final int OSEE_LEFTMARGINWIDTH = 15; + public static final String OSEE_EXCEPTION = "osee-exception"; + 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"; } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeArtifactNameLinkComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeArtifactNameLinkComponent.java index 71f68355168..6cb04a126a5 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeArtifactNameLinkComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeArtifactNameLinkComponent.java @@ -78,8 +78,11 @@ public class OseeArtifactNameLinkComponent extends HorizontalLayout { return artifact; } + private int debugindex = 0; + public void setArtifact(ViewArtifact artifact) { this.artifact = artifact; + artifactNameLink.setDebugId(String.format("OseeArtifactNameLinkComponent.%s.%d", artifact.getGuid(), debugindex)); updateLayout(); } 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 3cce22ce1b5..1427df0bfc2 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 @@ -15,12 +15,9 @@ import java.util.ArrayList; import java.util.Collection; import org.eclipse.osee.display.api.components.AttributeComponent; import org.eclipse.osee.display.view.web.CssConstants; -import com.vaadin.Application; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; /** * @author Shawn F. Cook @@ -107,18 +104,9 @@ public class OseeAttributeComponent extends VerticalLayout implements AttributeC } @Override - public void setErrorMessage(String message) { - Application app = this.getApplication(); - if (app != null) { - Window mainWindow = app.getMainWindow(); - if (mainWindow != null) { - mainWindow.showNotification(message, Notification.TYPE_ERROR_MESSAGE); - } else { - System.out.println("OseeAttributeComponent.setErrorMessage - ERROR: Application.getMainWindow() returns null value."); - } - } else { - System.out.println("OseeAttributeComponent.setErrorMessage - ERROR: getApplication() returns null value."); - } + public void setErrorMessage(String shortMsg, String longMsg, MsgType msgType) { + OseeExceptionDialogComponent dlg = + new OseeExceptionDialogComponent(msgType, shortMsg, longMsg, getApplication().getMainWindow()); } @Override 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 new file mode 100644 index 00000000000..faa4def4794 --- /dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeExceptionDialogComponent.java @@ -0,0 +1,155 @@ +/******************************************************************************* + * Copyright (c) 2011 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.display.view.web.components; + +import org.eclipse.osee.display.api.components.DisplaysErrorComponent.MsgType; +import org.eclipse.osee.display.view.web.CssConstants; +import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.terminal.ThemeResource; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeExceptionDialogComponent extends Window { + + private final Label msgTypeLabel = new Label(); + 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 Window mainWindow; + private final int HEIGHT_CLOSED = 100; + private final int HEIGHT_OPEN = 210; + private final int WIDTH = 400; + private final int MARGIN = 15; + + public OseeExceptionDialogComponent(MsgType msgType, String shortMsg, String longMsg, Window mainWindow) { + this.mainWindow = mainWindow; + createLayout(); + + switch (msgType) { + case MSGTYPE_ERROR: + msgTypeLabel.setCaption("Error!"); + msgTypeLabel.setStyleName(CssConstants.OSEE_EXCEPTION_ERROR_TITLE_TEXT); + break; + case MSGTYPE_WARNING: + msgTypeLabel.setCaption("Warning:"); + msgTypeLabel.setStyleName(CssConstants.OSEE_EXCEPTION_WARNING_TITLE_TEXT); + break; + default: + break; + } + + shortMsgLabel.setCaption(shortMsg); + longMsgTextArea.setValue(longMsg); + + if (mainWindow != null) { + mainWindow.addWindow(this); + moveToCenter(); + focus(); + } + } + + private void moveToCenter() { + float width = getApplication().getMainWindow().getWidth(); + float height = getApplication().getMainWindow().getHeight(); + + float centerx = width / 2.0f; + float centery = height / 2.0f; + + float halfwidth = this.getWidth() / 2.0f; + float halfheight = this.getHeight() / 2.0f; + + float x = centerx - halfwidth; + float y = centery - halfheight; + + setPositionX((int) x); + setPositionY((int) y); + } + + private void createLayout() { + setWidth(WIDTH, UNITS_PIXELS); + setHeight(HEIGHT_CLOSED, UNITS_PIXELS); + setCloseShortcut(KeyCode.ESCAPE); + setScrollable(false); + setStyleName(CssConstants.OSEE_EXCEPTION); + + shortMsgLabel.setWidth(null); + + longMsgTextArea.setWidth(WIDTH - MARGIN, UNITS_PIXELS); + longMsgTextArea.setHeight(HEIGHT_CLOSED, UNITS_PIXELS); + longMsgTextArea.setVisible(false); + longMsgTextArea.setStyleName(CssConstants.OSEE_EXCEPTION_LONGMSG); + showHideDetailsButton.setStyleName("link"); + showHideDetailsButton.addListener(new Button.ClickListener() { + @Override + public void buttonClick(Button.ClickEvent event) { + longMsgTextArea.setVisible(!longMsgTextArea.isVisible()); + if (longMsgTextArea.isVisible()) { + OseeExceptionDialogComponent.this.setHeight(HEIGHT_OPEN, UNITS_PIXELS); + } else { + OseeExceptionDialogComponent.this.setHeight(HEIGHT_CLOSED, 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); + } + }); + + VerticalLayout vLayout_body = new VerticalLayout(); + HorizontalLayout row0 = new HorizontalLayout(); + HorizontalLayout row1 = new HorizontalLayout(); + HorizontalLayout row2 = new HorizontalLayout(); + HorizontalLayout row3 = new HorizontalLayout(); + + 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); + vLayout_body.addComponent(vSpacer_AboveDetails); + vLayout_body.addComponent(row3); + setContent(vLayout_body); + + row0.setComponentAlignment(closeButton, Alignment.TOP_RIGHT); + row3.setComponentAlignment(showHideDetailsButton, Alignment.BOTTOM_CENTER); + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java index a459beaaab9..091630dd452 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java @@ -16,7 +16,6 @@ import org.eclipse.osee.display.api.data.ViewId; import org.eclipse.osee.display.api.search.SearchNavigator; import org.eclipse.osee.display.api.search.SearchPresenter; import org.eclipse.osee.display.view.web.CssConstants; -import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.Alignment; @@ -24,8 +23,6 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.ListSelect; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; /** * @author Shawn F. Cook @@ -211,18 +208,9 @@ public class OseeRelationsComponent extends VerticalLayout implements RelationCo } @Override - public void setErrorMessage(String message) { - Application app = this.getApplication(); - if (app != null) { - Window mainWindow = app.getMainWindow(); - if (mainWindow != null) { - mainWindow.showNotification(message, Notification.TYPE_ERROR_MESSAGE); - } else { - System.out.println("OseeRelationsComponent.setErrorMessage - ERROR: Application.getMainWindow() returns null value."); - } - } else { - System.out.println("OseeRelationsComponent.setErrorMessage - ERROR: getApplication() returns null value."); - } + public void setErrorMessage(String shortMsg, String longMsg, MsgType msgType) { + OseeExceptionDialogComponent dlg = + new OseeExceptionDialogComponent(msgType, shortMsg, longMsg, getApplication().getMainWindow()); } @Override diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchHeaderComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchHeaderComponent.java index dc5996ce7fb..c4cc6696e40 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchHeaderComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchHeaderComponent.java @@ -11,36 +11,12 @@ package org.eclipse.osee.display.view.web.components; import org.eclipse.osee.display.api.components.SearchHeaderComponent; -import org.eclipse.osee.display.api.data.ViewSearchParameters; import com.vaadin.ui.CustomComponent; /** * @author Shawn F. Cook */ @SuppressWarnings("serial") -public class OseeSearchHeaderComponent extends CustomComponent implements SearchHeaderComponent { - - @Override - public void attach() { - createLayout(); - } - - public void createLayout() { - //Do nothing. - } - - @Override - public void clearAll() { - //Do nothing. - } - - @Override - public void setErrorMessage(String message) { - //Do nothing. - } - - public void setSearchCriteria(ViewSearchParameters params) { - //Do nothing. - } +public abstract class OseeSearchHeaderComponent extends CustomComponent implements SearchHeaderComponent { } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultComponent.java index 87e42fd00b9..d60a87e1f53 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultComponent.java @@ -20,13 +20,10 @@ import org.eclipse.osee.display.api.data.ViewSearchParameters; import org.eclipse.osee.display.api.search.SearchNavigator; import org.eclipse.osee.display.api.search.SearchPresenter; import org.eclipse.osee.display.view.web.CssConstants; -import com.vaadin.Application; import com.vaadin.ui.Alignment; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; /** * @author Shawn F. Cook @@ -102,18 +99,9 @@ public class OseeSearchResultComponent extends VerticalLayout implements SearchR } @Override - public void setErrorMessage(String message) { - Application app = this.getApplication(); - if (app != null) { - Window mainWindow = app.getMainWindow(); - if (mainWindow != null) { - mainWindow.showNotification(message, Notification.TYPE_ERROR_MESSAGE); - } else { - System.out.println("OseeSearchResultComponent.setErrorMessage - ERROR: Application.getMainWindow() returns null value."); - } - } else { - System.out.println("OseeSearchResultComponent.setErrorMessage - ERROR: getApplication() returns null value."); - } + public void setErrorMessage(String shortMsg, String longMsg, MsgType msgType) { + OseeExceptionDialogComponent dlg = + new OseeExceptionDialogComponent(msgType, shortMsg, longMsg, getApplication().getMainWindow()); } @Override diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java index 1f4edf614fd..aab41c3163c 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java @@ -20,7 +20,6 @@ import org.eclipse.osee.display.api.components.SearchResultsListComponent; import org.eclipse.osee.display.view.web.CssConstants; import org.eclipse.osee.display.view.web.components.OseePagingComponent.PageSelectedEvent; import org.eclipse.osee.display.view.web.components.OseePagingComponent.PageSelectedListener; -import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.Alignment; @@ -30,8 +29,6 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; /** * @author Shawn F. Cook @@ -193,18 +190,9 @@ public class OseeSearchResultsListComponent extends VerticalLayout implements Se } @Override - public void setErrorMessage(String message) { - Application app = this.getApplication(); - if (app != null) { - Window mainWindow = app.getMainWindow(); - if (mainWindow != null) { - mainWindow.showNotification(message, Notification.TYPE_ERROR_MESSAGE); - } else { - System.out.println("OseeSearchResultsListComponent.setErrorMessage - ERROR: Application.getMainWindow() returns null value."); - } - } else { - System.out.println("OseeSearchResultsListComponent.setErrorMessage - ERROR: getApplication() returns null value."); - } + public void setErrorMessage(String shortMsg, String longMsg, MsgType msgType) { + OseeExceptionDialogComponent dlg = + new OseeExceptionDialogComponent(msgType, shortMsg, longMsg, getApplication().getMainWindow()); } @Override diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeArtifactView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeArtifactView.java index 0e35709df84..87b13e00871 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeArtifactView.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeArtifactView.java @@ -16,15 +16,13 @@ import org.eclipse.osee.display.view.web.AbstractCommonView; import org.eclipse.osee.display.view.web.components.OseeArtifactNameLinkComponent; import org.eclipse.osee.display.view.web.components.OseeAttributeComponent; import org.eclipse.osee.display.view.web.components.OseeBreadcrumbComponent; +import org.eclipse.osee.display.view.web.components.OseeExceptionDialogComponent; import org.eclipse.osee.display.view.web.components.OseeRelationsComponent; -import com.vaadin.Application; import com.vaadin.ui.Alignment; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; /** * @author Shawn F. Cook @@ -142,17 +140,8 @@ public abstract class OseeArtifactView extends AbstractCommonView implements Art } @Override - public void setErrorMessage(String message) { - Application app = this.getApplication(); - if (app != null) { - Window mainWindow = app.getMainWindow(); - if (mainWindow != null) { - mainWindow.showNotification(message, Notification.TYPE_ERROR_MESSAGE); - } else { - System.out.println("OseeArtifactView.setErrorMessage - ERROR: Application.getMainWindow() returns null value."); - } - } else { - System.out.println("OseeArtifactView.setErrorMessage - ERROR: getApplication() returns null value."); - } + public void setErrorMessage(String shortMsg, String longMsg, MsgType msgType) { + OseeExceptionDialogComponent dlg = + new OseeExceptionDialogComponent(msgType, shortMsg, longMsg, getApplication().getMainWindow()); } } |