コード例 #1
0
ファイル: CDIUIProvider.java プロジェクト: Blimster/cdi
 @Override
 public UI createInstance(UICreateEvent uiCreateEvent) {
   Class<? extends UI> type = uiCreateEvent.getUIClass();
   int uiId = uiCreateEvent.getUiId();
   VaadinRequest request = uiCreateEvent.getRequest();
   Bean<?> bean = scanForBeans(type);
   String uiMapping = "";
   if (bean == null) {
     if (type.isAnnotationPresent(CDIUI.class)) {
       uiMapping = parseUIMapping(request);
       bean = getUIBeanWithMapping(uiMapping);
     } else {
       throw new IllegalStateException(
           "UI class: "
               + type.getName()
               + " with mapping: "
               + uiMapping
               + " is not annotated with CDIUI!");
     }
   }
   UIBean uiBean = new UIBean(bean, uiId);
   try {
     // Make the UIBean available to UIScopedContext when creating nested
     // injected objects
     CurrentInstance.set(UIBean.class, uiBean);
     return (UI)
         getBeanManager()
             .getReference(uiBean, type, getBeanManager().createCreationalContext(bean));
   } finally {
     CurrentInstance.set(UIBean.class, null);
   }
 }
コード例 #2
0
 @Override
 public UI createInstance(UICreateEvent event) {
   final Class<VaadinUIIdentifier> key = VaadinUIIdentifier.class;
   final VaadinUIIdentifier identifier = new VaadinUIIdentifier(event);
   CurrentInstance.set(key, identifier);
   try {
     logger.debug(
         "Creating a new UI bean of class [{}] with identifier [{}]",
         event.getUIClass().getCanonicalName(),
         identifier);
     return webApplicationContext.getBean(event.getUIClass());
   } finally {
     CurrentInstance.set(key, null);
   }
 }
コード例 #3
0
ファイル: RCFUIProvider.java プロジェクト: ravi-kumar-rc/rcf
  @Override
  public boolean isPreservedOnRefresh(UICreateEvent event) {
    if (!SpringApplicationContext.getApplicationContext()
        .isPrototype(getUIBeanName(event.getRequest()))) {
      return true;
    }

    return super.isPreservedOnRefresh(event);
  }
コード例 #4
0
ファイル: RCFUIProvider.java プロジェクト: ravi-kumar-rc/rcf
 @Scope("session")
 @Override
 public UI createInstance(UICreateEvent event) {
   return (UI)
       SpringApplicationContext.getApplicationContext().getBean(getUIBeanName(event.getRequest()));
 }