Package com.bitmovers.utilities

Examples of com.bitmovers.utilities.StringParser


  {
    String retVal = null;
    if (renderTemplate != null)
    {   
      aRenderable.fillParserValues();
      StringParser theParser = aRenderable.getParser();
      setupAlignment (aRenderable, theParser);
      if (this instanceof I_Generator)
      {
        generate (aRenderable, theParser);
      }
      else
      {
        theParser.setVariable ("components",
                     theParser.parseString (renderComponents (aRenderable)));
       
      }
      retVal = theParser.parseString (renderTemplate [0]);
    }
    return (retVal == null ? "" : retVal);
  }
View Full Code Here


 
  public String renderComponents(MContainer parent, String separator)
  {
    try
    {
      StringParser parser = new StringParser();

      MComponent[] components = parent.getComponents();

      if (components.length > 0)
      {
        for (int i = 0; i < components.length; i++)
        {
          MBorderLayout.CompassDirection position = null;
          MLayout.Alignment alignment = null;

          try
          {
            Object constraint = parent.getConstraints(components[i]);
           
            // If the constraint is an Object[], we have more than one constraint
            // to work with.
            if (constraint instanceof Object[])
            {
              Object[] constraints = (Object[])constraint;
             
              position = (MBorderLayout.CompassDirection)constraints[0];
              alignment = (MLayout.Alignment)constraints[1];
            }
            else if (constraint instanceof MBorderLayout.CompassDirection)
            {
              position = (MBorderLayout.CompassDirection)constraint;
              alignment = ((MBorderLayout)parent.getLayout()).getAlignment();
            }
            else
            {
              throw new ClassCastException();
            }
          }
          catch (ClassCastException exception)
          {
            System.err.println(new WarningString("An invalid constraint was passed to BorderLayout. Use BorderLayout.NORTH, SOUTH, EAST, WEST, or CENTER. Using default position of CENTER."));
            position = MBorderLayout.CENTER;
            alignment = ((MBorderLayout)parent.getLayout()).getAlignment();
          }

          parser.setVariable(position.toString(), doRenderComponent (components[i]));
          parser.setVariable(position.toString() + "Align", alignment.toString());
        }
      }
     
      return parser.parseString(super.getRenderTemplate((I_Renderable)parent.getLayout()));
    }
    catch (Exception exception)
    {
      System.err.println(new ErrorString(exception, "MBorderLayout_html.renderComponents()"));
     
View Full Code Here

    String retVal = null;
   
    if (renderTemplate != null)
    {
      aRenderable.fillParserValues();
      StringParser theStringParser = aRenderable.getParser();
     
      if (theStringParser == null)
      {
        theStringParser = new StringParser ();
      }
      if (this instanceof I_Generator)
      {
        generate (aRenderable, theStringParser);
      }
      else
      {
        doRender (theStringParser, aRenderable);
      }
     
      try
      {
        retVal = theStringParser.parseString (getRenderTemplate (aRenderable));
      }
      catch(NullPointerException e)
      {
        System.out.println(new ErrorString("[A_Renderer.render()] No templates available for " + aRenderable.getClass().getName()));
      }
View Full Code Here

TOP

Related Classes of com.bitmovers.utilities.StringParser

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.