Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Page


      //Bug 2686585: if ZK JSP used, we have no info so no exception
      return "";
    }

    final Page page = anchor.getPage();
    return page != null ? /*just in case*/page.getUuid(): "";
  }
View Full Code Here


    scope.setAttribute(VAR_NSW, NSWrap.getInstance(bshns));
    return bshns;
  }

  /*package*/ static BSHInterpreter getInterpreter(Scope scope) {
    Page owner = getPage(scope);
    if (owner != null) {
      for (Iterator it = owner.getLoadedInterpreters().iterator();
      it.hasNext();) {
        final Object ip = it.next();
        if (ip instanceof BSHInterpreter)
          return (BSHInterpreter)ip;
      }
View Full Code Here

          if (val != null /*||exec.hasAttribute(name)*/) //exec not support hasAttribute
            return val;
        }
      }

      final Page page = getOwner();
      Object val = page.getAttributeOrFellow(name, true); //page/desktop/session
      if (val != null || page.hasAttributeOrFellow(name, true))
        return val;
      val = page.getXelVariable(null, null, name, true);
      return val != null ? val: getImplicit(name);
    }
View Full Code Here

  private static final String PAGE_SCOPE = "ZK_SPRING_PAGE_SCOPE";
 
  public Object get(String name, ObjectFactory<?> objectFactory) {
    final Execution exec = Executions.getCurrent();
    if (exec != null) {
      final Page page = ((ExecutionCtrl)exec).getCurrentPage();
      Map pageScope = (Map) page.getAttribute(PAGE_SCOPE);
      if (pageScope == null) {
        page.setAttribute(PAGE_SCOPE, pageScope = new HashMap());
      }
      Object scopedObject = pageScope.get(name);
      if (scopedObject == null) {
        scopedObject = objectFactory.getObject();
        pageScope.put(name, scopedObject);
View Full Code Here

  }

  public String getConversationId() {
    final Execution exec = Executions.getCurrent();
    if (exec != null) {
      final Page page = ((ExecutionCtrl)exec).getCurrentPage();
      if (page != null) {
        return page.getId();
      }
    }
    return null;
  }
View Full Code Here

  }

  public Object remove(String name) {
    final Execution exec = Executions.getCurrent();
    if (exec != null) {
      final Page page = ((ExecutionCtrl)exec).getCurrentPage();
      final Map pageScope = (Map) page.getAttribute(PAGE_SCOPE);
      return pageScope != null ? pageScope.remove(name) : null;
    }
    throw new IllegalStateException("Unable to get page scope bean: "+name+". Do you access it in ZK event listener?");
  }
View Full Code Here

    if (comp == null) { //don't know what to do
      return;
    }

    //find new fragment component
    final Page page = comp.getPage();
    final String pageUrl = page.getRequestPath();
    Map newMap = (Map) pageMap.get(pageUrl);
    if (newMap == null) {
      newMap = new HashMap();
      pageMap.put(pageUrl, newMap);
     
View Full Code Here

  private Map prepareDesktopFragmentMap() {
    final Map fragmentMap = new HashMap();
    final Desktop desktop = Executions.getCurrent().getDesktop();
    final Collection pages = desktop.getPages();
    for (final Iterator it=pages.iterator(); it.hasNext();) {
      final Page page = (Page) it.next();
      prepareFragmentMap(fragmentMap, page.getRoots());
    }
    return fragmentMap;
  }
View Full Code Here

      if (exec != null) {
        final ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) SpringUtil.getApplicationContext();
        final ConfigurableBeanFactory factory = ctx.getBeanFactory();
        final String fid = "&"+comp.getId();
        if (factory.containsBean(fid)) {
          final Page page = ((ExecutionCtrl)exec).getCurrentPage();
          final Object self = page.hasAttribute("self") ?
              page.getAttribute("self", false) : null;
          try {
            page.setAttribute("self", comp);
            //trigger component binding
            final Object proxy = SpringUtil.getBean(comp.getId(), Component.class);
            if (proxy != null) {
              final BeanDefinition bd = factory.getMergedBeanDefinition(fid);
              final MutablePropertyValues mpv = bd.getPropertyValues();
              final PropertyValue pv = mpv.getPropertyValue("controllerIds");
              final Set controllerIds = (pv != null) ? (Set) pv.getValue() : null;
              if (controllerIds != null) {
                bindControllers(comp, controllerIds, fid);
              }
            }
          } finally {
            if (self == null) {
              page.removeAttribute("self");
            } else {
              page.setAttribute("self", self);
            }
          }
        }
      }
    }
View Full Code Here

  }

  public Page newPage(RequestInfo ri, PageDefinition pagedef, String path) {
    final ServletRequest request = (ServletRequest) ri.getNativeRequest();
    if (request.getAttribute(DESKTOP_REUSE) != null) {
      final Page page = (Page) ri.getDesktop().getPages().iterator().next();
      if (page instanceof ReusablePage) {
        ((ReusablePage)page).setReuse(true);
        return page;
      } else {
        throw new IllegalStateException("Should be a ReuseablePage: "+page);
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.Page

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.