Package devplugin

Examples of devplugin.Date


    y = mShowName && ((mChannelName.getLineCount() & 1) == 1) ? temp : (menuItem.getHeight() - menuItem.getFont()
        .getSize())
        / 2 - 1 + menuItem.getFont().getSize();
    if (mShowDate) {
      g.setFont(menuItem.getFont().deriveFont(Font.BOLD));
      Date currentDate = Date.getCurrentDate();

      if (currentDate.equals(mProgram.getDate().addDays(1))) {
        g.drawString(Localizer.getLocalization(Localizer.I18N_YESTERDAY), x, y);
      } else if (currentDate.equals(mProgram.getDate())) {
        g.drawString(Localizer.getLocalization(Localizer.I18N_TODAY), x, y);
      } else if (currentDate.addDays(1).equals(mProgram.getDate())) {
        g.drawString(Localizer.getLocalization(Localizer.I18N_TOMORROW), x, y);
      } else {
        g.drawString(mProgram.getDateString(), x, y);
      }
      x += ProgramMenuItem.DATE_WIDTH;
View Full Code Here


    mLayout = new FormLayout("pref:grow,3dlu,pref","pref,3dlu");
    final PanelBuilder programsPanel = new PanelBuilder(mLayout);
    CellConstraints cc = new CellConstraints();

    final Date today = Date.getCurrentDate();
    programsPanel.add(mHeader = new JLabel(""), cc.xyw(1, 1, 3));
    programsPanel.setRow(3);
    int remainingMinutesMax = 0;

    ArrayList<ProgramPanel> panels = new ArrayList<ProgramPanel>(reminders.size());

    for (ReminderListItem reminder : reminders) {
      Program program = reminder.getProgram();
      mGlobalReminderList.blockProgram(program);
      // text label
      String msg;
      final int progMinutesAfterMidnight = program.getStartTime();
      int remainingMinutes = 0;
      if (today.compareTo(program.getDate()) >= 0
          && IOUtilities.getMinutesAfterMidnight() > progMinutesAfterMidnight) {
        msg = updateRunningTime();
      } else {
        msg = mLocalizer.msg("soonStarts", "Soon starts");
        remainingMinutes = ReminderPlugin.getTimeToProgramStart(program);
View Full Code Here

  }
 
  /** {@inheritDoc} */
  public Program getProgram(String uniqueID) {
    String[] id = uniqueID.split("_");
    Date progDate;
    try {
      java.util.Date date = new SimpleDateFormat(MutableProgram.ID_DATE_FORMAT).parse(id[4]);
      Calendar cal = Calendar.getInstance();
      cal.setTimeInMillis(date.getTime());
      progDate = new Date(cal);
    } catch (ParseException e) {
      mLog.severe("Couldn't parse date from unique ID");
      return null;
    }
   
View Full Code Here

    mOnAirRowProgramsArr = null;
  }

  private void handleTimerEvent() {
    checkAutomaticGotoNow();
    Date date = Date.getCurrentDate();

    if(mLastTimerMinutesAfterMidnight == -1) {
      resetOnAirArrays();
      mAutoDownloadTimer = RandomUtils.nextInt(24 * 60 - 10);
    }

    // Avoid a repaint 6 times a minute (Once a minute is enough)
    try {
      int minutesAfterMidnight = IOUtilities.getMinutesAfterMidnight();
      boolean onAirChanged = false;
      if (minutesAfterMidnight != mLastTimerMinutesAfterMidnight && (downloadingThread == null || !downloadingThread.isAlive())) {
        mLastTimerMinutesAfterMidnight = minutesAfterMidnight;
        Channel[] ch = ChannelList.getSubscribedChannels();

        if(ch != null) {
          /* If no date array is available we have to find
           * the on air programs */
          if(mChannelDateArr == null) {
            onAirChanged = true;
            fillOnAirArrays(ch);
          }
          else {
            /* We have a date array and can test the programs */
            for(int i = 0; i < mChannelDateArr.length; i++) {
              if(mChannelDateArr[i] != null) {
                ChannelDayProgram chProg = TvDataBase.getInstance().getDayProgram(mChannelDateArr[i],ch[i]);

                if(chProg != null && chProg.getProgramCount() > 0 && mOnAirRowProgramsArr[i] != -1) {
                  if (mOnAirRowProgramsArr[i] >= chProg.getProgramCount()) {
                    fillOnAirArrays(ch);
                    mLog.warning("Reset of on-air-arrays");
                  }
                  Program p = chProg.getProgramAt(mOnAirRowProgramsArr[i]);

                  if(p.isOnAir()) {
                    p.validateMarking();
                  } else if(p.isExpired()) {
                    onAirChanged = true;
                    p.validateMarking();

                    int n = mOnAirRowProgramsArr[i]+1;

                    if(n < chProg.getProgramCount()) {
                      mOnAirRowProgramsArr[i] = n;
                      chProg.getProgramAt(mOnAirRowProgramsArr[i]).validateMarking();
                    }
                    else {
                      /* The last day program is expired so we have to
                       * look for the on air program on the next day */
                      mChannelDateArr[i] = mChannelDateArr[i].addDays(1);

                      chProg = TvDataBase.getInstance().getDayProgram(mChannelDateArr[i],ch[i]);

                      // The next day has no data
                      if(chProg == null || chProg.getProgramCount() < 1) {
                        mOnAirRowProgramsArr[i] = -1;
                      } else {
                        mOnAirRowProgramsArr[i] = 0;
                        chProg.getProgramAt(mOnAirRowProgramsArr[i]).validateMarking();
                      }
                    }
                  }
                }
                else if(mChannelDateArr[i].compareTo(Date.getCurrentDate()) < 0) {
                  /* If the date array for the channel contains a date
                   * earlier than today we have to use today instead */
                  mChannelDateArr[i] = Date.getCurrentDate();
                  onAirChanged = true;

                  chProg = TvDataBase.getInstance().getDayProgram(mChannelDateArr[i],ch[i]);

                  if(chProg != null && chProg.getProgramCount() > 0) {
                    mOnAirRowProgramsArr[i] = 0;
                    chProg.getProgramAt(mOnAirRowProgramsArr[i]).validateMarking();
                  }
                }
              }
            }
          }
        }
      }

      if (onAirChanged) {
        if(Settings.propTableLayout.getString().equals(Settings.LAYOUT_OPTIMIZED_COMPACT_TIME_BLOCK)) {
          mProgramTableScrollPane.getProgramTable().updateLayout();
        }

        // update filtered view if the "on air" condition changed for any program
        if(!getProgramFilter().equals(FilterManagerImpl.getInstance().getDefaultFilter())) {
          setProgramFilter(getProgramFilter());
        }
      }
    }catch(Exception e) {}

    if (mPluginView != null) {
      mPluginView.repaint();
    }

    if ((mLastAutoUpdateRun + Settings.propDataServiceAutoUpdateTime.getInt() * 60000L) <= System.currentTimeMillis() && !TvDataUpdater.getInstance().isDownloading()) {
      runAutoUpdate();
    }

    if(Settings.propAutoDataDownloadEnabled.getBoolean() && (mAutoDownloadTimer < IOUtilities.getMinutesAfterMidnight() || !date.equals(mCurrentDay)) && mAutoDownloadTimer != -1 && (downloadingThread == null || !downloadingThread.isAlive())) {
      TVBrowser.handleAutomaticDownload();
      mAutoDownloadTimer = -1;
    }

    if (date.equals(mCurrentDay)) {
      return;
    }

    if(mCurrentDay != null) {
      if(mProgramTableModel.getDate().compareTo(Date.getCurrentDate().addDays(-1)) < 0) {
View Full Code Here

    mChannelDateArr = new Date[ch.length];
    mOnAirRowProgramsArr = new int[ch.length];

    Arrays.fill(mOnAirRowProgramsArr, -1);

    Date currentDate = Date.getCurrentDate();
    for(int i = 0; i < ch.length; i++) {
      ChannelDayProgram chProg = TvDataBase.getInstance().getDayProgram(currentDate,ch[i]);

      if(chProg == null) {
        mChannelDateArr[i] = null;
      } else {
        int n = chProg.getProgramCount();

        for(int j = 0; j < n; j++) {
          Program p = chProg.getProgramAt(j);
          if(p.isOnAir() || !p.isExpired()) {
            p.validateMarking();
            mOnAirRowProgramsArr[i] = j;
            mChannelDateArr[i] = currentDate;
            break;
          }
        }

        if(mOnAirRowProgramsArr[i] == -1) {
          chProg = TvDataBase.getInstance().getDayProgram(currentDate.addDays(1),ch[i]);

          if(chProg != null && chProg.getProgramCount() > 0 && chProg.getProgramAt(0).isOnAir()) {
            chProg.getProgramAt(0).validateMarking();
            mOnAirRowProgramsArr[i] = 0;
          }

          mChannelDateArr[i] = currentDate.addDays(1);
        }
      }
    }
  }
View Full Code Here

    mConfigAssistantDialog.dispose();
    mConfigAssistantDialog = null;

    Settings.handleChangedSettings();

    boolean dataAvailable = TvDataBase.getInstance().dataAvailable(new Date());

    if (!dataAvailable) {
      askForDataUpdateNoDataAvailable();
    }
  }
View Full Code Here

  private void onDownloadStart() {
    mAutoDownloadTimer = -1;
    TVBrowserActions.update.setUpdating(true);

    if(!Settings.propPluginInfoDialogWasShown.getBoolean()) {
      Date compareDate = Settings.propFirstStartDate.getDate().addDays((int)(Math.random() * 4 + 3));

      if(compareDate.compareTo(Date.getCurrentDate()) <= 0) {
        showPluginInfoDlg();
        Settings.propPluginInfoDialogWasShown.setBoolean(true);
      }
    }

View Full Code Here

      ScrollableMenu menu = new SelectFilterPopup(MainFrame.getInstance());
      popup = menu.getPopupMenu();
    } else if (item == mGoToDateAction) {
      popup = new JPopupMenu();

      Date curDate = Date.getCurrentDate().addDays(-1);

      if(TvDataBase.getInstance().dataAvailable(curDate)) {
        popup.add(createDateMenuItem(curDate));
      }

      curDate = curDate.addDays(1);

      Date maxDate = TvDataBase.getInstance().getMaxSupportedDate();
      while (maxDate.getNumberOfDaysSince(curDate) >= 0) {
        if(!TvDataBase.getInstance().dataAvailable(curDate)) {
          break;
        }
        if (curDate.isFirstDayOfWeek()) {
          popup.addSeparator();
View Full Code Here

    Channel[] ch = settings.getChannelList();
    mListingsTab.setChannels(ch);
    int start = settings.getDayStartHour();
    int end = settings.getDayEndHour();
    mListingsTab.setTimeRange(start, end);
    Date from = settings.getFromDay();
    mListingsTab.setDateFrom(from);
    mListingsTab.setDayCount(settings.getNumberOfDays());
    mLayoutTab.setColumnLayout(settings.getColumnCount(), settings.getChannelsPerColumn());
    mExtrasTab.setProgramIconSettings(settings.getProgramIconSettings());
  }
View Full Code Here

    this("", "");
  }

  @Override
  public boolean accept(final Program program) {
    final Date progDate = program.getDate();
    Date currentDate = Date.getCurrentDate();
    Date mStartDate = currentDate.addDays(mStartDays);
    Date mEndDate = currentDate.addDays(mEndDays);
    return mStartDate.compareTo(progDate) <= 0
        && progDate.compareTo(mEndDate) <= 0;
  }
View Full Code Here

TOP

Related Classes of devplugin.Date

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.