Source Code Cross Referenced for AbstractHTMLView.java in  » Development » rapla » org » rapla » components » calendarview » html » 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 » Development » rapla » org.rapla.components.calendarview.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*--------------------------------------------------------------------------*
002:         | Copyright (C) 2006  Christopher Kohlhaas                                 |
003:         |                                                                          |
004:         | This program is free software; you can redistribute it and/or modify     |
005:         | it under the terms of the GNU General Public License as published by the |
006:         | Free Software Foundation. A copy of the license has been included with   |
007:         | these distribution in the COPYING file, if not go to www.fsf.org         |
008:         |                                                                          |
009:         | As a special exception, you are granted the permissions to link this     |
010:         | program with every library, which license fulfills the Open Source       |
011:         | Definition as published by the Open Source Initiative (OSI).             |
012:         *--------------------------------------------------------------------------*/
013:
014:        package org.rapla.components.calendarview.html;
015:
016:        import java.util.*;
017:
018:        import org.rapla.components.calendarview.Block;
019:        import org.rapla.components.calendarview.Builder;
020:        import org.rapla.components.calendarview.CalendarView;
021:        import org.rapla.components.calendarview.WeekdayMapper;
022:        import org.rapla.components.calendarview.BlockComparator;
023:
024:        public abstract class AbstractHTMLView implements  CalendarView {
025:            public static String COLOR_NO_RESOURCE = "#BBEEBB";
026:            protected Collection builders = new ArrayList();
027:            /** shared calendar instance. Only used for temporary stored values. */
028:            Calendar blockCalendar;
029:            WeekdayMapper weekdayMapper;
030:            Date startDate;
031:            Date endDate;
032:            String m_html;
033:            protected Collection excludeDays = Collections.EMPTY_SET;
034:
035:            Locale locale;
036:            TimeZone timeZone;
037:            Builder builder;
038:
039:            public void setTimeZone(TimeZone timeZone) {
040:                this .timeZone = timeZone;
041:                if (locale != null) {
042:                    blockCalendar = createCalendar();
043:                }
044:            }
045:
046:            public void setLocale(Locale locale) {
047:                this .locale = locale;
048:                if (timeZone != null) {
049:                    blockCalendar = createCalendar();
050:                }
051:                weekdayMapper = new WeekdayMapper(locale);
052:            }
053:
054:            public TimeZone getTimeZone() {
055:                return timeZone;
056:            }
057:
058:            public void addBuilder(Builder b) {
059:                builders.add(b);
060:            }
061:
062:            public void removeBuilder(Builder b) {
063:                builders.remove(b);
064:            }
065:
066:            public void rebuild(Builder builder) {
067:                try {
068:                    addBuilder(builder);
069:                    rebuild();
070:                } finally {
071:                    removeBuilder(builder);
072:                }
073:            }
074:
075:            public void setToDate(Date weekDate) {
076:                calcMinMaxDates(weekDate);
077:            }
078:
079:            public void setExcludeDays(Collection excludeDays) {
080:                this .excludeDays = excludeDays;
081:                if (startDate != null)
082:                    calcMinMaxDates(startDate);
083:            }
084:
085:            abstract public Collection getBlocks();
086:
087:            abstract void calcMinMaxDates(Date date);
088:
089:            Calendar createCalendar() {
090:                return Calendar.getInstance(getTimeZone(), locale);
091:            }
092:
093:            void checkBlock(Block bl) {
094:                if (!bl.getStart().before(this .endDate)) {
095:                    throw new IllegalStateException("Start-date "
096:                            + bl.getStart()
097:                            + " must be before calendar end at " + this .endDate);
098:                }
099:            }
100:
101:            public Date getStartDate() {
102:                return startDate;
103:            }
104:
105:            public Date getEndDate() {
106:                return endDate;
107:            }
108:
109:            public String getHtml() {
110:                return m_html;
111:            }
112:
113:            protected class HTMLSmallDaySlot extends ArrayList {
114:                private static final long serialVersionUID = 1L;
115:
116:                private String date;
117:
118:                public HTMLSmallDaySlot(String date) {
119:                    super (2);
120:                    this .date = date;
121:                }
122:
123:                public void putBlock(Block block) {
124:                    add(block);
125:                }
126:
127:                public void sort() {
128:                    Collections.sort(this , BlockComparator.COMPARATOR);
129:                }
130:
131:                public void paint(StringBuffer out) {
132:                    out.append("<div valign=\"top\" align=\"right\">");
133:                    out.append(date);
134:                    out.append("</div>\n");
135:                    for (int i = 0; i < size(); i++) {
136:                        Block block = (Block) get(i);
137:                        out.append("<div valign=\"top\" class=\"month_block\"");
138:                        if (block instanceof  HTMLBlock) {
139:                            out.append(" style=\"background-color:"
140:                                    + ((HTMLBlock) block).getBackgroundColor()
141:                                    + ";\"");
142:                        }
143:                        out.append(">");
144:                        out.append(block.toString());
145:                        out.append("</div>\n");
146:                    }
147:                }
148:            }
149:
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.