Package util.ui

Examples of util.ui.ProgramPanel


    int columnCount = model.getColumnCount();
    for (int col = 0; col < columnCount; col++) {
      int y = layout.getColumnStart(col);
      int rowCount = model.getRowCount(col);
      for (int row = 0; row < rowCount; row++) {
        ProgramPanel panel = model.getProgramPanel(col, row);
        if (panel != null) {
          Program prog = panel.getProgram();
          int startTime = prog.getStartTime();
          if (!mainDate.equals(prog.getDate())) {
            startTime += 24 * 60;
          }

          // Go to the block of this program
          int blockIndex = startTime / (mBlockSize * 60);
          TimeBlock block = blocks[blockIndex];

          // Check whether the y of the program is lower than the one of the
          // block
          int blockY = block.mStartY;
          if ((blockY == -1) || (y < blockY)) {
            block.mStartY = y;
          }

          y += panel.getHeight();
        }
      }
    }

    // Remove the blocks that have no y
View Full Code Here


          // program starts before given end time
          if (compareDateTime(progDate, progTime, toDate, toMinutes) <= 0) {
            // program starts after or at given end time
            if (compareDateTime(progDate, progTime, fromDate, fromMinutes) >= 0)  {
              if (filterAccepts(prog)) {
                ProgramPanel panel = new ProgramPanel(prog);
                mProgramColumn[col].add(panel);
              }
            }
            else {
              // add the last program _before_ the day start time which is still running afterwards
              if (mProgramColumn[col].isEmpty()) {
                if (compareDateTime(progDate, progTime + prog.getLength(), fromDate, fromMinutes) > 0) {
                  if (filterAccepts(prog)) {
                    ProgramPanel panel = new ProgramPanel(prog);
                    mProgramColumn[col].add(panel);
                  }
                }
              }
            }
View Full Code Here

  private void deregisterFromPrograms(ArrayList<ProgramPanel>[] columns) {
    for (ArrayList<ProgramPanel> list : columns) {
      Iterator<ProgramPanel> it=list.iterator();
      while (it.hasNext()) {
        ProgramPanel panel = it.next();
        Program prog = panel.getProgram();
        prog.removeChangeListener(this);
      }
    }
  }
View Full Code Here

  private void registerAtPrograms(ArrayList<ProgramPanel>[] columns) {
    for (ArrayList<ProgramPanel> list : columns) {
      Iterator<ProgramPanel> it=list.iterator();
      while (it.hasNext()) {
        ProgramPanel panel = it.next();
        Program prog = panel.getProgram();
        prog.addChangeListener(this);
      }
    }
  }
View Full Code Here

    mOnAirRows = new int[columnCount];
      Arrays.fill(mOnAirRows, -1);
      for (int col = 0; col < columnCount; col++) {
        int rowCount = getRowCount(col);
    for (int row = 0; row < rowCount; row++) {
          ProgramPanel panel = getProgramPanel(col, row);
          if (panel.getProgram().isOnAir()) {
            mOnAirRows[col] = row;
            fireTableCellUpdated(col, row);
          }
        }
      }
    }
    else {
      for (int col = 0; col < mOnAirRows.length; col++) {
        if(mOnAirRows[col] != -1) {
          ProgramPanel panel = getProgramPanel(col, mOnAirRows[col]);
         
          if(panel.getProgram().isOnAir()) {
            fireTableCellUpdated(col, mOnAirRows[col]);
          }
          else if(panel.getProgram().isExpired()){
            fireTableCellUpdated(col, mOnAirRows[col]);
           
            panel = getProgramPanel(col, mOnAirRows[col]+1);
           
            if(panel == null) {
View Full Code Here

    }
   
    int rowCount = getRowCount(col);
  // Get the row of this program
    for (int row = 0; row < rowCount; row++) {
      ProgramPanel panel = getProgramPanel(col, row);
      if (program == panel.getProgram()) {
        // Tell the panel that its program has changed
        panel.programHasChanged();
       
        // Fire the event
        fireTableCellUpdated(col, row);
        return;
      }
View Full Code Here

    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());
        }
      }
    }
   
    // Set the column starts
View Full Code Here

    } 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);

      mProgramPanel[row][index].setTextColor(label.getForeground());
View Full Code Here

        if (value != null) {
          Component renderComp = getCellRenderer(row, column).getTableCellRendererComponent(this, value, false, false, row, column);
          if (renderComp instanceof Container) {
            Container container = (Container) renderComp;
            if (container.getComponentCount() > 0 && container.getComponent(0) instanceof ProgramPanel) {
              ProgramPanel panel = (ProgramPanel) container.getComponent(0);
              Rectangle cellRect = getCellRect(row, column, true);
              int x = event.getX() - cellRect.x - panel.getX();
              int y = event.getY() - cellRect.y - panel.getY();
              return panel.getToolTipText(x, y);
            }
          }
        }
      }
      return null;
View Full Code Here

        int columnCount = model.getColumnCount();
    for (int col = 0; col < columnCount; col++) {
            int rowCount = model.getRowCount(col);
      for (int row = 0; row < rowCount; row++) {
                // Get the program
                ProgramPanel panel = model.getProgramPanel(col, row);
               
                array.add(panel.getProgram());
            }
        }
       
        Program[] prg = new Program[array.size()];
       
View Full Code Here

TOP

Related Classes of util.ui.ProgramPanel

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.