Logo Search packages:      
Sourcecode: pcalendar version File versions  Download package

void net::sf::linuxorg::pcal::bbtgui::BBTWidget::generateHorizontalLabels ( int  bbtDaysCount ) [inline, private]
Parameters:
bbtDaysCount- if 0 - the days count is recalculated, otherwise, the table is set to fit specified days count

Definition at line 343 of file BBTWidget.java.

References net::sf::linuxorg::pcal::engine::Engine::getBBT(), net::sf::linuxorg::pcal::MainWindow::getDayColors(), net::sf::linuxorg::pcal::engine::Engine::getDayInfo(), net::sf::linuxorg::pcal::engine::Engine::isFileBBTCelsiusScale(), and resetTableColumns().

Referenced by getBBTWidget(), and refreshWidgets().

                                                              {
            // determine how many days can be displayed in the current widget
            if(bbtDaysCount == 0) {
                  bbtDaysCount = bbtScrollPane.getViewportBorderBounds().width / genericRowHeight;
            }

            datesList = new Date[bbtDaysCount];
            dateLabels = new String[bbtDaysCount];
            bbtPointRow = new int[bbtDaysCount];
            daysBGColors = new Color[bbtDaysCount];
            daysFGColors = new Color[bbtDaysCount];
            isOvulationFlag = new boolean[bbtDaysCount];

            if(bbtDaysCount>0) {
                  Calendar calendar = new GregorianCalendar();
                  calendar.setTime(bbtStartDate);

                  int lastRecordedMonthIndex = calendar.get(Calendar.MONTH); 
                  String monthsList = MainWindow.monthNames[lastRecordedMonthIndex];

                  String yearString = String.valueOf(calendar.get(Calendar.YEAR));
                  boolean celsiusScale = PCalendar.engine.isFileBBTCelsiusScale();

                  for(int i=0; i<bbtDaysCount; i++) {
                        datesList[i] = calendar.getTime();
                        dateLabels[i] = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH));

                        PCalDayInfo dayInfo = PCalendar.engine.getDayInfo(calendar.getTime());
                        Color[] dayColors = PCalendar.mainWindow.getDayColors(dayInfo);
                        daysBGColors[i] = dayColors[0];
                        daysFGColors[i] = dayColors[1];
                        isOvulationFlag[i] = (dayInfo == null)?false:dayInfo.ovulation;

                        // get the BBT records as well
                        int temperature = PCalendar.engine.getBBT(calendar.getTime());
                        if(temperature>0) {
                              bbtPointRow[i] = (celsiusScale?BBT_TEMPERATURE_MIN_C:BBT_TEMPERATURE_MIN_F) + 
                                          bbtTemperatureLevelsCount - temperature - 1;
                              if(bbtPointRow[i] > bbtTemperatureLevelsCount) bbtPointRow[i] = -1; 
                        } else {
                              bbtPointRow[i] = -1;
                        }

                        int currentDateMonthIndex = calendar.get(Calendar.MONTH);
                        if(lastRecordedMonthIndex != currentDateMonthIndex) {
                              monthsList+= Messages.getString("BBTWidget.8") + MainWindow.monthNames[currentDateMonthIndex]; //$NON-NLS-1$
                              lastRecordedMonthIndex = currentDateMonthIndex;
                        }
                        calendar.add(Calendar.DATE, 1);
                  }
                  currentMonthLabel.setText(yearString+Messages.getString("BBTWidget.9")+monthsList); //$NON-NLS-1$
                  bbtTableModel.fireTableStructureChanged();
                  resetTableColumns();
            }
      }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index