Package net.xoetrope.xui.data

Examples of net.xoetrope.xui.data.XModel


  {
    int currentX = drawFrame ? 1 : 0 ;
    clearRow( g, row );

    for ( int fieldIdx = 0; fieldIdx < model.getNumChildren(); fieldIdx++ ){
      XModel fieldModel = model.get( fieldIdx );
      if ( fieldModel != null ){
        try {
          currentX = renderCell( g, currentX, fieldModel, (String)fieldModel.get(), fieldIdx, headerCell );
        }
        catch ( Exception ex ) {
          ex.printStackTrace();
        }
      }
View Full Code Here


      for ( int rowIdx = startRow; rowIdx < numChildren; rowIdx++ ) {
        if ( interactiveTable && ( rowIdx == currentRow ) )
          applySelectedStyle( g, selectedStyle );

        currentY += fontHeight + ( colPadding * 2 );
        XModel rowModel = model.get( rowIdx );
        if ( ((String)rowModel.get( 0 ).get()).length() > 0 )
          itemIdx++;

        if ( currentY > ( startClipY - ( fontHeight + ( colPadding * 2 ))))
          renderRow( itemIdx, g, rowModel, false );

View Full Code Here

  private int renderHeader( Graphics g, XModel model, int startClipY )
  {
    applyStyle( g, headerStyle );

    if ( model.getNumChildren() > 0 ) {
      XModel rowModel = model.get( 0 );
      String tag = rowModel.getTagName();
      if ( tag.equalsIgnoreCase( "th" ) ) {
        // A <th>...</th> header record
        currentY += fontMetrics.getAscent() + colPadding;
        if ( startClipY < rowHeight )
          renderRow( 0, g, rowModel, true );
View Full Code Here

        c.addKeyListener( this );
        c.setBounds( x, y, width, height );
        Container panel = owner.getComponentPanel();
        panel.add( c, 0 );
        currentComponent = c;
        XModel rowModel = ( XModel )model.get( row + 1 );
        XModel bindModel = ( XModel )rowModel.get( col );
        Hashtable bindingConfig = new Hashtable();
        Hashtable instanceConfig = new Hashtable();
        XTextBinding binding = new XTextBinding();
        binding.setup( XProjectManager.getCurrentProject(), c, bindingConfig, instanceConfig );
        binding.setSource( bindModel );
View Full Code Here

  {
    Dimension d = new Dimension();

    if (( model != null ) && ( model.getNumChildren() > 0 )) {
      // This width should be calculated based on the content of the cells.
      XModel rowModel = model.get( 0 );
      int numCols = rowModel.getNumChildren();
      for ( int i = 0; i < numCols; i++ )
        d.width += colWidth[ i ];

      if ( fontMetrics ==  null ) {
        Graphics g = getGraphics();
View Full Code Here

   * @param content
   */
  private void setTableContent( Object comp, String content )
  {
    if ( content != null ) {
      XModel xm = ( XModel )currentProject.getModel().get( content );
      ( ( XModelHolder )comp ).setModel( xm );
    }
  }
View Full Code Here

      String rawSourcePath = binding.getSourcePath();

      if ( rawOutputPath == null )
        rawOutputPath = rawSourcePath;

      XModel rootNode = XProjectManager.getCurrentProject().getModel();
      if ( rawOutputPath != null ) {
        String outputPath = evaluator.evaluatePath( rawOutputPath );
        if (( outputPath != null ) && ( outputPath.length() > 0 )) {
          if (( rawOutputPath.indexOf( "${" ) < 0 ) || !rawOutputPath.equals( outputPath )) {
            // Strip any attribute values as the output node should not be
            // distinguished by the selected values
            String evaluatedPath = evaluator.stripAttributeValues( outputPath );
            boolean appendByDefault = XBaseModel.getAppendByDefault();
            XBaseModel.setAppendByDefault( true );
            XModel outputNode = ( XModel )rootNode.get( XModel.prefixOutputPath( evaluatedPath ));
            XBaseModel.setAppendByDefault( appendByDefault );

            // If an attribute had been specified then the newNode might not
            // have the selected value and we would need to set it or else the
            // bound component won't show the correct initial value
            if ( !evaluatedPath.equals( outputPath ) ) {
              XModel valueNode = ( XModel )rootNode.get( XModel.prefixOutputPath( outputPath ));
              if ( valueNode != null ) {
                Object outputValue = valueNode.get();
                if ( outputValue != null )
                  outputNode.set( outputValue );
              }
            }
            binding.setOutput( outputNode, outputPath );
          }
        }
      }

      if ( rawSourcePath != null ) {
        String sourcePath = evaluator.evaluatePath( rawSourcePath );
        if (( sourcePath != null ) && ( sourcePath.length() > 0 )) {
          if (( rawSourcePath.indexOf( "${" ) < 0 ) || !rawSourcePath.equals( sourcePath )) {
            XModel sourceNode = ( XModel )rootNode.get( sourcePath );
            binding.setSource( sourceNode );
            binding.get();
          }
        }
      }
View Full Code Here

   * @return the service, or null if an error occured or the service is non existant
   */
  public static XServiceModelNode getService( XProject project, String serviceName )
  {
    try {
      XModel model = (XModel)project.getModel().get( serviceName );
      XServiceModelNode smn = (XServiceModelNode)model.get();
      return smn;
    }
    catch ( Exception e )   
    {     
      if ( BuildProperties.DEBUG )
View Full Code Here

   *          index of the children
   * @return the text
   */
  public String getText( XModel xmodel, int i )
  {
    XModel xm = xmodel.get( i );
    String value = xm.getAttribValueAsString( xm.getAttribute( "value" ) );
    if ( value != null )
      return value;
    return xm.getAttribValueAsString( xm.getAttribute( "id" ) );
  }
View Full Code Here

    XmlElement ele = XmlSource.read( r );
    XmlElement dbSrc = null, routeSrc = null, serviceSrc = null;
    Vector v = ele.getChildren();
    if ( v != null ) {
      int numFiles = v.size();
      XModel model = currentProject.getModel();
      for ( int i = 0; i < numFiles; i++ ) {
        try {
          XmlElement source = ( XmlElement )v.elementAt( i );
          Reader sr = currentProject.getBufferedReader( source.getAttribute( "filename" ), "UTF8" );
          if ( sr == null )
View Full Code Here

TOP

Related Classes of net.xoetrope.xui.data.XModel

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.