public boolean areInputValuesValid() { for (int i = 0; i < uiList.size(); i++) { XmlUIElement el = (XmlUIElement) uiElementsList.get(i); try { el.checkConstraints(); } catch (Exception e) { errorMessage = e.getMessage(); incompletePanel = (JPanel) elementsAndPanels.get(el); return false; } if ((el.isRequired()) && (el.isValueNull())) { errorMessage = MessageFormat.format( ProvClientUtils.getString("{0} field cannot be empty"), new Object[] {el.getLabelName()}); incompletePanel = (JPanel) elementsAndPanels.get(el); return false; } } return true; }
/** This replaces the user input variables in the XML template * */ public String replaceVariablesInString(String xmlStringArg) { String modXmlString = xmlStringArg; Properties prop = new Properties(); for (int i = 0; i < uiList.size(); i++) { UserInput ui = (UserInput) uiList.get(i); XmlUIElement el = (XmlUIElement) uiElementsList.get(i); ui.setValue(el.getValue()); prop.put("$UserInput$" + ui.getID(), el.getValue()); // modXmlString = StringUtil.replaceStringBySpecifiedString(modXmlString,"$UserInput$" + // ui.getID(),el.getValue()); } Template template = null; try { template = new Template(xmlStringArg); // template = PopulateTemplateParams.substituteParams(template, prop, 3); template = PopulateTemplateParams.substituteParams(template, prop); } catch (Exception exc) { exc.printStackTrace(); } // return modXmlString; return template.toString(); }