KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > gui > style > JPanelStyleSample


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * JPanelStyleSample.java
28  *
29  * Created on February 18, 2006, 12:46 PM
30  *
31  */

32
33 package it.businesslogic.ireport.gui.style;
34
35 import it.businesslogic.ireport.Box;
36 import it.businesslogic.ireport.IReportFont;
37 import it.businesslogic.ireport.ReportElement;
38 import it.businesslogic.ireport.Style;
39 import it.businesslogic.ireport.gui.MainFrame;
40 import it.businesslogic.ireport.util.Java2DUtil;
41 import it.businesslogic.ireport.util.Misc;
42 import java.awt.Color JavaDoc;
43 import java.awt.Font JavaDoc;
44 import java.awt.Graphics JavaDoc;
45 import java.awt.Graphics2D JavaDoc;
46 import java.awt.Point JavaDoc;
47 import java.awt.RenderingHints JavaDoc;
48 import java.awt.Stroke JavaDoc;
49 import java.awt.font.FontRenderContext JavaDoc;
50 import java.awt.font.LineBreakMeasurer JavaDoc;
51 import java.awt.font.TextAttribute JavaDoc;
52 import java.awt.font.TextLayout JavaDoc;
53 import java.awt.geom.AffineTransform JavaDoc;
54 import java.text.AttributedCharacterIterator JavaDoc;
55 import java.text.AttributedString JavaDoc;
56 import java.util.ArrayList JavaDoc;
57 import java.util.Iterator JavaDoc;
58 import java.util.List JavaDoc;
59 import java.util.StringTokenizer JavaDoc;
60
61
62 /**
63  *
64  * @author gtoffoli
65  */

