Source Code Cross Referenced for HSSFComment.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hssf » usermodel » 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 » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hssf.usermodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ====================================================================
002:           Licensed to the Apache Software Foundation (ASF) under one or more
003:           contributor license agreements.  See the NOTICE file distributed with
004:           this work for additional information regarding copyright ownership.
005:           The ASF licenses this file to You under the Apache License, Version 2.0
006:           (the "License"); you may not use this file except in compliance with
007:           the License.  You may obtain a copy of the License at
008:
009:               http://www.apache.org/licenses/LICENSE-2.0
010:
011:           Unless required by applicable law or agreed to in writing, software
012:           distributed under the License is distributed on an "AS IS" BASIS,
013:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:           See the License for the specific language governing permissions and
015:           limitations under the License.
016:        ==================================================================== */
017:        package org.apache.poi.hssf.usermodel;
018:
019:        import org.apache.poi.hssf.record.EscherAggregate;
020:        import org.apache.poi.hssf.record.NoteRecord;
021:        import org.apache.poi.hssf.record.TextObjectRecord;
022:        import org.apache.poi.ddf.*;
023:
024:        import java.util.Map;
025:        import java.util.List;
026:        import java.util.Iterator;
027:
028:        /**
029:         * Represents a cell comment - a sticky note associated with a cell.
030:         *
031:         * @author Yegor Kozlov
032:         */
033:        public class HSSFComment extends HSSFTextbox {
034:
035:            private boolean visible;
036:            private short col, row;
037:            private String author;
038:
039:            private NoteRecord note = null;
040:            private TextObjectRecord txo = null;
041:
042:            /**
043:             * Construct a new comment with the given parent and anchor.
044:             *
045:             * @param parent
046:             * @param anchor  defines position of this anchor in the sheet
047:             */
048:            public HSSFComment(HSSFShape parent, HSSFAnchor anchor) {
049:                super (parent, anchor);
050:                setShapeType(OBJECT_TYPE_COMMENT);
051:
052:                //default color for comments
053:                fillColor = 0x08000050;
054:
055:                //by default comments are hidden
056:                visible = false;
057:
058:                author = "";
059:            }
060:
061:            protected HSSFComment(NoteRecord note, TextObjectRecord txo) {
062:                this ((HSSFShape) null, (HSSFAnchor) null);
063:                this .txo = txo;
064:                this .note = note;
065:            }
066:
067:            /**
068:             * Returns whether this comment is visible.
069:             *
070:             * @param visible <code>true</code> if the comment is visible, <code>false</code> otherwise
071:             */
072:            public void setVisible(boolean visible) {
073:                if (note != null)
074:                    note.setFlags(visible ? NoteRecord.NOTE_VISIBLE
075:                            : NoteRecord.NOTE_HIDDEN);
076:                this .visible = visible;
077:            }
078:
079:            /**
080:             * Sets whether this comment is visible.
081:             *
082:             * @return <code>true</code> if the comment is visible, <code>false</code> otherwise
083:             */
084:            public boolean isVisible() {
085:                return this .visible;
086:            }
087:
088:            /**
089:             * Return the row of the cell that contains the comment
090:             *
091:             * @return the 0-based row of the cell that contains the comment
092:             */
093:            public int getRow() {
094:                return row;
095:            }
096:
097:            /**
098:             * Set the row of the cell that contains the comment
099:             *
100:             * @param row the 0-based row of the cell that contains the comment
101:             */
102:            public void setRow(int row) {
103:                if (note != null)
104:                    note.setRow((short) row);
105:                this .row = (short) row;
106:            }
107:
108:            /**
109:             * Return the column of the cell that contains the comment
110:             *
111:             * @return the 0-based column of the cell that contains the comment
112:             */
113:            public short getColumn() {
114:                return col;
115:            }
116:
117:            /**
118:             * Set the column of the cell that contains the comment
119:             *
120:             * @param col the 0-based column of the cell that contains the comment
121:             */
122:            public void setColumn(short col) {
123:                if (note != null)
124:                    note.setColumn(col);
125:                this .col = col;
126:            }
127:
128:            /**
129:             * Name of the original comment author
130:             *
131:             * @return the name of the original author of the comment
132:             */
133:            public String getAuthor() {
134:                return author;
135:            }
136:
137:            /**
138:             * Name of the original comment author
139:             *
140:             * @param author the name of the original author of the comment
141:             */
142:            public void setAuthor(String author) {
143:                if (note != null)
144:                    note.setAuthor(author);
145:                this .author = author;
146:            }
147:
148:            /**
149:             * Sets the rich text string used by this comment.
150:             *
151:             * @param string    Sets the rich text string used by this object.
152:             */
153:            public void setString(HSSFRichTextString string) {
154:                //if font is not set we must set the default one
155:                if (string.numFormattingRuns() == 0)
156:                    string.applyFont((short) 0);
157:
158:                if (txo != null) {
159:                    int frLength = (string.numFormattingRuns() + 1) * 8;
160:                    txo.setFormattingRunLength((short) frLength);
161:                    txo.setTextLength((short) string.length());
162:                    txo.setStr(string);
163:                }
164:                super.setString(string);
165:            }
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.