Examples of RSSItem


Examples of org.gudy.azureus2.plugins.utils.xml.rss.RSSItem

                                      item_rssitem.setText("RSS Feed active but no torrents present");
                                      item_rssitem.setBackground(item_server.getBackground());
                                  }
                                  for (int j=0;j<items.length;j++){

                                      RSSItem item = items[j];
                                      if(View.rss_info != null && !View.rss_info.isDisposed()){
                                          item_rssitem = new TreeItem(item_server,SWT.NULL);
                                          item_rssitem.setText(item.getTitle());
                                          item_rssitem.setBackground(item_server.getBackground());
                                         
                                          item_torrent_desc = new TreeItem(item_rssitem,SWT.NULL);
                                          item_torrent_desc.setText(" [description] " +  item.getDescription());
                                          item_torrent_desc.setBackground(item_rssitem.getBackground());
                                         
                                          item_torrent_link = new TreeItem(item_rssitem,SWT.NULL);
                                          item_torrent_link.setText(" [link] " + item.getLink());
                                          item_torrent_link.setBackground(item_rssitem.getBackground());
                                     
                                          //popup menu
                                          Menu popupmenu_bookmark = new Menu(View.rss_info.getParent());
                                       
                                          final MenuItem InsertTorrent = new MenuItem(popupmenu_bookmark, SWT.PUSH);
                                          InsertTorrent.setText("Add Torrent to Azureus");
                                        InsertTorrent.addListener(SWT.Selection, new Listener() {
                                          public void handleEvent (Event e){
                                            try {
//                                               Check is the table is not disposed
                                                if(View.rss_info == null || View.rss_info.isDisposed())
                                                  return;
                                                //Get the selection
                                                TreeItem[] items = View.rss_info.getSelection();
                                               
                                                //If an item is selected (single click selects at least one)
                                                if(items.length == 1) {
                                                  //Grab selected item
                                                  int place = 0;
                                                    TreeItem item = items[0];
                                                  String torrent_URL = item.getText();
                                 
                                                      try
                                                      {
                                                          TreeItem parent_torrent = item.getParentItem();
                                                          if(parent_torrent.getText().startsWith("Azureus BitTorrent"))
                                                        {
                                                            place = 1;
                                                                                                                      }
                                                      }
                                                     
                                                      catch (Exception nullpoint) {
                                                          System.out.println("too high!");
                                                          place = 2;
                                                      }
                                                     
                                                      if(place == 0)
                                                      {
                                                          InsertTorrent.setEnabled(true);
                                                          TreeItem item_parent = item.getParentItem();
                                                          TreeItem[] items_children = item_parent.getItems();
                                                          for(int i = 0 ; i < items_children.length ; i++){
                                                              if(items_children[i].getText().startsWith(" [link]")){
                                                                  //System.out.println("LINK! " + items_children[i].getText().substring(8,items_children[i].getText().length()));
                                                                  String link = items_children[i].getText().substring(8,items_children[i].getText().length());
                                                                  link = link.substring(0,link.indexOf("?"));
                                                                 
                                                                  Downloader.torrent_getter(link,pluginInterface);
                                                              }
                                                             
                                                          }
                                                      }
                                                      else if (place == 1)
                                                      {
                                                          InsertTorrent.setEnabled(true);
                                                          TreeItem[] items_children = item.getItems();
                                                          for(int i = 0 ; i < items_children.length ; i++){
                                                              if(items_children[i].getText().startsWith(" [link]")){
                                                                  //System.out.println("LINK! " + items_children[i].getText().substring(8,items_children[i].getText().length()));
                                                                  Downloader.torrent_getter(items_children[i].getText().substring(8,items_children[i].getText().length()),pluginInterface);
                                                              }
                                                             
                                                          }
                                                      }
                                                      else if (place == 2)
                                                      {
                                                          InsertTorrent.setEnabled(false);
                                                          //insert message!
                                                        Shell shell = new Shell(View.display);
                                                      MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
                                                      messageBox.setText("Selection Error");
                                                      messageBox.setMessage("You have choosen a Tracker, please select a torrent from the tracker to load into Azureus");
                                                      int response = messageBox.open();
                                                      switch (response){
                                                      case SWT.YES:
                                                          shell.dispose();
                                                          break;
                                                      }
                                                      }
                                                 
                                                 
                                                  //Downloader.torrent_getter(torrent_URL,pluginInterface);
                                                 
                                                 
                                                }
                                                 
                                               
                                                 
                                          } catch (Exception e1) {
                                            e1.printStackTrace();
                                          }
                                          }
                                        });
                                     
                                        View.rss_info.setMenu( popupmenu_bookmark);

                                     
                                     
                                     
                                     
                                     
                                      }   
                                     
                                      SimpleXMLParserDocumentNode node = item.getNode();

                                     
                                      if(View.rss_info != null && !View.rss_info.isDisposed()){
                                          item_torrent_hash = new TreeItem(item_rssitem,SWT.NULL);
                                          item_torrent_hash.setText( " [hash]    " + node.getChild(
View Full Code Here

Examples of org.josescalia.swingrss.model.RssItem

            nodeList = doc.getElementsByTagName("item");
            for (int temp = 0; temp < nodeList.getLength(); temp++) {
                node = nodeList.item(temp);
                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    e = (Element) node;
                    RssItem rssItem = new RssItem();
                    rssItem.setTitle(getTagValue("title", e));
                    rssItem.setLink(getTagValue("link", e));
                    rssItem.setGuid(getTagValue("guid", e));
                    rssItem.setPubDate(getTagValue("pubDate", e));
                    rssItem.setCategory(getTagValue("category", e));
                    rssItem.setDescription(getTagValue("description", e));
                    rssHeader.addItem(rssItem);
                }
            }

        } catch (Exception ex) {
View Full Code Here

Examples of org.josescalia.swingrss.model.RssItem

    /**
     * Creates new form RssReaderForm
     */
    public RssReaderForm(final MainPanel mainPanel) {
        this.mainPanel = mainPanel ;
        selectedItem = new RssItem();
        selectedRss = new Rss();
        service = new RssService();
       
       // suggestedList.addAll(ObservableCollections.observableList(service.getRssList()));
        initComponents();
View Full Code Here

Examples of org.josescalia.swingrss.model.RssItem

    public RssItem getSelectedItem() {
        return selectedItem;
    }

    public void setSelectedItem(RssItem selectedItem) {
        RssItem old = this.selectedItem;
        this.selectedItem = selectedItem;
        firePropertyChange("selectedItem", old, selectedItem);
    }
View Full Code Here

Examples of therandomhomepage.common.rss.RSSItem

                UIObject.setVisible(imageElement, false);
            }


            int randomIdx = Random.nextInt(rssItems.length);
            RSSItem randomItem = (RSSItem) rssItems[randomIdx];

            Element imageElement = DOM.getChild(lightbox.getElement(), randomIdx);
            DOM.setInnerHTML(imageElement, StringUtil.grep(randomItem.getDesc(), "<img", ">"));

            UIObject.setVisible(imageElement, true);
            prevIdx = randomIdx;
            randomFlickrImageTitle.setHTML("<a class=\"randomFlickrImageTitle\" target=\"_new\" href=\"" + randomItem.getLink() + "\">" + getTitle(randomItem) + "</a>");
        }
    }
View Full Code Here

Examples of therandomhomepage.common.rss.RSSItem

    }

    private Image[] getImages(RSSItem rssItems[]) {
        Image[] images = new Image[rssItems.length];
        for (int i = 0; i < rssItems.length; i++) {
            RSSItem rssItem = (RSSItem) rssItems[i];
            images[i] = rssItem.getMedia().getContent();
            images[i].setVisible(false);
        }
        return images;
    }
