| author | Shawn F. Cook | 2011-10-06 18:01:39 (EDT) |
|---|---|---|
| committer | Roberto E. Escobar | 2011-10-06 18:01:39 (EDT) |
| commit | c18358d7bf7a45e0893c4851881715e3a34a68f9 (patch) (side-by-side diff) | |
| tree | 0df1d2e3c4a8bdb787964da6642b2349cdc96a37 | |
| parent | dca09fa3470d2b5c75e612200ba609503dda0ed2 (diff) | |
| download | org.eclipse.osee-c18358d7bf7a45e0893c4851881715e3a34a68f9.zip org.eclipse.osee-c18358d7bf7a45e0893c4851881715e3a34a68f9.tar.gz org.eclipse.osee-c18358d7bf7a45e0893c4851881715e3a34a68f9.tar.bz2 | |
feature[ats_Q9NLC]: Web GUI and backend development
37 files changed, 1120 insertions, 451 deletions
diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsAppData.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsAppData.java index 9bdceff..99474d1 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsAppData.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsAppData.java @@ -12,9 +12,9 @@ he Eclipse Public License v1.0 package org.eclipse.osee.ats.view.web; import org.eclipse.osee.ats.api.search.AtsWebSearchPresenter; +import org.eclipse.osee.display.api.search.SearchNavigator; import org.eclipse.osee.display.api.search.SearchPresenter; import org.eclipse.osee.display.view.web.OseeAppData; -import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.Application; /** @@ -49,11 +49,11 @@ public class AtsAppData extends OseeAppData { } public static AtsWebSearchPresenter getAtsWebSearchPresenter() { - return (AtsWebSearchPresenter) OseeAppData.getAtsBackend(); + return (AtsWebSearchPresenter) OseeAppData.getSearchPresenter(); } @Override - protected Navigator createNavigator() { + protected SearchNavigator createNavigator() { return new AtsNavigator(); } diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsNavigator.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsNavigator.java index 0b8dece..d58c829 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsNavigator.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsNavigator.java @@ -1,14 +1,23 @@ -/* - * Created on Sep 30, 2011 +/******************************************************************************* + * 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 * - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ package org.eclipse.osee.ats.view.web; +import org.eclipse.osee.ats.view.web.search.AtsArtifactView; import org.eclipse.osee.ats.view.web.search.AtsSearchResultsView; import org.eclipse.osee.display.api.search.SearchNavigator; import org.eclipse.osee.vaadin.widgets.Navigator; +/** + * @author Shawn F. Cook + */ public class AtsNavigator extends Navigator implements SearchNavigator { @Override @@ -19,6 +28,7 @@ public class AtsNavigator extends Navigator implements SearchNavigator { @Override public void navigateArtifactPage(String url) { - //TODO: + String classUri = getUri(AtsArtifactView.class); + this.navigateTo(String.format("%s%s", classUri, url)); } } diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplication.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplication.java index 7175ffc..05b543e 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplication.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. + * 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 @@ -46,4 +46,27 @@ public class AtsUiApplication extends Application { public AtsWebSearchPresenter getAtsWebSearchPresenter() { return atsBackend; } + + // @Override + // public Window getWindow(String name) { + // // If the window is identified by name, we are good to go + // Window w = super.getWindow(name); + // + // // If not, we must create a new window for this new browser window/tab + // if (w == null) { + // + // // Use the random name given by the framework to identify this + // // window in future + // AtsWindowFactory factory = new AtsWindowFactory(); + // HasViews viewProvider = new AtsUiViews(); + // Window mainWindow = factory.createNavigatableWindow(viewProvider); + // mainWindow.setName(name); + // addWindow(mainWindow); + // + // // Move to the url to remember the name in the future + // mainWindow.open(new ExternalResource(mainWindow.getURL())); + // } + // + // return w; + // } } diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiViews.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiViews.java index c5ea169..2d7d74e 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiViews.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsUiViews.java @@ -12,6 +12,7 @@ package org.eclipse.osee.ats.view.web; import java.util.ArrayList; import java.util.List; +import org.eclipse.osee.ats.view.web.search.AtsArtifactView; import org.eclipse.osee.ats.view.web.search.AtsSearchHomeView; import org.eclipse.osee.ats.view.web.search.AtsSearchResultsView; import org.eclipse.osee.vaadin.widgets.HasViews; @@ -28,6 +29,7 @@ public class AtsUiViews implements HasViews { List<Class<? extends Navigator.View>> views = new ArrayList<Class<? extends Navigator.View>>(); views.add(AtsSearchHomeView.class); views.add(AtsSearchResultsView.class); + views.add(AtsArtifactView.class); return views; } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWebSearchPresenter_TestBackend.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWebSearchPresenter_TestBackend.java index ade62e4..afb942a 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWebSearchPresenter_TestBackend.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/AtsWebSearchPresenter_TestBackend.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. + * 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 @@ -53,11 +53,17 @@ public class AtsWebSearchPresenter_TestBackend implements AtsWebSearchPresenter WebId program2 = new WebId("taiwan_guid", "Taiwan"); WebArtifact defaultroot = new WebArtifact("defaultHierarchRoot_GUID", "Default Hierarchy Root", "Root Artifact"); - WebArtifact swreqs = new WebArtifact("SWReq_GUID", "Software Requirements", "Folder"); - WebArtifact crewIntreqs = new WebArtifact("CrewInt_GUID", "Crew Interface", "Folder"); + WebArtifact swreqs = new WebArtifact("SWReq_GUID", "Software Requirements", "Folder", + Arrays.asList(defaultroot.getWebId()), new WebId("branch_id1", "branch_id1")); + WebArtifact crewIntreqs = new WebArtifact("CrewInt_GUID", "Crew Interface", "Folder", Arrays.asList( + swreqs.getWebId(), defaultroot.getWebId()), new WebId("branch_id2", "branch_id2")); WebArtifact commSubSysCrewIntreqs = new WebArtifact("commSubSysCrewInt_GUID", - "Communication Subsystem Crew Interface", "Heading"); - WebArtifact comm_page_Intreqs = new WebArtifact("com_page_GUID", "{COM_PAGE}", "Software Requirement"); + "Communication Subsystem Crew Interface", "Heading", Arrays.asList(crewIntreqs.getWebId(), swreqs.getWebId(), + defaultroot.getWebId()), new WebId("branch_id3", "branch_id3")); + WebArtifact comm_page_Intreqs = + new WebArtifact("com_page_GUID", "{COM_PAGE}", "Software Requirement", Arrays.asList( + commSubSysCrewIntreqs.getWebId(), crewIntreqs.getWebId(), swreqs.getWebId(), defaultroot.getWebId()), + new WebId("branch_id4", "branch_id4")); private final Map<WebId, Collection<WebId>> programsAndBuilds = new HashMap<WebId, Collection<WebId>>(); private final Map<String, WebArtifact> artifacts = new HashMap<String, WebArtifact>(); @@ -96,6 +102,17 @@ public class AtsWebSearchPresenter_TestBackend implements AtsWebSearchPresenter artifacts.put(commSubSysCrewIntreqs.getGuid(), commSubSysCrewIntreqs); artifacts.put(comm_page_Intreqs.getGuid(), comm_page_Intreqs); + Set<Entry<String, WebArtifact>> artifactsSet = artifacts.entrySet(); + for (Entry<String, WebArtifact> entry : artifactsSet) { + WebArtifact artifact = entry.getValue(); + artifact.setAttr_Category("B"); + artifact.setAttr_DevAssurLevel("E"); + artifact.setAttr_ImpoParaNum("3.2.1.1"); + artifact.setAttr_Partition("CND, DP, SP, WP"); + artifact.setAttr_QualMethod("Test"); + artifact.setAttr_Subsystm("Communications"); + artifact.setAttr_TechPerfParam("False"); + } } @Override @@ -133,6 +150,55 @@ public class AtsWebSearchPresenter_TestBackend implements AtsWebSearchPresenter } } + @Override + public void initSearchHome(SearchHeaderComponent searchHeaderComp) { + searchHeaderComp.clearAll(); + } + + @Override + public void selectArtifact(WebArtifact artifact, SearchNavigator oseeNavigator) { + String url = String.format("/artifact/%s", artifact.getGuid()); + oseeNavigator.navigateArtifactPage(url); + } + + @Override + public void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp) { + initSearchHome(searchHeaderComp); + setSearchHeaderCriteria(url, (AtsSearchHeaderComponentInterface) searchHeaderComp); + artHeaderComp.clearAll(); + Map<String, String> params = requestStringToParameterMap(url); + if (params != null && params.size() > 0) { + String artGuid = params.get(UrlParamNameConstants.PARAMNAME_ARTIFACT); + if (artGuid != null && !artGuid.isEmpty()) { + WebArtifact artifact = artifacts.get(artGuid); + if (artifact != null) { + artHeaderComp.setArtifact(artifact); + + relComp.clearAll(); + WebId parentRelationType = new WebId("guid1", "Parent"); + WebId childRelationType = new WebId("guid2", "Child"); + WebId swReqRelationType = new WebId("guid3", "SW Requirement"); + relComp.addRelationType(parentRelationType); + relComp.addRelationType(childRelationType); + relComp.addRelationType(swReqRelationType); + + attrComp.clearAll(); + attrComp.setArtifact(artifact); + } + } + } + } + + @Override + public void selectRelationType(WebId id, RelationComponent relationComponent) { + relationComponent.clearRelations(); + Set<Entry<String, WebArtifact>> artifactsSet = artifacts.entrySet(); + for (Entry<String, WebArtifact> entry : artifactsSet) { + WebArtifact artifact = entry.getValue(); + relationComponent.addRelation(artifact); + } + } + public static AtsWebSearchPresenter getInstance() { return atsBackend; } @@ -142,15 +208,21 @@ public class AtsWebSearchPresenter_TestBackend implements AtsWebSearchPresenter if (program != null && headerComponent != null) { Collection<WebId> builds = programsAndBuilds.get(program); headerComponent.clearBuilds(); - for (WebId build : builds) { - headerComponent.addBuild(build); + if (builds != null) { + for (WebId build : builds) { + headerComponent.addBuild(build); + } + // headerComponent.setBuild(builds.iterator().next()); } - // headerComponent.setBuild(builds.iterator().next()); } } @Override - public void initSearchResults(String url, AtsSearchHeaderComponentInterface searchHeaderComponent, SearchResultsListComponent resultsComponent) { + public void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp) { + //Do nothing + } + + private void setSearchHeaderCriteria(String url, AtsSearchHeaderComponentInterface searchHeaderComponent) { Map<String, String> params = requestStringToParameterMap(url); WebId program = new WebId("", ""); WebId build = new WebId("", ""); @@ -178,13 +250,16 @@ public class AtsWebSearchPresenter_TestBackend implements AtsWebSearchPresenter } if (searchHeaderComponent != null) { - searchHeaderComponent.clearAll(); - Set<Entry<WebId, Collection<WebId>>> entrySetProg = programsAndBuilds.entrySet(); - for (Entry<WebId, Collection<WebId>> entry : entrySetProg) { - searchHeaderComponent.addProgram(entry.getKey()); - } + this.selectProgram(program, searchHeaderComponent); searchHeaderComponent.setSearchCriteria(program, build, nameOnly, searchPhrase); } + } + + @Override + public void initSearchResults(String url, AtsSearchHeaderComponentInterface searchHeaderComponent, SearchResultsListComponent resultsComponent) { + + initSearchHome(searchHeaderComponent); + setSearchHeaderCriteria(url, searchHeaderComponent); if (resultsComponent != null) { resultsComponent.clearAll(); @@ -267,24 +342,4 @@ public class AtsWebSearchPresenter_TestBackend implements AtsWebSearchPresenter return null; } - - @Override - public void initSearchHome(SearchHeaderComponent searchHeaderComp) { - } - - @Override - public void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp) { - } - - @Override - public void selectArtifact(WebId id) { - } - - @Override - public void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp) { - } - - @Override - public void selectRelationType(WebId id) { - } } diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderComponent.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderComponent.java index b89d9de..3ea99f9 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderComponent.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderComponent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. + * 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 @@ -21,6 +21,9 @@ import org.eclipse.osee.display.view.web.components.OseeLogoLink; import org.eclipse.osee.display.view.web.search.OseeSearchHeaderComponent; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.event.Action; +import com.vaadin.event.Action.Handler; +import com.vaadin.event.ShortcutAction; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -35,27 +38,54 @@ import com.vaadin.ui.VerticalLayout; * @author Shawn F. Cook */ @SuppressWarnings("serial") -public class AtsSearchHeaderComponent extends OseeSearchHeaderComponent implements AtsSearchHeaderComponentInterface { +public class AtsSearchHeaderComponent extends OseeSearchHeaderComponent implements AtsSearchHeaderComponentInterface, Handler { private boolean populated; - private final ComboBox programCombo = new ComboBox("Program:"); - private final ComboBox buildCombo = new ComboBox("Build:"); - private final CheckBox nameOnlyCheckBox = new CheckBox("Name Only", false); - private final TextField searchTextField = new TextField(); + private final ComboBox programCombo; + private final ComboBox buildCombo; + private final CheckBox nameOnlyCheckBox; + private final TextField searchTextField; private final boolean showOseeTitleAbove; - private final AtsWebSearchPresenter atsBackend = AtsAppData.getAtsWebSearchPresenter(); - private final AtsNavigator atsNavigator = AtsAppData.getAtsNavigator(); + private final AtsWebSearchPresenter atsBackend; + private final AtsNavigator atsNavigator; + private boolean lockProgramCombo = false; + + @Override + public void attach() { + if (populated) { + // Only populate the layout once + return; + } + + createLayout(); + + populated = true; + } + + private void selectSearch() { + WebId program = (WebId) programCombo.getValue(); + atsBackend.selectProgram(program, this); + } public AtsSearchHeaderComponent(boolean showOseeTitleAbove) { this.showOseeTitleAbove = showOseeTitleAbove; + + programCombo = new ComboBox("Program:"); + buildCombo = new ComboBox("Build:"); + nameOnlyCheckBox = new CheckBox("Name Only", false); + searchTextField = new TextField(); + atsBackend = AtsAppData.getAtsWebSearchPresenter(); + atsNavigator = AtsAppData.getAtsNavigator(); + if (programCombo != null) { programCombo.setNullSelectionAllowed(false); final AtsSearchHeaderComponentInterface me = this; programCombo.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - WebId program = (WebId) programCombo.getValue(); - atsBackend.selectProgram(program, me); + if (!lockProgramCombo) { + selectSearch(); + } } }); programCombo.setImmediate(true); @@ -69,11 +99,6 @@ public class AtsSearchHeaderComponent extends OseeSearchHeaderComponent implemen @Override protected void createLayout() { - if (populated) { - // Only populate the layout once - return; - } - setHeight(null); setWidth(100, UNITS_PERCENTAGE); setStyleName(CssConstants.OSEE_SEARCH_HEADER_COMPONENT); @@ -165,14 +190,14 @@ public class AtsSearchHeaderComponent extends OseeSearchHeaderComponent implemen addComponent(hLayoutRow0); addComponent(spacer5); } - - populated = true; } @Override public void addProgram(WebId program) { if (programCombo != null) { + lockProgramCombo = true; programCombo.addItem(program); + lockProgramCombo = false; } } @@ -193,7 +218,9 @@ public class AtsSearchHeaderComponent extends OseeSearchHeaderComponent implemen @Override public void setSearchCriteria(WebId program, WebId build, boolean nameOnly, String searchPhrase) { if (programCombo != null) { + lockProgramCombo = true; programCombo.setValue(program); + lockProgramCombo = false; } if (buildCombo != null) { buildCombo.setValue(build); @@ -240,6 +267,27 @@ public class AtsSearchHeaderComponent extends OseeSearchHeaderComponent implemen @Override public void setErrorMessage(String message) { + //TODO: + } + + //TODO: None of this works because Vaadin only supports key actions for Windows and Panel Objects. (this is + // a Component) + private final Action action_enter = new ShortcutAction("Enter key", ShortcutAction.KeyCode.ENTER, null); + private final Action[] actions = new Action[] {action_enter}; + + @Override + public Action[] getActions(Object target, Object sender) { + if (sender == searchTextField) { + return actions; + } + return null; + } + + @Override + public void handleAction(Action action, Object sender, Object target) { + if (sender == searchTextField && action == action_enter) { + selectSearch(); + } } } diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsArtifactView.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsArtifactView.java new file mode 100644 index 0000000..7089d4a --- a/dev/null +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsArtifactView.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * 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.ats.view.web.search; + +import org.eclipse.osee.ats.view.web.components.AtsSearchHeaderComponent; +import org.eclipse.osee.display.view.web.search.OseeArtifactView; +import org.eclipse.osee.display.view.web.search.OseeSearchHeaderComponent; + +/** + * @author Shawn F. Cook + */ +public class AtsArtifactView extends OseeArtifactView { + + @Override + protected OseeSearchHeaderComponent getOseeSearchHeader() { + return new AtsSearchHeaderComponent(false); + } + +} diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchHomeView.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchHomeView.java index 257ab1f..d6d2fa5 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchHomeView.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchHomeView.java @@ -22,7 +22,12 @@ import org.eclipse.osee.display.view.web.search.OseeSearchHomeView; @SuppressWarnings("serial") public class AtsSearchHomeView extends OseeSearchHomeView { - private final AtsWebSearchPresenter atsBackend = AtsAppData.getAtsWebSearchPresenter(); + private final AtsWebSearchPresenter atsBackend; + + public AtsSearchHomeView() { + super(); + atsBackend = AtsAppData.getAtsWebSearchPresenter(); + } @Override protected OseeSearchHeaderComponent getOseeSearchHeader() { diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchResultsView.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchResultsView.java index 01388ba..84d402d 100644 --- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchResultsView.java +++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/search/AtsSearchResultsView.java @@ -23,7 +23,12 @@ import org.eclipse.osee.display.view.web.search.OseeSearchResultsView; @SuppressWarnings("serial") public class AtsSearchResultsView extends OseeSearchResultsView { - private final AtsWebSearchPresenter atsBackend = AtsAppData.getAtsWebSearchPresenter(); + private final AtsWebSearchPresenter atsBackend; + + public AtsSearchResultsView() { + super(); + atsBackend = AtsAppData.getAtsWebSearchPresenter(); + } @Override protected OseeSearchHeaderComponent getOseeSearchHeader() { diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java index 0f4bd2c..4bc548d 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/ArtifactHeaderComponent.java @@ -12,4 +12,6 @@ public interface ArtifactHeaderComponent { void clearAll(); void setArtifact(WebArtifact artifact); + + void setErrorMessage(String message); } diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/RelationComponent.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/RelationComponent.java index ae170f9..3ad3abc 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/RelationComponent.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/components/RelationComponent.java @@ -5,6 +5,7 @@ */ package org.eclipse.osee.display.api.components; +import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.api.data.WebId; public interface RelationComponent { @@ -15,5 +16,5 @@ public interface RelationComponent { void clearRelations(); - void addRelation(WebId id); + void addRelation(WebArtifact id); } diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/WebArtifact.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/WebArtifact.java index 24bff25..96e5339 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/WebArtifact.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/data/WebArtifact.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.osee.display.api.data; +import java.util.ArrayList; +import java.util.Collection; + /** * @author Shawn F. Cook */ @@ -24,11 +27,23 @@ public class WebArtifact { private String attr_QualMethod; private String attr_Subsystm; private String attr_TechPerfParam; + private final WebId branch; - public WebArtifact(String guid, String artifactName, String artifactType) { + //ancestry should include all parental Artifacts starting with parent(index 0), grandparent(index 1), great-grandparent(index 2), etc. + private final Collection<WebId> ancestry = new ArrayList<WebId>(); + + public WebArtifact(String guid, String artifactName, String artifactType, Collection<WebId> ancestry, WebId branch) { this.guid = guid; this.artifactName = artifactName; this.artifactType = artifactType; + if (ancestry != null) { + this.ancestry.addAll(ancestry); + } + this.branch = branch; + } + + public WebArtifact(String guid, String artifactName, String artifactType) { + this(guid, artifactName, artifactType, (Collection<WebId>) null, null); } public String getArtifactName() { @@ -43,26 +58,13 @@ public class WebArtifact { return guid; } - // public Artifact getParent() { - // Collection<Artifact> listOfParents = relations.get(RelationType.PARENT); - // if (listOfParents == null || listOfParents.size() <= 0) { - // return null; - // } - // return listOfParents.iterator().next(); - // } - // - // /* - // * Returns list of ancestor Artifacts or empty list if there are no ancestors (i.e.: parent is null). - // */ - // public Collection<Artifact> getAncestry() { - // Collection<Artifact> ancestry = new ArrayList<Artifact>(); - // Artifact parent = this.getParent(); - // if (parent != null) { - // ancestry.addAll(parent.getAncestry()); - // ancestry.add(parent); - // } - // return ancestry; - // } + public WebId getBranch() { + return branch; + } + + public Collection<WebId> getAncestry() { + return ancestry; + } @Override public String toString() { @@ -125,4 +127,8 @@ public class WebArtifact { this.attr_TechPerfParam = attr_TechPerfParam; } + public WebId getWebId() { + WebId ret = new WebId(getGuid(), getArtifactName()); + return ret; + } } diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java index e2f2411..6679918 100644 --- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java +++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchPresenter.java @@ -15,6 +15,7 @@ import org.eclipse.osee.display.api.components.AttributeComponent; import org.eclipse.osee.display.api.components.RelationComponent; import org.eclipse.osee.display.api.components.SearchHeaderComponent; import org.eclipse.osee.display.api.components.SearchResultsListComponent; +import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.api.data.WebId; /* @@ -26,10 +27,10 @@ public interface SearchPresenter { void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp); - void selectArtifact(WebId id); + void selectArtifact(WebArtifact artifact, SearchNavigator oseeNavigator); void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp); - void selectRelationType(WebId id); + void selectRelationType(WebId id, RelationComponent relationComponent); }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java index 6d614c2..1096e42 100644 --- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java +++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/WebSearchPresenter.java @@ -11,6 +11,8 @@ package org.eclipse.osee.display.presenter; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.eclipse.osee.display.api.components.ArtifactHeaderComponent; import org.eclipse.osee.display.api.components.AttributeComponent; import org.eclipse.osee.display.api.components.RelationComponent; @@ -18,7 +20,9 @@ import org.eclipse.osee.display.api.components.SearchHeaderComponent; import org.eclipse.osee.display.api.components.SearchResultComponent; import org.eclipse.osee.display.api.components.SearchResultsListComponent; import org.eclipse.osee.display.api.data.SearchResultMatch; +import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.api.data.WebId; +import org.eclipse.osee.display.api.search.SearchNavigator; import org.eclipse.osee.display.api.search.SearchPresenter; import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.exception.OseeCoreException; @@ -30,9 +34,22 @@ import org.eclipse.osee.orcs.data.ReadableArtifact; public class WebSearchPresenter implements SearchPresenter { protected final ArtifactProvider artifactProvider; + private final static Pattern branchPattern = Pattern.compile("branch=([0-9A-Za-z\\+_=]{20,22})"); + private final static Pattern artifactPattern = Pattern.compile("artifact=([0-9A-Za-z\\+_=]{20,22})"); + private final static Pattern nameOnlyPattern = Pattern.compile("nameOnly=(true|false)"); + private final static Pattern searchPhrasePattern = Pattern.compile("search=([\\d\\w%]*)"); + + protected final Matcher branchMatcher; + protected final Matcher artifactMatcher; + protected final Matcher nameOnlyMatcher; + protected final Matcher searchPhraseMatcher; public WebSearchPresenter(ArtifactProvider artifactProvider) { this.artifactProvider = artifactProvider; + branchMatcher = branchPattern.matcher(""); + artifactMatcher = artifactPattern.matcher(""); + nameOnlyMatcher = nameOnlyPattern.matcher(""); + searchPhraseMatcher = searchPhrasePattern.matcher(""); } @Override @@ -42,7 +59,7 @@ public class WebSearchPresenter implements SearchPresenter { @Override public void initSearchResults(String url, SearchHeaderComponent searchHeaderComp, SearchResultsListComponent searchResultsComp) { searchResultsComp.clearAll(); - SearchParameters params = decode(url); + SearchParameters params = decodeSearchUrl(url); List<ReadableArtifact> searchResults = null; try { searchResults = @@ -54,29 +71,56 @@ public class WebSearchPresenter implements SearchPresenter { } for (ReadableArtifact art : searchResults) { SearchResultComponent searchResult = searchResultsComp.createSearchResult(); - org.eclipse.osee.display.api.data.WebArtifact displayArtifact = null; // = new org.eclipse.osee.display.api.data.Artifact(); + WebId branch = new WebId(art.getBranch().getGuid(), art.getBranch().getName()); + WebArtifact displayArtifact = + new WebArtifact(art.getGuid(), art.getName(), art.getArtifactType().getName(), null, branch); searchResult.setArtifact(displayArtifact); - SearchResultMatch match = null; + SearchResultMatch match = null; //ew SearchResultMatch(attributeType, matchHint, manyMatches); searchResult.addSearchResultMatch(match); } } @Override - public void selectArtifact(WebId id) { + public void selectArtifact(WebArtifact artifact, SearchNavigator oseeNavigator) { + oseeNavigator.navigateArtifactPage(encode(artifact)); } @Override public void initArtifactPage(String url, SearchHeaderComponent searchHeaderComp, ArtifactHeaderComponent artHeaderComp, RelationComponent relComp, AttributeComponent attrComp) { + ArtifactParameters params = decodeArtifactUrl(url); + String branch = params.getBranchId(); + String art = params.getArtifactId(); + ReadableArtifact artifactByGuid = null; + try { + artifactByGuid = artifactProvider.getArtifactByGuid(TokenFactory.createBranch(branch, ""), art); + } catch (OseeCoreException e) { + artHeaderComp.setErrorMessage(String.format("Error while loading artifact[%s] from branch:[%s]", art, branch)); + return; + } + WebId artBranch = new WebId(artifactByGuid.getBranch().getGuid(), artifactByGuid.getBranch().getName()); + WebArtifact artifact = + new WebArtifact(artifactByGuid.getGuid(), artifactByGuid.getName(), + artifactByGuid.getArtifactType().getName(), null, artBranch); + artHeaderComp.setArtifact(artifact); } @Override - public void selectRelationType(WebId id) { + public void selectRelationType(WebId id, RelationComponent relationComponent) { } - protected String encode(WebId id, boolean nameOnly, String searchPhrase) { + protected String encode(WebArtifact artifact) { StringBuilder sb = new StringBuilder(); - sb.append("?branch="); - sb.append(id.getGuid()); + sb.append("branch="); + sb.append(artifact.getBranch().getGuid()); + sb.append("?artifact="); + sb.append(artifact.getGuid()); + return sb.toString(); + } + + protected String encode(WebId branch, boolean nameOnly, String searchPhrase) { + StringBuilder sb = new StringBuilder(); + sb.append("branch="); + sb.append(branch.getGuid()); sb.append("?nameOnly="); sb.append(nameOnly); sb.append("?search="); @@ -84,13 +128,59 @@ public class WebSearchPresenter implements SearchPresenter { return sb.toString().replaceAll("\\s", "%20"); } - private SearchParameters decode(String url) { - String[] tokens = url.split("\\?"); - String branchId = tokens[0].split("=")[1]; - boolean nameOnly = tokens[1].split("=")[1].equalsIgnoreCase("true") ? true : false; - String searchPhrase = tokens[2].split("=")[1]; - searchPhrase = searchPhrase.replaceAll("%20", " "); - return new SearchParameters(branchId, nameOnly, searchPhrase); + private ArtifactParameters decodeArtifactUrl(String url) { + String branch = ""; + String artifact = ""; + + branchMatcher.reset(url); + artifactMatcher.reset(url); + + if (branchMatcher.matches()) { + branch = branchMatcher.group(1); + } + if (artifactMatcher.matches()) { + artifact = artifactMatcher.group(1); + } + return new ArtifactParameters(branch, artifact); + } + + private SearchParameters decodeSearchUrl(String url) { + String branch = ""; + boolean nameOnly = true; + String searchPhrase = ""; + + branchMatcher.reset(url); + nameOnlyMatcher.reset(url); + searchPhraseMatcher.reset(url); + + if (branchMatcher.matches()) { + branch = branchMatcher.group(1); + } + if (nameOnlyMatcher.find()) { + nameOnly = nameOnlyMatcher.group(1).equalsIgnoreCase("true") ? true : false; + } + if (searchPhraseMatcher.find()) { + searchPhrase = searchPhraseMatcher.group(1); + } + return new SearchParameters(branch, nameOnly, searchPhrase); + } + + private class ArtifactParameters { + private final String branchId; + private final String artifactId; + + public ArtifactParameters(String branchId, String artifactId) { + this.branchId = branchId; + this.artifactId = artifactId; + } + + public String getBranchId() { + return branchId; + } + + public String getArtifactId() { + return artifactId; + } } private class SearchParameters { @@ -116,7 +206,6 @@ public class WebSearchPresenter implements SearchPresenter { public String getSearchPhrase() { return searchPhrase; } - } } diff --git a/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF index 761e423..0651f0c 100644 --- a/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.display.view.web/META-INF/MANIFEST.MF @@ -14,6 +14,7 @@ Import-Package: com.vaadin, org.eclipse.osee.display.api.components, org.eclipse.osee.display.api.data, org.eclipse.osee.display.api.search, + org.eclipse.osee.framework.core.data, org.eclipse.osee.vaadin, org.eclipse.osee.vaadin.widgets, org.osgi.framework;version="1.6.0" 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 6077d89..88e4aa7 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 @@ -38,10 +38,16 @@ public final class CssConstants { public static final String OSEE_TITLE_LARGE_TEXT = "osee-title-large-text"; public static final String OSEE_TITLE_MEDIUM_TEXT = "osee-title-medium-text"; public static final String OSEE_SEARCH_TEXTFIELD = "osee-search-textfield"; + public static final String OSEE_SEARCHRESULT_ARTNAME = "osee-searchresult-artname"; public static final String OSEE_SEARCHRESULT_ARTTYPE = "osee-searchresult-arttype"; - public static final String OSEE_HORIZONTAL_LINE = "osee-horizontal-line"; public static final String OSEE_SEARCHRESULT_MATCH = "osee-searchresult-match"; public static final String OSEE_SEARCHRESULT_MATCH_MANY = "osee-searchresult-match-many"; + + public static final String OSEE_HORIZONTAL_LINE = "osee-horizontal-line"; public static final String OSEE_BREADCRUMB_ARTNAME = "osee-breadcrumb-artname"; + + public static final String OSEE_ATTRIBUTELABEL = "osee-attributelabel"; + public static final String OSEE_ATTRIBUTEVALUE = "osee-attributevalue"; + } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeAppData.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeAppData.java index 06b17f3..75ba35a 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeAppData.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeAppData.java @@ -11,8 +11,8 @@ he Eclipse Public License v1.0 *******************************************************************************/ package org.eclipse.osee.display.view.web; +import org.eclipse.osee.display.api.search.SearchNavigator; import org.eclipse.osee.display.api.search.SearchPresenter; -import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.Application; import com.vaadin.service.ApplicationContext.TransactionListener; @@ -26,8 +26,8 @@ public class OseeAppData implements TransactionListener { protected final Application app; // For distinguishing between apps protected static ThreadLocal<OseeAppData> instance = new ThreadLocal<OseeAppData>(); - private final Navigator navigator = createNavigator(); - private final SearchPresenter atsBackend = createSearchPresenter(); + private final SearchNavigator navigator = createNavigator(); + private final SearchPresenter searchPresenter = createSearchPresenter(); public OseeAppData(Application app) { this.app = app; @@ -44,19 +44,19 @@ public class OseeAppData implements TransactionListener { public void transactionEnd(Application application, Object transactionData) { } - protected Navigator createNavigator() { - return new Navigator(); + protected SearchNavigator createNavigator() { + return new OseeNavigator(); } protected SearchPresenter createSearchPresenter() { return null; } - public static Navigator getNavigator() { + public static SearchNavigator getNavigator() { return instance.get().navigator; } - public static SearchPresenter getAtsBackend() { - return instance.get().atsBackend; + public static SearchPresenter getSearchPresenter() { + return instance.get().searchPresenter; } } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeNavigator.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeNavigator.java new file mode 100644 index 0000000..4f719da --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/OseeNavigator.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * 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; + +import org.eclipse.osee.display.api.search.SearchNavigator; + +/** + * @author Shawn F. Cook + */ +public class OseeNavigator implements SearchNavigator { + + @Override + public void navigateSearchResults(String url) { + //Do nothing. + } + + @Override + public void navigateArtifactPage(String url) { + //Do nothing. + } + +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeActiveLink.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeActiveLink.java new file mode 100644 index 0000000..a9b9dcb --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeActiveLink.java @@ -0,0 +1,167 @@ +/******************************************************************************* + * Copyright (c) 2011 Boeing. + * All rightsimport com.vaadin.Application; +import com.vaadin.service.ApplicationContext.TransactionListener; +he 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 java.io.Serializable; +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Map; +import com.vaadin.terminal.PaintException; +import com.vaadin.terminal.PaintTarget; +import com.vaadin.terminal.Resource; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Component; +import com.vaadin.ui.Link; + +/** + * @author Shawn F. Cook + */ +public class OseeActiveLink extends Link { + + private static final String TAG = "activelink"; + + private static final Method LINK_FOLLOWED_METHOD; + + private final HashSet<LinkActivatedListener> listeners = new HashSet<LinkActivatedListener>(); + + public OseeActiveLink() { + super(); + } + + public OseeActiveLink(String caption, Resource resource, String targetName, int width, int height, int border) { + super(caption, resource, targetName, width, height, border); + } + + public OseeActiveLink(String caption, Resource resource) { + super(caption, resource); + } + + // @Override + // public String getTag() { + // return TAG; + // } + + static { + try { + LINK_FOLLOWED_METHOD = + LinkActivatedListener.class.getDeclaredMethod("linkActivated", new Class[] {LinkActivatedEvent.class}); + } catch (final java.lang.NoSuchMethodException e) { + // This should never happen + throw new java.lang.RuntimeException("Internal error finding methods in ActiveLink"); + } + } + + /** + * Adds the link activated listener. + * + * @param listener the Listener to be added. + */ + public void addListener(LinkActivatedListener listener) { + listeners.add(listener); + addListener(LinkActivatedEvent.class, listener, LINK_FOLLOWED_METHOD); + if (listeners.size() == 1) { + requestRepaint(); + } + } + + /** + * Removes the link activated listener. + * + * @param listener the Listener to be removed. + */ + public void removeListener(LinkActivatedListener listener) { + listeners.remove(listener); + removeListener(ClickEvent.class, listener, LINK_FOLLOWED_METHOD); + if (listeners.size() == 0) { + requestRepaint(); + } + } + + /** + * Emits the options change event. + */ + protected void fireClick(boolean linkOpened) { + fireEvent(new LinkActivatedEvent(this, linkOpened)); + } + + @Override + public void paintContent(PaintTarget target) throws PaintException { + super.paintContent(target); + + if (listeners.size() > 0) { + target.addVariable(this, "activated", false); + target.addVariable(this, "opened", false); + } + } + + @SuppressWarnings("unchecked") + @Override + public void changeVariables(Object source, Map variables) { + super.changeVariables(source, variables); + if (!isReadOnly() && variables.containsKey("activated")) { + final Boolean activated = (Boolean) variables.get("activated"); + final Boolean opened = (Boolean) variables.get("opened"); + if (activated != null && activated.booleanValue() && !isReadOnly()) { + fireClick((opened != null && opened.booleanValue() ? true : false)); + } + } + } + + public class LinkActivatedEvent extends Component.Event { + + private final boolean linkOpened; + + /** + * New instance of text change event. + * + * @param source the Source of the event. + */ + public LinkActivatedEvent(Component source, boolean linkOpened) { + super(source); + this.linkOpened = linkOpened; + } + + /** + * Gets the ActiveLink where the event occurred. + * + * @return the Source of the event. + */ + public OseeActiveLink getActiveLink() { + return (OseeActiveLink) getSource(); + } + + /** + * Indicates whether or not the link was opened on the client, i.e in a new window/tab. If the link was not + * opened, the listener should react to the event and "do something", otherwise the link does nothing. + * + * @return true if the link was opened on the client + */ + public boolean isLinkOpened() { + return linkOpened; + } + } + + /** + * ActiveLink click listener + */ + public interface LinkActivatedListener extends Serializable { + + /** + * ActiveLink has been activated. + * + * @param event ActiveLink click event. + */ + public void linkActivated(LinkActivatedEvent event); + + } + +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/ArtifactNameLinkComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeArtifactNameLinkComponent.java index 00381ea..503c535 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/ArtifactNameLinkComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeArtifactNameLinkComponent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. + * 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 @@ -14,10 +14,7 @@ import java.util.HashMap; import java.util.Map; import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.view.web.CssConstants; -import org.eclipse.osee.display.view.web.OseeAppData; -import org.eclipse.osee.display.view.web.internal.search.OseeArtifactView; import org.eclipse.osee.display.view.web.internal.search.OseeRoadMapAndNavigation; -import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.terminal.ExternalResource; import com.vaadin.terminal.Resource; import com.vaadin.ui.Link; @@ -26,22 +23,28 @@ import com.vaadin.ui.Link; * @author Shawn F. Cook */ @SuppressWarnings("serial") -public class ArtifactNameLinkComponent extends Link { +public class OseeArtifactNameLinkComponent extends Link { - private final Navigator navigator = OseeAppData.getNavigator(); - - public ArtifactNameLinkComponent(WebArtifact artifact) { + public OseeArtifactNameLinkComponent(WebArtifact artifact) { this(artifact, CssConstants.OSEE_SEARCHRESULT_ARTNAME); } - public ArtifactNameLinkComponent(WebArtifact artifact, String styleName) { + public OseeArtifactNameLinkComponent(WebArtifact artifact, String styleName) { + this(artifact.getArtifactName(), artifact.getGuid(), styleName); + } + + public OseeArtifactNameLinkComponent(String artName, String artGuid) { + this(artName, artGuid, CssConstants.OSEE_SEARCHRESULT_ARTNAME); + } + + public OseeArtifactNameLinkComponent(String artName, String artGuid, String styleName) { super(); - this.setCaption(artifact.getArtifactName()); + this.setCaption(artName); Map<String, String> parameterMap = new HashMap<String, String>(); - parameterMap.put(OseeRoadMapAndNavigation.ARTIFACT, artifact.getGuid()); + parameterMap.put(OseeRoadMapAndNavigation.ARTIFACT, artGuid); String paramString = OseeRoadMapAndNavigation.parameterMapToRequestString(parameterMap); - Resource artifactLink = new ExternalResource(String.format("%s", navigator.getUri(OseeArtifactView.class))); + Resource artifactLink = new ExternalResource(String.format("ats#AtsArtifactView%s", paramString)); this.setResource(artifactLink); setStyleName(styleName); 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 new file mode 100644 index 0000000..2b40a2e --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2011 Boeing. + * All rightsimport com.vaadin.Application; +import com.vaadin.service.ApplicationContext.TransactionListener; +he 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 java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import org.eclipse.osee.display.api.components.AttributeComponent; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.view.web.CssConstants; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeAttributeComponent extends VerticalLayout implements AttributeComponent { + + private WebArtifact artifact; + + private void createLayout() { + removeAllComponents(); + + if (artifact != null) { + final HorizontalLayout attributesLayout = new HorizontalLayout(); + final Button showHideButton = new Button("- Attributes"); + showHideButton.addListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + attributesLayout.setVisible(!attributesLayout.isVisible()); + if (attributesLayout.isVisible()) { + showHideButton.setCaption("- Attributes"); + } else { + showHideButton.setCaption("+ Attributes"); + } + } + }); + + Map<String, String> attributes = new HashMap<String, String>(); + attributes.put("Category", artifact.getAttr_Category()); + attributes.put("Developmental Assurance Level", artifact.getAttr_DevAssurLevel()); + attributes.put("Imported Paragraph Number", artifact.getAttr_ImpoParaNum()); + attributes.put("Partition", artifact.getAttr_Partition()); + attributes.put("Qualification Method", artifact.getAttr_QualMethod()); + attributes.put("Subsystem", artifact.getAttr_Subsystm()); + attributes.put("Technical Performance Parameter", artifact.getAttr_TechPerfParam()); + Set<Entry<String, String>> set = attributes.entrySet(); + VerticalLayout attrLabelsLayout = new VerticalLayout(); + VerticalLayout attrValuesLayout = new VerticalLayout(); + + for (Entry<String, String> entry : set) { + Label attrLabel = new Label(String.format("%s:", entry.getKey())); + Label attrValue = new Label(entry.getValue()); + attrLabel.setStyleName(CssConstants.OSEE_ATTRIBUTELABEL); + attrValue.setStyleName(CssConstants.OSEE_ATTRIBUTEVALUE); + + attrLabelsLayout.addComponent(attrLabel); + attrValuesLayout.addComponent(attrValue); + + attrLabelsLayout.setComponentAlignment(attrLabel, Alignment.MIDDLE_RIGHT); + attrValuesLayout.setComponentAlignment(attrValue, Alignment.MIDDLE_LEFT); + } + + Label spacer = new Label(""); + spacer.setWidth(15, UNITS_PIXELS); + attributesLayout.addComponent(attrLabelsLayout); + attributesLayout.addComponent(spacer); + attributesLayout.addComponent(attrValuesLayout); + + addComponent(showHideButton); + addComponent(attributesLayout); + setExpandRatio(attributesLayout, 1.0f); + } + } + + @Override + public void clearAll() { + this.artifact = null; + createLayout(); + } + + @Override + public void setArtifact(WebArtifact artifact) { + this.artifact = artifact; + createLayout(); + } + +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeBreadcrumbComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeBreadcrumbComponent.java new file mode 100644 index 0000000..f5917a8 --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeBreadcrumbComponent.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * 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 java.util.Collection; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.api.data.WebId; +import org.eclipse.osee.display.view.web.CssConstants; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeBreadcrumbComponent extends HorizontalLayout { + private WebArtifact artifact; + + private void init() { + this.removeAllComponents(); + + if (artifact != null && artifact.getAncestry() != null) { + Collection<WebId> ancestryList = artifact.getAncestry(); + if (ancestryList.size() > 0) { + Object[] ancestryArray = ancestryList.toArray(); + for (int i = ancestryArray.length - 1; i >= 0; i--) { + WebId ancestor = (WebId) ancestryArray[i]; + OseeArtifactNameLinkComponent crumbLabel = + new OseeArtifactNameLinkComponent(ancestor.getName(), ancestor.getGuid(), + CssConstants.OSEE_BREADCRUMB_ARTNAME); + addComponent(crumbLabel); + if (i > 0) { + Label delimiter = new Label(" >> ", Label.CONTENT_XHTML); + delimiter.setHeight(null); + addComponent(delimiter); + } + } + } + } + } + + public OseeBreadcrumbComponent(WebArtifact artifact) { + this.artifact = artifact; + + init(); + } + + public void setArtifact(WebArtifact artifact) { + this.artifact = artifact; + init(); + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeLogoLink.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeLogoLink.java index 9ce3732..515d00d 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeLogoLink.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeLogoLink.java @@ -20,6 +20,5 @@ public class OseeLogoLink extends Link { Resource logoIconRes = new ThemeResource("../osee/osee_large.png"); setIcon(logoIconRes); setStyleName(styleName); - } } 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 new file mode 100644 index 0000000..e3c8d1a --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java @@ -0,0 +1,143 @@ +/******************************************************************************* + * 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.RelationComponent; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.api.data.WebId; +import org.eclipse.osee.display.api.search.SearchNavigator; +import org.eclipse.osee.display.api.search.SearchPresenter; +import org.eclipse.osee.display.view.web.OseeAppData; +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.ListSelect; +import com.vaadin.ui.VerticalLayout; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeRelationsComponent extends VerticalLayout implements RelationComponent { + + private final ListSelect relationTypesListSelect = new ListSelect("Relation Types:"); + private final ListSelect relationsListSelect = new ListSelect("Relations:"); + SearchPresenter searchPresenter = OseeAppData.getSearchPresenter(); + SearchNavigator navigator = OseeAppData.getNavigator(); + private boolean lockRelTypesListener = false; + private boolean lockRelsListener = false; + + private void createLayout() { + removeAllComponents(); + + final HorizontalLayout listBoxesLayout = new HorizontalLayout(); + final Button showHideButton = new Button("- Relations"); + showHideButton.addListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + listBoxesLayout.setVisible(!listBoxesLayout.isVisible()); + if (listBoxesLayout.isVisible()) { + showHideButton.setCaption("- Relations"); + } else { + showHideButton.setCaption("+ Relations"); + } + } + }); + + relationTypesListSelect.setNullSelectionAllowed(false); + relationTypesListSelect.setImmediate(true); + Label spacer = new Label(); + spacer.setWidth(15, UNITS_PIXELS); + + relationsListSelect.setNullSelectionAllowed(false); + relationsListSelect.setImmediate(true); + + relationTypesListSelect.addListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + if (!lockRelTypesListener) { + WebId relationType = (WebId) relationTypesListSelect.getValue(); + searchPresenter.selectRelationType(relationType, OseeRelationsComponent.this); + } + } + }); + + relationsListSelect.addListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + if (!lockRelsListener) { + WebArtifact artifact = (WebArtifact) relationsListSelect.getValue(); + searchPresenter.selectArtifact(artifact, navigator); + } + } + }); + + listBoxesLayout.addComponent(relationTypesListSelect); + listBoxesLayout.addComponent(spacer); + listBoxesLayout.addComponent(relationsListSelect); + + addComponent(showHideButton); + addComponent(listBoxesLayout); + setExpandRatio(listBoxesLayout, 1.0f); + + //Fixed width lists make for a prettier layout + relationTypesListSelect.setWidth(200, UNITS_PIXELS); + relationsListSelect.setWidth(200, UNITS_PIXELS); + } + + public OseeRelationsComponent() { + createLayout(); + } + + @Override + public void clearAll() { + if (relationTypesListSelect != null) { + lockRelTypesListener = true; + relationTypesListSelect.removeAllItems(); + lockRelTypesListener = false; + } + if (relationsListSelect != null) { + lockRelsListener = true; + relationsListSelect.removeAllItems(); + lockRelsListener = false; + } + } + + @Override + public void addRelationType(WebId id) { + if (relationTypesListSelect != null) { + lockRelTypesListener = true; + relationTypesListSelect.addItem(id); + lockRelTypesListener = false; + } + } + + @Override + public void clearRelations() { + if (relationsListSelect != null) { + lockRelsListener = true; + relationsListSelect.removeAllItems(); + lockRelsListener = false; + } + } + + @Override + public void addRelation(WebArtifact id) { + if (relationsListSelect != null) { + lockRelsListener = true; + relationsListSelect.addItem(id); + lockRelsListener = false; + } + } +} 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 0af60ae..a9b7133 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 @@ -16,9 +16,6 @@ import org.eclipse.osee.display.api.components.SearchResultComponent; import org.eclipse.osee.display.api.data.WebArtifact; import org.eclipse.osee.display.api.data.SearchResultMatch; import org.eclipse.osee.display.view.web.CssConstants; -import org.eclipse.osee.display.view.web.OseeAppData; -import org.eclipse.osee.display.view.web.internal.search.OseeBreadcrumbComponent; -import org.eclipse.osee.vaadin.widgets.Navigator; import com.vaadin.ui.Alignment; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; @@ -30,7 +27,6 @@ import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") public class OseeSearchResultComponent extends VerticalLayout implements SearchResultComponent { - private final Navigator navigator = OseeAppData.getNavigator(); private WebArtifact artifact; private final Collection<SearchResultMatch> matches = new ArrayList<SearchResultMatch>(); @@ -51,8 +47,8 @@ public class OseeSearchResultComponent extends VerticalLayout implements SearchR HorizontalLayout row0 = new HorizontalLayout(); - ArtifactNameLinkComponent artifactName = - new ArtifactNameLinkComponent(artifact, CssConstants.OSEE_SEARCHRESULT_ARTNAME); + OseeArtifactNameLinkComponent artifactName = + new OseeArtifactNameLinkComponent(artifact, CssConstants.OSEE_SEARCHRESULT_ARTNAME); Label spacer1 = new Label(""); spacer1.setHeight(null); spacer1.setWidth(15, UNITS_PIXELS); @@ -64,7 +60,7 @@ public class OseeSearchResultComponent extends VerticalLayout implements SearchR row0.setComponentAlignment(artifactName, Alignment.BOTTOM_LEFT); row0.setComponentAlignment(artifactType, Alignment.MIDDLE_LEFT); - OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(navigator, artifact); + OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(artifact); addComponent(row0); addComponent(breadcrumbComp); 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 5a7542b..2bb05ca 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 @@ -16,7 +16,10 @@ import java.util.Collection; import java.util.Iterator; import org.eclipse.osee.display.api.components.SearchResultComponent; import org.eclipse.osee.display.api.components.SearchResultsListComponent; +import org.eclipse.osee.display.view.web.CssConstants; import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; /** @@ -26,8 +29,14 @@ import com.vaadin.ui.VerticalLayout; public class OseeSearchResultsListComponent extends VerticalLayout implements SearchResultsListComponent { VerticalLayout bottomSpacer = new VerticalLayout(); + HorizontalLayout manySearchResultsHorizLayout = new HorizontalLayout(); public OseeSearchResultsListComponent() { + addComponent(manySearchResultsHorizLayout); + Label spacer2 = new Label(""); + spacer2.setHeight(15, UNITS_PIXELS); + addComponent(spacer2); + bottomSpacer.setSizeFull(); addComponent(bottomSpacer); setExpandRatio(bottomSpacer, 1.0f); @@ -49,11 +58,36 @@ public class OseeSearchResultsListComponent extends VerticalLayout implements Se } } + private int getManySearchResultComponents() { + int many = 0; + for (Iterator<Component> iter = getComponentIterator(); iter.hasNext();) { + Component component = iter.next(); + if (component.getClass() == OseeSearchResultComponent.class) { + many++; + } + } + return many; + } + + private void updateManySearchResultsLabel() { + int manySearchResultComponents = getManySearchResultComponents(); + manySearchResultsHorizLayout.removeAllComponents(); + + Label manySearchResults = new Label(String.format("[%d]", manySearchResultComponents)); + Label manySearchResults_suffix = new Label("search result(s) found."); + manySearchResultsHorizLayout.addComponent(manySearchResults); + manySearchResultsHorizLayout.addComponent(manySearchResults_suffix); + manySearchResults.setStyleName(CssConstants.OSEE_SEARCHRESULT_MATCH_MANY); + + } + @Override public SearchResultComponent createSearchResult() { OseeSearchResultComponent searchResultComp = new OseeSearchResultComponent(); int spacerIndex = this.getComponentIndex(bottomSpacer); addComponent(searchResultComp, spacerIndex); + updateManySearchResultsLabel(); + return searchResultComp; } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java index 7282be3..16a9243 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/OseeUiViews.java @@ -12,9 +12,6 @@ package org.eclipse.osee.display.view.web.internal; import java.util.ArrayList; import java.util.List; -import org.eclipse.osee.display.view.web.internal.search.OseeArtifactView; -import org.eclipse.osee.display.view.web.search.OseeSearchHomeView; -import org.eclipse.osee.display.view.web.search.OseeSearchResultsView; import org.eclipse.osee.vaadin.widgets.HasViews; import org.eclipse.osee.vaadin.widgets.Navigator; @@ -27,12 +24,6 @@ public class OseeUiViews implements HasViews { public List<Class<? extends Navigator.View>> getViews() { // Dynamic View Registration? List<Class<? extends Navigator.View>> views = new ArrayList<Class<? extends Navigator.View>>(); - // views.add(View1.class); - // views.add(View2.class); - // views.add(View3.class); - views.add(OseeSearchHomeView.class); - views.add(OseeSearchResultsView.class); - views.add(OseeArtifactView.class); return views; } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeArtifactView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeArtifactView.java deleted file mode 100644 index 37a4802..0000000 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeArtifactView.java +++ b/dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.internal.search; - -import java.util.Map; -import org.eclipse.osee.display.api.data.WebArtifact; -import org.eclipse.osee.display.api.search.SearchView; -import org.eclipse.osee.display.view.web.components.ArtifactNameLinkComponent; -import org.eclipse.osee.display.view.web.search.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.VerticalLayout; - -/** - * @author Shawn F. Cook - */ -@SuppressWarnings("serial") -public class OseeArtifactView extends CustomComponent implements Navigator.View, SearchView { - - private OseeSearchHeaderComponent oseeSearchHeader; - private Navigator navigator; - private OseeRelationsComponent relationsComp; - private final OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(null, null); - private WebArtifact artifact; - - private void initLayout() { - final VerticalLayout vertLayout = new VerticalLayout(); - vertLayout.setSizeFull(); - - if (artifact != null) { - vertLayout.removeAllComponents(); - - ArtifactNameLinkComponent artifactName = new ArtifactNameLinkComponent(artifact); - - final VerticalLayout paddedVertLayout = new VerticalLayout(); - paddedVertLayout.setSizeFull(); - paddedVertLayout.setMargin(true); - paddedVertLayout.addComponent(breadcrumbComp); - paddedVertLayout.addComponent(artifactName); - paddedVertLayout.addComponent(relationsComp); - paddedVertLayout.setExpandRatio(relationsComp, 1.0f); - - vertLayout.addComponent(oseeSearchHeader); - vertLayout.setComponentAlignment(oseeSearchHeader, Alignment.TOP_LEFT); - vertLayout.addComponent(paddedVertLayout); - vertLayout.setExpandRatio(paddedVertLayout, 1.0f); - - } - setCompositionRoot(vertLayout); - } - - @Override - public void init(Navigator navigator, Application application) { - this.navigator = navigator; - - oseeSearchHeader = new OseeSearchHeaderComponent(); - breadcrumbComp.setNavigator(navigator); - //relationsComp = new OseeRelationsComponent(navigator, webBackend, null); - - setSizeFull(); - initLayout(); - } - - @Override - public void navigateTo(String requestedDataId) { - //TODO: PROTOTYPE - Replace this with actual code that properly parses the request string - Map<String, String> paramMap = OseeRoadMapAndNavigation.requestStringToParameterMap(requestedDataId); - String artifactGuid = paramMap.get(OseeRoadMapAndNavigation.ARTIFACT); - // webBackend.getArtifact(this, artifactGuid); - } - - @Override - public String getWarningForNavigatingFrom() { - return null; - } - - // @Override - // public String getWarningForNavigatingFrom() { - // return null; - // } - // - // @Override - // public void setProgramsAndBuilds(ProgramsAndBuilds builds) { - // //Do nothing - // } - // - // @Override - // public void setSearchResults(Collection<SearchResult> searchResults) { - // //Do nothing - // } - // - // @Override - // public void setArtifact(Artifact artifact) { - // breadcrumbComp.setArtifact(artifact); - // relationsComp.setArtifact(artifact); - // oseeSearchHeader.setArtifact(artifact); - // this.artifact = artifact; - // initLayout(); - // } - // - // @Override - // public void setProgram(Program program) { - // //Do nothing - // } - // - // @Override - // public void setBuild(Build build) { - // //Do nothing - // } - // - // @Override - // public void setErrorMessage(String message) { - // } - -} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeBreadcrumbComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeBreadcrumbComponent.java deleted file mode 100644 index 340859d..0000000 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeBreadcrumbComponent.java +++ b/dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.internal.search; - -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.osee.display.api.data.WebArtifact; -import org.eclipse.osee.display.view.web.CssConstants; -import org.eclipse.osee.display.view.web.components.ArtifactNameLinkComponent; -import org.eclipse.osee.vaadin.widgets.Navigator; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; - -/** - * @author Shawn F. Cook - */ -@SuppressWarnings("serial") -public class OseeBreadcrumbComponent extends HorizontalLayout { - private Navigator navigator; - private WebArtifact artifact; - - private void init() { - this.removeAllComponents(); - - Collection<WebArtifact> crumbs = new ArrayList<WebArtifact>(); - // if (artifact != null && artifact.getAncestry() != null && artifact.getAncestry().size() > 0) { - // crumbs.addAll(artifact.getAncestry()); - // } - - int count = 0; - int manyBreadCrumbs = crumbs.size(); - for (WebArtifact crumb : crumbs) { - ArtifactNameLinkComponent crumbLabel = - new ArtifactNameLinkComponent(crumb, CssConstants.OSEE_BREADCRUMB_ARTNAME); - addComponent(crumbLabel); - if (count < manyBreadCrumbs - 1) { - Label delimiter = new Label(" >> ", Label.CONTENT_XHTML); - delimiter.setHeight(null); - addComponent(delimiter); - } - count++; - } - } - - public OseeBreadcrumbComponent(Navigator navigator, WebArtifact artifact) { - this.navigator = navigator; - this.artifact = artifact; - - init(); - } - - public void setArtifact(WebArtifact artifact) { - this.artifact = artifact; - init(); - } - - public void setNavigator(Navigator navigator) { - this.navigator = navigator; - } - - public Navigator getNavigator() { - return navigator; - } -} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRelationsComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRelationsComponent.java deleted file mode 100644 index 30eeddd..0000000 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRelationsComponent.java +++ b/dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.internal.search; - -import org.eclipse.osee.display.api.data.WebArtifact; -import org.eclipse.osee.display.api.search.SearchPresenter; -import org.eclipse.osee.vaadin.widgets.Navigator; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.VerticalLayout; - -/** - * @author Shawn F. Cook - */ -@SuppressWarnings("serial") -public class OseeRelationsComponent extends VerticalLayout { - private final Navigator navigator; - private final SearchPresenter webBackend; - private WebArtifact artifact; - - private void initLayout() { - if (artifact != null) { - this.removeAllComponents(); - - final HorizontalLayout listBoxesLayout = new HorizontalLayout(); - final Button showHideButton = new Button("- Relations"); - showHideButton.addListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - listBoxesLayout.setVisible(!listBoxesLayout.isVisible()); - if (listBoxesLayout.isVisible()) { - showHideButton.setCaption("- Relations"); - } else { - showHideButton.setCaption("+ Relations"); - } - } - }); - - // final ListSelect relationTypesListSelect = new ListSelect("Relation Types:", artifact.getRelationTypes()); - // relationTypesListSelect.setNullSelectionAllowed(false); - // relationTypesListSelect.setImmediate(true); - // Label spacer = new Label(); - // spacer.setWidth(15, UNITS_PIXELS); - // final ListSelect relationsListSelect = new ListSelect("Relations:", new ArrayList<String>()); - // relationsListSelect.setNullSelectionAllowed(false); - // relationsListSelect.setImmediate(true); - // - // relationTypesListSelect.addListener(new Property.ValueChangeListener() { - // @Override - // public void valueChange(ValueChangeEvent event) { - // RelationType relationType = (RelationType) relationTypesListSelect.getValue(); - // Collection<Artifact> relations = artifact.getRelationsWithRelationType(relationType); - // relationsListSelect.removeAllItems(); - // for (Artifact artifact : relations) { - // relationsListSelect.addItem(artifact); - // } - // } - // }); - // - // listBoxesLayout.addComponent(relationTypesListSelect); - // listBoxesLayout.addComponent(spacer); - // listBoxesLayout.addComponent(relationsListSelect); - - addComponent(showHideButton); - addComponent(listBoxesLayout); - setExpandRatio(listBoxesLayout, 1.0f); - } - } - - public OseeRelationsComponent(Navigator navigator, SearchPresenter webBackend, WebArtifact artifact) { - this.navigator = navigator; - this.webBackend = webBackend; - this.artifact = artifact; - - initLayout(); - } - - public void setArtifact(WebArtifact artifact) { - this.artifact = artifact; - initLayout(); - } -} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRoadMapAndNavigation.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRoadMapAndNavigation.java index ecc086c..6279251 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRoadMapAndNavigation.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/internal/search/OseeRoadMapAndNavigation.java @@ -75,6 +75,9 @@ public class OseeRoadMapAndNavigation { return parameters; } + /* + * Returns: parameter string starting with '/' and ending without a delim character. example: "/program/blk3_guid" + */ public static String parameterMapToRequestString(Map<String, String> parameters) { String requestedDataId = "/"; 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 new file mode 100644 index 0000000..4bf072f --- a/dev/null +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeArtifactView.java @@ -0,0 +1,121 @@ +/******************************************************************************* + * 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.search; + +import org.eclipse.osee.display.api.components.ArtifactHeaderComponent; +import org.eclipse.osee.display.api.data.WebArtifact; +import org.eclipse.osee.display.api.search.SearchPresenter; +import org.eclipse.osee.display.view.web.OseeAppData; +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.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.VerticalLayout; + +/** + * @author Shawn F. Cook + */ +@SuppressWarnings("serial") +public class OseeArtifactView extends CustomComponent implements Navigator.View, ArtifactHeaderComponent { + + protected SearchPresenter searchPresenter = OseeAppData.getSearchPresenter(); + protected OseeSearchHeaderComponent oseeSearchHeader = getOseeSearchHeader(); + protected OseeRelationsComponent relationsComp = new OseeRelationsComponent(); + protected OseeAttributeComponent attributeComp = new OseeAttributeComponent(); + private final OseeBreadcrumbComponent breadcrumbComp = new OseeBreadcrumbComponent(null); + private WebArtifact artifact; + + private void initLayout() { + setSizeFull(); + + HorizontalLayout leftMarginAndBody = new HorizontalLayout(); + leftMarginAndBody.setSizeFull(); + Label leftMarginSpace = new Label(""); + leftMarginSpace.setWidth(80, UNITS_PIXELS); + leftMarginAndBody.addComponent(leftMarginSpace); + + if (artifact != null) { + VerticalLayout bodyVertLayout = new VerticalLayout(); + breadcrumbComp.setArtifact(artifact); + OseeArtifactNameLinkComponent artifactName = new OseeArtifactNameLinkComponent(artifact); + bodyVertLayout.addComponent(breadcrumbComp); + bodyVertLayout.addComponent(artifactName); + VerticalLayout artRelSpacer = new VerticalLayout(); + artRelSpacer.setHeight(15, UNITS_PIXELS); + bodyVertLayout.addComponent(artRelSpacer); + bodyVertLayout.addComponent(relationsComp); + VerticalLayout relAttrSpacer = new VerticalLayout(); + relAttrSpacer.setHeight(15, UNITS_PIXELS); + bodyVertLayout.addComponent(relAttrSpacer); + bodyVertLayout.addComponent(attributeComp); + VerticalLayout bottomSpacer = new VerticalLayout(); + bodyVertLayout.addComponent(bottomSpacer); + bodyVertLayout.setExpandRatio(bottomSpacer, 1.0f); + + leftMarginAndBody.addComponent(bodyVertLayout); + bodyVertLayout.setSizeFull(); + leftMarginAndBody.setExpandRatio(bodyVertLayout, 1.0f); + } + + final VerticalLayout vertLayout = new VerticalLayout(); + vertLayout.addComponent(oseeSearchHeader); + vertLayout.setComponentAlignment(oseeSearchHeader, Alignment.TOP_LEFT); + oseeSearchHeader.setWidth(100, UNITS_PERCENTAGE); + oseeSearchHeader.setHeight(null); + vertLayout.addComponent(leftMarginAndBody); + vertLayout.setExpandRatio(leftMarginAndBody, 1.0f); + + vertLayout.setSizeFull(); + setCompositionRoot(vertLayout); + } + + @Override + public void init(Navigator navigator, Application application) { + initLayout(); + } + + @Override + public void navigateTo(String requestedDataId) { + searchPresenter.initArtifactPage(requestedDataId, oseeSearchHeader, this, relationsComp, attributeComp); + } + + @Override + public String getWarningForNavigatingFrom() { + return null; + } + + protected OseeSearchHeaderComponent getOseeSearchHeader() { + return new OseeSearchHeaderComponent(); + } + + @Override + public void clearAll() { + this.artifact = null; + initLayout(); + } + + @Override + public void setArtifact(WebArtifact artifact) { + this.artifact = artifact; + initLayout(); + } + + @Override + public void setErrorMessage(String message) { + //TODO: + } +} diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHeaderComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHeaderComponent.java index 3e49500..cb8d27c 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHeaderComponent.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHeaderComponent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. + * 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 @@ -10,13 +10,14 @@ *******************************************************************************/ package org.eclipse.osee.display.view.web.search; +import org.eclipse.osee.display.api.components.SearchHeaderComponent; import com.vaadin.ui.VerticalLayout; /** * @author Shawn F. Cook */ @SuppressWarnings("serial") -public class OseeSearchHeaderComponent extends VerticalLayout { +public class OseeSearchHeaderComponent extends VerticalLayout implements SearchHeaderComponent { @Override public void attach() { @@ -27,4 +28,14 @@ public class OseeSearchHeaderComponent extends VerticalLayout { //Do nothing. } + @Override + public void clearAll() { + //Do nothing. + } + + @Override + public void setErrorMessage(String message) { + //Do nothing. + } + } diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHomeView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHomeView.java index 161cb8c..145eba8 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHomeView.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchHomeView.java @@ -22,7 +22,11 @@ import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") public class OseeSearchHomeView extends CustomComponent implements Navigator.View { - protected OseeSearchHeaderComponent oseeSearchHeader = getOseeSearchHeader(); + protected OseeSearchHeaderComponent oseeSearchHeader; + + public OseeSearchHomeView() { + oseeSearchHeader = getOseeSearchHeader(); + } @Override public void init(Navigator navigator, Application application) { diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchResultsView.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchResultsView.java index 265104b..06d5947 100644 --- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchResultsView.java +++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/search/OseeSearchResultsView.java @@ -25,38 +25,37 @@ import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") public class OseeSearchResultsView extends CustomComponent implements Navigator.View { - protected OseeSearchHeaderComponent oseeSearchHeader = getOseeSearchHeader(); - protected OseeSearchResultsListComponent searchResultsListComponent = new OseeSearchResultsListComponent(); + protected OseeSearchHeaderComponent oseeSearchHeader; + protected OseeSearchResultsListComponent searchResultsListComponent; - @Override - public void init(Navigator navigator, Application application) { - initComponents(); + public OseeSearchResultsView() { + oseeSearchHeader = getOseeSearchHeader(); + searchResultsListComponent = new OseeSearchResultsListComponent(); + } + private void initLayout() { setSizeFull(); - final HorizontalLayout headerHorzLayout = new HorizontalLayout(); - headerHorzLayout.addComponent(oseeSearchHeader); - headerHorzLayout.setComponentAlignment(oseeSearchHeader, Alignment.TOP_LEFT); - oseeSearchHeader.setSizeUndefined(); - - //This is a fixed-height spacer that simply forms a nice margin between the search - // results and the search header. - // Label topSpacer = new Label(""); - // topSpacer.setHeight(85, UNITS_PIXELS); - // topSpacer.setSizeUndefined(); - HorizontalLayout leftMarginAndBody = new HorizontalLayout(); leftMarginAndBody.setSizeFull(); Label leftMarginSpace = new Label(""); leftMarginSpace.setWidth(80, UNITS_PIXELS); leftMarginAndBody.addComponent(leftMarginSpace); + + VerticalLayout bodyVertLayout = new VerticalLayout(); leftMarginAndBody.addComponent(searchResultsListComponent); searchResultsListComponent.setSizeFull(); leftMarginAndBody.setExpandRatio(searchResultsListComponent, 1.0f); + leftMarginAndBody.addComponent(bodyVertLayout); + bodyVertLayout.setSizeFull(); + leftMarginAndBody.setExpandRatio(bodyVertLayout, 1.0f); + final VerticalLayout vertLayout = new VerticalLayout(); - vertLayout.addComponent(headerHorzLayout); - // vertLayout.addComponent(topSpacer); + vertLayout.addComponent(oseeSearchHeader); + vertLayout.setComponentAlignment(oseeSearchHeader, Alignment.TOP_LEFT); + oseeSearchHeader.setWidth(100, UNITS_PERCENTAGE); + oseeSearchHeader.setHeight(null); vertLayout.addComponent(leftMarginAndBody); vertLayout.setExpandRatio(leftMarginAndBody, 1.0f); @@ -64,6 +63,12 @@ public class OseeSearchResultsView extends CustomComponent implements Navigator. setCompositionRoot(vertLayout); } + @Override + public void init(Navigator navigator, Application application) { + initComponents(); + initLayout(); + } + protected OseeSearchHeaderComponent getOseeSearchHeader() { return new OseeSearchHeaderComponent(); } diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch b/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch index 5888196..81c710d 100644 --- a/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch +++ b/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch @@ -20,7 +20,7 @@ <stringAttribute key="pde.version" value="3.3"/> <booleanAttribute key="show_selected_only" value="false"/> <stringAttribute key="target_bundles" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.ibm.icu@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.commons.codec@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/> -<stringAttribute key="timestamp" value="1317764951871"/> +<stringAttribute key="timestamp" value="1317914806677"/> <booleanAttribute key="tracing" value="false"/> <booleanAttribute key="useCustomFeatures" value="false"/> <booleanAttribute key="useDefaultConfigArea" value="true"/> diff --git a/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css b/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css index 1c7ea24..62c5dee 100644 --- a/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css +++ b/plugins/org.eclipse.osee.vaadin.themes/src/VAADIN/themes/osee/styles.css @@ -89,7 +89,7 @@ font-size: 100px; } -.osee-title-medium-text { +.osee-title-medium-text a img { font-size: 70px; width: 70px; height: 70px; @@ -124,4 +124,10 @@ background-repeat:repeat-x; } +.osee-attributelabel { +} + +.osee-attributevalue { + font-weight:bold; +} |

