Package net.xoetrope.xml

Examples of net.xoetrope.xml.XmlElement


  {
    // read mapping file
    List mappingFiles = new ArrayList();
    try {     
      BufferedReader br = currentProject.getBufferedReader( "hibernate.cfg.xml" );
      XmlElement rootXml = XmlSource.read( br ).getFirstChildNamed( "session-factory" );
      if ( rootXml != null ) {
        Enumeration enumChildren = rootXml.getChildren().elements();
       
        // iterate through the children
        while ( enumChildren.hasMoreElements() ) {
          XmlElement childXml = (XmlElement)enumChildren.nextElement();         
          if ( !"mapping".equals( childXml.getName() ))
            continue;
         
          // store the name of the mapping file
          String fileName = childXml.getAttribute( "resource" );
          if ( fileName != null )
            mappingFiles.add( fileName );
        }
        br.close();
      }
View Full Code Here


  {
    try {
      BufferedReader br = currentProject.getBufferedReader( fileName );

      // get the mapping file content
      XmlElement rootXml = xmlParser.parse( br );
           
      // get the name of the package containing the mapped classes     
      String packageName = rootXml.getAttribute( "package" );
      if ( packageName == null )
        return;
     
      // read the entity definitions
      Enumeration enumClasses = rootXml.getChildren().elements();
      while ( enumClasses.hasMoreElements() ) {
       
        // read the configuration of a single class
        XmlElement classXml = (XmlElement)enumClasses.nextElement();
        if ( !"class".equals( classXml.getName() ))
          continue;       
        String className = ( packageName + "." + classXml.getAttribute( "name" ));
       
        // iterate over the properties of a class
        Enumeration enumProperties = classXml.getChildren().elements();
        while ( enumProperties.hasMoreElements() ) {
          // read the property configuration
          XmlElement propertyXml = (XmlElement)enumProperties.nextElement();         
         
          // check whether the xml node defines a "lazy" collection
          if ( isLazyCollection( propertyXml )) {           
            // mark that the collection is lazily initialized
            String propertyName = propertyXml.getAttribute( "name" );
            List properties = (List)hibernateConfiguration.get( className );                       
            if ( properties == null )
              hibernateConfiguration.put( className, properties = new ArrayList() );
            properties.add( propertyName );
          }
View Full Code Here

  protected void addValidations( PageSupport page, XmlElement model )
  {
    Vector validations = model.getChildren();
    int numValidations = validations.size();
    for ( int i = 0; i < numValidations; i++ ) {
      XmlElement childNode = ( XmlElement )validations.elementAt( i );
      Object target = page.findComponent( childNode.getAttribute( "target" ));
      String whenAttrib = childNode.getAttribute( "when" );
      int whenAttribValue = FocusEvent.FOCUS_LOST;
      if ( whenAttrib != null ) {
        if ( whenAttrib.toLowerCase().compareTo( "mouseclicked" ) == 0 )
          whenAttribValue = MouseEvent.MOUSE_CLICKED;
      }
     
      try {
        page.addValidation( target, childNode.getAttribute( "rule" ), childNode.getAttribute( "method" ), whenAttribValue, childNode );
      }
      catch ( Exception e ) {
        DebugLogger.logError( "BUILDER", "Could not create the validation - " + childNode.getAttribute( "rule" ) );
      }
    }
  }
View Full Code Here

    try {
      if (( r == null ) || !r.ready())
        return;

      XmlElement guideModel = XmlSource.read( r );
      read( guideModel );
    }
    catch ( Exception e ) {
      if ( BuildProperties.DEBUG )
        DebugLogger.logError( "Unable to load and process the guide file: " + fileName );
View Full Code Here

    int numGuides = guideElements.size();
    int[] previousGuides = new int[ numGuides ];
   
    // Pass one - create the guides
    for ( int i = 0; i < numGuides; i++ ) {
      XmlElement guideElement = (XmlElement)guideElements.elementAt( i );

      int id = Integer.parseInt( guideElement.getAttribute( "id" ));
      double pos = Double.parseDouble( guideElement.getAttribute( "pos" ));

      Guide guide = new Guide( pos, id, max, isVertical );
      int positioning = Integer.parseInt( guideElement.getAttribute( "type" ));
      guide.setPositioning( positioning );
      guide.setCoordinates( Integer.parseInt( guideElement.getAttribute( "coords" )));
      if ( positioning == Guide.RELATIVE_POSITION ) {
        int previousGuideId = Integer.parseInt( guideElement.getAttribute( "prev" ));;
        previousGuides[ i ] = previousGuideId;
      }
      else
        previousGuides[ i ] = -1;
      guides.add( guide );
View Full Code Here

   * @param reader the reader from which to read the file
   */
  public void read( String key, Reader reader )
  {
    try {
      XmlElement regRoot = XmlSource.read( reader );

      Vector registrationNodes = regRoot.getChildren();
      int numElements = registrationNodes.size();
      for ( int i = 0; i < numElements; i++ ) {
        XmlElement regElement = (XmlElement)registrationNodes.elementAt( i );
        String tag = regElement.getName();
        int mode = ( tag.equals( "InspectorBindings" ) ? INSPECTOR_MATCH :
                     tag.equals( "ClassBindings" ) ? CLASS_MATCH :
                     tag.equals( "InterfaceBindings" ) ? INTERFACE_MATCH :
                     INSTANCE_MATCH
                   );
View Full Code Here

  {
    try {
      Vector registrationNodes = regRoot.getChildren();
      int numElements = registrationNodes.size();
      for ( int i = 0; i < numElements; i++ ) {
        XmlElement regElement = (XmlElement)registrationNodes.elementAt( i );
        XBindingMatch registration = new XBindingMatch();
        registration.matchMode = mode;
        registration.target = regElement.getAttribute( "target" );
        registration.className = regElement.getAttribute( "class" );
        registration.type = regElement.getAttribute( "type" );
        /** @todo store the extra attributes */
        bindingRegisters[ mode ].add( registration );
      }
    }
    catch ( Exception ex ) {
View Full Code Here

   * Read a model from the Reader
   * @param r the Reader
   */
  public void read( Reader r )
  {
    XmlElement ele = XmlSource.read( r );
    read( ele );
  }
View Full Code Here

    Vector v = ele.getChildren();
    if ( v != null ) {
      int numFiles = v.size();
      for ( int i = 0; i < numFiles; i++ ) {
        try {
          XmlElement source = ( XmlElement )v.elementAt( i );
          String fileName = source.getAttribute( "filename" );
          if ( fileName != null ) {
            readDataSource( fileName, source );
          }
        }
        catch ( Exception ex ) {
View Full Code Here

  protected void readDataSource( String fileName, XmlElement source )
  {
    try {
      Reader sr = currentProject.getBufferedReader( fileName, null );

      XmlElement src = XmlSource.read( sr );
      String type = source.getAttribute( "type" );
      if ( ( type == null ) || ( type.length() == 0 ) )
        loadTable( src, currentProject.getModel() );
    }
    catch ( Exception ex ) {
View Full Code Here

TOP

Related Classes of net.xoetrope.xml.XmlElement

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.