X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FBlogReader.java;h=5baed1657c2b21d7a71da96ecbc98cf9cbe35b52;hb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;hp=53ab9a36c0029528dd330b8b340f952c8422ec55;hpb=e98b67b63a508e31a99bad1f8982f63b8ce1f5db;p=jalview.git diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index 53ab9a3..5baed16 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -1,25 +1,31 @@ -/******************************************************************************* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) + * Copyright (C) 2015 The Jalview Authors + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.gui; import jalview.bin.Cache; +import jalview.util.MessageManager; + import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Dialog.ModalExclusionType; import java.awt.Dimension; import java.awt.Font; import java.awt.Rectangle; @@ -122,11 +128,12 @@ public class BlogReader extends JPanel @Override public void actionPerformed(ActionEvent arg0) { - if (xf!=null) + if (xf != null) { xf.dispose(); } - xf=null;jd=null; + xf = null; + jd = null; if (parent != null) { parent.showNews(false); @@ -191,8 +198,8 @@ public class BlogReader extends JPanel { if (parent != null) { - Cache.log.info("News window closed."); - jd=null; + Cache.log.debug("News window closed."); + jd = null; parent.showNews(false); } } @@ -239,7 +246,7 @@ public class BlogReader extends JPanel public BlogReader(Desktop desktop) { - Cache.log.info("Constructing news reader."); + Cache.log.debug("Constructing news reader."); parent = desktop; _channelModel = new ChannelListModel(); @@ -268,10 +275,10 @@ public class BlogReader extends JPanel if (setvisible) { - Cache.log.info("Will show jalview news automatically"); + Cache.log.debug("Will show jalview news automatically"); showNews(); } - Cache.log.info("Completed construction of reader."); + Cache.log.debug("Completed construction of reader."); } @@ -324,9 +331,11 @@ public class BlogReader extends JPanel { createDialog(); bounds = new Rectangle(5, 5, 550, 350); - jd.initDialogFrame(me, false, false, "News from www.jalview.org", + jd.initDialogFrame(me, false, false, + MessageManager.getString("label.news_from_jalview"), bounds.width, bounds.height); - Cache.log.info("Displaying news."); + jd.frame.setModalExclusionType(ModalExclusionType.NO_EXCLUDE); + Cache.log.debug("Displaying news."); jd.waitForInput(); } } @@ -413,7 +422,7 @@ public class BlogReader extends JPanel { jalview.bin.Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", lastDate); - jalview.bin.Cache.log.info("Saved last read date as " + jalview.bin.Cache.log.debug("Saved last read date as " + jalview.bin.Cache.date_format.format(lastDate)); } @@ -432,7 +441,9 @@ public class BlogReader extends JPanel topBottomSplitPane.setBottomComponent(bottomPanel); JScrollPane spTextDescription = new JScrollPane(textDescription); textDescription.setText(""); - statusBar.setText(" [Status] "); + statusBar.setText(new StringBuffer("[") + .append(MessageManager.getString("label.status")).append("]") + .toString()); buttonRefresh.addActionListener(new ActionListener() { @@ -474,7 +485,7 @@ public class BlogReader extends JPanel _popupChannels); listItems.addMouseListener(popupAdapter); listItems.setCellRenderer(new ItemsRenderer()); - lblChannels.setText("Channels"); + lblChannels.setText(MessageManager.getString("label.channels")); } private void postInit() @@ -750,16 +761,16 @@ public class BlogReader extends JPanel + jalview.bin.Cache.date_format.format(lastread.getTime())); if (me.isNewsNew()) { - Cache.log.info("There is news to read."); + Cache.log.debug("There is news to read."); } else { - Cache.log.info("There is no new news."); + Cache.log.debug("There is no new news."); me.xf.setTitle("Testing : Last read is " + me.lastDate); me.showNews(); me.xf.toFront(); } - Cache.log.info("Waiting for closure."); + Cache.log.debug("Waiting for closure."); do { try @@ -773,18 +784,18 @@ public class BlogReader extends JPanel if (me.isNewsNew()) { - Cache.log.info("Still new news after reader displayed."); + Cache.log.debug("Still new news after reader displayed."); } if (lastread.getTime().before(me.lastDate)) { - Cache.log.info("The news was read."); + Cache.log.debug("The news was read."); lastread.setTime(me.lastDate); } else { lastread.add(Calendar.MONTH, 1); } - + } } @@ -808,8 +819,13 @@ class ChannelsRenderer extends DefaultListCellRenderer if (value instanceof Channel) { Channel channel = (Channel) value; - component.setText(channel.getTitle() + " (" - + channel.getUnreadItemCount() + ")"); + component + .setText(MessageManager.formatMessage( + "label.channel_title_item_count", + new String[] { + channel.getTitle(), + Integer.valueOf(channel.getUnreadItemCount()) + .toString() })); component.setToolTipText(channel.getURL()); } return component; @@ -832,9 +848,14 @@ class ItemsRenderer extends DefaultListCellRenderer Item item = (Item) value; if (item.getPublishDate() != null) { - component.setText(DateFormat.getDateInstance().format( - item.getPublishDate()) - + " " + item.getTitle()); + component.setText(MessageManager.formatMessage( + "label.blog_item_published_on_date", + new String[] { + DateFormat + .getDateInstance(DateFormat.LONG, + MessageManager.getLocale()) + .format(item.getPublishDate()).toString(), + item.getTitle() })); } component.setToolTipText(item.getLink()); if (!item.isRead())