Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.UiException


   * and it is different from {@link Listbox}.</p>
   * @since 3.0.2
   */
  public void setSelectedIndex(int jsel) {
    if (jsel >= getItemCount())
      throw new UiException("Out of bound: "+jsel+" while size="+getItemCount());
    if (jsel < -1)
      jsel = -1;
    setSelectedItem(jsel >= 0 ? getItemAtIndex(jsel): null);
      //Bug#2919037: setSelectedIndex(-1) shall unselect even with constraint
  }
View Full Code Here


  }

  //-- Component --//
  public void beforeChildAdded(Component newChild, Component refChild) {
    if (!(newChild instanceof Comboitem))
      throw new UiException("Unsupported child for Combobox: "+newChild);
    super.beforeChildAdded(newChild, refChild);
  }
View Full Code Here

    out.write('\n');
  }

  public void beforeParentChanged(Component parent) {
    if (parent != null && !(parent instanceof Html))
      throw new UiException("Body's parent must be Html, not "+parent);
    super.beforeParentChanged(parent);
  }
View Full Code Here

   * @exception UiException if {@link #isMaximizable} is false.
   */
  public void setMaximized(boolean maximized) {
    if (_maximized != maximized) {
      if (!_maximizable)
        throw new UiException("Not maximizable, "+this);

      _maximized = maximized;
      if (_maximized) {
        _minimized = false;
        setVisible0(true); //avoid dead loop
View Full Code Here

   * @exception UiException if {@link #isMinimizable} is false.
   */
  public void setMinimized(boolean minimized) {
    if (_minimized != minimized) {
      if (!_minimizable)
        throw new UiException("not minimizable, "+ this);

      _minimized = minimized;
      if (_minimized) {
        _maximized = false;
        setVisible0(false); //avoid dead loop
View Full Code Here

   */
  public boolean addToolbar(String name, Toolbar toolbar) {
    Component refChild = null;
    if ("tbar".equals(name)) {
      if (_tbar != null)
        throw new UiException("Only one top toolbar child is allowed: "+this);
      refChild = this.getFirstChild();
    } else if ("bbar".equals(name)) {
      if (_bbar != null)
        throw new UiException("Only one bottom toolbar child is allowed: "+this);
      refChild = _fbar;
    } else if ("fbar".equals(name)) {
      if (_fbar != null)
        throw new UiException("Only one foot toolbar child is allowed: "+this);
    } else {
      throw new UiException("Uknown toolbar: "+name);
    }

    if (super.insertBefore(toolbar, refChild)) {
      if ("tbar".equals(name)) {
        _tbar = toolbar;
View Full Code Here

 
  //-- Component --//
  public void beforeChildAdded(Component newChild, Component refChild) {
    if (newChild instanceof Caption) {
      if (_caption != null && _caption != newChild)
        throw new UiException("Only one caption is allowed: "+this);
    } else if (refChild instanceof Caption) {
      throw new UiException("caption must be the first child");
    } else if (newChild instanceof Panelchildren) {
      if (_panelchildren != null && _panelchildren != newChild)
        throw new UiException("Only one panelchildren child is allowed: "+this);
    } else if (newChild instanceof Toolbar) {
      if (refChild instanceof Panelchildren
      || (refChild == null && (getChildren().isEmpty()))) {
        if(_tbar != null && _tbar != newChild)
          throw new UiException("Only one top toolbar child is allowed: "+this);
      } else if (refChild == null || refChild == _fbar) {
        if (_bbar != null && _bbar != newChild) {
          if (refChild != null && refChild == _fbar)
            throw new UiException("Only one bottom toolbar child is allowed: "+this);
          if (_fbar != null && _fbar != newChild)
            throw new UiException("Only one foot toolbar child is allowed: "+this);
        }
      } else {
        throw new UiException("Only three toolbars child is allowed: " + this);
      }
    } else {
      throw new UiException("Unsupported child for Panel: " + newChild);
    }
    super.beforeChildAdded(newChild, refChild);
  }
View Full Code Here

    if (_span > 1)
      renderer.render("colspan", _span);
  }
  public void beforeParentChanged(Component parent) {
    if (parent != null && !(parent instanceof Listitem))
      throw new UiException("Wrong parent: "+parent);
    super.beforeParentChanged(parent);
  }
View Full Code Here

    render(renderer, "content", getContent()); //allow overriding getContent()
  }

  public void beforeParentChanged(Component parent) {
    if (parent != null && !(parent instanceof Combobox))
      throw new UiException("Comboitem's parent must be Combobox");   
    super.beforeParentChanged(parent);
  }
View Full Code Here

   * Get the spring application context.
   */
  public static ApplicationContext getApplicationContext() {
    Execution exec = Executions.getCurrent();
    if (exec == null) {
      throw new UiException("SpringUtil can be called only under ZK environment!");
    }
   
    return WebApplicationContextUtils.getRequiredWebApplicationContext(
        (ServletContext)exec.getDesktop().getWebApp().getNativeContext());
  }
View Full Code Here

TOP

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

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.