Package com.cedarsoft.spring.rcp.events

Examples of com.cedarsoft.spring.rcp.events.SelectionEvent


  private DynamicLookup currentlySelectedObjects = new DynamicLookup();

  @Override
  public void onApplicationEvent( @NotNull ApplicationEvent event ) {
    if ( event instanceof SelectionEvent ) {
      SelectionEvent selectionEvent = ( SelectionEvent ) event;

      if ( selectionEvent.getObjects().lookups().isEmpty() ) {
        return;
      }

      switch ( selectionEvent.getType() ) {
        case SELECT:
          select( selectionEvent.getObjects() );
          break;
        case UNSELECT:
          unselect( selectionEvent.getObjects() );
          break;
        default:
          throw new IllegalArgumentException( "Invalid type " + selectionEvent.getType() );
      }
    }
  }
View Full Code Here


        //Iterate two times - first unselect, then select

        //First unselect
        while ( listChanges.next() ) {
          if ( listChanges.getType() == ListEvent.DELETE ) {
            getApplicationContext().publishEvent( new SelectionEvent( SelectionEvent.Type.UNSELECT, listChanges.getOldValue() ) );
          }
        }

        listChanges.reset();

        //Now select
        while ( listChanges.next() ) {
          if ( listChanges.getType() == ListEvent.INSERT ) {
            getApplicationContext().publishEvent( new SelectionEvent( SelectionEvent.Type.SELECT, selectionModel.getSelected().get( listChanges.getIndex() ) ) );
          }
        }
      }
    } );
  }
View Full Code Here

* Extended view that offers methods related to selection
*/
public abstract class ExtendedView extends AbstractView {
  @Override
  public void componentFocusGained() {
    getApplicationContext().publishEvent( new SelectionEvent( SelectionEvent.Type.SELECT, getSelectedObjects() ) );
    super.componentFocusGained();
    updateStatusBar();
  }
View Full Code Here

        try {
          TreePath oldSelection = e.getOldLeadSelectionPath();
          if ( oldSelection != null ) {
            Object object = oldSelection.getLastPathComponent();
            notifyUnselect( new DetailsTreeSelectionEvent( DetailsTreeSelectionEvent.Type.UNSELECTED, object ) );
            SpringSupport.INSTANCE.publishEvent( new SelectionEvent( SelectionEvent.Type.UNSELECT, Lookups.dynamicLookupFromList( Arrays.asList( oldSelection.getPath() ) ) ) );
          }

          TreePath newSelection = e.getNewLeadSelectionPath();
          if ( newSelection != null ) {
            Object object = newSelection.getLastPathComponent();
            notifySelect( new DetailsTreeSelectionEvent( DetailsTreeSelectionEvent.Type.SELECTED, object ) );
            SpringSupport.INSTANCE.publishEvent( new SelectionEvent( SelectionEvent.Type.SELECT, Lookups.dynamicLookupFromList( Arrays.asList( newSelection.getPath() ) ) ) );
          }
        } finally {
          updatingSelection = false;
        }
      }
View Full Code Here

  private boolean updating = true;
  private T editorObject;

  @Override
  public void componentFocusGained() {
    getApplicationContext().publishEvent( new SelectionEvent( SelectionEvent.Type.SELECT, getSelectedObjects() ) );
    super.componentFocusGained();
  }
View Full Code Here

    super.componentFocusGained();
  }

  @Override
  public void componentFocusLost() {
    getApplicationContext().publishEvent( new SelectionEvent( SelectionEvent.Type.UNSELECT, getSelectedObjects() ) );
    super.componentFocusLost();
  }
View Full Code Here

TOP

Related Classes of com.cedarsoft.spring.rcp.events.SelectionEvent

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.