View Full Code Here

Examples of therandomhomepage.common.rss.RSSItem

    public void testParseYahooRSS() {
        List rssItems = JSON2RSSParser.parse(yahooRSSJSON);
        assertNotNull(rssItems);
        assertEquals(4, rssItems.size());

        RSSItem expectedRSSItem1 = new RSSItem("Mexican tells crowd he'll seek recount \n" +
                "    (AP)", "http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20060709/ap_on_re_la_am_ca/mexico_elections", "<p><a href=\"http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20060709/ap_on_re_la_am_ca/mexico_elections\"><img src=\"http://us.news3.yimg.com/us.i2.yimg.com/p/ap/20060709/capt.5a2fa662f8bc413597f669a36b502eab.mexico_elections__momu107.jpg?x=130&amp;y=83&amp;sig=67xo1gNkImk80pvOmOFUGQ--\" align=\"left\" height=\"83\" width=\"130\" alt=\"A lone flag of the Democratic Revolution Party (PRD) flies over thousands of supporters of Mexican presidential candidate Andres Manuel Lopez Obrador during a rally at the main Zocalo plaza in Mexico City, Mexico on Saturday, July 8, 2006. Obrador called his supporters onto the streets Saturday to protest his rival's narrow victory in a vote he said was more fraudulent than those held during 71 years of one-party rule. (AP Photo/Marco Ugarte) border=\"0\" /></a>AP - Leftist presidential candidate Andres Manuel Lopez Obrador called on a huge crowd of supporters Saturday to keep peacefully protesting as he goes to court to challenge what he called his fraudulent electoral defeat.</p><br clear=all>");
        expectedRSSItem1.setGuid("ap/20060709/mexico_elections");
        expectedRSSItem1.setPublishedDate("Sun, 09 Jul 2006 03:22:54 GMT");
        System.out.println("JSON2RSSParser_UT.testParseYahooRSS");
        assertRSSItem(expectedRSSItem1, rssItems);

        RSSItem expectedRSSItem2 = new RSSItem("Scores feared dead in Siberia runway crash \n" +
                "    (AP)", "http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20060709/ap_on_re_eu/russia_plane_crash", "AP - An airplane carrying about 200 people crashed Sunday in the Siberian city of Irkutsk and most on board were feared dead, officials said.");
        expectedRSSItem2.setGuid("ap/20060709/russia_plane_crash");
        expectedRSSItem2.setPublishedDate("Sun, 09 Jul 2006 03:58:19 GMT");
        assertRSSItem(expectedRSSItem2, rssItems);

        RSSItem expectedRSSItem3 = new RSSItem("U.S. seeks to exhume Iraqi girl's remains \n" +
                "    (AP)", "http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20060709/ap_on_re_mi_ea/iraq_rape_investigation", "<p><a href=\"http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20060709/ap_on_re_mi_ea/iraq_rape_investigation\"><img src=\"http://us.news3.yimg.com/us.i2.yimg.com/p/ap/20060706/capt.505f0de59abc48fb931cf4e851be7378.iraq_bag126.jpg?x=130&amp;y=86&amp;sig=D5Qs9rc_s61I84Jz1d1wvg--\" align=\"left\" height=\"86\" width=\"130\" alt=\"Neighbor and eyewitness Hussein Mohammed, 33, points to the charred ground where clothing of the young Iraqi girl who was allegedly raped then killed along with family members was burned outside of their home, Thursday, July 6, 2006, in Mahmoudiya, south of Baghdad, Iraq. Former US Army Pfc. Steve D. Green was charged Monday in federal court in Charlotte, North Carolina, with rape and four counts of murder. At least four other U.S. soldiers still in Iraq are under investigation in the attack. (AP Photo/Ali al-Mahmouri) border=\"0\" /></a>AP - U.S. investigators have asked Iraqi authorities to help them navigate cultural sensitivities to exhume the body of a teenager allegedly raped and murdered with her family by American soldiers, a military official said Saturday.</p><br clear=all>");
        expectedRSSItem3.setGuid("ap/20060709/iraq_rape_investigation");
        expectedRSSItem3.setPublishedDate("Sun, 09 Jul 2006 02:22:45 GMT");
        assertRSSItem(expectedRSSItem3, rssItems);

        RSSItem expectedRSSItem4 = new RSSItem("Astronauts: Daring spacewalk method works \n" +
                "    (AP)", "http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20060709/ap_on_sc/space_shuttle", "<p><a href=\"http://us.rd.yahoo.com/dailynews/rss/topstories/*http://news.yahoo.com/s/ap/20060709/ap_on_sc/space_shuttle\"><img src=\"http://us.news3.yimg.com/us.i2.yimg.com/p/ap/20060708/capt.d38cfd8b40774ebe9bb3c06b25ac41be.space_shuttle_txdc116.jpg?x=130&amp;y=97&amp;sig=1lrj6s3UxNaH.vQDoHFKEQ--\" align=\"left\" height=\"97\" width=\"130\" alt=\"In this image made from NASA TV, astronaut Piers Sellers, works on the end of the robotic arm during a spacewalk  Saturday, July 8, 2006.  Sellers is testing how different movements affect the robotic arm.  (AP Photo/NASA TV) border=\"0\" /></a>AP - A key test of a daring yet wobbly spacewalking technique that could be used someday to repair space shuttle heat shields worked well Saturday and got good reviews from two astronauts from the shuttle Discovery, NASA officials said.</p><br clear=all>");
        expectedRSSItem4.setGuid("ap/20060709/space_shuttle");
        expectedRSSItem4.setPublishedDate("Sun, 09 Jul 2006 03:13:06 GMT");
        assertRSSItem(expectedRSSItem4, rssItems);

    }
