001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.util.table;
028    
029    
030    
031    /**
032     * An interface for serializing tables.
033     * <p>
034     * The default implementation for each method is to do nothing.
035     * Implementations must override methods as required.
036     */
037    public abstract class TableSerializer {
038    
039      /**
040       * Create a new table serializer.
041       */
042      protected TableSerializer() {
043        // No implementation required.
044      }
045    
046    
047    
048      /**
049       * Prints a table cell.
050       *
051       * @param s
052       *          The cell contents.
053       */
054      public void addCell(String s) {
055        // Default implementation.
056      }
057    
058    
059    
060      /**
061       * Defines a column in the table.
062       *
063       * @param width
064       *          The width of the column in characters.
065       */
066      public void addColumn(int width) {
067        // Default implementation.
068      }
069    
070    
071    
072      /**
073       * Prints a column heading.
074       *
075       * @param s
076       *          The column heading.
077       */
078      public void addHeading(String s) {
079        // Default implementation.
080      }
081    
082    
083    
084      /**
085       * Finish printing the table contents.
086       */
087      public void endContent() {
088        // Default implementation.
089      }
090    
091    
092    
093      /**
094       * Finish printing the column headings.
095       */
096      public void endHeader() {
097        // Default implementation.
098      }
099    
100    
101    
102      /**
103       * Finish printing the current row of the table.
104       */
105      public void endRow() {
106        // Default implementation.
107      }
108    
109    
110    
111      /**
112       * Finish printing the table.
113       */
114      public void endTable() {
115        // Default implementation.
116      }
117    
118    
119    
120      /**
121       * Prepare to start printing the table contents.
122       */
123      public void startContent() {
124        // Default implementation.
125      }
126    
127    
128    
129      /**
130       * Prepare to start printing the column headings.
131       */
132      public void startHeader() {
133        // Default implementation.
134      }
135    
136    
137    
138      /**
139       * Prepare to start printing a new row of the table.
140       */
141      public void startRow() {
142        // Default implementation.
143      }
144    
145    
146    
147      /**
148       * Start a new table having the specified number of rows and
149       * columns.
150       *
151       * @param height
152       *          The number of rows in the table.
153       * @param width
154       *          The number of columns in the table.
155       */
156      public void startTable(int height, int width) {
157        // Default implementation.
158      }
159    
160    }