Source Code Cross Referenced for ImageReportElement.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » iReport 2.0.5 » it.businesslogic.ireport 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
0003:         * http://www.jaspersoft.com.
0004:         *
0005:         * Unless you have purchased a commercial license agreement from JasperSoft,
0006:         * the following license terms apply:
0007:         *
0008:         * This program is free software; you can redistribute it and/or modify
0009:         * it under the terms of the GNU General Public License version 2 as published by
0010:         * the Free Software Foundation.
0011:         *
0012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
0013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0014:         * See the GNU General Public License for more details.
0015:         *
0016:         * You should have received a copy of the GNU General Public License
0017:         * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
0018:         * or write to:
0019:         *
0020:         * Free Software Foundation, Inc.,
0021:         * 59 Temple Place - Suite 330,
0022:         * Boston, MA  USA  02111-1307
0023:         *
0024:         *
0025:         *
0026:         *
0027:         * ImageReportElement.java
0028:         * 
0029:         * Created on 28 febbraio 2003, 19.20
0030:         *
0031:         */
0032:
0033:        package it.businesslogic.ireport;
0034:
0035:        import it.businesslogic.ireport.gui.*;
0036:        import it.businesslogic.ireport.util.*;
0037:        import java.awt.*;
0038:        import java.awt.image.*;
0039:        import java.awt.geom.*;
0040:        import java.io.File;
0041:        import java.net.MalformedURLException;
0042:        import java.net.URL;
0043:
0044:        import net.sf.jasperreports.engine.JRException;
0045:        import net.sf.jasperreports.engine.util.JRImageLoader;
0046:
0047:        public class ImageReportElement extends GraphicReportElement implements 
0048:                ImageObserver, HyperLinkableReportElement, BoxElement {
0049:
0050:            static public final String SCALE = "SCALE";
0051:            static public final String VERTICAL_ALIGN = "VERTICAL_ALIGN";
0052:            static public final String HORIZONTAL_ALIGN = "HORIZONTAL_ALIGN";
0053:            static public final String USING_CACHE = "USING_CACHE";
0054:
0055:            static public final String DEFAULT_SCALE = "FillFrame";
0056:            static public final String DEFAULT_VERTICAL_ALIGN = "Top";
0057:            static public final String DEFAULT_HORIZONTAL_ALIGN = "Left";
0058:            static public final boolean DEFAULT_USING_CACHE = false;
0059:
0060:            private java.util.List linkParameters = new java.util.ArrayList();
0061:
0062:            private Image img = null;
0063:            static private Image defimg = null;
0064:            private String imageExpression;
0065:            private String imageClass;
0066:            //private String scaleImage;
0067:            private String hyperlinkType = "None";
0068:            private String evaluationTime = "Now";
0069:            private String evaluationGroup = "";
0070:
0071:            //private String verticalAlignment="Top";
0072:            //private String horizontalAlignment="Left";
0073:
0074:            private String anchorNameExpression = "";
0075:            private String hyperlinkReferenceExpression = "";
0076:            private String hyperlinkAnchorExpression = "";
0077:            private String hyperlinkPageExpression = "";
0078:            private String tooltipExpression = "";
0079:
0080:            private String onErrorType = "Error";
0081:
0082:            private int bookmarkLevel = 0;
0083:
0084:            //private boolean isUsingCache;
0085:            private boolean isLazy = false;
0086:            private File reportDirectory = null;
0087:            private boolean triedToLoadImg = false;
0088:
0089:            private Box box = null;
0090:
0091:            public ImageReportElement(int x, int y, int width, int height) {
0092:                super (x, y, Math.abs(width), Math.abs(height));
0093:                //setGraphicElementPen("Thin");
0094:                //this.bgcolor = Color.WHITE;
0095:                //this.fgcolor = Color.BLACK;
0096:                setKey("image");
0097:
0098:                if (defimg == null) {
0099:                    // Load default image...
0100:                    defimg = Misc
0101:                            .loadImageFromResources("it/businesslogic/ireport/icons/layout/img.gif");
0102:                }
0103:
0104:                img = null;
0105:                //isUsingCache=false;
0106:                imageExpression = "";
0107:                imageClass = "java.lang.String";
0108:                //scaleImage="FillFrame";
0109:                //graphicElementPen = "None";
0110:                this .hyperlinkType = "None";
0111:                this .anchorNameExpression = "";
0112:                box = new Box();
0113:            }
0114:
0115:            /*
0116:            public void drawObject(Graphics2D g,double zoom_factor, int x_shift_origin, int y_shift_origin)
0117:            {
0118:                    position.x -= 10;
0119:            position.y -= 10;
0120:            x_shift_origin -= 10;
0121:            y_shift_origin -= 10;
0122:            
0123:            this.zoom_factor = zoom_factor;
0124:                    
0125:                    g.setColor( bgcolor );
0126:                    if (!getTransparent().equalsIgnoreCase("Transparent"))
0127:                        g.fillRect( getZoomedDim(position.x)-x_shift_origin,
0128:            		getZoomedDim(position.y)-y_shift_origin,
0129:            		getZoomedDim(width),
0130:            		getZoomedDim(height));
0131:                    g.setColor( this.fgcolor );
0132:                                  
0133:            position.x += 10;
0134:            position.y += 10;
0135:            x_shift_origin += 10;
0136:            y_shift_origin += 10;
0137:                    
0138:                    drawGraphicsElement(g,this.getGraphicElementPen(), zoom_factor,  x_shift_origin,y_shift_origin, 0);
0139:            }*/
0140:
0141:            public void drawObject(Graphics2D g, double zoom_factor,
0142:                    int x_shift_origin, int y_shift_origin) {
0143:
0144:                position.x += -10 + box.getLeftPadding();
0145:                position.y += -10 + box.getTopPadding();
0146:                width = width - box.getLeftPadding() - box.getRightPadding();
0147:                height = height - box.getTopPadding() - box.getBottomPadding();
0148:
0149:                x_shift_origin -= 10;
0150:                y_shift_origin -= 10;
0151:
0152:                this .zoom_factor = zoom_factor;
0153:                Image imgx = img;
0154:
0155:                if (imgx == null) {
0156:                    // Try to load the image from imageExpression...
0157:
0158:                    String fname = imageExpression;
0159:
0160:                    if (!triedToLoadImg
0161:                            && imageClass.equals("java.lang.String")
0162:                            && fname.length() > 3 && fname.charAt(0) == '\"'
0163:                            && fname.charAt(fname.length() - 1) == '\"') {
0164:
0165:                        // Could be a file...
0166:                        fname = Misc.string_replace("\\", "\\\\", fname);
0167:                        fname = Misc.string_replace("", "\"", fname);
0168:
0169:                        //first try read image from file
0170:                        File file = new File(fname);
0171:                        if (!file.isAbsolute() && reportDirectory != null) {
0172:                            file = new File(reportDirectory, fname);
0173:                        }
0174:                        if (file.exists()) {
0175:                            img = Misc
0176:                                    .loadImageFromFile(file.getAbsolutePath());
0177:                        } else {
0178:
0179:                            try {
0180:
0181:                                img = JRImageLoader.loadImage(JRImageLoader
0182:                                        .loadImageDataFromURL(MainFrame
0183:                                                .getMainInstance()
0184:                                                .getReportClassLoader()
0185:                                                .getResource(fname)));
0186:                            } catch (Exception jrex) {
0187:                            }
0188:                        }
0189:
0190:                        imgx = img;
0191:                        triedToLoadImg = true;//try only once
0192:                    }
0193:
0194:                    if (imgx == null)
0195:                        imgx = defimg;
0196:                }
0197:
0198:                g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
0199:                        RenderingHints.VALUE_ANTIALIAS_ON);
0200:                g.setRenderingHint(RenderingHints.KEY_DITHERING,
0201:                        RenderingHints.VALUE_DITHER_ENABLE);
0202:
0203:                if (imgx != null) {
0204:                    int imageWidth = imgx.getWidth(this );
0205:                    int imageHeight = imgx.getHeight(this );
0206:                    /*
0207:                    if (imgx instanceof Image)
0208:                    {
0209:                    ((Image)imgx).setTransparent(true);
0210:                    }
0211:                     */
0212:
0213:                    // 
0214:                    Java2DUtil.setClip(g, getZoomedDim(position.x)
0215:                            - x_shift_origin, getZoomedDim(position.y)
0216:                            - y_shift_origin, getZoomedDim(width),
0217:                            getZoomedDim(height));
0218:
0219:                    if (getScaleImage().equalsIgnoreCase("RetainShape")) {
0220:                        if (imageWidth <= width && imageHeight <= height) {
0221:                            Rectangle destination = new Rectangle(
0222:                                    -x_shift_origin + getZoomedDim(position.x),
0223:                                    -y_shift_origin + getZoomedDim(position.y),
0224:                                    getZoomedDim(imageWidth),
0225:                                    getZoomedDim(imageHeight));
0226:                            Rectangle source = new Rectangle(0, 0, imageWidth,
0227:                                    imageHeight);
0228:                            // Calculate y shift based on hAlign...
0229:                            int elem_height = getZoomedDim(this .height);
0230:                            elem_height -= getZoomedDim(imageHeight);
0231:                            if (getVerticalAlignment().equals("Middle"))
0232:                                destination.y += elem_height / 2;
0233:                            else if (getVerticalAlignment().equals("Bottom"))
0234:                                destination.y += elem_height;
0235:
0236:                            // Calculate x shift based on hAlign...
0237:                            int elem_width = getZoomedDim(this .width);
0238:                            elem_width -= getZoomedDim(imageWidth);
0239:                            if (getHorizontalAlignment().equals("Center"))
0240:                                destination.x += elem_width / 2;
0241:                            else if (getHorizontalAlignment().equals("Right"))
0242:                                destination.x += elem_width;
0243:
0244:                            g.drawImage(imgx, destination.x, destination.y,
0245:                                    destination.x + destination.width,
0246:                                    destination.y + destination.height,
0247:                                    source.x, source.y, source.width,
0248:                                    source.height, null, this );
0249:
0250:                        } else if (width > 0 && height > 0)// Resize based on minor x/WIDTH... e y/HEIGHT
0251:                        {
0252:                            if ((double) ((double) imageWidth / (double) width) > (double) ((double) imageHeight / (double) height)) {
0253:
0254:                                Rectangle source = new Rectangle(0, 0,
0255:                                        imageWidth, imageHeight);
0256:                                Rectangle destination = new Rectangle(
0257:                                        -x_shift_origin
0258:                                                + getZoomedDim(position.x),
0259:                                        -y_shift_origin
0260:                                                + getZoomedDim(position.y),
0261:                                        getZoomedDim(width), getZoomedDim(Math
0262:                                                .min((imageHeight * width)
0263:                                                        / imageWidth, height)));
0264:
0265:                                // Calculate y shift based on hAlign...
0266:                                int elem_height = getZoomedDim(this .height);
0267:                                elem_height -= getZoomedDim(Math.min(
0268:                                        (imageHeight * width) / imageWidth,
0269:                                        height));
0270:                                if (getVerticalAlignment().equals("Middle"))
0271:                                    destination.y += elem_height / 2;
0272:                                else if (getVerticalAlignment()
0273:                                        .equals("Bottom"))
0274:                                    destination.y += elem_height;
0275:
0276:                                g.drawImage(imgx, destination.x, destination.y,
0277:                                        destination.x + destination.width,
0278:                                        destination.y + destination.height,
0279:                                        source.x, source.y, source.width,
0280:                                        source.height, null, this );
0281:
0282:                            } else {
0283:                                Rectangle source = new Rectangle(0, 0,
0284:                                        imageWidth, imageHeight);
0285:                                Rectangle destination = new Rectangle(
0286:                                        -x_shift_origin
0287:                                                + getZoomedDim(position.x),
0288:                                        -y_shift_origin
0289:                                                + getZoomedDim(position.y),
0290:                                        getZoomedDim(Math.min(
0291:                                                (imageWidth * height)
0292:                                                        / imageHeight, width)),
0293:                                        getZoomedDim(height));
0294:
0295:                                // Calculate x shift based on hAlign...
0296:                                int elem_width = getZoomedDim(this .width);
0297:                                elem_width -= getZoomedDim(Math.min(
0298:                                        (imageWidth * height) / imageHeight,
0299:                                        width));
0300:                                if (getHorizontalAlignment().equals("Center"))
0301:                                    destination.x += elem_width / 2;
0302:                                else if (getHorizontalAlignment().equals(
0303:                                        "Right"))
0304:                                    destination.x += elem_width;
0305:
0306:                                g.drawImage(imgx, destination.x, destination.y,
0307:                                        destination.x + destination.width,
0308:                                        destination.y + destination.height,
0309:                                        source.x, source.y, source.width,
0310:                                        source.height, null, this );
0311:
0312:                            }
0313:                        }
0314:
0315:                    } else if (getScaleImage().equalsIgnoreCase("FillFrame")) {
0316:
0317:                        g.drawImage(imgx, getZoomedDim(position.x)
0318:                                - x_shift_origin, getZoomedDim(position.y)
0319:                                - y_shift_origin, getZoomedDim(position.x
0320:                                + width)
0321:                                - x_shift_origin, getZoomedDim(position.y
0322:                                + height)
0323:                                - y_shift_origin, 0, 0, imageWidth,
0324:                                imageHeight, null, this );
0325:
0326:                        //-x_shift_origin+ getZoomedDim( position.x-10)+10 ,-y_shift_origin+getZoomedDim(position.y)+10, getZoomedDim( this.width), getZoomedDim( this.height),
0327:
0328:                    } else {
0329:                        Rectangle destination = new Rectangle(-x_shift_origin
0330:                                + getZoomedDim(position.x), -y_shift_origin
0331:                                + getZoomedDim(position.y), getZoomedDim(Math
0332:                                .min(imageWidth, width)), getZoomedDim(Math
0333:                                .min(imageHeight, height)));
0334:                        Rectangle source = new Rectangle(0, 0, Math.min(
0335:                                imageWidth, width), Math.min(imageHeight,
0336:                                height));
0337:
0338:                        // Calculate y shift based on hAlign...
0339:                        int elem_height = getZoomedDim(height);
0340:                        elem_height -= getZoomedDim(imageHeight);
0341:                        if (getVerticalAlignment().equals("Middle")) {
0342:                            destination.y += elem_height / 2;
0343:                            if (destination.y < --y_shift_origin
0344:                                    + getZoomedDim(position.y) + 10) {
0345:                                source.y += -y_shift_origin
0346:                                        + getZoomedDim(position.y) + 10
0347:                                        - destination.y;
0348:                                destination.y = -y_shift_origin
0349:                                        + getZoomedDim(position.y) + 10;
0350:                            }
0351:                        } else if (getVerticalAlignment().equals("Bottom")) {
0352:                            destination.y += elem_height;
0353:                            if (destination.y < -y_shift_origin
0354:                                    + getZoomedDim(position.y) + 10) {
0355:                                source.y += -y_shift_origin
0356:                                        + getZoomedDim(position.y) + 10
0357:                                        - destination.y;
0358:                                destination.y = -y_shift_origin
0359:                                        + getZoomedDim(position.y) + 10;
0360:                            }
0361:                        }
0362:
0363:                        // Calculate x shift based on hAlign...
0364:                        int elem_width = getZoomedDim(width);
0365:                        elem_width -= getZoomedDim(imageWidth);
0366:                        if (getHorizontalAlignment().equals("Center")) {
0367:                            destination.x += elem_width / 2;
0368:                            if (destination.x < -x_shift_origin
0369:                                    + getZoomedDim(position.x - 10) + 10) {
0370:                                source.x += -x_shift_origin
0371:                                        + getZoomedDim(position.x - 10) + 10
0372:                                        - destination.x;
0373:                                destination.x = -x_shift_origin
0374:                                        + getZoomedDim(position.x - 10) + 10;
0375:                            }
0376:                        } else if (getHorizontalAlignment().equals("Right")) {
0377:                            destination.x += elem_width;
0378:                            if (destination.x < -x_shift_origin
0379:                                    + getZoomedDim(position.x - 10) + 10) {
0380:                                source.x += -x_shift_origin
0381:                                        + getZoomedDim(position.x - 10) + 10
0382:                                        - destination.x;
0383:                                destination.x = -x_shift_origin
0384:                                        + getZoomedDim(position.x - 10) + 10;
0385:                            }
0386:                        }
0387:
0388:                        g.drawImage(imgx, destination.x, destination.y,
0389:                                destination.x + destination.width,
0390:                                destination.y + destination.height, source.x,
0391:                                source.y, source.width, source.height, null,
0392:                                this );
0393:                    }
0394:
0395:                    Java2DUtil.resetClip(g);
0396:                }
0397:
0398:                if (it.businesslogic.ireport.gui.MainFrame.getMainInstance()
0399:                        .getProperties().getProperty("Antialias", "true")
0400:                        .equals("false")) {
0401:                    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
0402:                            RenderingHints.VALUE_ANTIALIAS_OFF);
0403:                    g.setRenderingHint(RenderingHints.KEY_DITHERING,
0404:                            RenderingHints.VALUE_DITHER_DISABLE);
0405:                }
0406:                //position.x += 10;
0407:                //position.y += 10;
0408:
0409:                position.x += 10 - box.getLeftPadding();
0410:                position.y += 10 - box.getTopPadding();
0411:                width = width + box.getLeftPadding() + box.getRightPadding();
0412:                height = height + box.getTopPadding() + box.getBottomPadding();
0413:
0414:                x_shift_origin += 10;
0415:                y_shift_origin += 10;
0416:
0417:                super .drawBorder((Graphics2D) g, zoom_factor, x_shift_origin,
0418:                        y_shift_origin);
0419:                drawGraphicsElement((Graphics2D) g,
0420:                        this .getGraphicElementPen(), zoom_factor,
0421:                        x_shift_origin, y_shift_origin);
0422:                drawBorder(g, zoom_factor, x_shift_origin, y_shift_origin,
0423:                        getBox());
0424:            }
0425:
0426:            public ReportElement cloneMe() {
0427:                ImageReportElement newReportElement = new ImageReportElement(
0428:                        position.x, position.y, width, height);
0429:                copyBaseReportElement(newReportElement, this );
0430:                newReportElement.setIsLazy(this .isIsLazy());
0431:                return newReportElement;
0432:            }
0433:
0434:            public void copyBaseReportElement(ReportElement destination,
0435:                    ReportElement source) {
0436:                super .copyBaseReportElement(destination, source);
0437:
0438:                if (destination instanceof  ImageReportElement
0439:                        && source instanceof  ImageReportElement) {
0440:                    destination.setPropertyValue(SCALE, source
0441:                            .getPropertyValue(SCALE));
0442:                    destination.setPropertyValue(VERTICAL_ALIGN, source
0443:                            .getPropertyValue(VERTICAL_ALIGN));
0444:                    destination.setPropertyValue(HORIZONTAL_ALIGN, source
0445:                            .getPropertyValue(HORIZONTAL_ALIGN));
0446:                    destination.setPropertyValue(USING_CACHE, source
0447:                            .getPropertyValue(USING_CACHE));
0448:
0449:                    ((ImageReportElement) destination)
0450:                            .setEvaluationGroup(new String(
0451:                                    ((ImageReportElement) source)
0452:                                            .getEvaluationGroup()));
0453:                    ((ImageReportElement) destination)
0454:                            .setEvaluationTime(new String(
0455:                                    ((ImageReportElement) source)
0456:                                            .getEvaluationTime()));
0457:                    //((ImageReportElement)destination).setHorizontalAlignment( new String(  ((ImageReportElement)source).getHorizontalAlignment() ));
0458:                    ((ImageReportElement) destination)
0459:                            .setImageClass(new String(
0460:                                    ((ImageReportElement) source)
0461:                                            .getImageClass()));
0462:                    ((ImageReportElement) destination)
0463:                            .setImageExpression(new String(
0464:                                    ((ImageReportElement) source)
0465:                                            .getImageExpression()));
0466:                    //((ImageReportElement)destination).setIsUsingCache( ((ImageReportElement)source).isIsUsingCache());
0467:                    //((ImageReportElement)destination).setScaleImage( new String(  ((ImageReportElement)source).getScaleImage() ));
0468:                    //((ImageReportElement)destination).setVerticalAlignment(  new String(  ((ImageReportElement)source).getVerticalAlignment() ));
0469:                    ((ImageReportElement) destination)
0470:                            .setReportDirectory(((ImageReportElement) source)
0471:                                    .getReportDirectory());
0472:
0473:                    ((HyperLinkableReportElement) destination)
0474:                            .setAnchorNameExpression(new String(
0475:                                    ((HyperLinkableReportElement) source)
0476:                                            .getAnchorNameExpression()));
0477:                    ((HyperLinkableReportElement) destination)
0478:                            .setHyperlinkAnchorExpression(new String(
0479:                                    ((HyperLinkableReportElement) source)
0480:                                            .getHyperlinkAnchorExpression()));
0481:                    ((HyperLinkableReportElement) destination)
0482:                            .setHyperlinkPageExpression(new String(
0483:                                    ((HyperLinkableReportElement) source)
0484:                                            .getHyperlinkPageExpression()));
0485:                    ((HyperLinkableReportElement) destination)
0486:                            .setHyperlinkReferenceExpression(new String(
0487:                                    ((HyperLinkableReportElement) source)
0488:                                            .getHyperlinkReferenceExpression()));
0489:                    ((HyperLinkableReportElement) destination)
0490:                            .setHyperlinkType(new String(
0491:                                    ((HyperLinkableReportElement) source)
0492:                                            .getHyperlinkType()));
0493:                }
0494:            }
0495:
0496:            public void drawGraphicsElement(Graphics2D g, String pen,
0497:                    double zoom_factor, int x_shift_origin, int y_shift_origin) {
0498:
0499:                Stroke stroke = getPenStroke(pen, zoom_factor);
0500:                g.setColor(getFgcolor());
0501:
0502:                this .zoom_factor = zoom_factor;
0503:                if (stroke == null || pen.equalsIgnoreCase("None"))
0504:                    return;
0505:
0506:                position.x -= 10;
0507:                position.y -= 10;
0508:                x_shift_origin -= 10;
0509:                y_shift_origin -= 10;
0510:
0511:                Stroke oldStroke = g.getStroke();
0512:                g.setStroke(stroke);
0513:                g.drawRect(getZoomedDim(position.x) - x_shift_origin,
0514:                        getZoomedDim(position.y) - y_shift_origin,
0515:                        getZoomedDim(width), getZoomedDim(height));
0516:
0517:                position.x += 10;
0518:                position.y += 10;
0519:
0520:                g.setStroke(oldStroke);
0521:            }
0522:
0523:            /** Getter for property horizontalAlignment.
0524:             * @return Value of property horizontalAlignment.
0525:             *
0526:             */
0527:            public java.lang.String getHorizontalAlignment() {
0528:                if (getPropertyValue(HORIZONTAL_ALIGN) == null) {
0529:                    // Look for a fgcolor in the stylesheet...
0530:                    if (getStyle() != null) {
0531:                        return getStyle().getAttributeString(
0532:                                getStyle().ATTRIBUTE_hAlign,
0533:                                DEFAULT_HORIZONTAL_ALIGN, true);
0534:                    }
0535:                }
0536:                return getStringValue(HORIZONTAL_ALIGN,
0537:                        DEFAULT_HORIZONTAL_ALIGN);
0538:            }
0539:
0540:            /** Setter for property horizontalAlignment.
0541:             * @param horizontalAlignment New value of property horizontalAlignment.
0542:             *
0543:             */
0544:            public void setHorizontalAlignment(
0545:                    java.lang.String horizontalAlignment) {
0546:                setPropertyValue(HORIZONTAL_ALIGN, horizontalAlignment);
0547:            }
0548:
0549:            /** Getter for property imageClass.
0550:             * @return Value of property imageClass.
0551:             *
0552:             */
0553:            public java.lang.String getImageClass() {
0554:                return imageClass;
0555:            }
0556:
0557:            /** Setter for property imageClass.
0558:             * @param imageClass New value of property imageClass.
0559:             *
0560:             */
0561:            public void setImageClass(java.lang.String imageClass) {
0562:                this .imageClass = imageClass;
0563:            }
0564:
0565:            /** Getter for property verticalAlignment.
0566:             * @return Value of property verticalAlignment.
0567:             *
0568:             */
0569:            public java.lang.String getVerticalAlignment() {
0570:                if (getPropertyValue(VERTICAL_ALIGN) == null) {
0571:                    // Look for a fgcolor in the stylesheet...
0572:                    if (getStyle() != null) {
0573:                        return getStyle().getAttributeString(
0574:                                getStyle().ATTRIBUTE_vAlign,
0575:                                DEFAULT_VERTICAL_ALIGN, true);
0576:                    }
0577:                }
0578:                return getStringValue(VERTICAL_ALIGN, DEFAULT_VERTICAL_ALIGN);
0579:            }
0580:
0581:            /** Setter for property verticalAlignment.
0582:             * @param verticalAlignment New value of property verticalAlignment.
0583:             *
0584:             */
0585:            public void setVerticalAlignment(java.lang.String verticalAlignment) {
0586:                setPropertyValue(VERTICAL_ALIGN, verticalAlignment);
0587:            }
0588:
0589:            /** Getter for property evaluationGroup.
0590:             * @return Value of property evaluationGroup.
0591:             *
0592:             */
0593:            public java.lang.String getEvaluationGroup() {
0594:                return evaluationGroup;
0595:            }
0596:
0597:            /** Setter for property evaluationGroup.
0598:             * @param evaluationGroup New value of property evaluationGroup.
0599:             *
0600:             */
0601:            public void setEvaluationGroup(java.lang.String evaluationGroup) {
0602:                this .evaluationGroup = evaluationGroup;
0603:            }
0604:
0605:            /** Getter for property imageExpression.
0606:             * @return Value of property imageExpression.
0607:             *
0608:             */
0609:            public java.lang.String getImageExpression() {
0610:                return imageExpression;
0611:            }
0612:
0613:            /** Setter for property imageExpression.
0614:             * @param imageExpression New value of property imageExpression.
0615:             *
0616:             */
0617:            public void setImageExpression(java.lang.String imageExpression) {
0618:                this .imageExpression = imageExpression;
0619:                this .triedToLoadImg = false;
0620:            }
0621:
0622:            /** Getter for property evaluationTime.
0623:             * @return Value of property evaluationTime.
0624:             *
0625:             */
0626:            public java.lang.String getEvaluationTime() {
0627:                return evaluationTime;
0628:            }
0629:
0630:            /** Setter for property evaluationTime.
0631:             * @param evaluationTime New value of property evaluationTime.
0632:             *
0633:             */
0634:            public void setEvaluationTime(java.lang.String evaluationTime) {
0635:                this .evaluationTime = evaluationTime;
0636:            }
0637:
0638:            /** Getter for property img.
0639:             * @return Value of property img.
0640:             *
0641:             */
0642:            public java.awt.Image getImg() {
0643:                return img;
0644:            }
0645:
0646:            public java.awt.Image getImgDef() {
0647:                return defimg;
0648:            }
0649:
0650:            /** Setter for property img.
0651:             * @param img New value of property img.
0652:             *
0653:             */
0654:            public void setImg(java.awt.Image img) {
0655:                this .img = img;
0656:            }
0657:
0658:            /** Getter for property hyperlinkType.
0659:             * @return Value of property hyperlinkType.
0660:             *
0661:             */
0662:            public java.lang.String getHyperlinkType() {
0663:                return hyperlinkType;
0664:            }
0665:
0666:            /** Setter for property hyperlinkType.
0667:             * @param hyperlinkType New value of property hyperlinkType.
0668:             *
0669:             */
0670:            public void setHyperlinkType(java.lang.String hyperlinkType) {
0671:                this .hyperlinkType = hyperlinkType;
0672:            }
0673:
0674:            /** Getter for property anchorNameExpression.
0675:             * @return Value of property anchorNameExpression.
0676:             *
0677:             */
0678:            public java.lang.String getAnchorNameExpression() {
0679:                return anchorNameExpression;
0680:            }
0681:
0682:            /** Setter for property anchorNameExpression.
0683:             * @param anchorNameExpression New value of property anchorNameExpression.
0684:             *
0685:             */
0686:            public void setAnchorNameExpression(
0687:                    java.lang.String anchorNameExpression) {
0688:                this .anchorNameExpression = anchorNameExpression;
0689:            }
0690:
0691:            /** Getter for property scaleImage.
0692:             * @return Value of property scaleImage.
0693:             *
0694:             */
0695:            public java.lang.String getScaleImage() {
0696:                if (getPropertyValue(SCALE) == null) {
0697:                    // Look for a fgcolor in the stylesheet...
0698:                    if (getStyle() != null) {
0699:                        return getStyle().getAttributeString(
0700:                                getStyle().ATTRIBUTE_scaleImage, DEFAULT_SCALE,
0701:                                true);
0702:                    }
0703:                }
0704:                return getStringValue(SCALE, DEFAULT_SCALE);
0705:            }
0706:
0707:            /** Setter for property scaleImage.
0708:             * @param scaleImage New value of property scaleImage.
0709:             *
0710:             */
0711:            public void setScaleImage(java.lang.String scaleImage) {
0712:                setPropertyValue(SCALE, scaleImage);
0713:            }
0714:
0715:            /** Getter for property hyperlinkReferenceExpression.
0716:             * @return Value of property hyperlinkReferenceExpression.
0717:             *
0718:             */
0719:            public java.lang.String getHyperlinkReferenceExpression() {
0720:                return hyperlinkReferenceExpression;
0721:            }
0722:
0723:            /** Setter for property hyperlinkReferenceExpression.
0724:             * @param hyperlinkReferenceExpression New value of property hyperlinkReferenceExpression.
0725:             *
0726:             */
0727:            public void setHyperlinkReferenceExpression(
0728:                    java.lang.String hyperlinkReferenceExpression) {
0729:                this .hyperlinkReferenceExpression = hyperlinkReferenceExpression;
0730:            }
0731:
0732:            /** Getter for property hyperlinkAnchorExpression.
0733:             * @return Value of property hyperlinkAnchorExpression.
0734:             *
0735:             */
0736:            public java.lang.String getHyperlinkAnchorExpression() {
0737:                return hyperlinkAnchorExpression;
0738:            }
0739:
0740:            /** Setter for property hyperlinkAnchorExpression.
0741:             * @param hyperlinkAnchorExpression New value of property hyperlinkAnchorExpression.
0742:             *
0743:             */
0744:            public void setHyperlinkAnchorExpression(
0745:                    java.lang.String hyperlinkAnchorExpression) {
0746:                this .hyperlinkAnchorExpression = hyperlinkAnchorExpression;
0747:            }
0748:
0749:            /** Getter for property hyperlinkPageExpression.
0750:             * @return Value of property hyperlinkPageExpression.
0751:             *
0752:             */
0753:            public java.lang.String getHyperlinkPageExpression() {
0754:                return hyperlinkPageExpression;
0755:            }
0756:
0757:            /** Setter for property hyperlinkPageExpression.
0758:             * @param hyperlinkPageExpression New value of property hyperlinkPageExpression.
0759:             *
0760:             */
0761:            public void setHyperlinkPageExpression(
0762:                    java.lang.String hyperlinkPageExpression) {
0763:                this .hyperlinkPageExpression = hyperlinkPageExpression;
0764:            }
0765:
0766:            /** This method is called when information about an image which was
0767:             * previously requested using an asynchronous interface becomes
0768:             * available.  Asynchronous interfaces are method calls such as
0769:             * getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
0770:             * which take an ImageObserver object as an argument.  Those methods
0771:             * register the caller as interested either in information about
0772:             * the overall image itself (in the case of getWidth(ImageObserver))
0773:             * or about an output version of an image (in the case of the
0774:             * drawImage(img, x, y, [w, h,] ImageObserver) call).
0775:             *
0776:             * <p>This method
0777:             * should return true if further updates are needed or false if the
0778:             * required information has been acquired.  The image which was being
0779:             * tracked is passed in using the img argument.  Various constants
0780:             * are combined to form the infoflags argument which indicates what
0781:             * information about the image is now available.  The interpretation
0782:             * of the x, y, width, and height arguments depends on the contents
0783:             * of the infoflags argument.
0784:             * <p>
0785:             * The <code>infoflags</code> argument should be the bitwise inclusive
0786:             * <b>OR</b> of the following flags: <code>WIDTH</code>,
0787:             * <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>,
0788:             * <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>,
0789:             * <code>ABORT</code>.
0790:             *
0791:             * @param     img   the image being observed.
0792:             * @param     infoflags   the bitwise inclusive OR of the following
0793:             *               flags:  <code>WIDTH</code>, <code>HEIGHT</code>,
0794:             *               <code>PROPERTIES</code>, <code>SOMEBITS</code>,
0795:             *               <code>FRAMEBITS</code>, <code>ALLBITS</code>,
0796:             *               <code>ERROR</code>, <code>ABORT</code>.
0797:             * @param     x   the <i>x</i> coordinate.
0798:             * @param     y   the <i>y</i> coordinate.
0799:             * @param     width    the width.
0800:             * @param     height   the height.
0801:             * @return    <code>false</code> if the infoflags indicate that the
0802:             *            image is completely loaded; <code>true</code> otherwise.
0803:             *
0804:             * @see #WIDTH
0805:             * @see #HEIGHT
0806:             * @see #PROPERTIES
0807:             * @see #SOMEBITS
0808:             * @see #FRAMEBITS
0809:             * @see #ALLBITS
0810:             * @see #ERROR
0811:             * @see #ABORT
0812:             * @see Image#getWidth
0813:             * @see Image#getHeight
0814:             * @see java.awt.Graphics#drawImage
0815:             *
0816:             */
0817:            public boolean imageUpdate(Image img, int infoflags, int x, int y,
0818:                    int width, int height) {
0819:                return true;
0820:            }
0821:
0822:            public static void setImgDef(Image defImg) {
0823:                defimg = defImg;
0824:            }
0825:
0826:            /** Getter for property isUsingCache.
0827:             * @return Value of property isUsingCache.
0828:             *
0829:             */
0830:            public boolean isIsUsingCache() {
0831:
0832:                return getBooleanValue(USING_CACHE, DEFAULT_USING_CACHE);
0833:            }
0834:
0835:            /** Setter for property isUsingCache.
0836:             * @param isUsingCache New value of property isUsingCache.
0837:             *
0838:             */
0839:            public void setIsUsingCache(boolean isUsingCache) {
0840:                setPropertyValue(USING_CACHE, new Boolean(isUsingCache));
0841:            }
0842:
0843:            /**
0844:             * @return
0845:             */
0846:            public File getReportDirectory() {
0847:                return reportDirectory;
0848:            }
0849:
0850:            /**
0851:             * @param directory
0852:             */
0853:            public void setReportDirectory(File directory) {
0854:                reportDirectory = directory;
0855:            }
0856:
0857:            protected String hyperlinkTarget = "Self";
0858:
0859:            /** Getter for property hyperlinkTarget.
0860:             * @return Value of property hyperlinkTarget.
0861:             *
0862:             */
0863:            public java.lang.String getHyperlinkTarget() {
0864:                return hyperlinkTarget;
0865:            }
0866:
0867:            /** Setter for property hyperlinkTarget.
0868:             * @param hyperlinkTarget New value of property hyperlinkTarget.
0869:             *
0870:             */
0871:            public void setHyperlinkTarget(java.lang.String hyperlinkTarget) {
0872:                this .hyperlinkTarget = hyperlinkTarget;
0873:            }
0874:
0875:            public Box getBox() {
0876:                return box;
0877:            }
0878:
0879:            public void setBox(Box box) {
0880:                this .box = box;
0881:            }
0882:
0883:            public boolean isIsLazy() {
0884:                return isLazy;
0885:            }
0886:
0887:            public void setIsLazy(boolean isLazy) {
0888:                this .isLazy = isLazy;
0889:            }
0890:
0891:            public int getBookmarkLevel() {
0892:                return bookmarkLevel;
0893:            }
0894:
0895:            public void setBookmarkLevel(int bookmarkLevel) {
0896:                this .bookmarkLevel = bookmarkLevel;
0897:            }
0898:
0899:            public String getOnErrorType() {
0900:                return onErrorType;
0901:            }
0902:
0903:            public void setOnErrorType(String onErrorType) {
0904:                this .onErrorType = onErrorType;
0905:            }
0906:
0907:            public void setStyle(Style style) {
0908:
0909:                super .setStyle(style);
0910:
0911:                if (style != null) {
0912:                    //this.setHorizontalAlignment(style.getAttributeString( style.ATTRIBUTE_hAlign, getHorizontalAlignment(), true));
0913:                    //this.setVerticalAlignment( style.getAttributeString( style.ATTRIBUTE_vAlign, getVerticalAlignment(), true));
0914:
0915:                    //this.setScaleImage( style.getAttributeString( style.ATTRIBUTE_scaleImage, getScaleImage(), true));
0916:
0917:                    // BOX
0918:                    if (style.getAttributeString(style.ATTRIBUTE_border, null,
0919:                            true) != null)
0920:                        this .getBox().setBorder(
0921:                                style.getAttributeString(
0922:                                        style.ATTRIBUTE_border, null, true));
0923:                    if (style.getAttributeColor(style.ATTRIBUTE_borderColor,
0924:                            null, true) != null)
0925:                        this .getBox().setBorderColor(
0926:                                style
0927:                                        .getAttributeColor(
0928:                                                style.ATTRIBUTE_borderColor,
0929:                                                null, true));
0930:                    if (style.getAttributeString(style.ATTRIBUTE_padding, null,
0931:                            true) != null)
0932:                        this .getBox().setPadding(
0933:                                Integer.parseInt(style.getAttributeString(
0934:                                        style.ATTRIBUTE_padding, null, true)));
0935:
0936:                    if (style.getAttributeString(style.ATTRIBUTE_topBorder,
0937:                            null, true) != null)
0938:                        this .getBox().setTopBorder(
0939:                                style.getAttributeString(
0940:                                        style.ATTRIBUTE_topBorder, null, true));
0941:                    if (style.getAttributeColor(style.ATTRIBUTE_topBorderColor,
0942:                            null, true) != null)
0943:                        this .getBox().setTopBorderColor(
0944:                                style.getAttributeColor(
0945:                                        style.ATTRIBUTE_topBorderColor, null,
0946:                                        true));
0947:                    if (style.getAttributeString(style.ATTRIBUTE_topPadding,
0948:                            null, true) != null)
0949:                        this .getBox().setTopPadding(
0950:                                Integer
0951:                                        .parseInt(style.getAttributeString(
0952:                                                style.ATTRIBUTE_topPadding,
0953:                                                null, true)));
0954:
0955:                    if (style.getAttributeString(style.ATTRIBUTE_leftBorder,
0956:                            null, true) != null)
0957:                        this .getBox()
0958:                                .setLeftBorder(
0959:                                        style.getAttributeString(
0960:                                                style.ATTRIBUTE_leftBorder,
0961:                                                null, true));
0962:                    if (style.getAttributeColor(
0963:                            style.ATTRIBUTE_leftBorderColor, null, true) != null)
0964:                        this .getBox().setLeftBorderColor(
0965:                                style.getAttributeColor(
0966:                                        style.ATTRIBUTE_leftBorderColor, null,
0967:                                        true));
0968:                    if (style.getAttributeString(style.ATTRIBUTE_leftPadding,
0969:                            null, true) != null)
0970:                        this .getBox().setLeftPadding(
0971:                                Integer.parseInt(style
0972:                                        .getAttributeString(
0973:                                                style.ATTRIBUTE_leftPadding,
0974:                                                null, true)));
0975:
0976:                    if (style.getAttributeString(style.ATTRIBUTE_rightBorder,
0977:                            null, true) != null)
0978:                        this .getBox().setRightBorder(
0979:                                style
0980:                                        .getAttributeString(
0981:                                                style.ATTRIBUTE_rightBorder,
0982:                                                null, true));
0983:                    if (style.getAttributeColor(
0984:                            style.ATTRIBUTE_rightBorderColor, null, true) != null)
0985:                        this .getBox().setRightBorderColor(
0986:                                style.getAttributeColor(
0987:                                        style.ATTRIBUTE_rightBorderColor, null,
0988:                                        true));
0989:                    if (style.getAttributeString(style.ATTRIBUTE_rightPadding,
0990:                            null, true) != null)
0991:                        this .getBox().setRightPadding(
0992:                                Integer.parseInt(style.getAttributeString(
0993:                                        style.ATTRIBUTE_rightPadding, null,
0994:                                        true)));
0995:
0996:                    if (style.getAttributeString(style.ATTRIBUTE_bottomBorder,
0997:                            null, true) != null)
0998:                        this .getBox().setBottomBorder(
0999:                                style.getAttributeString(
1000:                                        style.ATTRIBUTE_bottomBorder, null,
1001:                                        true));
1002:                    if (style.getAttributeColor(
1003:                            style.ATTRIBUTE_bottomBorderColor, null, true) != null)
1004:                        this .getBox().setBottomBorderColor(
1005:                                style.getAttributeColor(
1006:                                        style.ATTRIBUTE_bottomBorderColor,
1007:                                        null, true));
1008:                    if (style.getAttributeString(style.ATTRIBUTE_bottomPadding,
1009:                            null, true) != null)
1010:                        this .getBox().setBottomPadding(
1011:                                Integer.parseInt(style.getAttributeString(
1012:                                        style.ATTRIBUTE_bottomPadding, null,
1013:                                        true)));
1014:
1015:                }
1016:            }
1017:
1018:            public java.util.List getLinkParameters() {
1019:                return linkParameters;
1020:            }
1021:
1022:            public void setLinkParameters(java.util.List linkParameters) {
1023:                this .linkParameters = linkParameters;
1024:            }
1025:
1026:            public String getTooltipExpression() {
1027:                return tooltipExpression;
1028:            }
1029:
1030:            public void setTooltipExpression(String tooltipExpression) {
1031:                this.tooltipExpression = tooltipExpression;
1032:            }
1033:
1034:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.