예제 #1
0
  public PlanViewPanel(
      PlannerUI plannerUI, StudentPlan plan, boolean showOptional, SchoolAdapter schoolAdapter) {
    _plannerUI = plannerUI;
    _plan = plan;
    _schoolAdapter = schoolAdapter;
    _showOptional = showOptional;

    _semesterPanels = new PlanViewSemesterPanel[_plan.years()][_plan.semesters(0)];
    for (int i = 0; i < _semesterPanels.length; i++)
      for (int j = 0; j < _semesterPanels[i].length; j++)
        _semesterPanels[i][j] = new PlanViewSemesterPanel(_plan, this, i, j);
    _semesterPanels[_selectedYear][_selectedSemester].setSelected(true);

    // monitorStudentPlan(_plan);

    draw();
  }
예제 #2
0
 public void draw() {
   removeAll();
   int numSemesters;
   if (_showOptional) numSemesters = _schoolAdapter.getSemesters().length;
   else {
     numSemesters = 0;
     for (int i = 0; i < _schoolAdapter.getSemesters().length; i++)
       if (_schoolAdapter.getRequiredSemesters()[i]) numSemesters++;
   }
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   for (int year = 0; year < _plan.years(); year++) {
     final JPanel yearPanel = new JPanel();
     yearPanel.setLayout(new GridLayout(1, numSemesters));
     // yearPanel.setPreferredSize(new Dimension(0, 200));
     for (int semester = 0; semester < numSemesters; semester++) {
       _semesterPanels[year][semester] = new PlanViewSemesterPanel(_plan, this, year, semester);
       yearPanel.add(_semesterPanels[year][semester]);
     }
     add(yearPanel);
   }
   _semesterPanels[_selectedYear][_selectedSemester].setSelected(true);
 }