66 public class JPanelStyleSample extends javax.swing.JPanel JavaDoc {
67     
68     private Style style = null;
69     
70     static public Rotation ROTATION_NONE;
71     static public Rotation ROTATION_LEFT;
72     static public Rotation ROTATION_RIGHT;
73   
74    static
75    {
76      ROTATION_NONE = new Rotation("None", 0);
77      ROTATION_LEFT = new Rotation("Left", 1);
78      ROTATION_RIGHT = new Rotation("Right", 2);
79    }
80     
81     
82     /** Creates new form JPanelStyleSample */
83     public JPanelStyleSample() {
84         initComponents();
85     }
86
87     public Style getStyle() {
88         return style;
89     }
90
91     public void setStyle(Style style) {
92         this.style = style;
93         this.repaint();
94     }
95     
96     /** This method is called from within the constructor to
97      * initialize the form.
98      * WARNING: Do NOT modify this code. The content of this method is
99      * always regenerated by the Form Editor.
100      */

101     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
102
private void initComponents() {
103
104         setLayout(null);
105
106     }// </editor-fold>//GEN-END:initComponents
107

108     
109     // Variables declaration - do not modify//GEN-BEGIN:variables
110
// End of variables declaration//GEN-END:variables
111

112     
113     public void paint(Graphics JavaDoc g)
114     {
115         super.paint(g);
116         Graphics2D JavaDoc g2 = (Graphics2D JavaDoc)g;
117         
118         if (getStyle() == null) return;
119         
120         if (this.getSize().getWidth() <= 10) return;
121         if (this.getSize().getHeight() <= 10) return;
122         
123         int x=5;
124         int y=5;
125         int width = (int)this.getSize().getWidth()-10;
126         int heigth = (int)this.getSize().getHeight()-10;
127
128         if (MainFrame.getMainInstance().getProperties().getProperty("Antialias","true").equals("false"))
129         {
130         
131             g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
132                     RenderingHints.VALUE_ANTIALIAS_OFF);
133             g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
134                     RenderingHints.VALUE_STROKE_PURE);
135             g2.setRenderingHint(RenderingHints.KEY_DITHERING,
136                     RenderingHints.VALUE_DITHER_DISABLE);
137         }
138         else
139         {
140         
141             g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
142                     RenderingHints.VALUE_ANTIALIAS_ON);
143             g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
144                     RenderingHints.VALUE_STROKE_DEFAULT);
145             g2.setRenderingHint(RenderingHints.KEY_DITHERING,
146                     RenderingHints.VALUE_DITHER_ENABLE);
147         }
148         
149         int round = Integer.parseInt( getStyle().getAttributeString(Style.ATTRIBUTE_radius, "0"));
150         round *= 2;
151         
152         // 1. Draw backgrouns...
153
Color JavaDoc c = getStyle().getAttributeColor(Style.ATTRIBUTE_backcolor, null);
154         String JavaDoc transparent = getStyle().getAttributeString(Style.ATTRIBUTE_mode, "Transparent");
155         if (c != null && !transparent.equals("Transparent"))
156         {
157             g2.setColor(c);
158             g2.fillRoundRect(x,y,width,heigth,round,round);
159         }
160         
161         // 1. Draw border...
162
c = getStyle().getAttributeColor(Style.ATTRIBUTE_forecolor, null);
163         Stroke JavaDoc stroke = ReportElement.getPenStroke(getStyle().getAttributeString(Style.ATTRIBUTE_pen, "Thin"), 1);
164         
165         if (c != null && stroke != null)
166         {
167             g2.setStroke(stroke);
168             g2.setColor(c);
169             g2.drawRoundRect(x,y,width,heigth,round,round);
170         }
171         
172         
173         
174         Box box = new Box();
175         
176         if (style.getAttributeString(style.ATTRIBUTE_border, null, true) != null)
177             box.setBorder( style.getAttributeString(style.ATTRIBUTE_border, null, true) );
178         if (style.getAttributeColor(style.ATTRIBUTE_borderColor, null, true) != null)
179             box.setBorderColor( style.getAttributeColor(style.ATTRIBUTE_borderColor, null, true));
180         if (style.getAttributeString(style.ATTRIBUTE_padding, null, true) != null)
181             box.setPadding( Integer.parseInt( style.getAttributeString(style.ATTRIBUTE_padding, null, true) ));
182
183         if (style.getAttributeString(style.ATTRIBUTE_topBorder, null, true) != null)
184             box.setTopBorder( style.getAttributeString(style.ATTRIBUTE_topBorder, null, true) );
185         if (style.getAttributeColor(style.ATTRIBUTE_topBorderColor, null, true) != null)
186             box.setTopBorderColor( style.getAttributeColor(style.ATTRIBUTE_topBorderColor, null, true));
187         if (style.getAttributeString(style.ATTRIBUTE_topPadding, null, true) != null)
188             box.setTopPadding( Integer.parseInt( style.getAttributeString(style.ATTRIBUTE_topPadding, null, true) ));
189
190         if (style.getAttributeString(style.ATTRIBUTE_leftBorder, null, true) != null)
191             box.setLeftBorder( style.getAttributeString(style.ATTRIBUTE_leftBorder, null, true) );
192         if (style.getAttributeColor(style.ATTRIBUTE_leftBorderColor, null, true) != null)
193             box.setLeftBorderColor( style.getAttributeColor(style.ATTRIBUTE_leftBorderColor, null, true));
194         if (style.getAttributeString(style.ATTRIBUTE_leftPadding, null, true) != null)
195             box.setLeftPadding( Integer.parseInt( style.getAttributeString(style.ATTRIBUTE_leftPadding, null, true) ));
196
197         if (style.getAttributeString(style.ATTRIBUTE_rightBorder, null, true) != null)
198             box.setRightBorder( style.getAttributeString(style.ATTRIBUTE_rightBorder, null, true) );
199         if (style.getAttributeColor(style.ATTRIBUTE_rightBorderColor, null, true) != null)
200             box.setRightBorderColor( style.getAttributeColor(style.ATTRIBUTE_rightBorderColor, null, true));
201         if (style.getAttributeString(style.ATTRIBUTE_rightPadding, null, true) != null)
202             box.setRightPadding( Integer.parseInt( style.getAttributeString(style.ATTRIBUTE_rightPadding, null, true) ));
203
204         if (style.getAttributeString(style.ATTRIBUTE_bottomBorder, null, true) != null)
205             box.setBottomBorder( style.getAttributeString(style.ATTRIBUTE_bottomBorder, null, true) );
206         if (style.getAttributeColor(style.ATTRIBUTE_bottomBorderColor, null, true) != null)
207             box.setBottomBorderColor( style.getAttributeColor(style.ATTRIBUTE_bottomBorderColor, null, true));
208         if (style.getAttributeString(style.ATTRIBUTE_bottomPadding, null, true) != null)
209             box.setBottomPadding( Integer.parseInt( style.getAttributeString(style.ATTRIBUTE_bottomPadding, null, true) ));
210
211
212         int ax = x;
213         int ay = y;
214         int bx = x+width;
215         int by = y+heigth;
216
217         Stroke JavaDoc newBoxStroke = null;
218
219         if (box.getLeftBorderColor() != null)
220         {
221             g2.setColor(box.getLeftBorderColor());
222         }
223         else
224         {
225             g2.setColor( g2.getBackground());
226         }
227
228         if ((newBoxStroke = ReportElement.getPenStroke(box.getLeftBorder(), 1)) != null)
229         {
230             g2.setStroke(newBoxStroke);
231             g2.drawLine(x, y, x+width, y+heigth);
232         }
233
234         //else g.setStroke(oldStroke);
235
if (box.getTopBorderColor() != null)
236         {
237             g2.setColor(box.getTopBorderColor());
238         }
239         else
240         {
241             g2.setColor(g2.getBackground());
242         }
243
244         if ((newBoxStroke = ReportElement.getPenStroke(box.getTopBorder(), 1)) != null)
245         {
246             g2.setStroke(newBoxStroke);
247             g2.drawLine(ax, ay, bx, ay);
248         }
249
250         if (box.getRightBorderColor() != null)
251         {
252             g2.setColor(box.getRightBorderColor());
253         }
254         else
255         {
256             g2.setColor( g2.getBackground());
257         }
258
259         if ((newBoxStroke = ReportElement.getPenStroke(box.getRightBorder(), 1)) != null)
260         {
261             g2.setStroke(newBoxStroke);
262             g2.drawLine(bx, ay, bx, by);
263         }
264
265         if (box.getBottomBorderColor() != null)
266         {
267             g2.setColor(box.getBottomBorderColor());
268         }
269         else
270         {
271             g2.setColor(g2.getBackground());
272         }
273
274         if ((newBoxStroke = ReportElement.getPenStroke(box.getBottomBorder(), 1)) != null)
275         {
276             g2.setStroke(newBoxStroke);
277             g2.drawLine(ax, by, bx, by);
278         }
279
280         renderText(g2, "This is a\ntest", getStyle(), new Box(), width, heigth);
281
282     }
283     
284     public static IReportFont createIreportFont(Style myStyle) {
285         
286         if (myStyle.getAttribute("style.font") != null)
287         {
288             return (IReportFont)myStyle.getAttribute("style.font");
289         }
290         
291         
292         IReportFont ir = new IReportFont();
293         
294         if (!myStyle.getAttributes().containsKey("style.font") )
295         {
296             ir.setBold( myStyle.getAttributeBoolean( myStyle.ATTRIBUTE_isBold, false));
297             ir.setFontName( myStyle.getAttributeString( myStyle.ATTRIBUTE_fontName, ir.getFontName()));
298             ir.setFontSize( myStyle.getAttributeInteger( myStyle.ATTRIBUTE_fontSize,ir.getFontSize()));
299             ir.setItalic( myStyle.getAttributeBoolean( myStyle.ATTRIBUTE_isItalic, false));
300
301             ir.setPdfEmbedded( myStyle.getAttributeBoolean( myStyle.ATTRIBUTE_isPdfEmbedded, false));
302             ir.setPdfEncoding( myStyle.getAttributeString( myStyle.ATTRIBUTE_pdfEncoding, ir.getPdfEncoding()));
303             ir.setStrikeTrought( myStyle.getAttributeBoolean( myStyle.ATTRIBUTE_isStrikeThrough, false));
304
305             // TODO = We have to understand what kind of font is this...
306
ir.setPDFFontName( myStyle.getAttributeString( myStyle.ATTRIBUTE_pdfFontName, ir.getPDFFontName()));
307             ir.setUnderline( myStyle.getAttributeBoolean( myStyle.ATTRIBUTE_isUnderline, false));
308         }
309         return ir;
310     }
311         
312     
313      private class TextReportElementLayout {
314        private TextLayout JavaDoc layout;
315        private float x;
316        private float y;
317
318
319        private TextReportElementLayout(TextLayout JavaDoc layout, float x, float y) {
320            this.layout = layout;
321            this.x = x;
322            this.y = y;
323        }
324
325
326        void drawWithOffset(Graphics2D JavaDoc g2, float yOffset) {
327            layout.draw(g2, x, y + yOffset);
328        }
329    }
330      
331     /**
332      * Render text
333      */

