org.pentaho.ui.xul.impl.XulEventHandler Java Examples

The following examples show how to use org.pentaho.ui.xul.impl.XulEventHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractPreviewRowsXulDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void initializeXul( XulLoader loader, BindingFactory bindingFactory, XulRunner runner, Object parent ) throws XulException {

    bf = bindingFactory;
    this.runner = runner;

    loader.registerClassLoader( getClass().getClassLoader() );
    loader.setSettingsManager( getSettingsManager() );
    loader.setOuterContext( parent );

    container = loader.loadXul( xulFile, getResourceBundle() );

    bf.setDocument( container.getDocumentRoot() );

    for ( XulEventHandler h : getEventHandlers() ) {
      container.addEventHandler( h );
    }

    this.runner.addContainer( container );

    // try and get the dialog
    xulDialog = (XulDialog) container.getDocumentRoot().getRootElement();
    runner.initialize();
  }
 
Example #2
Source File: BaseStepGenericXulDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void initializeXul( XulLoader loader, BindingFactory bindingFactory, XulRunner runner, Object parent ) throws XulException {
  bf = bindingFactory;
  this.runner = runner;
  loader.registerClassLoader( getClass().getClassLoader() );
  loader.setSettingsManager( getSettingsManager() );
  loader.setOuterContext( parent );
  container = loader.loadXul( xulFile, getResourceBundle() );
  bf.setDocument( container.getDocumentRoot() );

  for ( XulEventHandler h : getEventHandlers() ) {
    container.addEventHandler( h );
  }

  this.runner.addContainer( container );

  // try and get the dialog
  xulDialog = (XulDialog) container.getDocumentRoot().getRootElement();
  runner.initialize();
}
 
Example #3
Source File: ConnectionControllerTest.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  controller = new ConnectionController();
  context = new JUnit4Mockery();
  doc = context.mock(Document.class);
  container = context.mock(XulDomContainer.class);
  dataHandler = context.mock(XulEventHandler.class);
  model = context.mock(ConnectionModel.class);
  controller.setConnectionModel(model);
  workspace = new Workspace();
  controller.setWorkspace(workspace);
  outputService = context.mock(OutputService.class);
  controller.setOutputService(outputService);
  aSchemaProvider = context.mock(SchemaProviderUiExtension.class);
  cubeNames = Arrays.asList("testCube1", "testCube2");
  providerModel = context.mock(SchemaModel.class);

  // need some expectations here as setXulDomContainer calls getDocumentRoot on the container
  context.checking(new Expectations() {
    {
      one(container).getDocumentRoot();
      will(returnValue(doc));
      allowing(doc).invokeLater(with(any(Runnable.class))); //don't care if the controller uses invokeLater or not
    }
  });

  controller.setXulDomContainer(container);
  controller.setDataHandler(dataHandler);
}
 
Example #4
Source File: UIMain.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void start(ApplicationContext context) throws XulException {
  XulDomContainer container;

  //check to see if they've specified an alternate resource bundle
  String bundleStr = configuration.getResourceBundle();
  ResourceBundle bundle = null;
  if(bundleStr != null){
    try{
      bundle = ResourceBundle.getBundle(bundleStr);
    } catch (MissingResourceException e){
      logger.error("Could not load Resource Bundle: "+bundleStr); //$NON-NLS-1$
    }
  }

  //Set the look and feel based on configuration
  setLAF();

  if(bundle != null){
    container = xulLoader.loadXul("org/pentaho/aggdes/ui/resources/mainFrame.xul", bundle); //$NON-NLS-1$
  } else {
    container = xulLoader.loadXul("org/pentaho/aggdes/ui/resources/mainFrame.xul"); //$NON-NLS-1$
  }

  //generically register all Spring-initialized XulEventHandlers
  Map handlerMap = context.getBeansOfType(XulEventHandler.class);
  for(Object handler : handlerMap.values()) {
    container.addEventHandler((XulEventHandler)handler);
  }

  xulRunner.addContainer(container);
  xulRunner.initialize();
  xulRunner.start();
}
 
