Package com.jidesoft.spring.richclient.googledemo.events

Examples of com.jidesoft.spring.richclient.googledemo.events.SearchResultEvent


  // Occurs within the EDT
  protected void finished() {
    if(getException() == null){
      GoogleSearchResult result = (GoogleSearchResult)getFinishedResult();
      Application.instance().getApplicationContext().publishEvent(
          new SearchResultEvent(this, result));
    }
    else{
      InvocationTargetException error = getException();
      Application.instance().getApplicationContext().publishEvent(
          new SwingWorkerExceptionEvent(this, error));
View Full Code Here


   * In bigger applications I don't use this event mechanism but
   * rather the event listener framework at https://elf.dev.java.net/
   */
  public void onApplicationEvent(ApplicationEvent event) {
    if(event instanceof SearchResultEvent){
      SearchResultEvent specificEvent = (SearchResultEvent)event;
      if(specificEvent.getSearchResult() != null){
        Integer results = new Integer(specificEvent.getSearchResult().getResultElements().length);
        int estimatedResults = specificEvent.getSearchResult().getEstimatedTotalResultsCount();
        if(estimatedResults == 0){
          statusBar.setMessage(getMessage(NO_RESULTS));
        }
        else{
          statusBar.setMessage(getMessage(ESTIMATED_RESULTS,
              new Object[]{new Integer(estimatedResults)}));
        }
      }
      else{
        statusBar.setMessage(getMessage(NO_RESULTS));
      }
    }
    else if(event instanceof SearchResultsSelectionEvent){
      //SearchResultsSelectionEvent specificEvent = (SearchResultsSelectionEvent)event;
      //statusBarCommandGroup.setMessage(specificEvent.getSearchResult().getURL());
    }
    else if(event instanceof SwingWorkerExceptionEvent){
      SwingWorkerExceptionEvent specificEvent = (SwingWorkerExceptionEvent)event;
      if(specificEvent.getCause().getCause() != null){
        statusBar.setErrorMessage(
            specificEvent.getCause().getCause().getMessage());
      }
      else{
        statusBar.setErrorMessage(getMessage(UNKNOWN_ERROR));
      }
    }
    else if(event instanceof OpenEditorEvent){
      OpenEditorEvent specificEvent = (OpenEditorEvent)event;
      GoogleSearchResultElement element = (GoogleSearchResultElement)specificEvent.getObject();
      statusBar.setMessage(getMessage(OPENED, new Object[]{element.getURL()}));
    }
  }
View Full Code Here

   * worker when finished). These events should occur on the EDT
   * but I check to make sure.
   */
  public void onApplicationEvent(ApplicationEvent event) {
    if(event instanceof SearchResultEvent){
      SearchResultEvent searchResultEvent = (SearchResultEvent)event;
      final GoogleSearchResult results = searchResultEvent.getSearchResult();
      if(SwingUtilities.isEventDispatchThread()){
        updateTreeModel(results);
      }
      else{
        SwingUtilities.invokeLater(new Runnable(){
View Full Code Here

TOP

Related Classes of com.jidesoft.spring.richclient.googledemo.events.SearchResultEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.