/* ============================================================
 * JRobin : Pure java implementation of RRDTool's functionality
 * ============================================================
 *
 * Project Info:  http://www.jrobin.org
 * Project Lead:  Sasa Markovic (saxon@jrobin.org)
 *
 * Developers:    Sasa Markovic (saxon@jrobin.org)
 *
 *
 * (C) Copyright 2003-2005, by Sasa Markovic.
 *
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 */
package org.jrobin.graph;

import org.jrobin.core.RrdException;
import org.jrobin.data.DataProcessor;

class CommentText implements RrdGraphConstants {
	private final String text;		// original text

	String resolvedText;	// resolved text
	String marker; // end-of-text marker
	boolean enabled; // hrule and vrule comments can be disabled at runtime
	int x, y; // coordinates, evaluated later

	CommentText(String text) {
		this.text = text;
	}

	void resolveText(DataProcessor dproc, ValueScaler valueScaler) throws RrdException {
		resolvedText = text;
		marker = "";
		if (resolvedText != null) {
			for (String mark : MARKERS) {
				if (resolvedText.endsWith(mark)) {
					marker = mark;
					resolvedText = resolvedText.substring(0, resolvedText.length() - marker.length());
					trimIfGlue();
					break;
				}
			}
		}
		enabled = resolvedText != null;
	}


	void trimIfGlue() {
		if (marker.equals(GLUE_MARKER)) {
			resolvedText = resolvedText.trim();
		}
	}

	boolean isPrint() {
		return false;
	}

	boolean isValidGraphElement() {
		return !isPrint() && enabled;
	}
}

@@ -1303,17 +1303,20 @@
 ants %7B%0D%0A
-%09
+    
 private 
@@ -1333,18 +1333,17 @@
 ng text;
-%09%09
+ 
 // origi
@@ -1354,17 +1354,20 @@
 text%0D%0A%0D%0A
-%09
+    
 String r
@@ -1378,17 +1378,17 @@
 vedText;
-%09
+ 
 // resol
@@ -1397,17 +1397,20 @@
 d text%0D%0A
-%09
+    
 String m
@@ -1439,17 +1439,20 @@
 marker%0D%0A
-%09
+    
 boolean 
@@ -1516,17 +1516,20 @@
 untime%0D%0A
-%09
+    
 int x, y
@@ -1565,17 +1565,20 @@
 ater%0D%0A%0D%0A
-%09
+    
 CommentT
@@ -1597,18 +1597,24 @@
 ext) %7B%0D%0A
-%09%09
+        
 this.tex
@@ -1624,23 +1624,29 @@
  text;%0D%0A
-%09
+    
 %7D%0D%0A%0D%0A
-%09
+    
 void res
@@ -1723,18 +1723,24 @@
 tion %7B%0D%0A
-%09%09
+        
 resolved
@@ -1753,18 +1753,24 @@
  text;%0D%0A
-%09%09
+        
 marker =
@@ -1775,18 +1775,24 @@
  = %22%22;%0D%0A
-%09%09
+        
 if (reso
@@ -1812,19 +1812,28 @@
 ull) %7B%0D%0A
-%09%09%09
+            
 for (Str
@@ -1855,20 +1855,32 @@
 ERS) %7B%0D%0A
-%09%09%09%09
+                
 if (reso
@@ -1911,34 +1911,64 @@
  %7B%0D%0A
-%09%09%09%09%09marker = mark;%0D%0A%09%09%09%09%09
+                    marker = mark;%0D%0A                    
 reso
@@ -2051,61 +2051,124 @@
 );%0D%0A
-%09%09%09%09%09trimIfGlue();%0D%0A%09%09%09%09%09break;%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09
+                    trimIfGlue();%0D%0A                    break;%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D%0D%0A        
 enab
@@ -2200,17 +2200,21 @@
 l;%0D%0A
-%09
+    
 %7D%0D%0A%0D%0A
-%0D%0A%09
+    
 void
@@ -2230,18 +2230,24 @@
 ue() %7B%0D%0A
-%09%09
+        
 if (mark
@@ -2277,11 +2277,20 @@
  %7B%0D%0A
-%09%09%09
+            
 reso
@@ -2326,20 +2326,32 @@
 );%0D%0A
-%09%09%7D%0D%0A%09
+        %7D%0D%0A    
 %7D%0D%0A%0D%0A
-%09
+    
 bool
@@ -2363,26 +2363,32 @@
 sPrint() %7B%0D%0A
-%09%09
+        
 return false
@@ -2394,15 +2394,21 @@
 e;%0D%0A
-%09
+    
 %7D%0D%0A%0D%0A
-%09
+    
 bool
@@ -2440,10 +2440,16 @@
  %7B%0D%0A
-%09%09
+        
 retu
@@ -2479,9 +2479,12 @@
 d;%0D%0A
-%09
+    
 %7D%0D%0A%7D

clean up the whitespace