Ejemplo n.º 1
0
 public XmlUIElement getXmlElement(UserInput uiArg) {
   String type = "textfield";
   Qualifier qual = uiArg.getQualifier();
   String enumNames[] = null;
   String enumValues[] = null;
   if (qual != null) {
     type = qual.getType();
     Vector enumVec = qual.getEnums();
     if (enumVec.size() > 0) {
       enumNames = new String[enumVec.size()];
       enumValues = new String[enumVec.size()];
       for (int i = 0; i < enumNames.length; i++) {
         com.adventnet.management.config.xml.Enum e =
             (com.adventnet.management.config.xml.Enum) enumVec.elementAt(i);
         enumNames[i] = e.getName();
         enumValues[i] = e.getValue();
         if (enumNames[i] == null) {
           enumNames[i] = enumValues[i];
         }
       }
     }
   }
   XmlUIElement el = getXmlUIElementFor(type);
   if (el == null) {
     return null;
   }
   el.setDescription(uiArg.getDescription());
   if (enumNames != null) {
     el.setEnumeratedValues(enumNames, enumValues);
   }
   if ((qual != null) && (qual.getRange() != null) && (!(qual.getRange().equals("")))) {
     el.setRange(qual.getRange());
   }
   if (uiArg.getDefaultValue() != null) {
     el.setValue(uiArg.getDefaultValue());
   }
   String isEditable = uiArg.getAttribute("editable");
   if (isEditable != null) {
     if (isEditable.trim().equals("false")) {
       el.setEditable(false);
     } else {
       el.setEditable(true);
     }
   }
   String required = uiArg.getAttribute("required");
   {
     if (required.trim().equals("true")) {
       el.setRequired(true);
       numberOfRequiredFields++;
     } else {
       el.setRequired(false);
     }
   }
   el.setLabelName(uiArg.getLabel());
   return el;
 }
Ejemplo n.º 2
0
 public ArrayList getXmlUIElements(Form f) throws InvalidTemplateException {
   Vector v = f.getUserInputs();
   Vector userInputVecArg = new Vector();
   int size = v.size();
   for (int i = 0; i < size; i++) {
     UserInput ui = (UserInput) v.elementAt(i);
     String satisfied = ui.getAttribute("satisfied");
     if (satisfied == null || (!satisfied.equals("false"))) {
       userInputVecArg.addElement(ui);
     }
   }
   ArrayList list = new ArrayList(userInputVecArg.size());
   for (int i = 0, j = userInputVecArg.size(); i < j; i++) {
     UserInput ui = (UserInput) userInputVecArg.elementAt(i);
     uiList.add(ui);
     XmlUIElement el = getXmlElement(ui);
     uiElementsList.add(el);
     list.add(el);
   }
   return list;
 }