Package de.mhus.lib.form2.validation

Examples of de.mhus.lib.form2.validation.Validator


  @ALayoutModel
  public DefRoot createModel() throws MException {
    return new DefRoot(
        new FmInformation()
        ,
        new FmText("user",new FmNls("User","Beschreibung 1"),new FmDefaultSources())
        ,
        new FmPassword("password",new FmNls("Password","Beschreibung 2"),new FmDefaultSources())
        ,
        new FmNumber("number",FmNumber.TYPE.INTEGER,new FmNls("text3","Nr3","Beschreibung 3")).format(FmNumber.FORMAT.CURRENCY)
        ,
        new FmCombobox("sex", new FmNls("Sex","Geschlecht"),new FmDefaultSources())
        ).build();
  }
View Full Code Here


    try {
     
      DefRoot model = new DefRoot(
          new FmInformation()
          ,
          new FmText("user",new FmNls("User","Beschreibung 1"),new FmDefaultSources())
          ,
          new FmPassword("password",new FmNls("Password","Beschreibung 2"),new FmDefaultSources())
          ,
          new FmNumber("number",FmNumber.TYPE.INTEGER,new FmNls("text3","Nr3","Beschreibung 3")).format(FmNumber.FORMAT.CURRENCY)
          ,
          new FmCombobox("sex", new FmNls("Sex","Geschlecht"),new FmDefaultSources())
          ).build();

ConfigUtil.dump(model, System.out);

      MNls nls = model.createNls();
View Full Code Here

      builder.setFormFactory(new LayoutFactory());
     
      MyModel pojo = new MyModel();
      ActivatorControl control = new ActivatorControl();
      control.setFocusManager(new InformationFocus());
      LayoutModelByPojo layout = new LayoutModelByPojo(pojo);
      layout.setFormControl(control);
      layout.setFormFactory(builder.getFormFactory());
      layout.doBuild();
 
     
      builder.setRoot(layout.getModelRoot());
      builder.doBuild();
     
      builder.getRootComposit().setWidth("800px");
      mainWindow.addComponent(builder.getRootComposit());
     
View Full Code Here

//    if (a == null) a = element.getLayoutFactory().getActivator();
    MActivator a = element.getLayoutFactory().getActivator();
   
    String[] va = string.split(",");
    for (String v : va) {
      Validator validator;
      try {
        validator = (Validator) a.getObject(Validator.class,v);
      } catch (Exception e) {
        e.printStackTrace();
        return false;
      }
      if (validator != null && !validator.validate(this,element,value))
        return false;
    }
    return true;
  }
View Full Code Here

    fValidator.setFile(false);
    // fValidator.setReadable(true);
    gBuilder.withOption(aBuilder.reset().withName(CONF_FILE).withDescription("is the wrapper.conf to use.  Name must be absolute or relative")
        .withMinimum(0).withMaximum(10).create());

    Validator pValidator = new Validator()
    {

      public void validate(List values) throws InvalidArgumentException
      {
        for (Iterator it = values.iterator(); it.hasNext();)
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
      public void validate(final List values) throws InvalidArgumentException {
        // Note : This code doesnt belong here, it should be changed to
        // an can exec check in java 6
        for (String file : (List<String>)values) {
          File f = new File(file)
          if ( ! f.exists() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " doesn't exist.");
          }
          if ( ! f.isFile() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " is not a file.");
          }
          if ( ! f.canRead() ) {
            throw new InvalidArgumentException("Argument : " +
                f.getAbsolutePath() + " is not accessible");
          }
        }
      }     
    };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
      public void validate(final List values) throws InvalidArgumentException {
        // Note : This code doesnt belong here, it should be changed to
        // an can exec check in java 6
        for (String file : (List<String>)values) {
          try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

    return builder.withLongName(name).withDescription(desc).create();
  }
 
  private void setupOptions(){

    final Validator fileValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            File f = new File(file)
            if (!f.exists()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " doesn't exist.");
            }
            if (!f.isFile()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not a file.");
            }
            if (!f.canRead()) {
              throw new InvalidArgumentException("Argument : " +
                                                 f.getAbsolutePath() + " is not accessible");
            }
          }
        }     
      };

    // Note: not extending CLI2's FileValidator, that overwrites
    // the String arg into File and causes ClassCastException
    // in inheritance tree.
    final Validator execValidator = new Validator(){
        public void validate(final List values) throws InvalidArgumentException {
          // Note : This code doesnt belong here, it should be changed to
          // an can exec check in java 6
          for (String file : (List<String>)values) {
            try{
View Full Code Here

TOP

Related Classes of de.mhus.lib.form2.validation.Validator

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.