KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jrobin > graph > TimeAxisLabel


1 /* ============================================================
2  * JRobin : Pure java implementation of RRDTool's functionality
3  * ============================================================
4  *
5  * Project Info: http://www.jrobin.org
6  * Project Lead: Sasa Markovic (saxon@jrobin.org)
7  *
8  * Developers: Sasa Markovic (saxon@jrobin.org)
9  * Arne Vandamme (cobralord@jrobin.org)
10  *
11  * (C) Copyright 2003, by Sasa Markovic.
12  *
13  * This library is free software; you can redistribute it and/or modify it under the terms
14  * of the GNU Lesser General Public License as published by the Free Software Foundation;
15  * either version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * See the GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License along with this
22  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */

25 package org.jrobin.graph;
26
27 import org.jrobin.core.RrdException;
28 import org.jrobin.core.XmlWriter;
29
30 /**
31  * <p>Represents the TimeAxis label used in the graph. The TimeAxisLabel object has the same alignment
32  * possibilities as all other text/comment objects in a graph.</p>
33  *
34  * @author Arne Vandamme (cobralord@jrobin.org)
35  */

36 public class TimeAxisLabel extends Comment
37 {
38     // ================================================================
39
// -- Constructors
40
// ================================================================
41
/**
42      * Constructs a TimeAxisLabel object based on a text string.
43      * @param text Text string with alignment markers representing the label.
44      * @throws RrdException Thrown in case of a JRobin specific error.
45      */

46     TimeAxisLabel( String JavaDoc text ) throws RrdException
47     {
48         this.text = text;
49         lfToken = Comment.TKN_ACF;
50         super.parseComment();
51         
52         // If there's no line end, add centered-line end
53
if ( !super.isCompleteLine() ) {
54             oList.add( "" );
55             oList.add( TimeAxisLabel.TKN_ACF );
56         
57             oList.add( "" );
58             oList.add( TimeAxisLabel.TKN_ALF );
59             
60             this.lineCount += 2;
61         }
62     }
63
64     void exportXmlTemplate(XmlWriter xml) {
65         xml.writeTag("time_axis_label", getText());
66     }
67
68 }
69
Popular Tags