Package util.ui

Examples of util.ui.ProgramPanel


      remainingMinutesMax = Math.max(remainingMinutesMax, remainingMinutes);

      List<JComponent> componentList = new ArrayList<JComponent>();
      mComponents.put(reminder, componentList);

      final ProgramPanel panel = new ProgramPanel(program,
          new ProgramPanelSettings(new PluginPictureSettings(
              PluginPictureSettings.ALL_PLUGINS_SETTINGS_TYPE), false,
              ProgramPanelSettings.X_AXIS));
      componentList.add(panel);
      panels.add(panel);
      panel.setMinimumSize(new Dimension(300,50));
      panel.setWidth(300);
      // register panel with tooltip manager
      panel.setToolTipText("");
      panel.addPluginContextMenuMouseListener(ReminderPluginProxy
          .getInstance());

      final JPanel channelPanel = new JPanel(new BorderLayout());
      componentList.add(channelPanel);
      if (program.getLength() > 0) {
View Full Code Here


    int[] columnHeightArr = new int[columnCount];
   
    for (int col = 0; col < columnCount; col++) {
      int rowCount = model.getRowCount(col);
      for (int row = 0; row < rowCount; row++) {
        ProgramPanel panel = model.getProgramPanel(col, row);
        columnHeightArr[col] += panel.getPreferredHeight();
        panel.setHeight(panel.getPreferredHeight());
      }
    }
   
    // Set the column starts
    setColumnStarts(columnStartArr);
View Full Code Here

      return new Point(-1, -1);
    }

    int rowCount = mModel.getRowCount(col);
    for (int row = 0; row < rowCount; row++) {
      ProgramPanel panel = mModel.getProgramPanel(col, row);
      currY += panel.getHeight();
      if (pointY < currY) {
        return new Point(col, row);
      }
    }
