package kakibeans;
import java.util.*;
import java.sql.*;
import kotkabeans.*;
/**
*
Title: PlannedGroup
* Description: A group included in study plan.
* Group can contain children, groups and courses.
*
* Copyright: Copyright (c) Kuikka-team GPL 2004
* Company: University of Jyväskylä
* Created: 19.4.2004
* @author Sami Kosonen
* @version 1.0
*/
public class PlannedGroup
implements StudyPlanAbility {
// Constants
// Attributes
// Constructors
// Print methods
/**
* Prints this element in StringBuffer.
* @param buff the StringBuffer where to print
* @param s element to be printed
*/
public void printSelf(StringBuffer buff, StudyPlanElement s) {
buff.append("
"
+
(s.getDepth() == 0 ? "" : "")
+ s.getName()
+ (s.getDepth() == 0 ? "" : "") + " | "
+ s.getMinCredits() + " | "
+ s.getBeginYear() + " ");
ComboTerm.printAsText(buff, s.getBeginTime());
buff.append(" | "
+ s.getEndYear() + " ");
ComboTerm.printAsText(buff, s.getEndTime());
buff.append(" | "
+
time.monthToOutFormat( ( (s.getCompletedAt()).toString()).
substring(0, 10))
+ " | " + s.getGrade() +
" | " +
s.getUser().T("Perustelut")
+ " |
");
}
/**
* Prints this element and all the children recursively.
* @param buff Buffer to print
* @param s element to be printed
*/
public void printRecursive(StringBuffer buff, StudyPlanElement s) {
s.getAbility().printSelf(buff, s);
Iterator i = s.iterator();
while (i.hasNext()) {
StudyPlanElement element = (StudyPlanElement) i.next();
//Check that element is part of the study plan
if (element.getPlanned() != null) {
element.printRecursive(buff);
}
}
}
/**
* Prints this element in StringBuffer.
* @param buff the StringBuffer where to print
* @param s element to be printed
*/
public void printSelfModify(StringBuffer buff, StudyPlanElement s) {
buff.append("");
//Node is open
if (s.getOpen()) {
//CheckBox box = new CheckBox(""+s.getName() + " "
// + "[Lisää muuta]","planned",""+s.getUnitID(),true);
//buff.append(box.printSelf());
//LETS USE ICON INSTEAD OF CHeCKBOX
buff.append("");
buff.append( (s.getDepth() == 0 ? "" :
"") + " " +
s.getName() + " " + "[Lisää muuta]"
+ (s.getDepth() == 0 ? "" : ""));
}
//Node is closed
else {
//CheckBox box2 = new CheckBox(""+s.getName()+"","planned",""+s.getStudyGroupID(),true);
//buff.append(box2.printSelf());
buff.append("");
buff.append(" " + s.getName() + "");
}
//Rest of the printing is same in both cases
buff.append(" | " + s.getMinCredits() + " | ");
ComboYear.print(buff, StudyPlanElement.BEGINCOMBOYEAR + s.getStudyGroupID(),
s.getBeginYear());
//s.getBeginTime().getYear());
ComboTerm.print(buff, s.getUser(),
StudyPlanElement.BEGINCOMBOTERM + s.getStudyGroupID(),
s.getBeginTime());
buff.append(" | ");
ComboYear.print(buff, StudyPlanElement.ENDCOMBOYEAR + s.getStudyGroupID(),
s.getEndYear());
//s.getEndTime().getYear());
ComboTerm.print(buff, s.getUser(),
StudyPlanElement.ENDCOMBOTERM + s.getStudyGroupID(),
s.getEndTime());
buff.append(" | " +
s.getUser().T("Perustelut")
+ " |
\n");
}
/**
* Prints this element and all the children recursively.
* @param buff Buffer to print
* @param s element to be printed
*/
public void printRecursiveModify(StringBuffer buff, StudyPlanElement s) {
s.getAbility().printSelfModify(buff, s);
if (s.getOpen() == false)
return;
Iterator i = s.iterator();
while (i.hasNext()) {
( (StudyPlanElement) i.next()).printRecursiveModify(buff);
}
}
}