Package net.xoetrope.xml

Examples of net.xoetrope.xml.XmlElement


//    cursorStr = "";

    Vector eventNodes = model.getChildren();
    int numChildren = eventNodes.size();
    for ( int i = 0; i < numChildren; i++ ) {
      XmlElement childNode = ( XmlElement )eventNodes.elementAt( i );
      if ( childNode.getName().compareTo( "Repeat" ) != 0 )
        addEvent( childNode );
      else {
        String repeatReference = childNode.getAttribute( "while" );
        pushRepeatReference( repeatReference );
        // Repeat the child addition.      
        boolean whileClauseResult = ((Boolean)rootPage.evaluateAttribute( repeatReference )).booleanValue();
        if ( whileClauseResult ) {
          i--;
View Full Code Here


      return;

    Vector eventNodes = model.getChildren();
    int numChildren = eventNodes.size();
    for ( int i = 0; i < numChildren; i++ ) {
      XmlElement childNode = ( XmlElement )eventNodes.elementAt( i );
      if ( childNode.getName().compareTo( "Repeat" ) != 0 )
        addBinding( childNode );
      else {
        // Repeat the child addition.
        String repeatReference = childNode.getAttribute( "while" );
        pushRepeatReference( repeatReference );
        boolean whileClauseResult = ((Boolean)rootPage.evaluateAttribute( repeatReference )).booleanValue();
        if ( whileClauseResult ) {
          i--;
          addBindings( page, childNode );
View Full Code Here

        else {
          if ( attribName.equals( "name" ))
            nameStr = attribValue;
          else if ( attribName.equals( "layout" )) {
            layoutMgr = attribValue;
            XmlElement layoutElement = childNode.getFirstChildNamed( "Layout" );
            if ( layoutElement != null ) {
              layoutAttributes = new Hashtable();
              Enumeration layoutAttribNamesEnum = layoutElement.enumerateAttributeNames();
              while ( layoutAttribNamesEnum.hasMoreElements()) {
                String layoutAttribName = (String)layoutAttribNamesEnum.nextElement();
                String layoutAttribValue = (String)layoutElement.getAttribute( layoutAttribName );
                layoutAttributes.put( layoutAttribName, layoutAttribValue );
              }
            }
            else
              layoutAttributes = componentAttributes;
View Full Code Here

      }

      Vector menuNodes = model.getChildren();
      int numMenus = menuNodes.size();
      for ( int i = 0; i < numMenus; i++ ) {
        XmlElement childNode = ( XmlElement )menuNodes.elementAt( i );
        addMenu( menuBar, childNode, basePackageName,
          menuStyle, menuBkColor, menuTextColor, menuFont );
      }
      menuBar.setup();
    }
View Full Code Here

    Color menuBkColor, Color menuTextColor,
    Font menuFont ) throws ClassNotFoundException, InstantiationException, IllegalAccessException
  {
    int numMenuItems = childNode.getChildren().size();
    for ( int j = 0; j < numMenuItems; j++ ) {
      XmlElement itemNode = ( XmlElement )childNode.elementAt( j );
      if ( itemNode.getName().equalsIgnoreCase( "Menu" )) {
        addMenu( menu, itemNode,
                basePackageName, menuStyle,
                menuBkColor, menuTextColor,
                menuFont );
      }
      else {
        String menuText = itemNode.getAttribute( "content" );
        if ( menuText != null ) {
          Object menuItem = null;
          if ( adapter.requiresParent()) {
            Object[] args = new Object[ 1 ];
            args[ 0 ] = menu;
            menuItem = ReflectionHelper.constructViaReflection( basePackageName + XPage.MENUITEM, args );
          }
          else {
            menuItem = Class.forName( basePackageName + XPage.MENUITEM ).newInstance();
          }

          if ( menuStyle != null ) {
            adapter.setBackground( menuItem, menuBkColor );
            adapter.setForeground( menuItem, menuTextColor );
            adapter.setFont( menuItem, menuFont );
          }

          ((XTextHolder)menuItem).setText( componentFactory.translate( menuText ));
          if ( menuItem instanceof XAttributedComponent ) {
            // Should these values be translated?
            ((XAttributedComponent)menuItem).setAttribute( "image", componentFactory.translate( itemNode.getAttribute( "image" )));
            ((XAttributedComponent)menuItem).setAttribute( "name", componentFactory.translate( itemNode.getAttribute( "name" )));
          }
          menu.append( menuItem, itemNode.getAttribute( "name" ) );

          String attribStr = itemNode.getAttribute( "enabled" );
          if (( attribStr != null ) && attribStr.equals( "false" ))
            adapter.setEnabled( menuItem, false );

          attribStr = itemNode.getAttribute( "visible" );
          if (( attribStr != null ) && attribStr.equals( "false" ))
            adapter.setVisible( menuItem, false );
        }
        else
          menu.addSeparator();         
View Full Code Here

   * customization specified by the configuration
   * @param adapter the adapter being customized
   */
  protected void overrideAdapter( XPojoAdapter adapter )
  {
    XmlElement override = getOverrideXml( adapter );
    if ( override != null ) {
      boolean isDao = "true".equals( override.getAttribute( "dao" ));
      ((XPersistentPojoAdapter)adapter).setDao( isDao );
      super.overrideAdapter( adapter );
    }
  }
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 );
        XRegistrationEntry registration;
        if ( mode == INSPECTOR_MATCH ) {
          registration = new XInspectorRegistrationEntry();
          try {
            String inspector = regElement.getAttribute( "inspector" );
            if ( inspector != null ) {
              Class inspectorClass = Class.forName( inspector );
              ((XInspectorRegistrationEntry)registration).inspector = (XInspector)inspectorClass.newInstance();
            }
          }
          catch ( Exception ex )
          {
            ex.printStackTrace();
          }
        }
        else 
          registration = new XRegistrationEntry();
       
        registration.matchMode = mode;
        registration.target = regElement.getAttribute( "target" );
        registration.className = regElement.getAttribute( "class" );
        handlerRegisters[ mode ].add( registration );
      }
    }
    catch ( Exception ex ) {
      if ( BuildProperties.DEBUG )
View Full Code Here

   * customization specified by the configuration
   * @param adapter the adapter being customized
   */   
  protected void overrideAdapter( XPojoAdapter adapter )
  {
    XmlElement override = getOverrideXml( adapter );
    if ( override != null ) {
      Enumeration enumOverrides = override.getChildren().elements();
      while ( enumOverrides.hasMoreElements() ) {
        XmlElement propertyElement = (XmlElement)enumOverrides.nextElement();
        customizeProperty( adapter, propertyElement );
      }
    }
  }   
View Full Code Here

      if ( annotation != null ) {
        try {
          Validate validateAnnotation = (Validate)annotation;
          String ruleStr = validateAnnotation.value();

          XmlElement validateElement = new NanoXmlElement();
          String extraStr = validateAnnotation.extra();
          StringTokenizer tokenizer = new StringTokenizer( extraStr, "," );
          while( tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            int pos = token.indexOf( '=' );
            validateElement.setAttribute( token.substring( 0, pos ), token.substring( pos + 1 ));
          }

          int whenAttribValue = FocusEvent.FOCUS_LOST;
          String whenAttrib = validateAnnotation.when();
          validateElement.setAttribute( "when", whenAttrib );
          if (( whenAttrib != null ) && ( whenAttrib.length() > 0 )) {
            if ( whenAttrib.toLowerCase().compareTo( "mouseclicked" ) == 0 )
              whenAttribValue = MouseEvent.MOUSE_CLICKED;
          }
         
View Full Code Here

   
    if ( metadata != null ) {
      Vector children = metadata.getChildren();
      int numChildren = children.size();
      for ( int i = 0; i < numChildren; i++ ) {
        XmlElement child = (XmlElement)children.elementAt( i );
        String tag = child.getName();
        String id = child.getAttribute( "id" );
       
        RescaleElement re = new RescaleElement();
        re.element = diagram.getElement( id );
        if ( re.element == null )
          continue;
       
        String attr = child.getAttribute( "x" );
        if ( attr != null )
          re.x = new Double( attr ).doubleValue();
       
        attr = child.getAttribute( "y" );
        if ( attr != null )
          re.y = new Double( attr ).doubleValue();
       
        attr = child.getAttribute( "w" );
        if ( attr != null )
          re.w = new Double( attr ).doubleValue();
       
        attr = child.getAttribute( "h" );
        if ( attr != null )
          re.h = new Double( attr ).doubleValue();
       
        attr = child.getAttribute( "radius" );
        if ( attr != null )
          re.radius = new Double( attr ).doubleValue();
       
        attr = child.getAttribute( "stroke" );
        if ( attr != null )
          re.stroke = new Double( attr ).doubleValue();

        attr = child.getAttribute( "ow" );
        if ( attr != null )
          re.origW = new Double( attr ).doubleValue();
       
        attr = child.getAttribute( "oh" );
        if ( attr != null )
          re.origH = new Double( attr ).doubleValue();

        rescaleElements.add( re );
      }
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.