Package com.google.gwt.xml.client

Examples of com.google.gwt.xml.client.Element


  public PU_Font(WebGLTexture texture, String info)
  {
    mImage = new PU_Image(256, 256, texture);
   
    Document infoDom = XMLParser.parse(info);
    Element common = (Element)infoDom.getElementsByTagName("common").item(0);
    mLineHeight = Integer.parseInt(common.getAttribute("lineHeight"));
   
    NodeList chars = infoDom.getElementsByTagName("char");
    for(int i = 0; i < chars.getLength(); i++)
    {
      Element character = (Element) chars.item(i);
     
      PU_FontCharacter fontCharacter = new PU_FontCharacter();
      int id = Integer.parseInt(character.getAttribute("id"));
      fontCharacter.x = Integer.parseInt(character.getAttribute("x"));
      fontCharacter.y = Integer.parseInt(character.getAttribute("y"));
      fontCharacter.width = Integer.parseInt(character.getAttribute("width"));
      fontCharacter.height = Integer.parseInt(character.getAttribute("height"));
      fontCharacter.xOffset = Integer.parseInt(character.getAttribute("xoffset"));
      fontCharacter.yOffset = Integer.parseInt(character.getAttribute("yoffset"));
      fontCharacter.xAdvance = Integer.parseInt(character.getAttribute("xadvance"));
      mCharacters[id] = fontCharacter;
    }
  }
View Full Code Here


    Node root = doc.getFirstChild();
    NodeList list = doc.getElementsByTagName(modelType.recordName);
    ArrayList<BaseModel> records = new ArrayList<BaseModel>();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      Element elem = (Element) node;
      BaseModel model = new BaseModel();
      for (int j = 0; j < modelType.getFieldCount(); j++) {
        DataField field = modelType.getField(j);
        String map = field.map != null ? field.map : field.name;
        String v = getValue(elem, map);
View Full Code Here

            updateTable.getCellFormatter().setStyleName( 0, 1, "backgroundContentHeaderTableCell" ); //$NON-NLS-1$
            updateTable.getCellFormatter().setStyleName( 0, 2, "backgroundContentHeaderTableCell" ); //$NON-NLS-1$
            updateTable.getCellFormatter().setStyleName( 0, 3, "backgroundContentHeaderTableCellRight" ); //$NON-NLS-1$

            for ( int i = 0; i < updates.getLength(); i++ ) {
              Element updateElement = (Element) updates.item( i );
              String version = updateElement.getAttribute( "version" ); //$NON-NLS-1$
              String type = updateElement.getAttribute( "type" ); //$NON-NLS-1$
              String os = updateElement.getAttribute( "os" ); //$NON-NLS-1$
              // String title = updateElement.getAttribute("title");
              String downloadURL = updateElement.getElementsByTagName( "downloadurl" ).item( 0 ).toString(); //$NON-NLS-1$
              downloadURL = downloadURL.substring( downloadURL.indexOf( "http" ), downloadURL.indexOf( "]" ) ); //$NON-NLS-1$ //$NON-NLS-2$
              updateTable.setWidget( i + 1, 0, new Label( version ) );
              updateTable.setWidget( i + 1, 1, new Label( type ) );
              updateTable.setWidget( i + 1, 2, new Label( os ) );
              updateTable
View Full Code Here

  }

  private Boolean isModifiableUserOrRole( Document fileInfo, String recipient, String recipientType ) {
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        NodeList modifiable = ace.getElementsByTagName( MODIFIABLE_ELEMENT_NAME );
        return modifiable.getLength() > 0 && modifiable.item( 0 ).getFirstChild().getNodeValue().equals( "true" );
      }
    }
    return false;
  }
View Full Code Here

  private void updatePermissionForUserOrRole( Document fileInfo, String recipient, String recipientType, boolean grant, int perm ) {
    // first let's see if this node exists
    Node foundPermission = null;
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        NodeList permissions = ace.getElementsByTagName( PERMISSIONS_ELEMENT_NAME );
        for ( int j = 0; j < permissions.getLength(); j++ ) {
          Node testNode = permissions.item( j );
          if ( testNode.getFirstChild() != null && Integer.parseInt( testNode.getFirstChild()
              .getNodeValue() ) == perm ) {
            foundPermission = testNode;
View Full Code Here

      Node perm = perms.item( i );
      if ( perm != null ) {
        ace.removeChild( perm );
      }
    }
    Element newPerm = fileInfo.createElement( PERMISSIONS_ELEMENT_NAME );
    Text textNode = fileInfo.createTextNode( Integer.toString( PERM_ALL ) );
    newPerm.appendChild( textNode );
    ace.appendChild( newPerm );
  }
View Full Code Here

      // Check if any of the permission sets should be replaced with ALL.
      // Any non-inherited Ace with a permission set containing PERM_GRANT_PERM should be replaced
      // with a single PERM_ALL.
      NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
      for ( int i = 0; i < aces.getLength(); i++ ) {
        Element ace = (Element) aces.item( i );
        NodeList perms = ace.getElementsByTagName( PERMISSIONS_ELEMENT_NAME );
        for ( int j = 0; j < perms.getLength(); j++ ) {
          Element perm = (Element) perms.item( j );
          if ( perm.getFirstChild() != null ) {
            if ( Integer.parseInt( perm.getFirstChild().getNodeValue() ) == PERM_GRANT_PERM ) {
              replacePermissionsWithAll( ace, fileInfo );
              break;
            }
          }
        }
View Full Code Here

  // Document manipulation
  // *********************
  void removeRecipient( String recipient, String recipientType, Document fileInfo ) {
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) &&  ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        ace.getParentNode().removeChild( ace );
        break;
      }
    }
  }
View Full Code Here

  /**
   * @param recipientName
   * @param recipientType
   */
  void addRecipient( String recipientName, int recipientType, Document fileInfo ) {
    Element newAces = fileInfo.createElement( ACES_ELEMENT_NAME );
    Element newPermission = fileInfo.createElement( PERMISSIONS_ELEMENT_NAME );
    Element newRecipient = fileInfo.createElement( RECIPIENT_ELEMENT_NAME );
    Element newRecipientType = fileInfo.createElement( RECIPIENT_TYPE_ELEMENT_NAME );
    Text textNode = fileInfo.createTextNode( recipientName );
    newRecipient.appendChild( textNode );
    textNode = fileInfo.createTextNode( Integer.toString( recipientType ) );
    newRecipientType.appendChild( textNode );
    newAces.appendChild( newPermission );
    newAces.appendChild( newRecipient );
    newAces.appendChild( newRecipientType );

    fileInfo.getDocumentElement().appendChild( newAces );
View Full Code Here

   * @param permission
   */
  private void addPermission( String recipient, String recipientType, int permission, Document fileInfo ) {
    NodeList aces = fileInfo.getElementsByTagName( ACES_ELEMENT_NAME );
    for ( int i = 0; i < aces.getLength(); i++ ) {
      Element ace = (Element) aces.item( i );
      if ( ace.getElementsByTagName( RECIPIENT_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipient ) && ace.getElementsByTagName( RECIPIENT_TYPE_ELEMENT_NAME ).item( 0 ).getFirstChild().getNodeValue().equals(
          recipientType ) ) {
        Element newPerm = fileInfo.createElement( PERMISSIONS_ELEMENT_NAME );
        Text textNode = fileInfo.createTextNode( Integer.toString( permission ) );
        newPerm.appendChild( textNode );
        ace.appendChild( newPerm );
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.Element

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.