Example #5
Source File: RepositoryLockController.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void init( Repository rep ) throws ControllerInitializationException {
  try {
    if ( rep != null && rep.hasService( ILockService.class ) ) {
      repository = rep;
      service = (ILockService) rep.getService( ILockService.class );
    } else {
      throw new ControllerInitializationException( BaseMessages.getString( PKG,
          "RepositoryLockController.ERROR_0001_UNABLE_TO_INITIAL_REPOSITORY_SERVICE", ILockService.class ) ); //$NON-NLS-1$

    }

    bindingFactory = new DefaultBindingFactory();
    bindingFactory.setDocument( getXulDomContainer().getDocumentRoot() );

    XulEventHandler eventHandler = getXulDomContainer().getEventHandler( "browseController" ); //$NON-NLS-1$

    if ( eventHandler instanceof BrowseController ) {
      browseController = (BrowseController) eventHandler;
    }

    // Disable row dragging if it is locked and the user does not have permissions
    fileTable = (XulTree) getXulDomContainer().getDocumentRoot().getElementById( "file-table" ); //$NON-NLS-1$
    folderTree = (XulTree) document.getElementById( "folder-tree" ); //$NON-NLS-1$
    lockFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById( "file-context-lock" ); //$NON-NLS-1$
    deleteFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById( "file-context-delete" ); //$NON-NLS-1$
    renameFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById( "file-context-rename" ); //$NON-NLS-1$

    messageBox = (XulMessageBox) document.createElement( "messagebox" ); //$NON-NLS-1$

    createBindings();
  } catch ( Exception e ) {
    throw new RuntimeException( e );
  }
}
 
Example #6
Source File: AbstractRepositoryExplorerUISupport.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public AbstractRepositoryExplorerUISupport() {
  super();
  handlers = new ArrayList<XulEventHandler>();
  overlays = new ArrayList<XulOverlay>();
  controllerNames = new ArrayList<String>();
  setup();
}
 
Example #7
Source File: AbstractRepositoryExplorerUISupport.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void apply( XulDomContainer container ) throws XulException {
  this.container = container;
  container.registerClassLoader( getClass().getClassLoader() );
  for ( XulEventHandler handler : handlers ) {
    container.addEventHandler( handler );
  }
  for ( XulOverlay overlay : overlays ) {
    if ( overlay instanceof RepositoryExplorerDefaultXulOverlay ) {
      container.loadOverlay( overlay.getOverlayUri(), new XulSpoonResourceBundle(
        ( (RepositoryExplorerDefaultXulOverlay) overlay ).getPackageClass() ) );
    } else {
      container.loadOverlay( overlay.getOverlayUri(), overlay.getResourceBundleUri() );
    }
  }
}
 
Example #8
Source File: Neo4jPerspective.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 4 votes vote down vote up
@Override public List<XulEventHandler> getEventHandlers() {
  return null;
}
 
Example #9
Source File: ConnectionControllerITest.java    From pentaho-aggdesigner with GNU General Public License v2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
  /*
   * In this integration test, we want to mock only the XUL framework, all other components
   * we want to be the "real" ones.  This will allow us to test application behavior without
   * dependency on a UI.
   */
  context = new JUnit4Mockery();
  eventRecorder = new EventRecorder();
  doc = context.mock(Document.class);
  container = context.mock(XulDomContainer.class);

  // need some expectations here as setXulDomContainer calls getDocumentRoot on the container
  context.checking(new Expectations() {
    {
      allowing(container).getDocumentRoot();
      will(returnValue(doc));
      allowing(container).addEventHandler(with(any(XulEventHandler.class)));
      allowing(doc).addOverlay(with(any(String.class)));
      ignoring(container);
      allowing(doc).getElementById(with(aNonNull(String.class)));
      will(returnValue(context.mock(XulComponent.class, Long.toString(System.currentTimeMillis()))));
      allowing(doc).addInitializedBinding(with(any(Binding.class)));
      allowing(doc).invokeLater(with(any(Runnable.class))); //don't care if the controller uses invokeLater or not, this is UI stuff
    }
  });

  controller.setXulDomContainer(container);


  //In order to really make this an integration test, there needs to be a BindingFactory that is injected into the controller
  //so we can mock or stub it out and allow the object->object bindings to actually be bound while the xulcomponent bindings
  //are consumed.  Here we are proxying the BindingFactory to achieve this.
  bindingFactory.setDocument(doc);
  //setup the proxy binding factory that will ignore all XUL stuff
  XulSupressingBindingFactoryProxy proxy = new XulSupressingBindingFactoryProxy();
  proxy.setProxiedBindingFactory(bindingFactory);
  controller.setBindingFactory(proxy);

  for(MondrianFileSchemaProvider provider : mondrianFileSchemaProviders) {
    provider.setXulDomContainer(container);
    provider.setBindingFactory(proxy);
  }
  // this model gets reused across tests.  Revert to default value.
  model.setApplySchemaSourceEnabled( false );
}
 
