Package org.zkoss.zk.ui.metainfo

Examples of org.zkoss.zk.ui.metainfo.Annotation


  }

  //[0] expr, [1] loadWhenEvents, [2] saveWhenEvents, [3] access, [4] converter, [5] args, [6] loadAfterEvents, [7] saveAfterEvents
  protected Object[] loadPropertyAnnotation(Component comp, String propName, String bindName) {
    ComponentCtrl compCtrl = (ComponentCtrl) comp;
    Annotation ann = compCtrl.getAnnotation(propName, bindName);
    if (ann != null) {
      final Map attrs = ann.getAttributes(); //(tag, tagExpr)
      List loadWhenEvents = null;
      List saveWhenEvents = null;
      List loadAfterEvents = null;
      List saveAfterEvents = null;
      String access = null;
View Full Code Here


      Component comp = (Component) roots.iterator().next();
     
      // join "define" components as children of "insert" component
      do {
        final Component nextRoot = comp.getNextSibling();
        final Annotation annt = ((ComponentCtrl)comp).getAnnotation("define");
        if (annt != null) {
          final String joinId = annt.getAttribute("value");
          final Component insertComp = (Component) insertMap.get(joinId);
          if (insertComp != null) {
            comp.setParent(insertComp);
          } else {
            comp.detach(); //no where to insert
View Full Code Here

  }
 
  private void resolveInsertComponents(Collection comps, Map map) {
    for (final Iterator it = comps.iterator(); it.hasNext(); ) {
      final Component comp = (Component) it.next();
      final Annotation annt = ((ComponentCtrl)comp).getAnnotation("insert");
      if (annt != null) {
        final String insertName = annt.getAttribute("value");
        if (map.containsKey(insertName)) {
          throw new UiException("Duplicate insert name: "+insertName+" at Component "+comp);
        }
        map.put(insertName, comp);
      }
View Full Code Here

      date = new Date(timestamp.getTime());
    } else if( val instanceof Date ){
      date = (Date)val;
    }

    final Annotation annot = ((ComponentCtrl)comp).getAnnotation("format");
    String pattern = null;
    if (annot != null) {
      pattern = annot.getAttribute("value");
    }
   
    if (date == null)
      return "";
View Full Code Here

    loadComponentAnnotation(comp, "bind");
  }
 
  private void loadComponentAnnotation(Component comp, String annotName) {
    ComponentCtrl compCtrl = (ComponentCtrl) comp;
    Annotation ann = compCtrl.getAnnotation(annotName);
    if (ann != null) {
      Map attrs = ann.getAttributes();
      for(final Iterator it = attrs.entrySet().iterator(); it.hasNext();) {
        Entry me = (Entry) it.next();
        String attr = (String) me.getKey();
        //[0] bean value, [1 ~ *] tag:expression
        List expr = parseExpression((String) me.getValue(), ";");
View Full Code Here

          ZKProxy.getProxy().setAttribute(exec, "actionEvent", oldEvent);
        }
      } else {
        final Component comp = event.getTarget();
        //for bookmark event, target is null
        @SuppressWarnings("deprecation")
        final Annotation annt = comp == null?null:((ComponentCtrl)comp).getAnnotation("action"); //@{action(search)}
        if (annt != null) {
          String flowWhen = annt.getAttribute("when");
          if (flowWhen == null) { //default to "onClick"
            flowWhen = "onClick";
          }
          final String flowEvent = annt.getAttribute("value");
          if (flowEvent != null && eventName.equals(flowWhen)) {
            final Execution exec = Executions.getCurrent();

            //see ZkELResolver
            //see ZkExpressionParser
View Full Code Here

 
  @SuppressWarnings("deprecation")
  private static Map prepareFragmentMap(Map fragmentMap, Collection comps) {
    for (final Iterator it = comps.iterator(); it.hasNext();) {
      final ComponentCtrl comp = (ComponentCtrl) it.next();
      final Annotation annt = comp.getAnnotation("fragment");
      if (annt != null) {
        final String fragment = annt.getAttribute("value");
        if (fragment != null) {
          if (fragmentMap.containsKey(fragment)) {
            throw new UiException("fragment id must be unique in a desktop. Components:"+comp+", "+fragmentMap.get(fragment)+", Fragment:"+fragment);
          }
          fragmentMap.put(fragment, comp);
View Full Code Here

        if(true) return;
    sb.append("=").append(compCtrl.getAnnotations().size()+" : ")
      .append(compCtrl.getAnnotatedProperties().size());
    String prop;
    for (Iterator it = compCtrl.getAnnotations().iterator(); it.hasNext();) {
      Annotation annot = (Annotation) it.next();
      sb.append(" self").append(annot);
    }
    for (Iterator it = compCtrl.getAnnotatedProperties().iterator(); it.hasNext();) {
      prop = (String) it.next();
      sb.append(" ").append(prop)
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.metainfo.Annotation

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.