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.JDBCMetaData;
010
011 /**
012 * A view component used to display the information contained in
013 * {@link com.sptci.rwt.JDBCMetaData}.
014 *
015 * <p>© 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: JDBCView.java 4123 2008-05-25 21:49:01Z rakesh $
018 */
019 public class JDBCView extends AbstractView
020 {
021 /** The meta data object whose details are to be displayed. */
022 private final JDBCMetaData 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 JDBCView( final JDBCMetaData 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 * JDBC 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( "version", metaData, grid );
060
061 GroupBox box = new GroupBox( Configuration.getString( this, "title" ) );
062 box.add( grid );
063 return box;
064 }
065 }