javax.el.ELContextEvent Java Examples

The following examples show how to use javax.el.ELContextEvent. 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: ConfigManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Publishes a {@link javax.faces.event.PostConstructApplicationEvent} event for the current
 * {@link Application} instance.
 */
void publishPostConfigEvent() {

    FacesContext ctx = FacesContext.getCurrentInstance();
    Application app = ctx.getApplication();
    if (null == ((InitFacesContext)ctx).getELContext()) {
        ELContext elContext = new ELContextImpl(app.getELResolver());
        elContext.putContext(FacesContext.class, ctx);
        UIViewRoot root = ctx.getViewRoot();
        if (null != root) {
            elContext.setLocale(root.getLocale());
        }
        ELContextListener[] listeners = app.getELContextListeners();
        if (listeners.length > 0) {
            ELContextEvent event = new ELContextEvent(elContext);
            for (ELContextListener listener: listeners) {
                listener.contextCreated(event);
            }
        }
        ((InitFacesContext)ctx).setELContext(elContext);
    }

    app.publishEvent(ctx,
                     PostConstructApplicationEvent.class,
                     Application.class,
                     app);

}
 
Example #2
Source File: JspApplicationContextImpl.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
protected ELContext createELContext(ELResolver resolver) {

        ELContext elContext = new ELContextImpl(resolver);

        // Notify the listeners
        Iterator<ELContextListener> iter = listeners.iterator();
        while (iter.hasNext()) {
            ELContextListener elcl = iter.next();
            elcl.contextCreated(new ELContextEvent(elContext));
        }
        return elContext;
    }
 
Example #3
Source File: ELSampleBean.java    From tutorials with MIT License 5 votes vote down vote up
@PostConstruct
public void init() {
    pageCounter = randomIntGen.nextInt();
    FacesContext.getCurrentInstance()
        .getApplication()
        .addELContextListener(new ELContextListener() {
            @Override
            public void contextCreated(ELContextEvent evt) {
                evt.getELContext()
                    .getImportHandler()
                    .importClass("com.baeldung.springintegration.controllers.ELSampleBean");
            }
        });
}
 
Example #4
Source File: JspApplicationContextImpl.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
protected void fireListeners(ELContext elContext) {
    ELContextEvent event = new ELContextEvent(elContext);
    for (int i = 0; i < this.contextListeners.size(); i++) {
        this.contextListeners.get(i).contextCreated(event);
    }
}
 
Example #5
Source File: FpTestClass2.java    From java-specialagent with Apache License 2.0 4 votes vote down vote up
@Test
@Override
public void contextCreated(ELContextEvent ece) {
  final Object x = (ELContextEvent)null;
}