Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Component


    private boolean isSameBean(BindingNode node, Object bean) { 
      final Collection bindings = node.getBindings();
      if (bindings.isEmpty()) {
        return true;
      }
      final Component comp = ((Binding)bindings.iterator().next()).getComponent();
      if (isTemplate(comp)) {
        return true;
      }
      final Object nodebean = getBeanWithExpression(comp, node.getPath());
      return Objects.equals(nodebean, bean);
View Full Code Here


        throw new UiException("Page is already covered by another Data Binder. Cannot be covered by this Data Binder again. Page:"+page.getId());
      } else {
        page.setAttribute(_name, _binder);
      }
    } else if (_compPath.startsWith("/")) { //absolute path
      final Component comp = Path.getComponent(_compPath);
      if (comp == null) {
        throw new UiException("Cannot find the specified component. Absolute Path:"+_compPath);
      }
      _binder = new AnnotateDataBinder(comp, b);
      saveBinder(comp);//comp.setAttribute(_name, _binder);
    } else if (_compPath.startsWith("./") || _compPath.startsWith("../")) { //relative path
      for (int j = 0; j < comps.length; ++j) {
        final Component vroot = comps[j];
        final Component comp = Path.getComponent(vroot.getSpaceOwner(), _compPath);
        if (comp != null) { //found
          _binder = new AnnotateDataBinder(comp, b);
          saveBinder(comp);//comp.setAttribute(_name, _binder);
          break;
        }
      }
      if (_binder == null) {
        throw new UiException("Cannot find the specified component. Relative Path:"+_compPath);
      }
    } else {
      final Component comp = page.getFellow(_compPath);
      _binder = new AnnotateDataBinder(comp, b);
      saveBinder(comp);//comp.setAttribute(_name, _binder);
    }
    _binder.loadAll(); //load data bean properties into UI components
  }
View Full Code Here

  private static final long serialVersionUID = 200808190445L;
  public Object coerceToUi(Object val, Component comp) { //load
      if (val != null) {
      //iterate to find the selected radio via the value
      for (Iterator it = ((Tabbox)comp).getTabs().getChildren().iterator(); it.hasNext();) {
        final Component child = (Component)it.next();
        if (child instanceof Tab) {
          if (val.equals(((Tab)child).getLabel())) {
            return child;
          }
        }
View Full Code Here

    resolveGroup(false);
    if (_group != null)
      return _group;

    for (Component p = this;;) {
      Component q = p.getParent();
      if ((q instanceof Radiogroup) || q == null)
        return (Radiogroup)q;
      p = q;
    }
  }
View Full Code Here

   * to partition a component, such as {@link org.zkoss.zul.Imagemap} and {@link org.zkoss.zul.Chart}.
   * @since 5.0.4
   */
  public Component getAreaComponent() {
    if (_areacomp == null && _area != null) {
      final Component target = getTarget();
      Desktop desktop = null;
      if (target != null) {
        _areacomp = target.getFellowIfAny(_area);
        if (_areacomp != null)
          return _areacomp;

        desktop = target.getDesktop();
      }
      if (desktop == null) {
        final Execution exec = Executions.getCurrent();
        if (exec != null)
          desktop = exec.getDesktop();
View Full Code Here

  /** Creates an instance of {@link Event} based on the specified request.
   */
  public static Event getEvent(AuRequest request) {
    final String name = request.getCommand();
    final Component comp = request.getComponent();
    final Map data = request.getData();
    final Object data2 = data != null ? data.get(""): null;
    if (data2 == null)
      return new Event(name, comp);
    if (data2 instanceof List) {
View Full Code Here

  }

  /** Returns the grid that this belongs to.
   */
  public Grid getGrid() {
    final Component comp = getParent();
    return comp != null ? (Grid)comp.getParent(): null;
  }
View Full Code Here

 
  /** Returns the value of the {@link Label} it contains, or null
   * if no such cell.
   */
  public String getLabel() {
    final Component cell = getFirstChild();
    return cell != null && cell instanceof Label ? ((Label)cell).getValue(): null;
  }
View Full Code Here

  public String getZclass() {
    return _zclass == null ? "z-groupfoot" : _zclass;
  }
  private Label autoFirstCell() {
    Component cell = getFirstChild();
    if (cell == null || cell instanceof Label) {
      if (cell == null) cell = new Label();
      cell.applyProperties();
      cell.setParent(this);
      return (Label)cell;
    }
    throw new UiException("Unsupported child for setLabel: "+cell);
  }
View Full Code Here

  /** Returns the level this cell is. The root is level 0.
   */
  public int getLevel() {
    int level = 0;
    for (Component item = this;; ++level) {
      final Component tch = item.getParent();
      if (tch == null)
        break;

      item = tch.getParent();
      if (item == null || item instanceof Tree)
        break;
    }
    return level;
  }
View Full Code Here

TOP

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

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.