Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rename components to match xml namings

Signed-off-by: Adrian Jones <adrianj1998@hotmail.com>
  • Loading branch information...
commit 4dce50e89e8203f7c2c8111dd438b5cb343612fe 1 parent 0992a7f
@adrianj98 adrianj98 authored
View
6 class/parser/JasperBand.php
@@ -16,7 +16,7 @@
* @author adrian
*/
-class JasperBand extends JasperObject {
+class Jasper_band extends JasperObject {
protected $_height;
protected $_isSplitAllowed;
@@ -42,9 +42,9 @@ public function parseElements($xml_path) {
$elementName = 'Jasper_'.$k;
if (class_exists($elementName))
- $element = new $elementName();
+ $element = new $elementName($this);
else
- $element = new JasperElement();
+ $element = new Jasper_reportElement($this);
$element->type = $k;
$element->parse($out);
$this->addElement($element);
View
33 class/parser/JasperElement.php
@@ -10,7 +10,7 @@
*
* @author adrian
*/
-class JasperElement extends JasperObject {
+class Jasper_reportElement extends JasperObject {
function getInt($value,$def=0)
{
@@ -26,6 +26,11 @@ function getString($value,$def='')
return (string)$value;
}
+
+ function __construct($parent) {
+ $this->parent = $parent;
+ parent::__construct();
+ }
function getBool($value,$def=false)
{
if (!isset($value))
@@ -47,7 +52,7 @@ function getBool($value,$def=false)
protected $_fillcolor = array("r" => 255, "g" => 255, "b" => 255);
protected $_stretchoverflow = "true";
protected $_printoverflow = "false";
-
+ protected $_printWhenExpression = '';
function parse($data)
{
@@ -56,7 +61,7 @@ function parse($data)
$this->y = $this->getInt($data->reportElement["y"]);
$this->width = $this->getInt($data->reportElement["width"]);
/** allow forground color "forecolor" */
-
+ $this->printWhenExpression = $this->getString($data->reportElement->printWhenExpression);
//reportElement
if (isset($data->reportElement["forecolor"])) {
$this->textcolor = array("r" => hexdec(substr($data->reportElement["forecolor"], 1, 2)), "g" => hexdec(substr($data->reportElement["forecolor"], 3, 2)), "b" => hexdec(substr($data->reportElement["forecolor"], 5, 2)));
@@ -76,15 +81,24 @@ function parse($data)
}
}
+
+ function layout()
+ {
+ // if visible
+
+ }
}
-class JasperBox extends JasperElement
+class Jasper_box extends Jasper_reportElement
{
//box
- protected $_border = 0;
+ protected $_border = 0;
protected $_drawcolor = array("r" => 0, "g" => 0, "b" => 0);
-
+ function layout()
+ {
+ parent::layout();
+ }
function parse($data)
{
parent::parse($data) ;
@@ -99,7 +113,7 @@ function parse($data)
}
-class JasperText extends JasperBox
+class Jasper_textElement extends Jasper_box
{
//textElement
@@ -110,7 +124,10 @@ class JasperText extends JasperBox
protected $_font = "helvetica";
protected $_fontstyle = '';
-
+ function getTextSize($text)
+ {
+
+ }
function parse($data)
{
parent::parse($data) ;
View
24 class/parser/JasperElements.php
@@ -10,7 +10,7 @@
*
* @author adrian
*/
-class Jasper_staticText extends JasperText {
+class Jasper_staticText extends Jasper_textElement {
protected $_text = "";
@@ -27,7 +27,7 @@ public function parse($data) {
// $this->report->pointer[] = array("type" => "SetFont", "font" => $font, "fontstyle" => $fontstyle, "fontsize" => $fontsize, "hidden_type" => "font");
//"height"=>$data->reportElement["height"]
//### UTF-8 characters, a must for me.
- $txtEnc = ($data->text);
+ $txtEnc = (string)($data->text);
$this->text = $$txtEnc;
@@ -38,7 +38,12 @@ public function parse($data) {
//### End of modification, below is the original line
// $this->report->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>$data->text,"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"statictext","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"rotation"=>$rotation);
}
-
+ function layout()
+ {
+ parent::layout();
+
+ $this->getTextSize($this->text);
+ }
}
/**
@@ -46,7 +51,7 @@ public function parse($data) {
*
* @todo hyperlinks need to be covered
*/
-class Jasper_textField extends JasperText {
+class Jasper_textField extends Jasper_textElement {
protected $_textFieldExpression = "";
@@ -55,15 +60,20 @@ public function parse($data) {
parent::parse($data);
- $this->textFieldExpression = $data->textFieldExpression;
+ $this->textFieldExpression = (string) $data->textFieldExpression;
+ }
+ function layout()
+ {
+ parent::layout();
+ $text = ''; //need get text expression
+ $this->getTextSize($text);
}
-
}
/**
*
* @link http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/schema.reference.html#group
*/
-class Japser_group extends JasperElement {
+class Japser_group extends Jasper_reportElement {
public $_groupFooter;
public $_groupHeader;
View
8 tests/class/parser/JasperBandTest.php
@@ -18,7 +18,7 @@ class JasperBandTest extends PHPUnit_Framework_TestCase {
* This method is called before a test is executed.
*/
protected function setUp() {
- $this->object = new JasperBand();
+ $this->object = new Jasper_band();
}
/**
@@ -71,8 +71,10 @@ public function testParseElements() {
public $testBand = '<pageHeader>
<band height="177" splitType="Stretch">
<textField>
- <reportElement x="478" y="98" width="69" height="20"/>
- <textElement/>
+ <reportElement style="Column header" x="492" y="14" width="66" height="26" forecolor="#000000">
+ <printWhenExpression><![CDATA[$P{printType} == ( "quote" )]]></printWhenExpression>
+ </reportElement>
+ <textElement/>
<textFieldExpression><![CDATA[$F{sample2_date}]]></textFieldExpression>
</textField>
<textField>
Please sign in to comment.
Something went wrong with that request. Please try again.