View Full Code Here

  public void selectProgram(Program program) {
    int columnCount = mModel.getColumnCount();
    for (int col = 0; col < columnCount; col++) {
      int rowCount = mModel.getRowCount(col);
      for (int row = 0; row < rowCount; row++) {
        ProgramPanel panel = mModel.getProgramPanel(col, row);
        if (panel.getProgram().equals(program)) {
          mCurrentCol = col;
          mCurrentRow = row;
          repaintCurrentCell();
          return;
        }
View Full Code Here

    ProgramTableModel model = getModel();
    int cols = model.getColumnCount();
    for (int c = 0; c < cols; c++) {
      int rows = model.getRowCount(c);
      for (int r = 0; r < rows; r++) {
        ProgramPanel programPanel = model.getProgramPanel(c, r);
        programPanel.programHasChanged();
      }
    }
    repaint();
  }
View Full Code Here

  @Override
  public String getToolTipText(MouseEvent event) {
    Point mousePoint = event.getPoint();
    Point panelIndex = getMatrix(mousePoint.x, mousePoint.y);
    if (panelIndex.x != -1) {
      ProgramPanel panel = mModel.getProgramPanel(panelIndex.x, panelIndex.y);

      // calculate relative mouse coordinates
      int currY = mLayout.getColumnStart(panelIndex.x);
      for (int row = 0; row < panelIndex.y; row++) {
        currY += mModel.getProgramPanel(panelIndex.x, row).getHeight();
      }
      final int panelX = mousePoint.x - panelIndex.x * mColumnWidth;
      final int panelY = mousePoint.y - currY;
      StringBuilder buffer = new StringBuilder();
      String tooltip = panel.getToolTipText(panelX, panelY);
      if (tooltip != null && tooltip.length() > 0) {
        buffer.append(tooltip);
      }

      // if program is partially not visible then show the title as tooltip
      final JViewport viewport = MainFrame.getInstance()
          .getProgramTableScrollPane().getViewport();
      Point viewPos = viewport.getViewPosition();
      Dimension viewSize = viewport.getSize();
      final Program program = panel.getProgram();
      if ((currY < viewPos.y)
          || (panelIndex.x * mColumnWidth + panel.getTitleX() < viewPos.x)
          || ((panelIndex.x + 1) * mColumnWidth - 1 > viewPos.x
              + viewSize.width)) {
        if (buffer.indexOf(program.getTitle()) < 0) {
          appendTooltip(buffer, program.getTitle());
        }
      }

      // show end time if start time of next
      // shown program is not end of current program
      ProgramPanel nextPanel = mModel.getProgramPanel(panelIndex.x,
          panelIndex.y + 1);

      boolean showTime = (nextPanel == null && program.getLength() > 0);
      if (nextPanel != null) {
        int length = program.getLength();
        int nextStartTime = nextPanel.getProgram().getStartTime();
        if (nextStartTime < program.getStartTime()) {
          nextStartTime += 24 * 60;
        }
        if ((length > 0)
            && (program.getStartTime() + length + 1 < nextStartTime)) {
View Full Code Here

        int height = 0;
        int rowCount = model.getRowCount(column);
        for(int row = lastRow[column]; row < rowCount; row++) {
          lastRow[column] = row;
         
          ProgramPanel panel = model.getProgramPanel(column,row);
         
          int startTime = panel.getProgram().getStartTime();
          if(panel.getProgram().getDate().equals(nextProgramTableDate)) {
            startTime += 24 * 60;
          }
         
          if((startTime >= block * blockSize) && (startTime < (block+1) * blockSize)) {
            blockProgramList[column].add(panel);
            // reset the preferred height of the panel
            panel.setHeight(-1);
           
            height += mCompactLayout && (!mOptimizedCompactLayout || !panel.getProgram().isOnAir()) ? panel.getMinimumHeight() : panel.getPreferredHeight();
           
            if(height > maxHeight) {
              maxHeight = height;
            }
          }
          else {
            break;
          }
        }
       
        minimumBlockHeight[column] = height;
      }

      // increase overall height by block height
      int blockStart = blockEnd;
      blockEnd += maxHeight;
     
      for(int col = 0; col < columnCount; col++) {
        // first correct the last panel of this column to make it full size
        if(lastLayoutComponentList[col] != null) {
          lastLayoutComponentList[col].getPanel().setHeight(blockStart - lastLayoutComponentList[col].getPrePosition());
        }

        // set all panels in this block to preferred size
        ArrayList<ProgramPanel> list = blockProgramList[col];
        if(!list.isEmpty()) {
          if(list.get(0).equals(model.getProgramPanel(col,0))) {
            columnStartArr[col] = blockStart;
          }
         
          int internHeight = blockStart;
          int internLastHeight = internHeight;

          int additionalHeight = 0;
          int additionalHeight2 = 0;
         
          if(mOptimizedCompactLayout) {
            additionalHeight = (blockEnd - blockStart - minimumBlockHeight[col]) / list.size();
           
            int additionalCount = 0;
            int preferredSizeHeights = 0;
            int minimumSizeHeights = 0;
           
            for(int i = 0; i < list.size(); i++) {
              ProgramPanel panel = list.get(i);
             
              if(panel.getPreferredHeight() < (panel.getMinimumHeight() + additionalHeight) || panel.getProgram().isOnAir()) {
                preferredSizeHeights += panel.getPreferredHeight();
              }
              else {
                additionalCount++;
                minimumSizeHeights += panel.getMinimumHeight();
              }
            }
           
            if(additionalCount != 0) {
              additionalHeight2 = (blockEnd - blockStart - preferredSizeHeights - minimumSizeHeights) / additionalCount;
            }
          }
         
          for(int i = 0; i < list.size(); i++) {
            ProgramPanel panel = list.get(i);
           
            if(mCompactLayout && !mOptimizedCompactLayout) {
              panel.setHeight(panel.getMinimumHeight());
            }
            else if(!mOptimizedCompactLayout || (panel.getMinimumHeight() + additionalHeight > panel.getPreferredHeight() || panel.getProgram().isOnAir())) {
              panel.setHeight(panel.getPreferredHeight());
            }
            else {
              panel.setHeight(panel.getMinimumHeight() + additionalHeight2);
            }
           
            internLastHeight = internHeight;
            internHeight += panel.getHeight();
          }
         
          lastLayoutComponentList[col] = new LastLayoutComponent(list.get(list.size()-1),internLastHeight);
        }
      }
View Full Code Here

   
    int maxColHeight = 0;
    for (int col = 0; col < columnCount; col++) {
      int rowCount = model.getRowCount(col);
      for (int row = 0; row < rowCount; row++) {
        ProgramPanel panel = model.getProgramPanel(col, row);
        columnHeightArr[col] += panel.getPreferredHeight();
      }
     
      maxColHeight = Math.max(columnHeightArr[col], maxColHeight);
    }
   
    // Adjust all columns so they have the same height
    for (int col = 0; col < columnCount; col++) {
      int rowCount = model.getRowCount(col);
      int difference = maxColHeight - columnHeightArr[col];
      for (int row = 0; row < rowCount; row++) {
        int remainingRows = rowCount - row;
        int yPlus = difference / remainingRows;

        ProgramPanel panel = model.getProgramPanel(col, row);
        int height = panel.getPreferredHeight();
       
        height += yPlus;
        difference -= yPlus;
       
        panel.setHeight(height);
      }
    }

    // Set the column starts
    setColumnStarts(columnStartArr);
View Full Code Here

    int minLength = 10000;
   
    for (int col = 0; col < columnCount; col++) {
      int rowCount = model.getRowCount(col);
    for (int row = 0; row < rowCount; row++) {
        ProgramPanel panel = model.getProgramPanel(col, row);
       
        if(panel.getProgram().getLength() > 0) {
          Program p = panel.getProgram();
          float scale = ((float)(panel.getMinimumHeight())) / p.getLength();
         
          if(scale > scaleValue && minLength >= p.getLength()) {
            scaleValue = scale;
            minLength = p.getLength();
          }
        }
      }
    }
   
    for (int col = 0; col < columnCount; col++) {
      int rowCount = model.getRowCount(col);
    for (int row = 0; row < rowCount; row++) {
        ProgramPanel panel = model.getProgramPanel(col, row);
        Program program = panel.getProgram();
       
        if (row == 0) {
          if(model.getDate().compareTo(program.getDate()) < 0) {
            columnStartArr[col] = (int)((program.getStartTime() + 24 * 60)* scaleValue);
          }
          else {
            columnStartArr[col] = (int)(program.getStartTime() * scaleValue);
          }
        }
       
        if(row != rowCount - 1) {
          Program next = model.getProgramPanel(col, row + 1).getProgram();
          int startTime = program.getStartTime();
          int endTime = next.getStartTime();
          if (endTime < startTime) {
            // The program ends the next day
            endTime += 24 * 60;
          }
         
          int length = endTime - startTime;
         
          panel.setHeight((int)(length * scaleValue));
        } else {
          panel.setHeight(panel.getProgram().getLength() > 0 ? (int)(panel.getProgram().getLength() * scaleValue) : panel.getPreferredHeight());
        }
      }
    }

    // Set the column starts
View Full Code Here

      fillImage(grp, x, 0, columnWidth, y, getOuterBackgroundImage(), clipBounds);
     
      int rowCount = model.getRowCount(col);
    for (int row = 0; row < rowCount; row++) {
        // Get the program
        ProgramPanel panel = model.getProgramPanel(col, row);
       
        // Render the program
        if (panel != null) {
          int cellHeight = panel.getHeight();

          Image backImg = getBackgroundImageFor(panel.getProgram());
          fillImage(grp, x, y, columnWidth, cellHeight, backImg, clipBounds);
         
          // Move to the next row in this column
          y += cellHeight;
        }
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.