Package devplugin

Examples of devplugin.Program


    for (ReminderListItem item : localItems) {
      if (item.getProgram().getProgramState() == Program.WAS_DELETED_STATE) {
        removedPrograms.add(item.getProgram());
      } else if (item.getProgram().getProgramState() == Program.WAS_UPDATED_STATE) {
        Program p = item.getProgram();
        add(Plugin.getPluginManager().getProgram(p.getDate(), p.getID()),
                item.getMinutes(), item.getReferenceCount());
      } else {
        synchronized (mList) {
          mList.add(item);
        }
View Full Code Here


              PluginTreeNode pNode = newNode.addProgramWithoutCheck(program);
              allPrograms.add(program);
              if (episodeOnly || progArr.length <= 10) {
                pNode.setNodeFormatter(new NodeFormatter() {
                  public String format(ProgramItem pitem) {
                    Program p = pitem.getProgram();
                    return FavoriteTreeModel.getFavoriteLabel(child.getFavorite(), p);
                  }
                });
              }
            }
View Full Code Here

    int minY = 0;
    int maxY = 0;
    int minSameTimeY = -1;
    long lastStartTime = 0;
   
    Program minProgram;
    ProgramPanel minPanel;
    do {
      // Find out the program with the lowest start time
      minProgram = null;
      minPanel = null;
      int programCol = 0;
      long minStartTime = Long.MAX_VALUE;
      for (int col = 0; col < columnCount; col++) {
        ProgramPanel panel = model.getProgramPanel(col, rowIdxArr[col]);
        if (panel != null) {
          Program program = panel.getProgram();
          if (program != null) {
            long startTime = (program.getDate().getValue()) * 10000
                + program.getStartTime();
           
            if (startTime < minStartTime) {
              // found earliest by now
              minStartTime = startTime;
              minProgram = program;
              minPanel = panel;
              programCol = col;
            }
          }
        }
      }

      // Layout the program
      if (minProgram != null) {
       
        int programRow = rowIdxArr[programCol];

        // Get the y position for the program
        int y = Math.max(minY, colYArr[programCol]);
        if (minStartTime == lastStartTime) {
          y = Math.max(minSameTimeY, colYArr[programCol]);
        }

        // Ensure that the start of the program is at the specified y
        if (programRow == 0) {
          // This is the first program of this column -> Set columnStartArr
          columnStartArr[programCol] = y;
        } else {
          // Adjust the last program of this column to reach the y position
          ProgramPanel lastPanel = model.getProgramPanel(programCol, programRow - 1);
          int height = lastPanel.getPreferredHeight();
          int heightDiff = y - colYArr[programCol];
          height += heightDiff;
          lastPanel.setHeight(height);
        }

        // Get the height for the program
        int preferredHeight = minPanel.getPreferredHeight();

        // Set the height for the program if it is the last of the row
        if (programRow + 1 == model.getRowCount(programCol)) {
          // It is the last row
          minPanel.setHeight(preferredHeight);
        }

        // Prepare the next iteration
        if (minStartTime != lastStartTime) {
          //minimum y for programs with same start time
          minSameTimeY = y;
        }
        minY = Math.max(y, minY);
        lastStartTime = minStartTime;
        colYArr[programCol] = y + preferredHeight;
        maxY = Math.max(maxY,colYArr[programCol]);
        rowIdxArr[programCol]++;
      }
    } while (minProgram != null);
   
    // expand last program of each column up to end of day (if it reaches end of day)
    for (int col = 0; col < columnCount; col++) {
      int count = model.getRowCount(col);
     
      if(count > 0) {
        ProgramPanel panel = model.getProgramPanel(col, count-1);
        Program program = panel.getProgram();
        if (program.getStartTime() <= Settings.propProgramTableEndOfDay.getInt() && program.getStartTime() + program.getLength() >= Settings.propProgramTableEndOfDay.getInt()) {
          panel.setHeight(maxY - colYArr[col] + panel.getHeight());
        }
      }
    }
   
View Full Code Here

    // We search backwards, because the data may come already ordered. And if
    // this is the case we only have to compare once.
    int addIdx;
    int time = program.getStartTime();
    for (addIdx = mProgramList.size(); addIdx > 0; addIdx--) {
      Program cmp = mProgramList.get(addIdx - 1);
      int cmpTime = cmp.getStartTime();
       
    if (program.getDate().compareTo(cmp.getDate())>0) {
        break; // insert here
      }
      else if (program.getDate().compareTo(cmp.getDate())<0) {
        continue;
      }
   
      if (cmpTime == time) {
        // We already have this program
View Full Code Here

  public boolean isComplete() {
    int size = mProgramList.size();
    if (size == 0) {
      return false;
    } else {
      Program lastProgram = mProgramList.get(size - 1);
      int endTime = lastProgram.getHours() * 60 + lastProgram.getMinutes()
        + lastProgram.getLength();

      return endTime >= (23 * 60);
    }
  }
View Full Code Here

    }
    if (!getChannel().equals(dayProgram.getChannel())) {
      return false;
    }
    for (int i = 0; i < getProgramCount(); i++) {
      Program program = getProgramAt(i);
      Program otherProgram = dayProgram.getProgramAt(i);
      if (program instanceof MutableProgram && otherProgram instanceof MutableProgram) {
        if (!((MutableProgram) program).equalsAllFields((MutableProgram) otherProgram)) {
          return false;
        }
      }
View Full Code Here

              && mFilter.equals(Plugin.getPluginManager().getFilterManager().getAllFilter()) ? 2 : 28;
          for (int d = 0; d < maxDays; d++) {
            if (Plugin.getPluginManager().isDataAvailable(date)) {
              for (Channel channel : channels) {
                for (Iterator<Program> it = Plugin.getPluginManager().getChannelDayProgram(date, channel); it.hasNext();) {
                  Program program = it.next();
                  if ((showExpired || !program.isExpired()) && mFilter.accept(program)) {
                    if (mFilter.equals(Plugin.getPluginManager().getFilterManager().getAllFilter())) {
                      if ((d == 0 && program.getStartTime() >= startTime)
                          || (d == 1 && program.getStartTime() <= endTime)) {
                        mPrograms.add(program);
                      }
                    } else {
                      mPrograms.add(program);
                    }
                  }
                }
              }
            }
            date = date.addDays(1);
          }

          if (channels.length > 1) {
            Collections.sort(mPrograms, ProgramUtilities.getProgramComparator());
          }

          int index = -1;

          for (Program program : mPrograms) {
            if (mModel.size() < MAX_PROGRAMS_SHOWN) {
              mModel.addElement(program);

              if (!program.isExpired() && index == -1) {
                index = mModel.getSize() - 1;
              }
            }
          }
          int forceScrollingIndex = mModel.size() - 1;
View Full Code Here

      return channelLabel;
    } else if (value instanceof Program) {
      int index = column - 1;

      Program program = (Program) value;

      mProgramPanel[row][index] = new ProgramPanel(program, new ProgramPanelSettings(ListViewPlugin.getInstance().getPictureSettings(),false, ProgramPanelSettings.X_AXIS));

      JPanel rpanel = new JPanel(new BorderLayout());
      rpanel.add(mProgramPanel[row][index], BorderLayout.CENTER);
View Full Code Here

     */
    public void addToAllPrograms() {
        ListTableModel model = (ListTableModel) getModel();

        for (int i = 0; i < model.getRowCount(); i++) {
            Program prg = model.getProgram(i);
            if (prg != null) {
                prg.addChangeListener(this);
                mPrograms.add(prg);
            }

            prg = model.getNextProgram(i);
            if (prg != null) {
                prg.addChangeListener(this);
                mPrograms.add(prg);
            }
        }
    }
View Full Code Here

            for (int v = 0; v < progCount; v++) {
              Date programDate = Date.readData(in);
              String progId = (String) in.readObject();
              if (programs != null) {
                Program program = Plugin.getPluginManager().getProgram(programDate, progId);
                programs.add(program);
              }
            }
          }
View Full Code Here

TOP

Related Classes of devplugin.Program

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.