Source Code Cross Referenced for CalendarView.java in  » ERP-CRM-Financial » SourceTap-CRM » com » sourcetap » sfa » activity » 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 » ERP CRM Financial » SourceTap CRM » com.sourcetap.sfa.activity 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 
003:         * Copyright (c) 2004 SourceTap - www.sourcetap.com
004:         *
005:         *  The contents of this file are subject to the SourceTap Public License 
006:         * ("License"); You may not use this file except in compliance with the 
007:         * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
008:         * Software distributed under the License is distributed on an  "AS IS"  basis,
009:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
010:         * the specific language governing rights and limitations under the License.
011:         *
012:         * The above copyright notice and this permission notice shall be included
013:         * in all copies or substantial portions of the Software.
014:         *
015:         */
016:
017:        package com.sourcetap.sfa.activity;
018:
019:        import java.util.Calendar;
020:
021:        /**
022:         * DOCUMENT ME!
023:         *
024:         */
025:        public class CalendarView {
026:            public static final int MONTH_VIEW = 0;
027:            public static final int DAY_VIEW = 0;
028:            public static final int WEEK_VIEW = 0;
029:            private static final int currentMonth = Calendar.getInstance().get(
030:                    Calendar.MONTH) + 1;
031:            private static final int currentYear = Calendar.getInstance().get(
032:                    Calendar.YEAR);
033:            private static final int currentDay = Calendar.getInstance().get(
034:                    Calendar.DAY_OF_MONTH);
035:
036:            public CalendarView() {
037:            }
038:
039:            /**
040:             * DOCUMENT ME!
041:             *
042:             * @return 
043:             */
044:            public static String getCalendar() {
045:                return "";
046:            }
047:
048:            /**
049:             * DOCUMENT ME!
050:             *
051:             * @param year 
052:             * @param month 
053:             * @param day 
054:             * @param destURL 
055:             *
056:             * @return 
057:             */
058:            public static String getSmallMonthCalendarHTML(int year, int month,
059:                    int day, String destURL) {
060:                Calendar calendar = CalendarUtil.getCalendar(year, month, 1);
061:                int firstDay = calendar.get(Calendar.DAY_OF_WEEK);
062:                int rows;
063:
064:                if (((CalendarUtil.daysInMonth[month] == 31) && (firstDay >= 6))
065:                        || ((CalendarUtil.daysInMonth[month] == 30) && (firstDay == 7))) {
066:                    rows = 6;
067:                } else if ((CalendarUtil.daysInMonth[month] == 28)
068:                        && (firstDay == 1)) {
069:                    rows = 4;
070:                } else {
071:                    rows = 5;
072:                }
073:
074:                StringBuffer returnString = new StringBuffer();
075:                returnString
076:                        .append("<table class=\"tabularSectionTitleTable\" width=\"100%\">\n");
077:                returnString.append(" <tr>\n");
078:                returnString.append("  <td>\n");
079:                returnString
080:                        .append("  " + smallMonthHeader(year, month) + "\n");
081:                returnString.append("  </td>\n");
082:                returnString.append(" </tr>\n");
083:                returnString.append("</table>\n");
084:                returnString
085:                        .append("<table class=\"tabularSectionDisplayTable\" width=\"100%\">\n");
086:
087:                //style=\"border: 0.02cm solid black; border-collapse: collapse; table-layout: fixed;  \" border=\"0\"
088:                returnString.append(" <tr class=\"tabularSectionLabel\">\n");
089:
090:                for (int i = 0; i < 7; i++) {
091:                    returnString.append("  <td>\n");
092:                    returnString.append("   "
093:                            + CalendarUtil.dayLabel[i].substring(0, 2) + "\n");
094:                    returnString.append("  </td>\n");
095:                }
096:
097:                returnString.append(" </tr>\n");
098:
099:                int dayCounter = 1;
100:                int loopCounter = 1;
101:                String dayDetail = "";
102:
103:                for (int j = 1; j <= rows; j++) {
104:                    returnString.append(" <tr>\n");
105:
106:                    for (int i = 1; i < 8; i++) {
107:                        returnString
108:                                .append("  <td class=\"tabularSectionField\"");
109:
110:                        // if it is a valid day of the month
111:                        if ((loopCounter >= firstDay)
112:                                && (dayCounter <= CalendarUtil.daysInMonth[month])) {
113:                            // if the counter is on today
114:                            if ((dayCounter == currentDay)
115:                                    && (month == currentMonth)
116:                                    && (year == currentYear)) {
117:                                returnString.append(" bgcolor=\"#C0C0C0\"");
118:                            }
119:
120:                            returnString.append(">\n");
121:
122:                            // See if this is the currently selected day.
123:                            if ((dayCounter == day) && (month == currentMonth)
124:                                    && (year == currentYear)) {
125:                                returnString.append("<B>");
126:                            }
127:
128:                            returnString
129:                                    .append("   <a href=\"/sfa/control/frontpage?action=day&amp;day="
130:                                            + dayCounter
131:                                            + "&amp;month="
132:                                            + month
133:                                            + "&amp;year="
134:                                            + year
135:                                            + " \">\n");
136:                            returnString.append("    " + dayCounter + "\n");
137:                            returnString.append("   </a>\n");
138:
139:                            if ((dayCounter == day) && (month == currentMonth)
140:                                    && (year == currentYear)) {
141:                                returnString.append("</B>");
142:                            }
143:
144:                            returnString.append("   <br>\n");
145:                            dayCounter++;
146:                        } else {
147:                            // not a valid day, make a blank cell
148:                            returnString.append(">\n");
149:                            returnString.append("   &nbsp;\n");
150:                        }
151:
152:                        returnString.append("  </td>\n");
153:                        loopCounter++;
154:                    }
155:
156:                    //  returnString.append("<td align=\"center\"><div class=\"tabletext\"><a href=\"/sfa/control/activityCalendar?action=week&amp;day=" + (dayCounter-1) + "&amp;month=" + month + "&amp;year=" + year + "\" >w<br>e<br>e<br>k</a></div></td>");
157:                    returnString.append(" </tr>\n");
158:                }
159:
160:                returnString.append("</table>");
161:
162:                return returnString.toString();
163:            }
164:
165:            /**
166:             * DOCUMENT ME!
167:             *
168:             * @param year 
169:             * @param month 
170:             *
171:             * @return 
172:             */
173:            private static String monthHeader(int year, int month) {
174:                StringBuffer returnString = new StringBuffer();
175:
176:                if (month == Calendar.FEBRUARY) {
177:                    CalendarUtil.daysInMonth[2] = (((year % 400) == 0) || (((year % 4) == 0) && ((year % 100) != 0))) ? 29
178:                            : 28;
179:                }
180:
181:                returnString
182:                        .append("<a href=\"/sfa/control/activityCalendar?action=month&amp;month="
183:                                + ((month != 1) ? (month - 1) : 12)
184:                                + "&amp;year="
185:                                + ((month != 1) ? year : (year - 1))
186:                                + " \"><</a>&nbsp;");
187:                returnString.append(CalendarUtil.monthLabel[month]);
188:                returnString.append("&nbsp;");
189:                returnString.append(year);
190:                returnString
191:                        .append("&nbsp;<a href=\"/sfa/control/activityCalendar?action=month&amp;month="
192:                                + ((month != 12) ? (month + 1) : 1)
193:                                + "&amp;year="
194:                                + ((month != 12) ? year : (year + 1))
195:                                + " \">></a>&nbsp;");
196:
197:                return returnString.toString();
198:            }
199:
200:            /**
201:             * DOCUMENT ME!
202:             *
203:             * @param year 
204:             * @param month 
205:             *
206:             * @return 
207:             */
208:            private static String smallMonthHeader(int year, int month) {
209:                StringBuffer returnString = new StringBuffer();
210:
211:                if (month == Calendar.FEBRUARY) {
212:                    CalendarUtil.daysInMonth[2] = (((year % 400) == 0) || (((year % 4) == 0) && ((year % 100) != 0))) ? 29
213:                            : 28;
214:                }
215:
216:                returnString
217:                        .append("   <a class=\"tabularSectionAnchorSelected\" href=\"/sfa/control/frontpage?action=month&amp;month="
218:                                + ((month != 1) ? (month - 1) : 12)
219:                                + "&amp;year="
220:                                + ((month != 1) ? year : (year - 1)) + " \">\n");
221:                returnString.append("    <<\n");
222:                returnString.append("   </a>\n");
223:                returnString.append("   &nbsp;\n");
224:                returnString.append(CalendarUtil.monthLabel[month]);
225:                returnString.append("&nbsp;");
226:                returnString.append(year);
227:                returnString.append("&nbsp;");
228:                returnString
229:                        .append("   <a class=\"tabularSectionAnchorSelected\" href=\"/sfa/control/frontpage?action=month&amp;month="
230:                                + ((month != 12) ? (month + 1) : 1)
231:                                + "&amp;year="
232:                                + ((month != 12) ? year : (year + 1))
233:                                + " \">\n");
234:                returnString.append("    >>\n");
235:                returnString.append("   </a>\n");
236:                returnString.append("   &nbsp;\n");
237:
238:                return returnString.toString();
239:            }
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.