KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > xmleditor > RW


1
2 package com.calipso.xmleditor;
3
4 import net.sf.jasperreports.engine.*;
5 import net.sf.jasperreports.engine.design.JasperDesign;
6 import net.sf.jasperreports.engine.base.JRBaseReport;
7
8 import javax.swing.*;
9 import java.awt.*;
10 import java.util.*;
11
12 public abstract class RW {
13
14     /**
15      * Description of the Field
16      */

17     public final static String JavaDoc IMAGE_EXPRESSION_TYPES[] = {
18             "java.lang.String", "java.io.File", "java.net.URL",
19             "java.io.InputStream", "java.awt.Image"};
20
21     /**
22      * Description of the Field
23      */

24     public final static String JavaDoc WHEN_NO_DATA[] = {
25             "NoPages", "BlankPage", "AllSectionsNoDetail"};
26
27     /**
28      * Description of the Field
29      */

30     public final static String JavaDoc SCALE_TYPES[] = {
31             "Retain shape", "Fill frame", "Clip"};
32
33     /**
34      * Description of the Field
35      */

36     public final static String JavaDoc STRETCH_TYPES[] = {
37             "None", "Band height", "Tallest object"};
38
39     /**
40      * Description of the Field
41      */

42     public final static String JavaDoc PEN_TYPES[] = {
43             "None", "1 pt", "2 pt", "4 pt", "Dotted"};
44
45     /**
46      * Description of the Field
47      */

48     public final static String JavaDoc EVAL_TIMES[] = {
49             "Now", "Report", "Page", "Column", "Group"};
50
51     /**
52      * Description of the Field
53      */

54     public final static String JavaDoc ALIGNMENTS[] = {
55             "Left", "Center", "Right", "Justified"};
56
57     /**
58      * Description of the Field
59      */

60     public final static String JavaDoc HORIZONTAL_ALIGNMENTS[] = {
61             "Left", "Center", "Right"};
62
63     /**
64      * Description of the Field
65      */

66     public final static String JavaDoc VERTICAL_ALIGNMENTS[] = {
67             "Top", "Middle", "Bottom"};
68     /**
69      * Description of the Field
70      */

71     public final static String JavaDoc LINE_SPACINGS[] = {
72             "Single", "1_1_2", "Double"};
73
74     /**
75      * Description of the Field
76      */

77     public final static String JavaDoc VALUE_TYPES[] = {
78             "String",
79             "Double",
80             "Date",
81             "Integer",
82             "Timestamp",
83             "Boolean",
84             "Byte",
85             "Float",
86             "InputStream",
87             "Long",
88             "Short",
89     };
90
91     /**
92      * Calculation types
93      */

94     public final static String JavaDoc CALC_TYPES[] = {
95             "Nothing", "Count", "Sum", "Average", "Lowest",
96             "Highest", "StandardDeviation", "Variance", "System"};
97
98     /**
99      * Reset types
100      */

101     public final static String JavaDoc RESET_TYPES[] = {
102             "None", "Report", "Page", "Column", "Group"
103             };
104
105     /**
106      * Hyperlink types
107      */

108     public final static String JavaDoc HYPERLINK_TYPES[] = {
109             "None", "LocalAnchor", "LocalPage", "Reference",
110             "RemoteAnchor", "RemotePage"
111             };
112
113     private static Map typesMap = null;
114
115     /**
116      * Gets the resetTypeName attribute of the RW class
117      *
118      * @param var Description of the Parameter
119      * @return The resetTypeName value
120      */

121     public static String JavaDoc getResetTypeName( JRVariable var ) {
122         return getResetTypeName( var.getResetType() );
123     }
124
125     private static void loadTypesMap() {
126         typesMap = new HashMap();
127         typesMap.put( "String", java.lang.String JavaDoc.class );
128         typesMap.put( "Boolean", java.lang.Boolean JavaDoc.class );
129         typesMap.put( "Byte", java.lang.Byte JavaDoc.class );
130         typesMap.put( "Date", java.util.Date JavaDoc.class );
131         typesMap.put( "Timestamp", java.sql.Timestamp JavaDoc.class );
132         typesMap.put( "Double", java.lang.Double JavaDoc.class );
133         typesMap.put( "Float", java.lang.Float JavaDoc.class );
134         typesMap.put( "Integer", java.lang.Integer JavaDoc.class );
135         typesMap.put( "InputStream", java.io.InputStream JavaDoc.class );
136         typesMap.put( "Long", java.lang.Long JavaDoc.class );
137         typesMap.put( "Short", java.lang.Short JavaDoc.class );
138     }
139
140     public static Class JavaDoc getValueClass( String JavaDoc typeName ) {
141         if( typesMap == null ) {
142             loadTypesMap();
143         }
144         return (Class JavaDoc)typesMap.get( typeName );
145     }
146
147     public static String JavaDoc getTypeName( Class JavaDoc cls ) {
148         String JavaDoc clsName = cls.getName();
149         int ix = clsName.lastIndexOf( "." );
150         if( ix>=0 ) {
151             clsName = clsName.substring( ix + 1 );
152         }
153         return clsName;
154     }
155
156     /**
157      * Gets the scaleTypeName attribute of the RW class
158      *
159      * @param i Description of the Parameter
160      * @return The scaleTypeName value
161      */

162     public static String JavaDoc getScaleTypeName( int i ) {
163
164         String JavaDoc penStr = "Clip";
165         switch ( i ) {
166             case JRImage.SCALE_IMAGE_FILL_FRAME:
167                 penStr = "Fill frame";
168                 break;
169             case JRImage.SCALE_IMAGE_RETAIN_SHAPE:
170                 penStr = "Retain shape";
171                 break;
172         }
173         return penStr;
174     }
175
176     /**
177      * Gets the scaleType attribute of the RW class
178      *
179      * @param s Description of the Parameter
180      * @return The scaleType value
181      */

182     public static byte getScaleType( String JavaDoc s ) {
183         if( "Fill frame".equals( s ) ) {
184             return JRImage.SCALE_IMAGE_FILL_FRAME;
185         }
186         else if( "Retain shape".equals( s ) ) {
187             return JRImage.SCALE_IMAGE_RETAIN_SHAPE;
188         }
189         return JRImage.SCALE_IMAGE_CLIP;
190     }
191
192     /**
193      * Gets the stretchTypeName attribute of the RW class
194      *
195      * @param i Description of the Parameter
196      * @return The stretchTypeName value
197      */

198     public static String JavaDoc getStretchTypeName( int i ) {
199
200         String JavaDoc penStr = "None";
201         switch ( i ) {
202             case JRGraphicElement.STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT:
203                 penStr = "Band height";
204                 break;
205             case JRGraphicElement.STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT:
206                 penStr = "Tallest object";
207                 break;
208         }
209         return penStr;
210     }
211
212     /**
213      * Gets the stretchType attribute of the RW class
214      *
215      * @param s Description of the Parameter
216      * @return The stretchType value
217      */

218     public static byte getStretchType( String JavaDoc s ) {
219         if( "Band height".equals( s ) ) {
220             return JRGraphicElement.STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT;
221         }
222         else if( "Tallest object".equals( s ) ) {
223             return JRGraphicElement.STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT;
224         }
225         return JRGraphicElement.STRETCH_TYPE_NO_STRETCH;
226     }
227
228     /**
229      * Gets the penTypeName attribute of the RW class
230      *
231      * @param i Description of the Parameter
232      * @return The penTypeName value
233      */

234     public static String JavaDoc getPenTypeName( int i ) {
235
236         String JavaDoc penStr = "None";
237         switch ( i ) {
238             case JRGraphicElement.PEN_1_POINT:
239                 penStr = "1 pt";
240                 break;
241             case JRGraphicElement.PEN_2_POINT:
242                 penStr = "2 pt";
243                 break;
244             case JRGraphicElement.PEN_4_POINT:
245                 penStr = "4 pt";
246                 break;
247             case JRGraphicElement.PEN_DOTTED:
248                 penStr = "Dotted";
249                 break;
250         }
251         return penStr;
252     }
253
254     /**
255      * Gets the penType attribute of the RW class
256      *
257      * @param s Description of the Parameter
258      * @return The penType value
259      */

260     public static byte getPenType( String JavaDoc s ) {
261         if( "1 pt".equals( s ) ) {
262             return JRGraphicElement.PEN_1_POINT;
263         }
264         else if( "2 pt".equals( s ) ) {
265             return JRGraphicElement.PEN_2_POINT;
266         }
267         else if( "4 pt".equals( s ) ) {
268             return JRGraphicElement.PEN_4_POINT;
269         }
270         else if( "Dotted".equals( s ) ) {
271             return JRGraphicElement.PEN_DOTTED;
272         }
273         return JRGraphicElement.PEN_NONE;
274     }
275
276     /**
277      * Gets the resetTypeName attribute of the RW class
278      *
279      * @param i Description of the Parameter
280      * @return The resetTypeName value
281      */

282     public static String JavaDoc getResetTypeName( int i ) {
283
284         String JavaDoc resetStr = "None";
285         switch ( i ) {
286             case JRVariable.RESET_TYPE_COLUMN:
287                 resetStr = "Column";
288                 break;
289             case JRVariable.RESET_TYPE_GROUP:
290                 resetStr = "Group";
291                 break;
292             case JRVariable.RESET_TYPE_NONE:
293                 resetStr = "None";
294                 break;
295             case JRVariable.RESET_TYPE_PAGE:
296                 resetStr = "Page";
297                 break;
298             case JRVariable.RESET_TYPE_REPORT:
299                 resetStr = "Report";
300                 break;
301         }
302         return resetStr;
303     }
304
305     /**
306      * Gets the calculationName attribute of the RW class
307      *
308      * @param var Description of the Parameter
309      * @return The calculationName value
310      */

311     public static String JavaDoc getCalculationName( JRVariable var ) {
312         return getCalculationName( var.getCalculation() );
313     }
314
315     /**
316      * Gets the evaluationTimeName attribute of the RW class
317      *
318      * @param i Description of the Parameter
319      * @return The evaluationTimeName value
320      */

321     public static String JavaDoc getEvaluationTimeName( int i ) {
322
323         switch ( i ) {
324             case JRExpression.EVALUATION_TIME_COLUMN:
325                 return "Column";
326             case JRExpression.EVALUATION_TIME_GROUP:
327                 return "Group";
328             case JRExpression.EVALUATION_TIME_PAGE:
329                 return "Page";
330             case JRExpression.EVALUATION_TIME_REPORT:
331                 return "Report";
332         }
333         return "Now";
334     }
335
336     /**
337      * Gets the evaluationTime attribute of the RW class
338      *
339      * @param s Description of the Parameter
340      * @return The evaluationTime value
341      */

342     public static byte getEvaluationTime( String JavaDoc s ) {
343
344         if( "Column".equals( s ) ) {
345             return JRExpression.EVALUATION_TIME_COLUMN;
346         }
347         else if( "Report".equals( s ) ) {
348             return JRExpression.EVALUATION_TIME_REPORT;
349         }
350         else if( "Page".equals( s ) ) {
351             return JRExpression.EVALUATION_TIME_PAGE;
352         }
353         else if( "Group".equals( s ) ) {
354             return JRExpression.EVALUATION_TIME_GROUP;
355         }
356         return JRExpression.EVALUATION_TIME_NOW;
357     }
358
359     /**
360      * Gets the calculationName attribute of the RW class
361      *
362      * @param i Description of the Parameter
363      * @return The calculationName value
364      */

365     public static String JavaDoc getCalculationName( int i ) {
366
367         String JavaDoc calcName = "Nothing";
368         switch ( i ) {
369             case JRVariable.CALCULATION_AVERAGE:
370                 calcName = "Average";
371                 break;
372             case JRVariable.CALCULATION_COUNT:
373                 calcName = "Count";
374                 break;
375             case JRVariable.CALCULATION_HIGHEST:
376                 calcName = "Highest";
377                 break;
378             case JRVariable.CALCULATION_LOWEST:
379                 calcName = "Lowest";
380                 break;
381             case JRVariable.CALCULATION_NOTHING:
382                 calcName = "Nothing";
383                 break;
384             case JRVariable.CALCULATION_STANDARD_DEVIATION:
385                 calcName = "StandardDeviation";
386                 break;
387             case JRVariable.CALCULATION_SUM:
388                 calcName = "Sum";
389                 break;
390             case JRVariable.CALCULATION_SYSTEM:
391                 calcName = "System";
392                 break;
393             case JRVariable.CALCULATION_VARIANCE:
394                 calcName = "Variance";
395                 break;
396             default:
397                 calcName = "Nothing";
398         }
399         return calcName;
400     }
401
402     /**
403      * Gets the calculationType attribute of the RW class
404      *
405      * @param str Description of the Parameter
406      * @return The calculationType value
407      */

408     public static byte getCalculationType( String JavaDoc str ) {
409
410         if( "Count".equals( str ) ) {
411             return JRVariable.CALCULATION_COUNT;
412         }
413         else if( "Sum".equals( str ) ) {
414             return JRVariable.CALCULATION_SUM;
415         }
416         else if( "Average".equals( str ) ) {
417             return JRVariable.CALCULATION_AVERAGE;
418         }
419         else if( "Lowest".equals( str ) ) {
420             return JRVariable.CALCULATION_LOWEST;
421         }
422         else if( "Highest".equals( str ) ) {
423             return JRVariable.CALCULATION_HIGHEST;
424         }
425         else if( "StandardDeviation".equals( str ) ) {
426             return JRVariable.CALCULATION_STANDARD_DEVIATION;
427         }
428         else if( "Variance".equals( str ) ) {
429             return JRVariable.CALCULATION_VARIANCE;
430         }
431         else if( "System".equals( str ) ) {
432             return JRVariable.CALCULATION_SYSTEM;
433         }
434         return JRVariable.CALCULATION_NOTHING;
435     }
436
437     /**
438      * Gets the resetType attribute of the RW class
439      *
440      * @param str Description of the Parameter
441      * @return The resetType value
442      */

443     public static byte getResetType( String JavaDoc str ) {
444
445         if( "Report".equals( str ) ) {
446             return JRVariable.RESET_TYPE_REPORT;
447         }
448         else if( "Page".equals( str ) ) {
449             return JRVariable.RESET_TYPE_PAGE;
450         }
451         else if( "Column".equals( str ) ) {
452             return JRVariable.RESET_TYPE_COLUMN;
453         }
454         else if( "Group".equals( str ) ) {
455             return JRVariable.RESET_TYPE_GROUP;
456         }
457         return JRVariable.RESET_TYPE_NONE;
458     }
459
460     public static String JavaDoc getHyperlinkTypeName( int aType ) {
461         if( aType == JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR ) {
462             return "LocalAnchor";
463         }
464         else if( aType == JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE ) {
465             return "LocalPage";
466         }
467         else if( aType == JRHyperlink.HYPERLINK_TYPE_REFERENCE ) {
468             return "Reference";
469         }
470         else if( aType == JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR ) {
471             return "RemoteAnchor";
472         }
473         else if( aType == JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE ) {
474             return "RemotePage";
475         }
476         return "None";
477     }
478
479     public static byte getHyperlinkType( String JavaDoc str ) {
480         if( "LocalAnchor".equals( str ) ) {
481             return JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR;
482         }
483         else if( "LocalPage".equals( str ) ) {
484             return JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE;
485         }
486         else if( "Reference".equals( str ) ) {
487             return JRHyperlink.HYPERLINK_TYPE_REFERENCE;
488         }
489         else if( "RemoteAnchor".equals( str ) ) {
490             return JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR;
491         }
492         else if( "RemotePage".equals( str ) ) {
493             return JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE;
494         }
495         return JRHyperlink.HYPERLINK_TYPE_NONE;
496     }
497
498     /**
499      * Gets the expressionText attribute of the RW class
500      *
501      * @param exp Description of the Parameter
502      * @return The expressionText value
503      */

504     public static String JavaDoc getExpressionText( JRExpression exp ) {
505
506         StringBuffer JavaDoc expressionTxt = new StringBuffer JavaDoc();
507         if( exp == null ) {
508             return "";
509         }
510         JRExpressionChunk chunks[] = exp.getChunks();
511         for( int i = 0; chunks != null && i < chunks.length; i++ ) {
512             JRExpressionChunk chunk = chunks[i];
513             switch ( chunk.getType() ) {
514                 case JRExpressionChunk.TYPE_FIELD:
515                     expressionTxt.append( "$F{" + chunk.getText() + "}" );
516                     break;
517                 case JRExpressionChunk.TYPE_VARIABLE:
518                     expressionTxt.append( "$V{" + chunk.getText() + "}" );
519                     break;
520                 case JRExpressionChunk.TYPE_PARAMETER:
521                     expressionTxt.append( "$P{" + chunk.getText() + "}" );
522                     break;
523                 default:
524                     expressionTxt.append( chunk.getText() );
525             }
526         }
527         return expressionTxt.toString();
528     }
529
530     /**
531      * Gets the groupNames attribute of the RW class
532      *
533      * @param report Description of the Parameter
534      * @return The groupNames value
535      */

536     public static Vector getGroupNames( JRBaseReport report ) {
537         Vector v = new Vector( report.getGroups().length );
538         JRGroup grps[] = report.getGroups();
539         for( int i = 0; i < grps.length; i++ ) {
540             JRGroup group = grps[i];
541             v.add( group.getName() );
542         }
543         return v;
544     }
545
546     /**
547      * Gets the alignmentName attribute of the RW class
548      *
549      * @param i Description of the Parameter
550      * @return The alignmentName value
551      */

552     public static String JavaDoc getAlignmentName( int i ) {
553
554         switch ( i ) {
555             case JRTextElement.TEXT_ALIGN_CENTER:
556                 return "Center";
557             case JRTextElement.TEXT_ALIGN_RIGHT:
558                 return "Right";
559             case JRTextElement.TEXT_ALIGN_JUSTIFIED:
560                 return "Justified";
561             default:
562                 return "Left";
563         }
564     }
565
566     public static byte getHorizontalAlignment( String JavaDoc s ) {
567
568         if( "Center".equals( s ) ) {
569             return JRAlignment.HORIZONTAL_ALIGN_CENTER;
570         }
571         else if( "Right".equals( s ) ) {
572             return JRAlignment.HORIZONTAL_ALIGN_RIGHT;
573         }
574         return JRAlignment.HORIZONTAL_ALIGN_LEFT;
575     }
576
577     public static String JavaDoc getHorizontalAlignmentName( byte b ) {
578         if( JRAlignment.HORIZONTAL_ALIGN_CENTER == b ) {
579             return "Center";
580         }
581         else if( JRAlignment.HORIZONTAL_ALIGN_RIGHT == b ) {
582             return "Right";
583         }
584         return "Left";
585     }
586
587     public static byte getVerticalAlignment( String JavaDoc s ) {
588
589         if( "Middle".equals( s ) ) {
590             return JRAlignment.VERTICAL_ALIGN_MIDDLE;
591         }
592         else if( "Bottome".equals( s ) ) {
593             return JRAlignment.VERTICAL_ALIGN_BOTTOM;
594         }
595         return JRAlignment.VERTICAL_ALIGN_TOP;
596     }
597
598     public static String JavaDoc getVerticalAlignmentName( byte b ) {
599         if( JRAlignment.VERTICAL_ALIGN_MIDDLE == b ) {
600             return "Middle";
601         }
602         else if( JRAlignment.VERTICAL_ALIGN_BOTTOM == b ) {
603             return "Bottom";
604         }
605         return "Top";
606     }
607
608     /**
609      * Gets the alignment attribute of the RW class
610      *
611      * @param s Description of the Parameter
612      * @return The alignment value
613      */

614     public static byte getAlignment( String JavaDoc s ) {
615
616         if( "Center".equals( s ) ) {
617             return JRTextElement.TEXT_ALIGN_CENTER;
618         }
619         else if( "Right".equals( s ) ) {
620             return JRTextElement.TEXT_ALIGN_RIGHT;
621         }
622         else if( "Justified".equals( s ) ) {
623             return JRTextElement.TEXT_ALIGN_JUSTIFIED;
624         }
625         return JRTextElement.TEXT_ALIGN_LEFT;
626     }
627
628     public static String JavaDoc getWhenNoDataName( int i ) {
629         switch ( i ) {
630             case JRReport.WHEN_NO_DATA_TYPE_BLANK_PAGE:
631                 return "BlankPage";
632             case JRReport.WHEN_NO_DATA_TYPE_ALL_SECTIONS_NO_DETAIL:
633                 return "AllSectionsNoDetail";
634         }
635         return "NoPages";
636     }
637
638     public static byte getWhenNoData( String JavaDoc s ) {
639
640         if( "BlankPage".equals( s ) ) {
641             return JRReport.WHEN_NO_DATA_TYPE_BLANK_PAGE;
642         }
643         else if( "AllSectionsNoDetail".equals( s ) ) {
644             return JRReport.WHEN_NO_DATA_TYPE_ALL_SECTIONS_NO_DETAIL;
645         }
646         return JRReport.WHEN_NO_DATA_TYPE_NO_PAGES;
647     }
648
649     /**
650      * Gets the lineSpacingName attribute of the RW class
651      *
652      * @param i Description of the Parameter
653      * @return The lineSpacingName value
654      */

655     public static String JavaDoc getLineSpacingName( int i ) {
656
657         switch ( i ) {
658             case JRTextElement.LINE_SPACING_SINGLE:
659                 return "Single";
660             case JRTextElement.LINE_SPACING_DOUBLE:
661                 return "Double";
662             case JRTextElement.LINE_SPACING_1_1_2:
663                 return "1_1_2";
664         }
665         return "Single";
666     }
667
668     /**
669      * Gets the lineSpacing attribute of the RW class
670      *
671      * @param s Description of the Parameter
672      * @return The lineSpacing value
673      */

674     public static byte getLineSpacing( String JavaDoc s ) {
675
676         if( "Single".equals( s ) ) {
677             return JRTextElement.LINE_SPACING_SINGLE;
678         }
679         else if( "Double".equals( s ) ) {
680             return JRTextElement.LINE_SPACING_DOUBLE;
681         }
682         else if( "1_1_2".equals( s ) ) {
683             return JRTextElement.LINE_SPACING_1_1_2;
684         }
685         return JRTextElement.LINE_SPACING_SINGLE;
686     }
687
688     /**
689      * Gets the jdbcTypeClass attribute of the RW class
690      *
691      * @param t jdbc Type code value
692      * @return The jdbcTypeClass value
693      */

694     public static String JavaDoc getJdbcTypeClass( int t ) {
695         String JavaDoc cls = "java.lang.String";
696         switch ( t ) {
697             case java.sql.Types.TINYINT:
698             case java.sql.Types.BIT:
699                 cls = "java.lang.Byte";
700                 break;
701             case java.sql.Types.SMALLINT:
702                 cls = "java.lang.Short";
703                 break;
704             case java.sql.Types.INTEGER:
705                 cls = "java.lang.Integer";
706                 break;
707             case java.sql.Types.REAL:
708             case java.sql.Types.DOUBLE:
709             case java.sql.Types.NUMERIC:
710             case java.sql.Types.DECIMAL:
711                 cls = "java.lang.Double";
712                 break;
713             case java.sql.Types.CHAR:
714             case java.sql.Types.VARCHAR:
715                 cls = "java.lang.String";
716                 break;
717             case java.sql.Types.BOOLEAN:
718                 cls = "java.lang.Boolean";
719                 break;
720             case java.sql.Types.BIGINT:
721                 cls = "java.lang.Long";
722                 break;
723             case java.sql.Types.DATE:
724             case java.sql.Types.TIME:
725                 cls = "java.util.Date";
726                 break;
727             case java.sql.Types.TIMESTAMP:
728                 cls = "java.sql.Timestamp";
729                 break;
730         }
731         return cls;
732     }
733
734     /**
735      * Gets the JRReportFont to an specific name
736      *
737      * @param name The reportFont-Name to search for
738      * @param design The JasperDesign which holds the reportFont-Definitions
739      * @return The JRReportFont to the name or null if not found
740      */

741     public static JRReportFont searchReportFont( String JavaDoc name, JasperDesign design ) {
742         if( design == null ) {
743             return null;
744         }
745         JRReportFont[] allReportf = design.getFonts();
746         for( int i = 0; i < allReportf.length; i++ ) {
747             if( allReportf[i].getName().equals( name ) ) {
748                 return allReportf[i];
749             }
750         }
751         return null;
752     }
753 }
754
755
Popular Tags