View Full Code Here

Examples of therandomhomepage.common.rss.RSSItem

        List rssItems = JSON2RSSParser.parse(googleRSSJSON);
        assertNotNull(rssItems);
        assertEquals(6, rssItems.size());

        RSSItem expectedRSSItem1 = new RSSItem("Plane crashes in Russia, death toll reaches 120 - Reuters.uk", "http://news.google.com/news/url?sa=T&ct=us/0-0-0&fd=R&url=http://today.reuters.co.uk/news/newsArticle.aspx%3Ftype%3DtopNews%26storyID%3D2006-07-09T072653Z_01_L09335850_RTRUKOC_0_UK-RUSSIA-PLANE.xml&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg", "<br><table border=0 align= cellpadding=5 cellspacing=0><tr><td width=80 align=center valign=top><a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0i-0&fd=R&url=http://news.bbc.co.uk/1/hi/world/europe/5162082.stm&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\"><img src=http://news.google.com/news?imgefp=RVLpY5ko6Q8J&imgurl=newsimg.bbc.co.uk/media/images/41864000/jpg/_41864964_crash.jpg width=79 height=59 alt=\"\" border=1><br><font size=-2>BBC News</font></a></td></tr></table><a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0-0&fd=R&url=http://today.reuters.co.uk/news/newsArticle.aspx%3Ftype%3DtopNews%26storyID%3D2006-07-09T072653Z_01_L09335850_RTRUKOC_0_UK-RUSSIA-PLANE.xml&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\"><b>Plane crashes in Russia, death toll reaches 120</b></a><br><font size=-1><font color=#6f6f6f><b>Reuters.uk&nbsp;-</font> <nobr>25 minutes ago</nobr></b></font><br><font size=-1>By Dmitry Solovyov. MOSCOW (Reuters) - A Russian airliner crashed on landing and burst into flames in Siberia on Sunday, killing at least 120 people and injuring more than 50, emergencies officials said. A <b>...</b>  </font><br><font size=-1><a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0-1&fd=R&url=http://news.independent.co.uk/world/asia/article1168576.ece&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\">118 killed in Siberia plane crash</a> <font size=-1 color=#6f6f6f><nobr>Independent</nobr></font></font><br><font size=-1><a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0-2&fd=R&url=http://www.tass.ru/eng/level2.html%3FNewsID%3D10606632%26PageNum%3D0&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\">A-310 crash in Irkutsk leaves 127 dead</a> <font size=-1 color=#6f6f6f><nobr>ITAR-TASS</nobr></font></font><br><font size=-1 class=p><a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0-3&fd=R&url=http://english.eastday.com/eastday/englishedition/node20676/userobject1ai2166050.html&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\"><nobr>EastDay.com</nobr></a>&nbsp;- <a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0-4&fd=R&url=http://www.nytimes.com/2006/07/09/world/europe/09crash.html%3Fhp%26ex%3D1152504000%26en%3D4e6cdc6d6ae4bc76%26ei%3D5094%26partner%3Dhomepage&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\"><nobr>New York Times</nobr></a>&nbsp;- <a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0-5&fd=R&url=http://msnbc.msn.com/id/13773633/&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\"><nobr>MSNBC</nobr></a>&nbsp;- <a href=\"http://news.google.com/news/url?sa=T&ct=us/0-0-6&fd=R&url=http://news.bbc.co.uk/2/hi/5162082.stm%3Fls&cid=1107810086&ei=X7awRISXGoz8oQLrsvnMBg\"><nobr>BBC News</nobr></a>&nbsp;- </font><font class=p size=-1><a class=p href=http://news.google.com/?ncl=http://today.reuters.co.uk/news/newsArticle.aspx%3Ftype%3DtopNews%26storyID%3D2006-07-09T072653Z_01_L09335850_RTRUKOC_0_UK-RUSSIA-PLANE.xml&hl=en><nobr><b>all 441 related</b></nobr></a></font><br clear=all>");
        expectedRSSItem1.setGuid("tag:news.google.com,2005:cluster=4207d726");
        expectedRSSItem1.setPublishedDate("Sun, 09 Jul 2006 07:30:00 GMT");

        assertRSSItem(expectedRSSItem1, rssItems);
    }
