Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeArtifactView.java')
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeArtifactView.java164
1 files changed, 73 insertions, 91 deletions
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 1e03fd2e6cd..ecf2606ae63 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
@@ -12,40 +12,34 @@ package org.eclipse.osee.display.view.web.search;
import org.eclipse.osee.display.api.components.ArtifactHeaderComponent;
import org.eclipse.osee.display.api.data.ViewArtifact;
-import org.eclipse.osee.display.api.search.SearchPresenter;
+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.OseeRelationsComponent;
-import org.eclipse.osee.display.view.web.components.OseeSearchHeaderComponent;
-import org.eclipse.osee.vaadin.widgets.Navigator;
import com.vaadin.Application;
import com.vaadin.ui.Alignment;
-import com.vaadin.ui.CustomComponent;
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
*/
@SuppressWarnings("serial")
-public class OseeArtifactView extends CustomComponent implements Navigator.View, ArtifactHeaderComponent {
+public abstract class OseeArtifactView extends AbstractCommonView implements ArtifactHeaderComponent {
- protected SearchPresenter searchPresenter = null;
- protected OseeSearchHeaderComponent searchHeader;
- protected OseeRelationsComponent relationsComp = new OseeRelationsComponent();
- protected OseeAttributeComponent attributeComp = new OseeAttributeComponent();
+ protected final OseeRelationsComponent relationsComp = new OseeRelationsComponent();
+ protected final OseeAttributeComponent attributeComp = new OseeAttributeComponent();
private final OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(null);
+ private final OseeArtifactNameLinkComponent artifactName = new OseeArtifactNameLinkComponent();
+ private final Label artifactType = new Label("", Label.CONTENT_XHTML);
private ViewArtifact artifact;
private final int LEFTMARGIN_WIDTH = 5;
- @Override
- public void attach() {
- //TODO: remove?
- }
-
protected void createLayout() {
setSizeFull();
@@ -61,115 +55,103 @@ public class OseeArtifactView extends CustomComponent implements Navigator.View,
leftMarginSpace.setWidth(LEFTMARGIN_WIDTH, UNITS_PIXELS);
hLayout_LeftMargAndBody.addComponent(leftMarginSpace);
- if (artifact != null) {
- VerticalLayout vLayout_OutBody = new VerticalLayout();
- vLayout_OutBody.setSizeFull();
-
- breadcrumbComp.setArtifact(artifact);
-
- Label vSpacer = new Label();
- vSpacer.setHeight(5, UNITS_PIXELS);
-
- OseeArtifactNameLinkComponent artifactName = new OseeArtifactNameLinkComponent(artifact);
- artifactName.setSizeUndefined();
-
- Label spacer1 = new Label();
- spacer1.setWidth(10, UNITS_PIXELS);
- spacer1.setHeight(null);
-
- Label artifactType = new Label(String.format("[%s]", artifact.getArtifactType()), Label.CONTENT_XHTML);
- artifactType.setSizeUndefined();
+ VerticalLayout vLayout_OutBody = new VerticalLayout();
+ vLayout_OutBody.setSizeFull();
- HorizontalLayout hLayout_ArtNameAndType = new HorizontalLayout();
- hLayout_ArtNameAndType.setSizeUndefined();
+ Label vSpacer = new Label();
+ vSpacer.setHeight(5, UNITS_PIXELS);
- VerticalLayout artRelSpacer = new VerticalLayout();
- artRelSpacer.setHeight(15, UNITS_PIXELS);
+ artifactName.setSizeUndefined();
- VerticalLayout vLayout_Body = new VerticalLayout();
- vLayout_Body.setMargin(false, false, false, true);
- vLayout_Body.setSizeFull();
+ Label spacer1 = new Label();
+ spacer1.setWidth(10, UNITS_PIXELS);
+ spacer1.setHeight(null);
- VerticalLayout relAttrSpacer = new VerticalLayout();
- relAttrSpacer.setHeight(15, UNITS_PIXELS);
+ artifactType.setSizeUndefined();
- VerticalLayout bottomSpacer = new VerticalLayout();
+ HorizontalLayout hLayout_ArtNameAndType = new HorizontalLayout();
+ hLayout_ArtNameAndType.setSizeUndefined();
- Panel panel_Body = new Panel();
- panel_Body.setScrollable(true);
- panel_Body.getContent().setSizeUndefined();
- panel_Body.setSizeFull();
+ VerticalLayout artRelSpacer = new VerticalLayout();
+ artRelSpacer.setHeight(15, UNITS_PIXELS);
- hLayout_ArtNameAndType.addComponent(artifactName);
- hLayout_ArtNameAndType.addComponent(spacer1);
- hLayout_ArtNameAndType.addComponent(artifactType);
+ VerticalLayout vLayout_Body = new VerticalLayout();
+ vLayout_Body.setMargin(false, false, false, true);
+ vLayout_Body.setSizeFull();
- vLayout_Body.addComponent(vSpacer);
- vLayout_Body.addComponent(hLayout_ArtNameAndType);
- vLayout_Body.addComponent(artRelSpacer);
- vLayout_Body.addComponent(relationsComp);
- vLayout_Body.addComponent(relAttrSpacer);
- vLayout_Body.addComponent(attributeComp);
- vLayout_Body.addComponent(bottomSpacer);
+ VerticalLayout relAttrSpacer = new VerticalLayout();
+ relAttrSpacer.setHeight(15, UNITS_PIXELS);
- panel_Body.setContent(vLayout_Body);
+ VerticalLayout bottomSpacer = new VerticalLayout();
- vLayout_OutBody.addComponent(breadcrumbComp);
- vLayout_OutBody.addComponent(panel_Body);
+ Panel panel_Body = new Panel();
+ panel_Body.setScrollable(true);
+ panel_Body.getContent().setSizeUndefined();
+ panel_Body.setSizeFull();
- hLayout_LeftMargAndBody.addComponent(vLayout_OutBody);
+ hLayout_ArtNameAndType.addComponent(artifactName);
+ hLayout_ArtNameAndType.addComponent(spacer1);
+ hLayout_ArtNameAndType.addComponent(artifactType);
- hLayout_ArtNameAndType.setComponentAlignment(artifactType, Alignment.BOTTOM_CENTER);
- vLayout_Body.setExpandRatio(bottomSpacer, 1.0f);
- vLayout_OutBody.setExpandRatio(panel_Body, 1.0f);
- hLayout_LeftMargAndBody.setExpandRatio(vLayout_OutBody, 1.0f);
- }
+ vLayout_Body.addComponent(vSpacer);
+ vLayout_Body.addComponent(hLayout_ArtNameAndType);
+ vLayout_Body.addComponent(artRelSpacer);
+ vLayout_Body.addComponent(relationsComp);
+ vLayout_Body.addComponent(relAttrSpacer);
+ vLayout_Body.addComponent(attributeComp);
+ vLayout_Body.addComponent(bottomSpacer);
- final VerticalLayout vertLayout = new VerticalLayout();
- vertLayout.setSizeFull();
+ panel_Body.setContent(vLayout_Body);
- vertLayout.addComponent(searchHeader);
- vertLayout.addComponent(spacer);
- vertLayout.addComponent(hLayout_LeftMargAndBody);
+ vLayout_OutBody.addComponent(breadcrumbComp);
+ vLayout_OutBody.addComponent(panel_Body);
- vertLayout.setComponentAlignment(searchHeader, Alignment.TOP_LEFT);
- vertLayout.setExpandRatio(hLayout_LeftMargAndBody, 1.0f);
+ hLayout_LeftMargAndBody.addComponent(vLayout_OutBody);
- setCompositionRoot(vertLayout);
- }
+ addComponent(searchHeader);
+ addComponent(spacer);
+ addComponent(hLayout_LeftMargAndBody);
- @Override
- public void init(Navigator navigator, Application application) {
- //Do nothing.
+ hLayout_ArtNameAndType.setComponentAlignment(artifactType, Alignment.BOTTOM_CENTER);
+ vLayout_Body.setExpandRatio(bottomSpacer, 1.0f);
+ vLayout_OutBody.setExpandRatio(panel_Body, 1.0f);
+ hLayout_LeftMargAndBody.setExpandRatio(vLayout_OutBody, 1.0f);
+ setComponentAlignment(searchHeader, Alignment.TOP_LEFT);
+ setExpandRatio(hLayout_LeftMargAndBody, 1.0f);
}
- @Override
- public String getWarningForNavigatingFrom() {
- return null;
+ private void updateLayout() {
+ if (artifact != null) {
+ breadcrumbComp.setArtifact(artifact);
+ artifactType.setCaption(String.format("[%s]", artifact.getArtifactType()));
+ artifactName.setArtifact(artifact);
+ }
}
@Override
public void clearAll() {
- this.artifact = null;
- createLayout();
+ artifact = null;
+ updateLayout();
}
@Override
public void setArtifact(ViewArtifact artifact) {
this.artifact = artifact;
- createLayout();
+ updateLayout();
}
@Override
public void setErrorMessage(String message) {
- //TODO:
- }
-
- @Override
- public void navigateTo(String requestedDataId) {
- if (searchHeader != null) {
- searchHeader.createLayout();
+ 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.");
}
- createLayout();
}
}

Back to the top