Example #10
Source File: MondrianFileSchemaProviderTest.java    From pentaho-aggdesigner with GNU General Public License v2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
  /*
   * In this integration test, we want to mock only the XUL framework, all other components
   * we want to be the "real" ones.  This will allow us to test application behavior without
   * dependency on a UI.
   */
  context = new JUnit4Mockery();
  doc = context.mock(Document.class);
  container = context.mock(XulDomContainer.class);

  // need some expectations here as setXulDomContainer calls getDocumentRoot on the container
  context.checking(new Expectations() {
    {
      allowing(container).getDocumentRoot();
      will(returnValue(doc));
      allowing(container).addEventHandler(with(any(XulEventHandler.class)));
      allowing(doc).addOverlay(with(any(String.class)));
      ignoring(container);
      allowing(doc).getElementById(with(aNonNull(String.class)));
      will(returnValue(context.mock(XulComponent.class, Long.toString(System.currentTimeMillis()))));
      allowing(doc).addInitializedBinding(with(any(Binding.class)));
      allowing(doc).invokeLater(with(any(Runnable.class))); //don't care if the controller uses invokeLater or not, this is UI stuff
    }
  });

  schemaProvider.setXulDomContainer(container);


  //In order to really make this an integration test, there needs to be a BindingFactory that is injected into the controller
  //so we can mock or stub it out and allow the object->object bindings to actually be bound while the xulcomponent bindings
  //are consumed.  Here we are proxying the BindingFactory to acheive this.
  bindingFactory.setDocument(doc);
  //setup the proxy binding factory that will ignore all XUL stuff
  XulSupressingBindingFactoryProxy proxy = new XulSupressingBindingFactoryProxy();
  proxy.setProxiedBindingFactory(bindingFactory);
  schemaProvider.setBindingFactory(proxy);

  schemaProvider.onLoad();

  eventRecorder = new EventRecorder();
  eventRecorder.setLogging(true);
  eventRecorder.record(schemaProvider);
}
 
Example #11
Source File: StarModelerPerspective.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override
public List<XulEventHandler> getEventHandlers() {
  return null;
}
 
Example #12
Source File: SpoonPerspectiveManagerTest.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override public List<XulEventHandler> getEventHandlers() {
  return null;
}
 
Example #13
Source File: MainSpoonPerspective.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override
public List<XulEventHandler> getEventHandlers() {
  return null;
}
 
Example #14
Source File: BaseStepGenericXulDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
protected List<XulEventHandler> getEventHandlers() {
  return Collections.singletonList( (XulEventHandler) this );
}
 
Example #15
Source File: AbstractRepositoryExplorerUISupport.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public List<XulEventHandler> getEventHandlers() {
  return handlers;
}
 
Example #16
Source File: AbstractPreviewRowsXulDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
protected List<XulEventHandler> getEventHandlers() {
  return Collections.singletonList( (XulEventHandler) this );
}
 
Example #17
Source File: AbstractReportDesignerUiPlugin.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XulEventHandler[] createEventHandlers() {
  return EMPTY_EVENTHANDLERS;
}
 
Example #18
Source File: WizardControllerPanel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * @param mainWizardContainer
 */
public void addContent( final XulDomContainer mainWizardContainer ) throws XulException {
  mainWizardContainer.loadOverlay( WIZARD_CONTROLLER_OVERLAY );
  mainWizardContainer.addEventHandler( (XulEventHandler) controller );
}
 
Example #19
Source File: BeamPerspective.java    From kettle-beam with Apache License 2.0 4 votes vote down vote up
@Override public List<XulEventHandler> getEventHandlers() {
  return null;
}
 
Example #20
Source File: SpoonPerspective.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a list of Xul Event Handlers (controllers) to be added to Xul Containers in Spoon. Perspectives may
 * overwrite existing event handlers by registering one with the same ID.
 *
 * @return list of XulEventHandlers
 */
public List<XulEventHandler> getEventHandlers();
 
Example #21
Source File: IRepositoryExplorerUISupport.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * Get the list of event handlers added to the list of event handlers
 *
 * @return list of event handlers
 */
public List<XulEventHandler> getEventHandlers();
 
Example #22
Source File: ConnectionController.java    From pentaho-aggdesigner with GNU General Public License v2.0 2 votes vote down vote up
public void setDataHandler(XulEventHandler dataHandler) {

    this.dataHandler = dataHandler;
  }
 
Example #23
Source File: ReportDesignerUiPlugin.java    From pentaho-reporting with GNU Lesser General Public License v2.1 votes vote down vote up
public XulEventHandler[] createEventHandlers(); 
Example #24
Source File: XulDomContainerStub.java    From pentaho-aggdesigner with GNU General Public License v2.0 votes vote down vote up
public void addEventHandler(XulEventHandler handler) {} 
Example #25
Source File: XulDomContainerStub.java    From pentaho-aggdesigner with GNU General Public License v2.0 votes vote down vote up
public XulEventHandler getEventHandler(String key) throws XulException { return null; } 
Example #26
Source File: XulDomContainerStub.java    From pentaho-aggdesigner with GNU General Public License v2.0 votes vote down vote up
public Map<String, XulEventHandler> getEventHandlers() { return null; }