View Full Code Here

Examples of therandomhomepage.common.rss.RSSItem

    private void assertRSSItem(RSSItem expectedRSSItem, List actualRSSItems) {

        boolean asserted = false;
        for (int i = 0; i < actualRSSItems.size(); i++) {
            RSSItem actualRSSItem = (RSSItem) actualRSSItems.get(i);
            if (expectedRSSItem.getTitle().equals(actualRSSItem.getTitle())) {
                asserted = true;
                assertEquals(expectedRSSItem.getTitle(), actualRSSItem.getTitle());
                assertEquals(expectedRSSItem.getLink(), actualRSSItem.getLink());
                assertEquals(expectedRSSItem.getDesc(), actualRSSItem.getDesc());
                assertEquals(expectedRSSItem.getGuid(), actualRSSItem.getGuid());
                assertEquals(expectedRSSItem.getPublishedDate(), actualRSSItem.getPublishedDate());
                break;
            }
        }
        assertTrue("Should have asserted with some values !", asserted);
    }
View Full Code Here

Examples of therandomhomepage.common.rss.RSSItem

    private void assertResult(String result) {
        List rssItems = RSS2XMLDocumentParser.parse(result);
        assertEquals(1,rssItems.size());
        for (Iterator iterator = rssItems.iterator(); iterator.hasNext();) {
            RSSItem rssItem = (RSSItem) iterator.next();
            assertEquals("hotel glória",rssItem.getTitle());
            assertEquals("http://www.flickr.com/photos/gastaum/310473631/",rssItem.getLink());
            String expectedDesc = "<p><a href=\"http://www.flickr.com/people/gastaum/\">ftrc</a> posted a photo:</p>\n" +
                    "\n" +
                    "<p><a href=\"http://www.flickr.com/photos/gastaum/310473631/\" title=\"hotel glória\"><img src=\"http://static.flickr.com/123/310473631_0f69135463_m.jpg\" width=\"240\" height=\"176\" alt=\"hotel glória\" style=\"border: 1px solid #ddd;\" /></a></p>\n" +
                    "\n" +
                    "<p>hotel glória<br />\n" +
                    "<br />\n" +
                    "djs<br />\n" +
                    "<br />\n" +
                    "joakim + marcos morcerf + luca &amp; liana + no porn<br />\n" +
                    "<br />\n" +
                    "<a href=\"http://www.clubegloria.com.br\">www.clubegloria.com.br</a></p>";
            assertEquals(expectedDesc,rssItem.getDesc());

            String expectedContentImage = "<IMG class=gwt-Image height=176 src=\"http://static.flickr.com/123/310473631_0f69135463_m.jpg\" width=240 __eventBits=\"98429\" onchange=\"null\">";
            String actualContent = rssItem.getMedia().getContent().toString();
            assertEquals(expectedContentImage, actualContent);
        }
        finishTest();
    }
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.