Package util.ui

Examples of util.ui.ScrollableMenu$ScrollUpOrDownButtonItem$MyMouseListener


        .getValue(ToolBar.ACTION_VALUE);

    JPopupMenu popup = null;

    if (item == mFilterAction) {
      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();
        }

        popup.add(createDateMenuItem(curDate));
        curDate = curDate.addDays(1);
      }
    } else if (item == mScrollToChannelAction) {
      ScrollableMenu menu = new ScrollableMenu();
      popup = menu.getPopupMenu();

      Channel[] channels = Settings.propSubscribedChannels.getChannelArray();
      for (Channel channel : channels) {
        menu.add(createChannelMenuItem(channel, btn));
      }
    } else if (item == mScrollToTimeAction) {
      popup = new JPopupMenu();

      int[] array = Settings.propTimeButtons.getIntArray();
View Full Code Here


    mGotoDateMenu = createMenu("menuitem.date", "date");
    mGotoDateMenu.setIcon(IconLoader.getInstance().getIconFromTheme("apps",
        "office-calendar", 16));

    mGotoChannelMenu = new ScrollableMenu(Localizer
        .getLocalization(Localizer.I18N_CHANNEL));
    mGotoChannelMenu.setIcon(IconLoader.getInstance().getIconFromTheme(
        "actions", "scroll-to-channel", 16));
    mGotoTimeMenu = createMenu("menuitem.time", "time");
    mGotoTimeMenu.setIcon(IconLoader.getInstance().getIconFromTheme("actions",
View Full Code Here

    return createMenuItem(localizerKey, defaultLabel, icon, false);
  }

  protected JMenu createScrollableMenu(final String localizerKey,
       final String defaultLabel) {
    ScrollableMenu menu = new ScrollableMenu();
     setLabelAndAccessKeys(localizerKey, defaultLabel, menu, false);
     return menu;
  }
View Full Code Here

      JComponent subMenu;

      // Put the programs in a sub menu?
      if (Settings.propTrayNowProgramsInSubMenu.getBoolean() && Settings.propTrayNowProgramsEnabled.getBoolean()) {
        subMenu = new ScrollableMenu(mLocalizer.msg("menu.programsNow", "Now running programs"));
      } else {
        subMenu = mTrayMenu;
      }

      ArrayList<ProgramMenuItem> programs = new ArrayList<ProgramMenuItem>();
      ArrayList<ProgramMenuItem> additional = new ArrayList<ProgramMenuItem>();
      ArrayList<ProgramMenuItem> nextPrograms = new ArrayList<ProgramMenuItem>();
      ArrayList<ProgramMenuItem> nextAdditionalPrograms = new ArrayList<ProgramMenuItem>();

      /*
       * Search through all channels.
       */
      Date currentDate = Date.getCurrentDate();
      for (Channel channel : channels) {
        ChannelDayProgram today = TvDataBase.getInstance().getDayProgram(currentDate, channel);

        if (today != null && today.getProgramCount() > 0) {
          final int programCount = today.getProgramCount();
          for (int j = 0; j < programCount; j++) {
            if (j == 0 && today.getProgramAt(j).getStartTime() > IOUtilities.getMinutesAfterMidnight()) {
              ChannelDayProgram yesterday = TvDataBase.getInstance().getDayProgram(currentDate.addDays(-1), channel);

              if (yesterday != null && yesterday.getProgramCount() > 0) {
                Program p = yesterday.getProgramAt(yesterday.getProgramCount() - 1);

                if (p.isOnAir()) {
                  addToNowRunning(p, programs, additional);
                  Program p1 = today.getProgramAt(0);
                  addToNext(p1, nextPrograms, nextAdditionalPrograms);
                  break;
                }
              }
            }

            Program p = today.getProgramAt(j);

            if (p.isOnAir()) {
              addToNowRunning(p, programs, additional);
              Program nextProgram = null;
              if (j < programCount - 1) {
                nextProgram = today.getProgramAt(j + 1);
              } else {
                ChannelDayProgram tomorrow = TvDataBase.getInstance().getDayProgram(currentDate.addDays(1), channel);
                if (tomorrow != null && tomorrow.getProgramCount() > 0) {
                  nextProgram = tomorrow.getProgramAt(0);
                }
              }
              if (nextProgram != null) {
                addToNext(nextProgram, nextPrograms, nextAdditionalPrograms);
              }

              break;
            }
          }
        }
      }

      // Show important programs?
      if (Settings.propTrayImportantProgramsEnabled.getBoolean()) {
        if (Settings.propTrayImportantProgramsInSubMenu.getBoolean()) {
          mTrayMenu.add(addToImportantMenu(new ScrollableMenu(mLocalizer.msg("menu.programsImportant",
              "Important programs")), programs));
        } else {
          addToImportantMenu(mTrayMenu, programs);
        }
      }

      /*
       * if there are running programs and they should be displayed add them to
       * the menu.
       */

      if (Settings.propTrayImportantProgramsEnabled.getBoolean()) {
        mTrayMenu.addSeparator();
      }

      boolean now = false;

      // filter duplicates from additional programs
      for (ProgramMenuItem addItem : additional) {
        boolean equal = false;
        for (ProgramMenuItem item : programs) {
          if (item.getProgram().equals(addItem.getProgram())) {
            equal = true;
            break;
          }
        }
        if (!equal) {
          programs.add(addItem);
        }
      }

      if (Settings.propTrayNowProgramsEnabled.getBoolean() && (programs.size() > 0 || additional.size() > 0)) {

        addMenuItems(subMenu, programs);

        now = true;

        if (subMenu instanceof JMenu) {
          addNoProgramsItem((JMenu) subMenu);
        }
      }

      if (Settings.propTrayNowProgramsInSubMenu.getBoolean() && Settings.propTrayNowProgramsEnabled.getBoolean()) {
        mTrayMenu.add(subMenu);
      }

      if (Settings.propTraySoonProgramsEnabled.getBoolean()
          && (!nextPrograms.isEmpty() || !nextAdditionalPrograms.isEmpty())) {

        final JMenu next = new ScrollableMenu(now ? mLocalizer.msg("menu.programsSoon", "Soon runs") : mLocalizer.msg(
            "menu.programsSoonAlone", "Soon runs"));

        addMenuItems(next, nextPrograms);
        addMenuItems(next, nextAdditionalPrograms);
        addNoProgramsItem(next);
View Full Code Here

      if (icon.getIconWidth() != 42 || icon.getIconHeight() != 22) {
        icon = new FixedSizeIcon(16, 16, icon);
      }
    }
    if (menu.hasSubItems()) {
      result = new ScrollableMenu(menu.getTitle());

      if (icon != null) {
        result.setIcon(icon);
      }
View Full Code Here

          ((JPopupMenu) time).addSeparator();
        }
      } else {
        final int fvalue = value;

        final JMenu menu = new ScrollableMenu(IOUtilities.timeToString(value) + " "
            + (mTime24 ? mLocalizer.msg("menu.time", "") : ""));

        if (value < IOUtilities.getMinutesAfterMidnight()) {
          menu.setText(menu.getText() + " " + mLocalizer.msg("menu.tomorrow", ""));
        }

        menu.addMenuListener(new MenuListener() {
          public void menuSelected(MenuEvent e) {
            createTimeProgramMenu(menu, fvalue);
          }

          public void menuCanceled(MenuEvent e) {
View Full Code Here

    if (menu == null) {
      return null;
    }
    JMenuItem result = null;
    if (menu.hasSubItems()) {
      result = new ScrollableMenu(menu.getAction());
      checkAndSetBackgroundColor(result);
      ActionMenu[] subItems = menu.getSubItems();
      for (ActionMenu subItem : subItems) {
        JMenuItem item = createMenuItem(subItem, setFont);
View Full Code Here

TOP

Related Classes of util.ui.ScrollableMenu$ScrollUpOrDownButtonItem$MyMouseListener

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.