コード例 #1
0
 private XmlUIElement getXmlUIElementFor(String typeArg) {
   if (typeToClassMappingProp == null) {
     setUpMappingsHM();
   }
   String clsName = (String) typeToClassMappingProp.get(typeArg);
   if ((clsName != null) && !(clsName.equals("*NOTFOUND*")) && !(clsName.equals("*EXCEPTION*"))) {
     try {
       Class cls = Class.forName(clsName);
       return (XmlUIElement) cls.newInstance();
     } catch (Throwable th) {
       typeToClassMappingProp.put(typeArg, "*EXCEPTION*");
       showErrorMessage(
           MessageFormat.format(
               ProvClientUtils.getString(
                   "{0} occurred when trying to get the XmlUIElement for type : {1}"),
               new Object[] {th.getClass().getName(), typeArg}));
       th.printStackTrace();
       return null;
     }
   } else if (clsName == null) {
     typeToClassMappingProp.put(typeArg, "*NOTFOUND*");
     showErrorMessage(
         MessageFormat.format(
             ProvClientUtils.getString(
                 "The type {0} does not have the corresponding XMLUIElement specified in the TypeToUIElementMapping.txt file"),
             new Object[] {typeArg}));
   }
   return null;
 }
コード例 #2
0
 private void setUpMappingsHM() {
   typeToClassMappingProp = new Properties();
   URL url = UserInputUIHandler.class.getClassLoader().getResource(mappingTxt);
   if (url == null) {
     showErrorMessage(ProvClientUtils.getString("TypeToUIElementMapping.txt file is not found"));
     return;
   }
   try {
     typeToClassMappingProp.load(url.openStream());
   } catch (IOException ioe) {
     ioe.printStackTrace();
   }
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 private void showErrorMessage(String message) {
   JOptionPane.showMessageDialog(
       null, message, ProvClientUtils.getString("Error"), JOptionPane.ERROR_MESSAGE);
 }