Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.WrongValueException


      switch (cc) {
      case '^':
      case '$':
      case '@':
        if (sbcur != null)
          throw new WrongValueException("Combination of Shift, Alt and Ctrl not supported: "+keys);
        sbcur = cc == '^' ? sbctl: cc == '@' ? sbalt: sbsft;
        break;
      case '#':
        {
          int k = j + 1;
          for (; k < len; ++k) {
            final char c2 = (char)keys.charAt(k);
            if ((c2 > 'Z' || c2 < 'A')   && (c2 > 'z' || c2 < 'a')
            && (c2 > '9' || c2 < '0'))
              break;
          }
          if (k == j + 1)
            throw new WrongValueException(MCommon.UNEXPECTED_CHARACTER, new Object[] {new Character(cc), keys});

          final String s = keys.substring(j+1, k).toLowerCase();
          if ("pgup".equals(s)) cc = 'A';
          else if ("pgdn".equals(s)) cc = 'B';
          else if ("end".equals(s)) cc = 'C';
          else if ("home".equals(s)) cc = 'D';
          else if ("left".equals(s)) cc = 'E';
          else if ("up".equals(s)) cc = 'F';
          else if ("right".equals(s)) cc = 'G';
          else if ("down".equals(s)) cc = 'H';
          else if ("ins".equals(s)) cc = 'I';
          else if ("del".equals(s)) cc = 'J';
          else if (s.length() > 1 && s.charAt(0) == 'f') {
            final int v;
            try {
              v = Integer.parseInt(s.substring(1));
            } catch (Throwable ex) {
              throw new WrongValueException("Unknown #"+s+" in "+keys);
            }
            if (v == 0 || v > 12)
              throw new WrongValueException("Unsupported function key: #f"+v);
            cc = (char)('O' + v); //'P': F1, 'Q': F2... 'Z': F12
          } else
            throw new WrongValueException("Unknown #"+s+" in "+keys);

          if (sbcur == null) sbext.append(cc);
          else {
            sbcur.append(cc);
            sbcur = null;
          }
          j = k - 1;
        }
        break;
      default:
        if (sbcur == null || ((cc > 'Z' || cc < 'A')
        && (cc > 'z' || cc < 'a') && (cc > '9' || cc < '0')))
          throw new WrongValueException(MCommon.UNEXPECTED_CHARACTER, new Object[] {new Character(cc), keys});
        if (sbcur == sbsft)
          throw new WrongValueException("$"+cc+" not supported: "+keys);

        if (cc <= 'Z' && cc >= 'A')
          cc = (char)(cc + ('a' - 'A')); //to lower case
        sbcur.append(cc);
        sbcur = null;
View Full Code Here


        } while (--divscale > 0);
      }
      return v;
    } catch (NumberFormatException ex) {
      throw showCustomError(
        new WrongValueException(this, MZul.NUMBER_REQUIRED, value));
    }
  }
View Full Code Here

    return tagname != null && !"zscript".equals(tagname)
      && !"attribute".equals(tagname);
  }
  public void setTag(String tagname) throws WrongValueException {
    if (tagname == null || tagname.length() == 0)
      throw new WrongValueException("A tag name is required");
    _tagnm = tagname;
  }
View Full Code Here

  }

  private WrongValueException outOfRangeValue(Component comp) {
    final String errmsg = getErrorMessage(comp);
    if (errmsg != null)
      return new WrongValueException(comp, errmsg);

    final String s =
      _min != null ? _max != null ?
        _min + " ~ " + _max: ">= " + _min: "<= " + _max;
    return new WrongValueException(comp, MZul.OUT_OF_RANGE, s);
  }
View Full Code Here

          throw wrongValue(comp, getMessageForDateDenied());
      }
    }
  }
  private WrongValueException wrongValue(Component comp, int errcode) {
    return _errmsg != null ? new WrongValueException(comp, _errmsg):
      new WrongValueException(comp, errcode);
  }
View Full Code Here

  /** Sets the orient.
   * @param orient either "horizontal" or "vertical".
   */
  public void setOrient(String orient) throws WrongValueException {
    if (!"horizontal".equals(orient) && !"vertical".equals(orient))
      throw new WrongValueException("orient cannot be "+orient);

    setMold(orient);
  }
View Full Code Here

   * @param sortDir one of "ascending", "descending" and "natural"
   */
  public void setSortDirection(String sortDir) throws WrongValueException {
    if (sortDir == null || (!"ascending".equals(sortDir)
    && !"descending".equals(sortDir) && !"natural".equals(sortDir)))
      throw new WrongValueException("Unknown sort direction: "+sortDir);
    if (!Objects.equals(_sortDir, sortDir)) {
      _sortDir = sortDir;
      smartUpdate("sortDirection", _sortDir); //don't use null because sel.js assumes it
    }
  }
View Full Code Here

  /** Sets the orient.
   * @param orient either horizontal or vertical
   */
  public void setOrient(String orient) throws WrongValueException {
    if (!"horizontal".equals(orient) && !"vertical".equals(orient))
      throw new WrongValueException("orient cannot be "+orient);
   
    if (!Objects.equals(_orient, orient)) {
      _orient = orient;
      smartUpdate("orient", _orient);
    }
View Full Code Here

  /** Sets the direction.
   * @param dir either "normal" or "reverse".
   */
  public void setDir(String dir) throws WrongValueException {
    if (!"normal".equals(dir) && !"reverse".equals(dir))
      throw new WrongValueException(dir);

    if (!Objects.equals(_dir, dir)) {
      _dir = dir;
      smartUpdate("dir", _dir);
    }
View Full Code Here

  private boolean resolveGroup(boolean silent) {
    if (_groupId != null) {
      _group = (Radiogroup)Utils.getComponentById(this, _groupId);
      if (_group == null) {
        if (!silent)
          throw new WrongValueException("Radiogroup not found: "+_groupId);
        return false;
      }
      _groupId = null;
      _group.addExternal(this);
    }
View Full Code Here

TOP

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

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.