Package org.geotools.validation.dto

Examples of org.geotools.validation.dto.ArgumentDTO


     * @return
     */
    public static boolean noNullArguments(TestDTO test) {
      Map args = test.getArgs();
      for (Iterator i = args.keySet().iterator(); i.hasNext();) {
        ArgumentDTO arg = (ArgumentDTO) args.get(i.next());
        if (arg.getValue() == null) return false;
      }
      return true;
    }
View Full Code Here


            // if a defaultTypeRef exists, set any typeRefs to that value
            if ((defaultTypeRef != null) && defaultTypeRef.length() > 0) {
                thisTest = (TestDTO) processor.getTests().get(newTest.getName());
                Map args = thisTest.getArgs();
                for (Iterator i = args.keySet().iterator(); i.hasNext();) {
                    ArgumentDTO arg = (ArgumentDTO) args.get(i.next());
                    String argName = arg.getName();
                    //is it a typeRef?
                    if (isTypeRef(argName)) {
                        //is it empty?
                        if (arg.getValue() == null || arg.getValue().toString().length() == 0) {
                            arg.setValue(defaultTypeRef);
                        }
                    }
                }
            }
            //if the current item is not expanded, expand it to show the new item
View Full Code Here

        public void modify(Object element, String property, Object value) {
            if (property.equals("Value")) { //$NON-NLS-1$
                //store the new value in the testSuite
                TableItem tableItem = (TableItem) element;
                ArgumentDTO arg = (ArgumentDTO) tableItem.getData();
                if (value instanceof Integer) { //comboBox
                    if (value.equals(-1)) arg.setValue(""); //$NON-NLS-1$
                    else {
                        int val = (Integer) value;
                        arg.setValue(typeRefs[val]);
                    }
                } else if (value instanceof String) { //textBox
                    //on read of arg value: null --> ""
                    //on write of arg value:  "" --> null
                    if (value.equals("")) arg.setValue(null); //$NON-NLS-1$
                    else arg.setValue(value);
                }
                tableViewer.refresh();
                //update the argument value in the validation test lookups (FV and IV)
                try {
                    processor.setArg((TestDTO) selectedTreeItem, arg);
View Full Code Here

    comboBoxCellEditor = new ComboBoxCellEditor(parent, layers);
  }
 
  private void selectAmbiguousControl() {
    TableItem item = table.getItem(table.getSelectionIndex());
    ArgumentDTO argDTO = (ArgumentDTO) item.getData();
    if (argDTO.getName().toLowerCase().contains("typeref")) { //$NON-NLS-1$
      cellEditor = comboBoxCellEditor;
    } else {
      cellEditor = textCellEditor;
    }
  }
View Full Code Here

    //note: this copies the args from the PlugInDTO
    //Map oldArgs = plugin.getArgs();
    Map<String, ArgumentDTO> oldArgs = allArgs;
    Map<String, ArgumentDTO> newArgs = new HashMap<String, ArgumentDTO>();
    for (Iterator i = oldArgs.keySet().iterator(); i.hasNext();) {
      ArgumentDTO oldArg = (ArgumentDTO) oldArgs.get(i.next());
      ArgumentDTO newArg = (ArgumentDTO) oldArg.clone();
      newArgs.put(newArg.getName(), newArg);
    }
    //store the new args
    newTest.setArgs(newArgs);
    //add the new test to the appropriate testSuite
    Map<String, TestDTO> tests = ((TestSuiteDTO) testSuiteDTOs.get(testSuiteDTOKey)).getTests();
View Full Code Here

    // hashmap here to ensure each new validation has its own unique argument
    // (and are not accidentally shared).
    Map<String, ArgumentDTO> oldArgs = dto.getArgs();
    Map<String, ArgumentDTO> newArgs = new HashMap<String, ArgumentDTO>();
    for (Iterator i = oldArgs.keySet().iterator(); i.hasNext();) {
      ArgumentDTO oldArg = (ArgumentDTO) oldArgs.get(i.next());
      ArgumentDTO newArg = (ArgumentDTO) oldArg.clone();
      newArgs.put(newArg.getName(), newArg);
    }
    // we have the default args, but we'll scan the complete list of args
    // and add any that are missing
    Map allArgs = plugIn.getPropertyMap();
    for (Iterator i = allArgs.keySet().iterator(); i.hasNext();) {
      Object thisArg = allArgs.get(i.next());
     
      if (thisArg instanceof PropertyDescriptor) {
        PropertyDescriptor thisElement = ((PropertyDescriptor) thisArg);
        String argName = thisElement.getName();
        Object argValue = thisElement.getValue(argName);
        // add keys to the map which do not contain "name", "description", or an existing key
        if (!(newArgs.containsKey(argName)) && !(argName.equals("name")) && !(argName.equals("description"))) {  //$NON-NLS-1$//$NON-NLS-2$
          ArgumentDTO newArg = new ArgumentDTO();
          newArg.setName(argName);
          newArg.setValue(argValue);
          newArgs.put(newArg.getName(), newArg);
        }
      }
    }   
    //store the complete list of Args for future use (will be overwritten by the latest test creation)
    this.allArgs = newArgs;
View Full Code Here

        TestDTO test = (TestDTO) inputElement;
        Set argumentSet = new HashSet();
        Map args = test.getArgs();
        //add each argument to the set
        for (Iterator i = args.keySet().iterator(); i.hasNext();) {
          ArgumentDTO currentArg = (ArgumentDTO) args.get(i.next());
          argumentSet.add(currentArg);
        }
        return argumentSet.toArray();
      }
      return EMPTY_ARRAY;
View Full Code Here

    case 1:
      Object value = ((ArgumentDTO) element).getValue();
      if (value == null) {
        return ""; //$NON-NLS-1$
      }
      ArgumentDTO arg = (ArgumentDTO) element;
      //determine if the element came from a combobox or a textbox
      if (ValidationDialog.isTypeRef(arg.getName())) {
        //it's a typeRef, so this is a comboBox... get the label
        // (we could try to chop up the string we have and to get the
        // layer, but we'll play it safe and get it from the list of
        // layers and typeRefs in ValidationDialog)
        return ValidationDialog.getTypeRefLayer(value.toString());
View Full Code Here

        return r;
    }

    public ArgumentDTO toDTO() {
        ArgumentDTO dto = new ArgumentDTO();
        dto.setFinal(_final);
        dto.setName(name);
        dto.setValue(value);

        return dto;
    }
View Full Code Here

                } else {
                    Map m = new HashMap();
                    Iterator k = testArgs.keySet().iterator();

                    while (k.hasNext()) {
                        ArgumentDTO adto = (ArgumentDTO) testArgs.get(k.next());
                        m.put(adto.getName(), adto.getValue());
                    }

                    testArgs = m;
                }
View Full Code Here

TOP

Related Classes of org.geotools.validation.dto.ArgumentDTO

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.