use of org.magic.api.beans.MagicNews in project MtgDesktopCompanion by nicho92.
the class HsqlDAO method listNews.
@Override
public List<MagicNews> listNews() {
try (PreparedStatement pst = con.prepareStatement("select * from news")) {
List<MagicNews> news = new ArrayList<>();
try (ResultSet rs = pst.executeQuery()) {
while (rs.next()) {
MagicNews n = new MagicNews();
n.setCategorie(rs.getString("categorie"));
n.setName(rs.getString("name"));
n.setUrl(rs.getString("url"));
n.setType(NEWS_TYPE.valueOf(rs.getString("typeNews")));
n.setId(rs.getInt("id"));
news.add(n);
}
return news;
}
} catch (Exception e) {
logger.error(e);
return new ArrayList<>();
}
}
use of org.magic.api.beans.MagicNews in project MtgDesktopCompanion by nicho92.
the class MysqlDAO method listNews.
@Override
public List<MagicNews> listNews() {
try (PreparedStatement pst = con.prepareStatement("select * from news")) {
List<MagicNews> news = new ArrayList<>();
try (ResultSet rs = pst.executeQuery()) {
while (rs.next()) {
MagicNews n = new MagicNews();
n.setCategorie(rs.getString("categorie"));
n.setName(rs.getString("name"));
n.setUrl(rs.getString("url"));
n.setId(rs.getInt("id"));
n.setType(NEWS_TYPE.valueOf(rs.getString("typeNews")));
news.add(n);
}
return news;
}
} catch (Exception e) {
logger.error(e);
return new ArrayList<>();
}
}
use of org.magic.api.beans.MagicNews in project MtgDesktopCompanion by nicho92.
the class PostgresqlDAO method listNews.
@Override
public List<MagicNews> listNews() {
try (PreparedStatement pst = con.prepareStatement("select * from news")) {
List<MagicNews> news = new ArrayList<>();
try (ResultSet rs = pst.executeQuery()) {
while (rs.next()) {
MagicNews n = new MagicNews();
n.setCategorie(rs.getString("categorie"));
n.setName(rs.getString("name"));
n.setUrl(rs.getString("url"));
n.setType(NEWS_TYPE.valueOf(rs.getString("typeNews")));
n.setId(rs.getInt("id"));
news.add(n);
}
return news;
}
} catch (Exception e) {
logger.error(e);
return new ArrayList<>();
}
}
use of org.magic.api.beans.MagicNews in project MtgDesktopCompanion by nicho92.
the class RssGUI method initTree.
private void initTree() {
rootNode.removeAllChildren();
List<MagicNews> rss = MTGControler.getInstance().getEnabledDAO().listNews();
for (MagicNews cat : rss) add(cat.getCategorie(), cat);
((DefaultTreeModel) tree.getModel()).reload();
for (int i = 0; i < tree.getRowCount(); i++) tree.expandRow(i + 1);
}
Aggregations