|
From: <nic...@us...> - 2003-12-03 10:19:28
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt
In directory sc8-pr-cvs1:/tmp/cvs-serv28635/src/scratchpad/org/krysalis/jcharts/gantt
Modified Files:
DateHandlerTest.java Plan.java DateHandler.java
Log Message:
Bunch of updates and fixes.
Index: DateHandlerTest.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandlerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DateHandlerTest.java 4 Sep 2003 11:45:16 -0000 1.2
--- DateHandlerTest.java 3 Dec 2003 10:19:24 -0000 1.3
***************
*** 54,61 ****
final public void testGetStringDateFromWeek() throws ParseException {
//TRANSFORMING WEEK: 39 into: Mon Sep 22 10:36:32 CEST 2003
! String result = DateHandler.getStringDateFromWeek(39, true);
Assert.assertEquals(result, "20030922");
//TRANSFORMING WEEK: 40 into: Fri Oct 03 10:36:32 CEST 2003
! result = DateHandler.getStringDateFromWeek(40, false);
Assert.assertEquals(result, "20031003");
}
--- 54,64 ----
final public void testGetStringDateFromWeek() throws ParseException {
//TRANSFORMING WEEK: 39 into: Mon Sep 22 10:36:32 CEST 2003
! String result = DateHandler.getStringDateFromWeek("39", true);
Assert.assertEquals(result, "20030922");
//TRANSFORMING WEEK: 40 into: Fri Oct 03 10:36:32 CEST 2003
! result = DateHandler.getStringDateFromWeek("40", false);
! Assert.assertEquals(result, "20031003");
! //TRANSFORMING WEEK: 200340 into: Fri Oct 03 10:36:32 CEST 2003
! result = DateHandler.getStringDateFromWeek("200340", false);
Assert.assertEquals(result, "20031003");
}
Index: Plan.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/Plan.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Plan.java 4 Sep 2003 11:43:22 -0000 1.2
--- Plan.java 3 Dec 2003 10:19:24 -0000 1.3
***************
*** 211,214 ****
--- 211,234 ----
}
+ public Dimension getMinimumSize() {
+ //@todo use real width and hight!
+ return new Dimension(1100, 6000);
+ }
+
+ public Dimension getSize() {
+ //@todo use real width and hight!
+ return new Dimension(1100, 6000);
+ }
+
+ public int getWidth() {
+ //@todo use real width and hight!
+ return 1100;
+ }
+
+ public int getHeight() {
+ //@todo use real width and hight!
+ return 6000;
+ }
+
public void saveAsSvg(File outFile) throws IOException {
//Get a DOMImplementation
Index: DateHandler.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/scratchpad/org/krysalis/jcharts/gantt/DateHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** DateHandler.java 4 Sep 2003 11:45:16 -0000 1.9
--- DateHandler.java 3 Dec 2003 10:19:24 -0000 1.10
***************
*** 176,180 ****
}
! public static Date getDate(String label) {
Calendar cal = Calendar.getInstance();
--- 176,198 ----
}
! public static Date getDate(String label) throws IndexOutOfBoundsException{
! return getDate(label, "unspecified");
! }
!
! public static Date getDateSafe(String label, Object what){
! try {
! return getDate(label, what);
! }catch(Exception e){
! System.out.println(e);
! }
! return new Date();
! }
!
! public static Date getDate(String label, Object what) throws IndexOutOfBoundsException{
!
! if(label.length()!=8){
! throw new IndexOutOfBoundsException("Wrong date!:'" + label + "' \noffending:\n"+what);
! }
!
Calendar cal = Calendar.getInstance();
***************
*** 222,234 ****
}
! //TODO ! add year handling!!!
! public static String getStringDateFromWeek(int week, boolean startDay)
throws ParseException {
//@debug
! //System.out.print("TRANSFORMING WEEK: " + String.valueOf(week));
Calendar c = Calendar.getInstance();
c.setTime(new Date());
- c.set(Calendar.WEEK_OF_YEAR, week);
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
// | S | M | T | W | T | F |
--- 240,261 ----
}
! public static String getStringDateFromWeek(String yearweek, boolean startDay)
throws ParseException {
//@debug
! //System.out.print("TRANSFORMING WEEK: " + week);
!
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
+ int week;
+ if(yearweek.length()<3) {
+ c.set(Calendar.WEEK_OF_YEAR, Integer.parseInt(yearweek));
+ }else if(yearweek.length()<6) {
+ c.set(Calendar.WEEK_OF_YEAR, Integer.parseInt(yearweek.substring(4,5)));
+ c.set(Calendar.YEAR, Integer.parseInt(yearweek.substring(0,4)));
+ }else {
+ c.set(Calendar.WEEK_OF_YEAR, Integer.parseInt(yearweek.substring(4,6)));
+ c.set(Calendar.YEAR, Integer.parseInt(yearweek.substring(0,4)));
+ }
// | S | M | T | W | T | F |
***************
*** 271,274 ****
--- 298,302 ----
return formatter.format(date);
}
+
}
|