001 package com.sptci.rwt.webui.model;
002
003 import nextapp.echo2.app.Component;
004 import nextapp.echo2.app.Grid;
005 import nextapp.echo2.app.Label;
006
007 import echopointng.GroupBox;
008
009 import com.sptci.echo2.Configuration;
010 import com.sptci.echo2.Utilities;
011 import com.sptci.rwt.DBMSMetaData;
012
013 /**
014 * A view component used to display the information contained in
015 * {@link com.sptci.rwt.DBMSMetaData}.
016 *
017 * <p>© Copyright 2007 <a href='http://sptci.com/' target='_new'>Sans Pareil Technologies, Inc.</a></p>
018 * @author Rakesh Vidyadharan 2007-10-07
019 * @version $Id: DBMSView.java 4123 2008-05-25 21:49:01Z rakesh $
020 */
021 public class DBMSView extends AbstractView
022 {
023 /** The meta data object whose details are to be displayed. */
024 private final DBMSMetaData metaData;
025
026 /**
027 * Create a new instance of the view using the specified model object.
028 *
029 * @param metaData The {@link #metaData} model object to use.
030 */
031 public DBMSView( final DBMSMetaData metaData )
032 {
033 this.metaData = metaData;
034 }
035
036 /**
037 * Lifecycle method used to initialise component when added to a
038 * container hierarchy.
039 *
040 * @see #createDetails
041 * @see #createJDBCView
042 * @see #createLimitsView
043 */
044 @Override
045 public void init()
046 {
047 removeAll();
048 add( createDetails() );
049 add( createJDBCView() );
050 add( createLimitsView() );
051 }
052
053 /**
054 * Create the component used to display basic information about the
055 * database engine.
056 *
057 * @see #createLabels
058 * @return The component that displays the basic information.
059 */
060 protected Component createDetails()
061 {
062 Grid grid = new Grid();
063
064 grid.add( Utilities.createLabel(
065 getClass().getName(), "product", "Title.Label" ) );
066 grid.add( new Label( metaData.getName() ) );
067
068 createLabels( "version", metaData, grid );
069 createLabels( "defaultTransaction", metaData, grid );
070
071 GroupBox box = new GroupBox( Configuration.getString( this, "title" ) );
072 box.add( grid );
073 return box;
074 }
075
076 /**
077 * Create the component that is used to display the information
078 * pertaining to the JDBC driver in use.
079 *
080 * @return The component that displays the JDBC driver information.
081 */
082 protected Component createJDBCView()
083 {
084 return new JDBCView( metaData.getJdbcMetaData() );
085 }
086
087 /**
088 * Create the component that is used to display the information
089 * pertaining to the limits enforced by the database engine.
090 *
091 * @return The component that displays the limits for the database.
092 */
093 protected Component createLimitsView()
094 {
095 return new LimitsView( metaData.getLimitsMetaData() );
096 }
097 }