Package org.eclipse.jst.jsf.metadataprocessors.features

Examples of org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage


   * Non-EL values are invalid for method bound attribute values
   * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String)
   */
  public boolean isValidValue(String value) {   
    //if this is being called, we are being called in an non-EL context which is invalid.
    IValidationMessage msg = new ValidationMessage(Messages.MethodBindingType_invalid_value);
    getValidationMessages().add(msg);
    return false;
  }
View Full Code Here


 
  /* (non-Javadoc)
   * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String)
   */
  public boolean isValidValue(String value) {
    IValidationMessage msg = null;
    if (value != null && value.trim().length() == 0)
      msg = new ValidationMessage(Messages.ComponentIDType_invalid_value);
    else {
      //we could validate uniqueness, but will not for the time being.  This would require a DT FacesContext.
      //any other coercion rules apply here?
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.MethodBindingType#isValidValue(java.lang.String)
   */
  public boolean isValidValue(String value){
    if (value == null || (value != null && value.length() == 0)) {
      IValidationMessage msg = new ValidationMessage(Messages.ActionType_invalid_empty_value);
      getValidationMessages().add(msg);
      return false;
    }
    //any other value should be one of the possible values
    //optimize
    IWorkspaceContextResolver wr = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext());
    if (wr == null)
      return true;//shouldn't get here
   
    //in case that this is not JSF faceted or missing configs, need to pass
    if (JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()) == null)
      return true;
     
    IFile jsp = (IFile)wr.getResource();
    List<NavigationRuleType> rules = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()).getNavigationRulesForPage(jsp);
    for (final NavigationRuleType rule : rules) {
      for (Iterator cases=rule.getNavigationCase().iterator();cases.hasNext();) {       
        NavigationCaseType navCase = (NavigationCaseType)cases.next();         
        if (navCase.getFromOutcome() != null && navCase.getFromOutcome().getTextContent() != null &&
            value.equals(navCase.getFromOutcome().getTextContent().trim()))
          return true;       
      }
    }
    if (JSFVersion.valueOfProject(jsp.getProject()).compareTo(JSFVersion.V2_0) >= 0) {
      int index = value.indexOf('?');
      if (index != -1) {
        value = value.substring(0, index);
      }
      if (value != null && value.length() > 1) {
        IVirtualFolder webRoot = ComponentCore.createComponent(jsp.getProject()).getRootFolder();
        if (value.charAt(0) == '/') {
          IVirtualFile file = webRoot.getFile(new Path(value));
          if (file.exists()) {
            return true;
          }
        } else {
          IPath webContentPath = webRoot.getUnderlyingFolder().getFullPath();
          IPath filePath = jsp.getFullPath();
          if (filePath.matchingFirstSegments(webContentPath) == webContentPath.segmentCount()) {
            String extension = filePath.getFileExtension();
            filePath = filePath.removeFirstSegments(webContentPath.segmentCount());
            filePath = filePath.removeLastSegments(1);
            filePath = filePath.append(value);
            if (filePath.getFileExtension() == null && extension != null) {
              filePath = filePath.addFileExtension(extension);
            }
            IVirtualFile file = webRoot.getFile(filePath);
            if (file.exists()) {
              return true;
            }
          }
        }
      }
    }

    IValidationMessage msg = new ValidationMessage(Messages.ActionType_invalid_value);
    getValidationMessages().add(msg);
    return false;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String)
   */
  public boolean isValidValue(String value) {
    //Strings are invalid.   Requires a EL value binding.
    IValidationMessage msg = new ValidationMessage(Messages.ComponentBindingType_invalid_value);
    getValidationMessages().add(msg);
    return false;
  }
View Full Code Here

                    }

                    for (final Iterator msgs = v.getValidationMessages()
                            .iterator(); msgs.hasNext();)
                    {
                        final IValidationMessage msg = (IValidationMessage) msgs
                        .next();
                        reportValidationMessage(createValidationMessage(
                                context, attributeValue, msg.getSeverity(), msg
                                .getMessage(), _validationContext
                                .getFile()), context, attributeValue);
                    }
                }
                else if (DEBUG)
View Full Code Here

TOP

Related Classes of org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage

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.