001    package com.sptci.rwt.webui.model;
002    
003    import nextapp.echo2.app.Component;
004    import nextapp.echo2.app.Grid;
005    
006    import echopointng.GroupBox;
007    
008    import com.sptci.echo2.Configuration;
009    import com.sptci.rwt.ColumnMetaData;
010    
011    /**
012     * A view component used to display the information contained in
013     * {@link com.sptci.rwt.ColumnMetaData}.
014     *
015     * <p>&copy; Copyright 2007 <a href='http://sptci.com/' target='_new'>Sans Pareil Technologies, Inc.</a></p>
016     * @author Rakesh Vidyadharan 2007-10-07
017     * @version $Id: ColumnView.java 4123 2008-05-25 21:49:01Z rakesh $
018     */
019    public class ColumnView extends AbstractView
020    {
021      /** The meta data object whose details are to be displayed. */
022      private final ColumnMetaData metaData;
023    
024      /**
025       * Create a new instance of the view using the specified model object.
026       *
027       * @param metaData The {@link #metaData} model object to use.
028       */
029      public ColumnView( final ColumnMetaData metaData )
030      {
031        this.metaData = metaData;
032      }
033    
034      /**
035       * Lifecycle method used to initialise component when added to a
036       * container hierarchy.
037       *
038       * @see #createDetails
039       */
040      @Override
041      public void init()
042      {
043        removeAll();
044        add( createDetails() );
045      }
046    
047      /**
048       * Create the component used to display basic information about the
049       * Column driver.
050       *
051       * @see #createLabels
052       * @return The component that displays the basic information.
053       */
054      protected Component createDetails()
055      {
056        Grid grid = new Grid();
057    
058        createLabels( "name", metaData, grid );
059        createLabels( "type", metaData, grid );
060        createLabels( "typeName", metaData, grid );
061        createLabels( "defaultValue", metaData, grid );
062        createLabels( "size", metaData, grid );
063        createLabels( "nullable", metaData, grid );
064    
065        GroupBox box = new GroupBox( Configuration.getString( this, "title" ) );
066        box.add( grid );
067        return box;
068      }
069    }