Examples of IRadioItem


Examples of org.jampa.model.radio.IRadioItem

      columnRadioUrl.setText(Messages.getString("RadioPropertiesDialog.ColumnRadioUrl")); //$NON-NLS-1$
     
      radioListTable.setHeaderVisible(true);
     
      TableItem tableItem;
      IRadioItem item;
      Iterator<IRadioItem> radioIter = _item.getChildren().iterator();
      while (radioIter.hasNext()) {
        item = radioIter.next();
        tableItem = new TableItem(radioListTable, SWT.NONE);
        tableItem.setText(0, item.getName());
        tableItem.setText(1, ((RadioItem) item).getUrl());
      }     
    } else {
     
      panel.setLayoutData(mainGD);
View Full Code Here

Examples of org.jampa.model.radio.IRadioItem

    _rootCategory = rootCategory;
  }
 
  private void writeCategory(Document document, Element parentElement, List<IRadioItem> itemList) {
    if (itemList != null) {
      IRadioItem item;
     
      for (int i = 0; i < itemList.size(); i++) {
        item = itemList.get(i);
       
        try {
       
          if (item instanceof CategoryRadioItem) {
            Element categoryElement = document.createElement(RadioXmlConstants.CATEGORY_TAG);
            Element categoryNameElement = document.createElement(RadioXmlConstants.CATEGORY_NAME_TAG);
            categoryNameElement.setTextContent(URLEncoder.encode(item.getName(), "UTF-8"));
            categoryElement.appendChild(categoryNameElement);

            parentElement.appendChild(categoryElement);

            writeCategory(document, categoryElement, item.getChildren());

          } else if (item instanceof RadioItem) {
            Element radioElement = document.createElement(RadioXmlConstants.RADIO_TAG);
           
            radioElement.setAttribute(RadioXmlConstants.RADIO_IS_FAVORITE_ATTR, Boolean.toString(((RadioItem) item).isFavorite()));

            Element radioNameElement = document.createElement(RadioXmlConstants.RADIO_NAME_TAG);
            radioNameElement.setTextContent(URLEncoder.encode(item.getName(), "UTF-8"));

            Element radioUrlElement = document.createElement(RadioXmlConstants.RADIO_URL_TAG);
            radioUrlElement.setTextContent(URLEncoder.encode(((RadioItem) item).getUrl(), "UTF-8"));

            radioElement.appendChild(radioNameElement);
            radioElement.appendChild(radioUrlElement);

            parentElement.appendChild(radioElement);
          }
        } catch (UnsupportedEncodingException e) {
          Log.getInstance(RadioWriter.class).warn("Unable to encode value for item: " + item.getName());
        }
      }
    }
  }
View Full Code Here

Examples of org.jampa.model.radio.IRadioItem

   * Remove a radio from the radio list.
   * @param item The RadioItem to remove.
   */
  public void removeRadioItem(IRadioItem item) {
    if (item instanceof CategoryRadioItem) {
      IRadioItem categoryToRemove = _rootCategory.getChild(item.getName());
      if (categoryToRemove != null) {
        _rootCategory.getChildren().remove(categoryToRemove);
      }
    } else if (item instanceof RadioItem) {
      IRadioItem parentCategory = item.getParent();
      parentCategory.getChildren().remove(item);
    }
  }
View Full Code Here

Examples of org.jampa.model.radio.IRadioItem

   * Move a radio to another category.
   * @param item The radio to move.
   * @param newCategoryName The new category. Created if it does not exists.
   */
  public void changeItemCategory(IRadioItem item, String newCategoryName) {
    IRadioItem currentCategory = _rootCategory.getChild(item.getParent().getName());
   
    if (currentCategory != null) {
     
      currentCategory.getChildren().remove(item);
     
      IRadioItem newCategory = _rootCategory.getChild(newCategoryName);
      if (newCategory == null) {
        newCategory = new CategoryRadioItem(_rootCategory, newCategoryName);
        _rootCategory.add(newCategory);
      }
     
      item.setParent(newCategory);
      newCategory.getChildren().add(item);
    }
  }
View Full Code Here

Examples of org.jampa.model.radio.IRadioItem

     
      new MenuItem(playRadioMenu, SWT.SEPARATOR);
     
      Iterator<IRadioItem> categoryIter = Controller.getInstance().getRadioController().getRootCategory().getChildren(_onlyShowFavoritesRadio).iterator();
      while (categoryIter.hasNext()) {
        IRadioItem categoryItem = categoryIter.next();
        MenuItem categoryMenuItem = new MenuItem(playRadioMenu, SWT.CASCADE);
        categoryMenuItem.setText(categoryItem.getName());
        Menu categoryMenu = new Menu(trayMenu);
        categoryMenuItem.setMenu(categoryMenu);

        Iterator<IRadioItem> radioIter = categoryItem.getChildren(_onlyShowFavoritesRadio).iterator();
        while (radioIter.hasNext()) {
          IRadioItem radioItem = radioIter.next();
          final MenuItem radioMenuItem = new MenuItem(categoryMenu, SWT.PUSH);
          radioMenuItem.setText(radioItem.getName());
          radioMenuItem.setData(radioItem);

          radioMenuItem.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              new PlayRadioAction((RadioItem) radioMenuItem.getData()).run();
View Full Code Here

Examples of org.jampa.model.radio.IRadioItem

    }
  }
 
  private void addRadio(IStructuredSelection selection) {
    Object selectedObj = selection.getFirstElement();   
    IRadioItem selectedRadioItem;
   
    if (selectedObj != null) {
      if (selectedObj instanceof CategoryRadioItem) {
        selectedRadioItem = (IRadioItem) selectedObj;
      } else if (selectedObj instanceof RadioItem) {
View Full Code Here

Examples of org.jampa.model.radio.IRadioItem

    }           

    @Override
    public Object[] getChildren(Object parentElement) {     
      if (parentElement instanceof IRadioItem) {
        IRadioItem item = (IRadioItem) parentElement;
        return item.getChildren(_onlyShowFavorites).toArray();
      }
      return EMPTY_ARRAY;
    }
View Full Code Here

Examples of org.jampa.model.radio.IRadioItem

    }
  }

  class ViewLabelProvider extends LabelProvider implements ILabelProvider {
    public Image getImage(Object obj) {
      IRadioItem item = (IRadioItem) obj;
      if (item instanceof RadioItem) {
        if (item.isFavorite()) {
          if (((IAudioItem) item).isBoPlaying()) {
            if (Controller.getInstance().getEngine().isPaused()) {
              return _radioFavoritePausedImage;
            } else {
              return _radioFavoritePlayingImage;
            }
          } else {
            return _radioFavoriteImage;
          }
        } else {
          if (((IAudioItem) item).isBoPlaying()) {
            if (Controller.getInstance().getEngine().isPaused()) {
              return _radioPausedImage;
            } else {
              return _radioPlayingImage;
            }
          } else {
            return _radioImage;
          }
        }
      } else {
        if (item.isFavorite()) {
          if (((IPlaylist) item).hasAudioItemPlaying()) {
            if (Controller.getInstance().getEngine().isPaused()) {
              return _radioFolderFavoritePausedImage;
            } else {
              return _radioFolderFavoritePlayingImage;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.