334    
335     public void renderText(Graphics2D JavaDoc g, String JavaDoc str, Style s, Box box, int width, int height)
336     {
337         
338         IReportFont ir = createIreportFont(s);
339         Font font = ir.getJavaAWTFont();
340         
341         double zoom_factor = 1.0;
342         int x_shift_origin = 0;
343         int y_shift_origin = 0;
344         
345       //System.out.println(new java.util.Date() + " Print text " + this.getText() + " " + x_shift_origin +" " +y_shift_origin);
346
ArrayList JavaDoc textLayouts;
347       float x, y;
348       TextReportElementLayout textReportElementLayout;
349       AffineTransform JavaDoc transform;
350       
351       Point JavaDoc position = new Point JavaDoc(5,5);
352       //x_shift_origin -= 10;
353
//y_shift_origin -= 10;
354

355       g.setColor( s.getAttributeColor( s.ATTRIBUTE_forecolor, Color.BLACK ) );
356       
357       // Set font to default font....
358
//Font oldFont = g.getFont();
359

360           
361         // Code for rotation by gt (taked by jasperreports...
362

363       
364         int gfx_x = position.x + box.getLeftPadding()-x_shift_origin;
365         int gfx_y = position.y + box.getTopPadding()-y_shift_origin;
366         int gfx_width = width - box.getLeftPadding() - box.getRightPadding();
367         int gfx_height = height - box.getTopPadding() - box.getBottomPadding();
368
369         
370       Java2DUtil.setClip(g,
371  // 0,0, 3000,3000);
372
gfx_x,
373       gfx_y,
374       gfx_width,
375       gfx_height);
376        
377         double angle = 0;
378         double angle_restore = 0;
379
380         
381         // Apply the transformation "rotation"
382
// - Do nothing when rotate = "none"
383
transform = null;
384          if(s.getAttributeString( s.ATTRIBUTE_rotation, "None" ).equals(ROTATION_LEFT.getName()))
385          {
386            transform = new AffineTransform JavaDoc();
387            transform.rotate(-Math.PI / 2, gfx_x, gfx_y);
388            transform.translate(-gfx_height, -gfx_height);
389            gfx_y = position.y-y_shift_origin + height;
390            gfx_width = height;
391            gfx_height = width;
392            Java2DUtil.setTransform(g, transform);
393          }
394          else if(s.getAttributeString( s.ATTRIBUTE_rotation, "None" ).equals(ROTATION_RIGHT.getName()))
395          {
396            transform = new AffineTransform JavaDoc();
397            transform.rotate(Math.PI / 2, gfx_x, gfx_y);
398            transform.translate(0, -gfx_width);
399            gfx_x = position.x-x_shift_origin + width;
400            gfx_width = height;
401            gfx_height = width;
402            
403            Java2DUtil.setTransform(g, transform);
404          }
405         
406         
407         // End code for rotation by gt
408

409       // We must center the text..
410

411 /*
412                 Rectangle orgClipBounds = g.getClipBounds();
413                 g.setClip(getZoomedDim(position.x)-x_shift_origin,
414             getZoomedDim(position.y)-y_shift_origin,
415             getZoomedDim(width),
416             getZoomedDim(height));
417  */

418       
419       if (str != null && str.length() > 0)
420       {
421          int zoomedFieldHeight = gfx_height;
422          String JavaDoc allText = Misc.treatNewLineChars(str);
423          float formatWidth = (float)gfx_width;
424          float verticalOffset = 0f;
425          
426          
427          FontRenderContext JavaDoc fontRenderContext = g.getFontRenderContext();
428          java.util.Map JavaDoc fontAttributes = font.getAttributes();
429          fontAttributes.put(TextAttribute.SIZE, new Float JavaDoc(ir.getFontSize() ) );
430          fontAttributes.put(TextAttribute.FAMILY, ir.getFontName() );
431          if (ir.isBold())
432          {
433             fontAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
434          }
435          if (ir.isItalic())
436          {
437             fontAttributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
438          }
439          if (ir.isUnderline())
440          {
441             fontAttributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
442          }
443          if (ir.isStrikeTrought())
444          {
445             fontAttributes.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
446          }
447          
448          float lineSpacing = 1f;
449          String JavaDoc lineSpacingName = s.getAttributeString( s.ATTRIBUTE_lineSpacing, "Single" );
450          if (lineSpacingName.equals("Single")) lineSpacing = 1f;
451          else if (lineSpacingName.equals("1_1_2")) lineSpacing = 1.5f;
452          else if (lineSpacingName.equals("Double")) lineSpacing = 2f;
453          
454          AttributedString JavaDoc atext;
455          AttributedCharacterIterator JavaDoc paragraph;
456          int paragraphStart;
457          int paragraphEnd;
458          LineBreakMeasurer JavaDoc lineMeasurer;
459          TextLayout JavaDoc layout = null;
460          
461          
462          String JavaDoc paragr_text = "";
463          boolean isMaxHeightReached = false;
464          
465          StringTokenizer JavaDoc tkzer = new StringTokenizer JavaDoc(allText, "\n");
466          
467          float drawPosY = 0;
468          float drawPosX = 0;
469         
470          paragr_text = "";
471          isMaxHeightReached = false;
472          
473          tkzer = new StringTokenizer JavaDoc(allText, "\n");
474
475
476          textLayouts = new ArrayList JavaDoc();
477         
478          // Calculate the layouts. (But don't draw yet because we don't know yet
479
// the offset which is needed if we align the text "middle" or "bottom")
480
while(tkzer.hasMoreTokens() && !isMaxHeightReached)
481          {
482             paragr_text = tkzer.nextToken();
483             
484             atext = new AttributedString JavaDoc(paragr_text, fontAttributes);
485             paragraph = atext.getIterator();
486             paragraphStart = paragraph.getBeginIndex();
487             paragraphEnd = paragraph.getEndIndex();
488             lineMeasurer = new LineBreakMeasurer JavaDoc(paragraph, fontRenderContext);
489             lineMeasurer.setPosition(paragraphStart);
490             
491             layout = null;
492             while (lineMeasurer.getPosition() < paragraphEnd && !isMaxHeightReached)
493             {
494                layout = lineMeasurer.nextLayout(formatWidth);
495                
496                drawPosY += layout.getLeading() + lineSpacing * layout.getAscent();
497                
498                if (drawPosY + layout.getDescent() <= zoomedFieldHeight+1)
499                {
500                   if (s.getAttributeString( s.ATTRIBUTE_hAlign, "Left" ).equals("Justify"))
501                   {
502                      if (layout.isLeftToRight())
503                      {
504                         drawPosX = 0;
505                      }
506                      else
507                      {
508                         drawPosX = formatWidth - layout.getAdvance();
509                      }
510                      if (lineMeasurer.getPosition() < paragraphEnd)
511                      {
512                         layout = layout.getJustifiedLayout(formatWidth);
513                      }
514                   }
515                   else if (s.getAttributeString( s.ATTRIBUTE_hAlign, "Left" ).equals("Right"))
516                   {
517                      if (layout.isLeftToRight())
518                      {
519                         drawPosX = formatWidth - layout.getAdvance();
520                      }
521                      else
522                      {
523                         drawPosX = formatWidth;
524                      }
525                   }
526                   else if (s.getAttributeString( s.ATTRIBUTE_hAlign, "Left" ).equals("Center"))
527                   {
528                      drawPosX = (formatWidth - layout.getAdvance()) / 2;
529                   }
530                   else //if (this.getAlign().equals("Left"))
531
{
532                      if (layout.isLeftToRight())
533                      {
534                         drawPosX = 0;
535                      }
536                      else
537                      {
538                         drawPosX = formatWidth - layout.getAdvance();
539                      }
540                   }
541                 
542                   x = drawPosX + gfx_x; //getZoomedDim(position.x)-x_shift_origin;
543
y = drawPosY + gfx_y; //getZoomedDim(position.y)-y_shift_origin;
544
textReportElementLayout = new TextReportElementLayout(layout, x, y);
545                   textLayouts.add(textReportElementLayout);
546
547
548                   drawPosY += layout.getDescent();
549                }
550                else
551                {
552                   drawPosY -= layout.getLeading() + lineSpacing * layout.getAscent();
553                   isMaxHeightReached = true;
554                }
555             }
556          }
557
558
559          // Calculate the offset when aligning the text.
560
float textHeight = drawPosY;
561          if (s.getAttributeString( s.ATTRIBUTE_vAlign, "Top" ).equals("Top"))
562          {
563              verticalOffset = 0f;
564          }
565          else if (s.getAttributeString( s.ATTRIBUTE_vAlign, "Top" ).equals("Middle"))
566          {
567             verticalOffset = ((float)zoomedFieldHeight- textHeight) / 2f;
568          }
569          else if (s.getAttributeString( s.ATTRIBUTE_vAlign, "Top" ).equals("Bottom"))
570          {
571             verticalOffset = (float)zoomedFieldHeight - (float)textHeight;
572          }
573
574          
575
576          /*
577          
578          */

579       
580          // Now draw the text according to the calculated layouts.
581
for(Iterator JavaDoc i=textLayouts.iterator(); i.hasNext();)
582          {
583            textReportElementLayout = (TextReportElementLayout) i.next();
584            textReportElementLayout.drawWithOffset(g, verticalOffset);
585          }
586
587
588          if(transform != null)
589          {
590            // Undo the transformation "rotation"
591
Java2DUtil.resetTransform(g);
592          }
593
594          
595                     /*
596                     int txt_width = g.getFontMetrics().stringWidth( this.getText() )/2;
597                     int txt_height = g.getFontMetrics().getHeight();
598                      
599                     StringTokenizer st = new StringTokenizer(getText(),"\n");
600                     while( st.hasMoreElements())
601                     {
602                      String line = st.nextToken();
603                       float formatWidth = (float) this.getWidth();
604                      g.drawString(line,
605                         (float)(getZoomedDim(position.x)-x_shift_origin),
606                         getZoomedDim(position.y)-y_shift_origin + verticalOffset); //, zoomed_width, getZoomedDim(band.getHeight()
607                      
608                         verticalOffset += g.getFontMetrics().getHeight();
609                     }
610                      */

611          //g.drawLine(0, getZoomedDim(y)+10-vertical_scroll - txt_height - getZoomedDim(band.getHeight()/2), 700,getZoomedDim(y)+10-vertical_scroll - txt_height - getZoomedDim(band.getHeight()/2));
612
//g.drawLine(0, getZoomedDim(y)+10-vertical_scroll + txt_height - getZoomedDim(band.getHeight()/2), 700,getZoomedDim(y)+10-vertical_scroll + txt_height - getZoomedDim(band.getHeight()/2));
613

614       }
615       
616       
617       
618       //g.setClip(null);
619
//g.setClip(orgClipBounds);
620

621       Java2DUtil.resetClip(g);
622
623    }
624     
625     static class Rotation {
626        static private ArrayList JavaDoc rotations;
627        private String JavaDoc name;
628        private int number;
629
630
631        Rotation(String JavaDoc name, int number) {
632            this.name = name;
633            this.number = number;
634            rotations = new ArrayList JavaDoc();
635            rotations.add(this);
636        }
637
638
639        public int getNumber() {
640          return number;
641        }
642
643
644        public String JavaDoc getName() {
645            return name;
646        }
647
648
649        public String JavaDoc toString() {
650            return getName();
651        }
652    }
653     
654     static List JavaDoc getRotations() {
655        return Rotation.rotations;
656    }
657 }
658
Popular Tags