summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshawn.f.cook2011-10-26 18:16:35 (EDT)
committerRoberto E. Escobar2011-10-26 18:16:35 (EDT)
commit7a8fa75d738ca314020204988967309eafb1cb74 (patch)
tree26a37c64828c5c80841d14ce0ce4450608715bb1
parent61232010ccd90664d1e48241eb5e22e17ed9f2db (diff)
downloadorg.eclipse.osee-7a8fa75d738ca314020204988967309eafb1cb74.zip
org.eclipse.osee-7a8fa75d738ca314020204988967309eafb1cb74.tar.gz
org.eclipse.osee-7a8fa75d738ca314020204988967309eafb1cb74.tar.bz2
feature[ats_E6W8N]: Implement search progress listener
-rw-r--r--plugins/org.eclipse.osee.ats.presenter.mock/build.properties3
-rw-r--r--plugins/org.eclipse.osee.ats.presenter.mock/src/org/eclipse/osee/ats/presenter/mock/internal/MockAtsWebSearchPresenter.java57
-rw-r--r--plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderImpl.java88
-rw-r--r--plugins/org.eclipse.osee.display.api/build.properties3
-rw-r--r--plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressListener.java25
-rw-r--r--plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressProvider.java22
-rw-r--r--plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockSearchPresenter.java3
-rw-r--r--plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchProgressListenerImpl.java51
-rw-r--r--plugins/org.eclipse.osee.support.config/launchConfig/UI.launch2
9 files changed, 218 insertions, 36 deletions
diff --git a/plugins/org.eclipse.osee.ats.presenter.mock/build.properties b/plugins/org.eclipse.osee.ats.presenter.mock/build.properties
index d40b929..b799710 100644
--- a/plugins/org.eclipse.osee.ats.presenter.mock/build.properties
+++ b/plugins/org.eclipse.osee.ats.presenter.mock/build.properties
@@ -8,4 +8,5 @@ additional.bundles = org.eclipse.osee.ats.api,\
org.eclipse.osee.display.presenter.mocks,\
org.eclipse.osee.framework.core,\
org.eclipse.osee.ats.mocks,\
- org.eclipse.osee.orcs
+ org.eclipse.osee.orcs,\
+ org.eclipse.osee.display.presenter
diff --git a/plugins/org.eclipse.osee.ats.presenter.mock/src/org/eclipse/osee/ats/presenter/mock/internal/MockAtsWebSearchPresenter.java b/plugins/org.eclipse.osee.ats.presenter.mock/src/org/eclipse/osee/ats/presenter/mock/internal/MockAtsWebSearchPresenter.java
index b10a375..dfa1322 100644
--- a/plugins/org.eclipse.osee.ats.presenter.mock/src/org/eclipse/osee/ats/presenter/mock/internal/MockAtsWebSearchPresenter.java
+++ b/plugins/org.eclipse.osee.ats.presenter.mock/src/org/eclipse/osee/ats/presenter/mock/internal/MockAtsWebSearchPresenter.java
@@ -123,27 +123,46 @@ public class MockAtsWebSearchPresenter<T extends AtsSearchHeaderComponent, K ext
}
@Override
- public void selectSearch(String url, K params, SearchNavigator navigator) {
- if (navigator != null && params != null) {
- Map<String, String> parameters = new HashMap<String, String>();
+ public void selectCancel() {
+ fireSearchCancelledEvent();
+ }
- if (params.getProgram() != null) {
- parameters.put(UrlParamNameConstants.PARAMNAME_PROGRAM, params.getProgram().getGuid());
- }
- if (params.getBuild() != null) {
- parameters.put(UrlParamNameConstants.PARAMNAME_BUILD, params.getBuild().getGuid());
- }
- if (params.isNameOnly() != null) {
- parameters.put(UrlParamNameConstants.PARAMNAME_NAMEONLY, params.isNameOnly() ? "true" : "false");
- }
- if (params.getSearchString() != null) {
- parameters.put(UrlParamNameConstants.PARAMNAME_SEARCHPHRASE, params.getSearchString());
- }
- if (parameters.size() > 0) {
- String newurl = parameterMapToRequestString(parameters, url);
- navigator.navigateSearchResults(newurl);
+ @Override
+ public void selectSearch(final String url, final K params, final SearchNavigator navigator) {
+ fireSearchInProgressEvent();
+
+ Runnable searchThread = new Runnable() {
+ @Override
+ public void run() {
+ if (navigator != null && params != null) {
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ if (params.getProgram() != null) {
+ parameters.put(UrlParamNameConstants.PARAMNAME_PROGRAM, params.getProgram().getGuid());
+ }
+ if (params.getBuild() != null) {
+ parameters.put(UrlParamNameConstants.PARAMNAME_BUILD, params.getBuild().getGuid());
+ }
+ if (params.isNameOnly() != null) {
+ parameters.put(UrlParamNameConstants.PARAMNAME_NAMEONLY, params.isNameOnly() ? "true" : "false");
+ }
+ if (params.getSearchString() != null) {
+ parameters.put(UrlParamNameConstants.PARAMNAME_SEARCHPHRASE, params.getSearchString());
+ }
+ if (parameters.size() > 0) {
+ String newurl = parameterMapToRequestString(parameters, url);
+ // navigator.navigateSearchResults(newurl);
+ try {
+ Thread.sleep(2500);
+ } catch (InterruptedException ex) {
+ }
+ fireSearchCompletedEvent();
+ }
+ }
}
- }
+ };
+
+ searchThread.run();
}
private void updateSearchDisplayOptions(String url, DisplayOptionsComponent optionsComp) {
diff --git a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderImpl.java b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderImpl.java
index 08146d8..efc4d7c 100644
--- a/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderImpl.java
+++ b/plugins/org.eclipse.osee.ats.view.web/src/org/eclipse/osee/ats/view/web/components/AtsSearchHeaderImpl.java
@@ -17,6 +17,8 @@ import org.eclipse.osee.ats.view.web.AtsNavigator;
import org.eclipse.osee.ats.view.web.AtsUiApplication;
import org.eclipse.osee.ats.view.web.search.AtsSearchResultsView;
import org.eclipse.osee.display.api.data.ViewId;
+import org.eclipse.osee.display.api.search.SearchProgressListener;
+import org.eclipse.osee.display.api.search.SearchProgressProvider;
import org.eclipse.osee.display.view.web.CssConstants;
import org.eclipse.osee.display.view.web.components.ComponentUtility;
import org.eclipse.osee.display.view.web.components.OseeExceptionDialogComponent;
@@ -35,8 +37,10 @@ import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
+import com.vaadin.ui.ProgressIndicator;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window.Notification;
/**
* @author Shawn F. Cook
@@ -44,18 +48,25 @@ import com.vaadin.ui.VerticalLayout;
@SuppressWarnings("serial")
public class AtsSearchHeaderImpl extends OseeSearchHeaderComponent implements AtsSearchHeaderComponent, Handler, SearchProgressListener {
+ private final String SEARCHBUTTON_SEARCH = "Search";
+ private final String SEARCHBUTTON_CANCEL = "Cancel";
private boolean isLayoutComplete = false;
private final ComboBox programCombo = new ComboBox("Program:");
private final ComboBox buildCombo = new ComboBox("Build:");
private final CheckBox nameOnlyCheckBox = new CheckBox("Name Only", true);
private final TextField searchTextField = new TextField();
- private final Button searchButton = new Button("Search");
+ private final Button searchButton = new Button(SEARCHBUTTON_SEARCH);
private boolean lockProgramCombo = false;
- Panel searchTextPanel = new Panel();
+ private final Panel searchTextPanel = new Panel();
+ private final ProgressIndicator progressIndicator = new ProgressIndicator();
@Override
public void attach() {
if (!isLayoutComplete) {
+ AtsSearchPresenter searchPresenter = getPresenter();
+ if (searchPresenter != null && searchPresenter instanceof SearchProgressProvider) {
+ ((SearchProgressProvider) searchPresenter).addListener(this);
+ }
createLayout();
}
isLayoutComplete = true;
@@ -109,18 +120,35 @@ public class AtsSearchHeaderImpl extends OseeSearchHeaderComponent implements At
}
protected void selectSearch() {
- if (searchButton.isEnabled()) {
- if (ComponentUtility.isAccessible(programCombo, buildCombo, nameOnlyCheckBox, searchTextField)) {
- ViewId program = (ViewId) programCombo.getValue();
- ViewId build = (ViewId) buildCombo.getValue();
- boolean nameOnly = nameOnlyCheckBox.toString().equalsIgnoreCase("true");
- String searchPhrase = (String) searchTextField.getValue();
- AtsSearchParameters params = new AtsSearchParameters(searchPhrase, nameOnly, build, program);
- getPresenter().selectSearch(getRequestedDataId(), params, getNavigator());
- } else {
- System.out.println("AtsSearchHeaderComponent.selectSearch - WARNING: null value detected.");
+ Runnable thread = new Runnable() {
+ @Override
+ public void run() {
+ for (int i = 0; i < 9999; i++) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ex) {
+ }
+ nameOnlyCheckBox.setCaption(String.format("%d", i));
+ }
}
- }
+ };
+ thread.run();
+ // if (searchButton.isEnabled()) {
+ // if (searchButton.getCaption().equals(SEARCHBUTTON_SEARCH)) {
+ // if (ComponentUtility.isAccessible(programCombo, buildCombo, nameOnlyCheckBox, searchTextField)) {
+ // ViewId program = (ViewId) programCombo.getValue();
+ // ViewId build = (ViewId) buildCombo.getValue();
+ // boolean nameOnly = nameOnlyCheckBox.toString().equalsIgnoreCase("true");
+ // String searchPhrase = (String) searchTextField.getValue();
+ // AtsSearchParameters params = new AtsSearchParameters(searchPhrase, nameOnly, build, program);
+ // getPresenter().selectSearch(getRequestedDataId(), params, getNavigator());
+ // } else {
+ // System.out.println("AtsSearchHeaderComponent.selectSearch - WARNING: null value detected.");
+ // }
+ // } else if (searchButton.getCaption().equals(SEARCHBUTTON_CANCEL)) {
+ // getPresenter().selectCancel();
+ // }
+ // }
}
public void createLayout() {
@@ -172,6 +200,7 @@ public class AtsSearchHeaderImpl extends OseeSearchHeaderComponent implements At
searchTextPanel.setScrollable(false);
searchTextPanel.addActionHandler(this);
searchTextPanel.setContent(hLayout_SearchText);
+ progressIndicator.setPollingInterval(500);
hLayout_SearchText.addComponent(searchTextField);
@@ -184,6 +213,7 @@ public class AtsSearchHeaderImpl extends OseeSearchHeaderComponent implements At
hLayout_SearchTextBtn.addComponent(searchTextPanel);
hLayout_SearchTextBtn.addComponent(hSpacer_SearchTextBtn);
hLayout_SearchTextBtn.addComponent(searchButton);
+ hLayout_SearchTextBtn.addComponent(progressIndicator);
vLayout_SearchCrit.addComponent(hLayout_ProgBuildName);
vLayout_SearchCrit.addComponent(hLayout_SearchTextBtn);
@@ -303,5 +333,37 @@ public class AtsSearchHeaderImpl extends OseeSearchHeaderComponent implements At
private String getRequestedDataId() {
return getApplication().getUrl();
}
+
+ @Override
+ public void searchInProgress() {
+ System.out.println("Search in progress.");
+ programCombo.setEnabled(false);
+ buildCombo.setEnabled(false);
+ nameOnlyCheckBox.setEnabled(false);
+ searchTextField.setEnabled(false);
+ searchButton.setCaption(SEARCHBUTTON_CANCEL);
+ }
+
+ @Override
+ public void searchCancelled() {
+ System.out.println("Search cancelled.");
+ programCombo.setEnabled(true);
+ buildCombo.setEnabled(true);
+ nameOnlyCheckBox.setEnabled(true);
+ searchTextField.setEnabled(true);
+ validateSearchAndEnableSearchButton();
+ searchButton.setCaption(SEARCHBUTTON_SEARCH);
+ getApplication().getMainWindow().showNotification("Search Cancelled", Notification.TYPE_TRAY_NOTIFICATION);
+ }
+
+ @Override
+ public void searchCompleted() {
+ System.out.println("Search complete.");
+ programCombo.setEnabled(true);
+ buildCombo.setEnabled(true);
+ nameOnlyCheckBox.setEnabled(true);
+ searchTextField.setEnabled(true);
+ validateSearchAndEnableSearchButton();
+ searchButton.setCaption(SEARCHBUTTON_SEARCH);
}
}
diff --git a/plugins/org.eclipse.osee.display.api/build.properties b/plugins/org.eclipse.osee.display.api/build.properties
index df39ac1..d1990e7 100644
--- a/plugins/org.eclipse.osee.display.api/build.properties
+++ b/plugins/org.eclipse.osee.display.api/build.properties
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.
additional.bundles = org.eclipse.osee.framework.core,\
org.eclipse.osee.orcs,\
- org.eclipse.osee.framework.jdk.core
+ org.eclipse.osee.framework.jdk.core,\
+ com.vaadin
diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressListener.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressListener.java
new file mode 100644
index 0000000..9671e8c
--- /dev/null
+++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressListener.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.api.search;
+
+import java.io.Serializable;
+
+/**
+ * @author Shawn F. Cook
+ */
+public interface SearchProgressListener extends Serializable {
+
+ public void searchInProgress();
+
+ public void searchCancelled();
+
+ public void searchCompleted();
+}
diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressProvider.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressProvider.java
new file mode 100644
index 0000000..97b504e
--- /dev/null
+++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/SearchProgressProvider.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.api.search;
+
+/**
+ * @author Shawn F. Cook
+ */
+public interface SearchProgressProvider {
+
+ public void addListener(SearchProgressListener listener);
+
+ public void removeListener(SearchProgressListener listener);
+
+}
diff --git a/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockSearchPresenter.java b/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockSearchPresenter.java
index fbfa582..0a7ad70 100644
--- a/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockSearchPresenter.java
+++ b/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockSearchPresenter.java
@@ -14,11 +14,12 @@ import org.eclipse.osee.display.api.components.SearchHeaderComponent;
import org.eclipse.osee.display.api.data.ViewSearchParameters;
import org.eclipse.osee.display.api.search.SearchNavigator;
import org.eclipse.osee.display.api.search.SearchPresenter;
+import org.eclipse.osee.display.presenter.SearchProgressListenerImpl;
/**
* @author Shawn F. Cook
*/
-public abstract class MockSearchPresenter<T extends SearchHeaderComponent, K extends ViewSearchParameters> implements SearchPresenter<T, K> {
+public abstract class MockSearchPresenter<T extends SearchHeaderComponent, K extends ViewSearchParameters> extends SearchProgressListenerImpl implements SearchPresenter<T, K> {
@Override
public void selectSearch(String url, ViewSearchParameters params, SearchNavigator atsNavigator) {
diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchProgressListenerImpl.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchProgressListenerImpl.java
new file mode 100644
index 0000000..a28eaa3
--- /dev/null
+++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchProgressListenerImpl.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.presenter;
+
+import java.util.HashSet;
+import org.eclipse.osee.display.api.search.SearchProgressProvider;
+import org.eclipse.osee.display.api.search.SearchProgressListener;
+
+/**
+ * @author Shawn F. Cook
+ */
+public class SearchProgressListenerImpl implements SearchProgressProvider {
+
+ private final HashSet<SearchProgressListener> listeners = new HashSet<SearchProgressListener>();
+
+ @Override
+ public void addListener(SearchProgressListener listener) {
+ listeners.add(listener);
+ }
+
+ @Override
+ public void removeListener(SearchProgressListener listener) {
+ listeners.remove(listener);
+ }
+
+ protected void fireSearchInProgressEvent() {
+ for (SearchProgressListener listener : listeners) {
+ listener.searchInProgress();
+ }
+ }
+
+ protected void fireSearchCancelledEvent() {
+ for (SearchProgressListener listener : listeners) {
+ listener.searchCancelled();
+ }
+ }
+
+ protected void fireSearchCompletedEvent() {
+ for (SearchProgressListener listener : listeners) {
+ listener.searchCompleted();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch b/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch
index e496471..be2fb60 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.google.collect@default:default,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.ant.core@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="1318548088269"/>
+<stringAttribute key="timestamp" value="1319667132403"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>