1 package twitter.gui.action;
4 import java.awt.Desktop;
5 import java.awt.Dimension;
8 import java.awt.TrayIcon;
9 import java.awt.event.ActionEvent;
11 import java.io.FileInputStream;
12 import java.io.FileNotFoundException;
13 import java.io.FileOutputStream;
14 import java.io.IOException;
15 import java.io.UnsupportedEncodingException;
18 import java.net.URLEncoder;
19 import java.text.DateFormat;
20 import java.util.ArrayList;
21 import java.util.Comparator;
22 import java.util.List;
23 import java.util.Locale;
24 import java.util.Properties;
26 import java.util.TreeSet;
27 import java.util.logging.Level;
28 import java.util.logging.Logger;
29 import java.util.regex.Matcher;
30 import java.util.regex.Pattern;
31 import javax.swing.ImageIcon;
32 import javax.swing.JCheckBoxMenuItem;
34 import javax.swing.JEditorPane;
35 import javax.swing.JFrame;
36 import javax.swing.JLabel;
37 import javax.swing.JOptionPane;
38 import javax.swing.JPanel;
39 import javax.swing.JTabbedPane;
40 import javax.swing.JTable;
41 import javax.swing.JTextPane;
42 import javax.swing.JToggleButton;
43 import javax.swing.table.TableModel;
44 import javax.swing.text.Style;
45 import javax.swing.text.StyleConstants;
46 import javax.swing.text.html.HTMLDocument;
47 import javax.swing.text.html.StyleSheet;
48 import twitter.action.TweetDirectMessageGetter;
49 import twitter.action.TweetFavoriteGetter;
50 import twitter.action.TweetGetter;
51 import twitter.action.TweetListGetter;
52 import twitter.action.TweetMentionGetter;
53 import twitter.action.TweetSearchResultGetter;
54 import twitter.action.TweetSendDirectMessageGetter;
55 import twitter.action.TweetTimelineGetter;
56 import twitter.action.TweetUserTimelineGetter;
57 import twitter.action.list.ListGetterSelection;
58 import twitter.action.list.UserListGetter;
59 import twitter.action.list.UserListMembershipsGetter;
60 import twitter.action.list.UserListSpecificUserListsGetter;
61 import twitter.action.list.UserListSubscriptionGetter;
62 import twitter.cache.TwitterImageCache;
63 import twitter.gui.component.DnDTabbedPane;
65 import twitter.gui.component.TweetTabbedTable;
66 import twitter.gui.component.TweetTableModel;
67 import twitter.gui.form.AboutDialog;
68 import twitter.gui.form.AccountDialog;
69 import twitter.gui.form.ConfigurationDialog;
70 import twitter.gui.form.DirectMessageDialog;
71 import twitter.gui.form.HashtagSearchDialog;
72 import twitter.gui.form.KeywordSearchDialog;
73 import twitter.gui.form.UserListDialog;
74 import twitter.gui.form.UserSearchDialog;
75 import twitter.manage.TweetConfiguration;
76 import twitter.manage.TweetManager;
77 import twitter.task.ExistTimerIDException;
78 import twitter.task.TimerID;
79 import twitter.task.TweetTaskException;
80 import twitter.task.TweetTaskManager;
81 import twitter.task.TweetUpdateTask;
82 import twitter.util.HTMLEncode;
83 import twitter4j.Status;
84 import twitter4j.TwitterException;
92 public class TweetMainAction {
95 public static final String BASIC_SETTING_FILENAME = TweetConfiguration.BASIC_SETTING_FILENAME;
97 private static final Pattern convURLLinkPtn = Pattern.compile(
98 "(http://|https://){1}[\\w\\.\\-/:\\#\\?\\=\\&\\;\\%\\~\\+]+",
99 Pattern.CASE_INSENSITIVE);
100 // default char encoding
101 private static final String DEFAULT_CHARACTER_ENCODING = "UTF-8";
102 // 設定ファイルを保存するディレクトリ名
103 public static final String PROPERTIES_DIRECTORY = "properties";
104 // search twitterのクエリ
105 private static final String SEARCH_QUERY = "search?q=";
106 // search twitterのURL
107 private static final String SEARCH_TWITTER_URL = "http://"
108 + TweetConfiguration.SEARCH_TWITTER_HOSTNAME + "/";
109 // Direct Messageタブに表示する文字
110 public static final String TAB_DIRECT_MESSAGE_STRING = "Message";
112 public static final String TAB_MENTION_STRING = "Mention";
114 public static final String TAB_TIMELINE_STRING = "Timeline";
115 // Send Direct Messageタブに表示する文字
116 public static final String TAB_SEND_DIRECT_MESSAGE_STRING = "Send";
117 // テーブルのデータ量が以下の値を超えたら古いデータから削除
118 private static final int TABLE_ELEMENT_MAX_SIZE = 200;
120 private static final String TWITTER_URL = "http://twitter.com/";
122 private ConfigurationDialog configurationDialog = null;
124 private Status currentStatus = null;
126 private Status replyStatus = null;
128 private JPanel detailInfoPanel = null;
129 // ダイレクトメッセージ送信用ダイアログ
130 private DirectMessageDialog directMessageDialog = null;
131 // Twitter全体からキーワード検索ダイアログ
132 private KeywordSearchDialog keywordSearchDialog = null;
133 // hashtag search dialog
134 private HashtagSearchDialog hashtagSearchDialog = null;
136 private Color newTableColor = new Color(224, 255, 255);
138 private String tlFontName = "Takao Pゴシック";
140 private int tlFontSize = 13;
142 private String detailFontName = "Takao Pゴシック";
144 private int detailFontSize = 13;
146 private int tableElementHeight = 50;
148 private int mainFrameWidth = 729;
150 private int mainFrameHeight = 629;
152 private JFrame mainFrame = null;
154 private Properties property = null;
155 // 現在テーブルで選択しているユーザ画像のURL
156 private URL selectedUserImageURL = null;
157 // 現在テーブルで選択しているユーザの名前
158 private String selectedUsername = null;
160 private JLabel statusBarLabel = null;
162 private JTextPane tweetBoxPane = null;
163 // 自分がつぶやきを書く領域のスクロールペーン
164 private JPanel tweetBoxRegionPane = null;
166 private JTabbedPane tweetMainTab = null;
168 private TweetManager tweetManager = null;
169 // tweetを表示するTextPane
170 private JEditorPane tweetMessageBox = null;
171 // つぶやくことができる文字数を表示するラベル
172 private JLabel tweetMessageCountLabel = null;
173 private int uncheckedDirectMessageCount = 0;
174 private int uncheckedMentionTweetCount = 0;
175 // 自分宛のメッセージを通知バーに表示するか
176 private boolean isNotifyMentionMessage = true;
177 private boolean isNotifyDirectMessage = true;
178 //前回開いていたタブの情報を復活する際に利用する(最初の一回だけ利用)
179 private boolean isTempOpenedTimelineTab = true;
180 private boolean isTempOpenedMentionTab = true;
181 private boolean isTempOpenedDMTab = true;
182 private boolean isTempOpenedSendDMTab = true;
185 private JLabel userImageLabel = null;
186 private JLabel userNameLabel = null;
187 private JLabel updateTimeLabel = null;
188 private JLabel followerLabel = null;
189 private JLabel followingLabel = null;
190 private JLabel locationLabel = null;
191 private JEditorPane clientNameLabel = null;
192 private JLabel updateLabel = null;
193 private JEditorPane userIntroBox = null;
194 private JEditorPane userWebBox = null;
196 private TrayIcon trayIcon = null;
199 private javax.swing.JToggleButton timelineToggleButton;
200 private javax.swing.JToggleButton mentionToggleButton;
201 private javax.swing.JToggleButton dmToggleButton;
202 private javax.swing.JToggleButton sendDMToggleButton;
204 private javax.swing.JCheckBoxMenuItem timelineCheckBoxMenuItem;
205 private javax.swing.JCheckBoxMenuItem mentionCheckBoxMenuItem;
206 private javax.swing.JCheckBoxMenuItem dmCheckBoxMenuItem;
207 private javax.swing.JCheckBoxMenuItem sendCheckBoxMenuItem;
209 // 新しく取得したtweetでまだ参照していない数
210 private int uncheckedTimelineTweetCount = 0;
211 private AboutDialog aboutDialog = null;
213 private AccountDialog accountDialog;
215 private List<TweetTabbedTable> tweetTabbedTableList = new ArrayList<TweetTabbedTable>();
216 // ツイートテーブルの情報を一定間隔で更新するクラスを作成
217 private TweetTaskManager tweetTaskManager = new TweetTaskManager();
220 private UserListDialog userListDialog = null;
222 private UserSearchDialog userSearchDialog = null;
225 private int getTimelinePeriod = 60;
226 private int getMentionPeriod = 60 * 3;
227 private int getDirectMessagePeriod = 60 * 15;
228 private int getSendDirectMessagePeriod = 60 * 30;
233 * @param tweetManager
234 * @param statusBarLabel
235 * @param tweetTableModel
236 * @param mentionTableModel
237 * @param directMessageTableModel
238 * @param sendDirectMessageTableModel
239 * @param mainTweetTable
240 * @param mentionTable
241 * @param directMessageTable
242 * @param sendDirectMessageTable
243 * @param tweetBoxPane
244 * @param tweetBoxScrollPane
245 * @param tweetMessageCountLabel
246 * @param detailInfoPanel
247 * @param tweetMainTab
248 * @param tweetMessageBox
249 * @param userImageLabel
250 * @param userNameLabel
251 * @param updateTimeLabel
252 * @param followerLabel
253 * @param followingLabel
254 * @param locationLabel
255 * @param clientNameLabel
257 * @param userIntroBox
260 public TweetMainAction(JFrame mainFrame, TweetManager tweetManager,
261 JLabel statusBarLabel, JTextPane tweetBoxPane,
262 JPanel tweetBoxScrollPane, JLabel tweetMessageCountLabel,
263 JPanel detailInfoPanel, JTabbedPane tweetMainTab,
264 JEditorPane tweetMessageBox, JLabel userImageLabel,
265 JLabel userNameLabel, JLabel updateTimeLabel, JLabel followerLabel,
266 JLabel followingLabel, JLabel locationLabel,
267 JEditorPane clientNameLabel, JLabel updateLabel,
268 JEditorPane userIntroBox, JEditorPane userWebBox,
269 JToggleButton timelineToggleButton,
270 JToggleButton mentionToggleButton, JToggleButton dmToggleButton,
271 JToggleButton sendToggleButton,
272 JCheckBoxMenuItem timelineCheckBoxMenuItem,
273 JCheckBoxMenuItem mentionCheckBoxMenuItem,
274 JCheckBoxMenuItem dmCheckBoxMenuItem,
275 JCheckBoxMenuItem sendCheckBoxMenuItem, TrayIcon trayIcon) {
276 this.mainFrame = mainFrame;
277 this.tweetManager = tweetManager;
278 this.statusBarLabel = statusBarLabel;
279 this.tweetBoxPane = tweetBoxPane;
280 this.tweetMessageCountLabel = tweetMessageCountLabel;
281 this.detailInfoPanel = detailInfoPanel;
282 this.tweetMainTab = tweetMainTab;
283 this.tweetMessageBox = tweetMessageBox;
284 this.tweetBoxRegionPane = tweetBoxScrollPane;
287 this.userImageLabel = userImageLabel;
288 this.userNameLabel = userNameLabel;
289 this.updateTimeLabel = updateTimeLabel;
290 this.userIntroBox = userIntroBox;
291 this.followerLabel = followerLabel;
292 this.followingLabel = followingLabel;
293 this.locationLabel = locationLabel;
294 this.userWebBox = userWebBox;
295 this.clientNameLabel = clientNameLabel;
296 this.updateLabel = updateLabel;
298 this.timelineCheckBoxMenuItem = timelineCheckBoxMenuItem;
299 this.timelineToggleButton = timelineToggleButton;
300 this.mentionCheckBoxMenuItem = mentionCheckBoxMenuItem;
301 this.mentionToggleButton = mentionToggleButton;
302 this.dmCheckBoxMenuItem = dmCheckBoxMenuItem;
303 this.dmToggleButton = dmToggleButton;
304 this.sendCheckBoxMenuItem = sendCheckBoxMenuItem;
305 this.sendDMToggleButton = sendToggleButton;
308 this.trayIcon = trayIcon;
311 if (this.tweetMainTab instanceof DnDTabbedPane) {
312 ((DnDTabbedPane) this.tweetMainTab).setMainAction(this);
318 } catch (FileNotFoundException e) {
320 } catch (IOException e) {
324 updateFontInformationToComponent();
327 mainFrame.setSize(this.mainFrameWidth, this.mainFrameHeight);
328 mainFrame.setPreferredSize(new Dimension(this.mainFrameWidth,
329 this.mainFrameHeight));
335 public void updateCheckboxInformation() {
336 boolean timeline = this.isExistTimelineTab();
337 boolean mention = this.isExistMentionTab();
338 boolean dm = this.isExistDirectMessageTab();
339 boolean send = this.isExistSendDirectMessageTab();
341 this.timelineCheckBoxMenuItem.setSelected(timeline);
342 this.timelineToggleButton.setSelected(timeline);
343 this.mentionCheckBoxMenuItem.setSelected(mention);
344 this.mentionToggleButton.setSelected(mention);
345 this.dmCheckBoxMenuItem.setSelected(dm);
346 this.dmToggleButton.setSelected(dm);
347 this.sendCheckBoxMenuItem.setSelected(send);
348 this.sendDMToggleButton.setSelected(send);
352 * Timeline, Mention , DM, SendDMの情報更新間隔を取得し,その情報をテーブルに反映
354 public void updatePeriodInformationToComponent() {
355 // すべてのテーブルにフォント情報を反映
356 for (TweetTabbedTable t : this.tweetTabbedTableList) {
357 String timerID = t.getTimerID();
358 if (timerID.equals(TimerID.createTimelineID())) {
360 this.tweetTaskManager.updateTaskPeriod(timerID, this
361 .getGetTimelinePeriod(), false);
362 } else if (timerID.equals(TimerID.createMentionID())) {
364 this.tweetTaskManager.updateTaskPeriod(timerID, this
365 .getGetMentionPeriod(), false);
366 } else if (timerID.equals(TimerID.createDirectMessageID())) {
368 this.tweetTaskManager.updateTaskPeriod(timerID, this
369 .getGetDirectMessagePeriod(), false);
370 } else if (timerID.equals(TimerID.createSendDirectMessageID())) {
372 this.tweetTaskManager.updateTaskPeriod(timerID, this
373 .getGetSendDirectMessagePeriod(), false);
379 public void updateFontInformationToComponent() {
382 if (this.tlFontName != null) {
383 tlFont = new Font(this.tlFontName, Font.PLAIN, this.tlFontSize);
385 Font detailFont = null;
386 if (this.detailFontName != null) {
387 detailFont = new Font(this.detailFontName, Font.PLAIN,
388 this.detailFontSize);
391 // すべてのテーブルにフォント情報を反映
392 for (TweetTabbedTable t : this.tweetTabbedTableList) {
393 t.getTable().setFont(tlFont);
396 // tweetメッセージボックスのフォントはhtmlレベルで変更する必要がある
397 this.tweetMessageBox.setFont(detailFont);
399 HTMLDocument doc = (HTMLDocument) this.tweetMessageBox
401 StyleSheet[] style = doc.getStyleSheet().getStyleSheets();
402 for (int i = style.length - 1; i >= 0; i--) {
403 Style body = style[i].getStyle("body");
406 .setFontFamily(body, detailFont.getFontName());
407 StyleConstants.setFontSize(body, detailFont.getSize());
411 } catch (Exception e) {
420 * TimerIDクラスで生成したタイマーID
428 public void actionAddTab(String timerID, int period,
429 TweetGetter tweetGetter, String tabTitle) {
434 final TweetTabbedTable table = new TweetTabbedTable(
435 tweetGetter, tabTitle, this.tweetMainTab,
436 this.tableElementHeight, this.tweetManager, this,
437 newTableColor, TABLE_ELEMENT_MAX_SIZE, timerID);
439 this.tweetTaskManager.addTask(timerID, new TweetUpdateTask() {
442 public void runTask() throws TweetTaskException {
444 table.updateTweetTable();
448 this.tweetTaskManager.startTask(timerID, period * 1000L);
451 table.addTableToTab();
453 this.tweetTabbedTableList.add(table);
455 this.saveProperties();
456 // searchTable.updateTweetTable();
458 this.actionRequestForusToLastTab();
459 } catch (TweetTaskException ex) {
460 Logger.getLogger(TweetMainAction.class.getName()).log(
461 Level.SEVERE, null, ex);
462 } catch (IOException e) {
468 this.updateFontInformationToComponent();
470 this.updateTableHeight(this.getTableElementHeight());
479 public void actionAddMentionTab(int period) {
480 TimerID timerID = TimerID.getInstance();
481 String id = TimerID.createMentionID();
483 // 既にIDが存在していたらここで例外発生
486 if (this.isNotifyMentionMessage) {
488 actionAddTab(id, period, new TweetMentionGetter(tweetManager,
489 this.trayIcon), TweetMainAction.TAB_MENTION_STRING);
491 actionAddTab(id, period, new TweetMentionGetter(tweetManager),
492 TweetMainAction.TAB_MENTION_STRING);
494 } catch (ExistTimerIDException ex) {
495 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
496 JOptionPane.ERROR_MESSAGE);
504 * nullで自分自身を取得,指定するとscreenNameのFav取得
506 public void actionAddFavoriteTab(String screenName) {
507 TimerID timerID = TimerID.getInstance();
508 String id = TimerID.createFavoriteID(screenName);
510 // 既にIDが存在していたらここで例外発生
513 if (screenName == null) {
516 favTitle = screenName + "のお気に入り";
519 actionAddTab(id, Integer.MAX_VALUE, new TweetFavoriteGetter(
520 tweetManager, screenName), favTitle);
521 } catch (ExistTimerIDException ex) {
522 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
523 JOptionPane.ERROR_MESSAGE);
533 public void actionAddTimelineTab(int period) {
534 TimerID timerID = TimerID.getInstance();
535 String id = TimerID.createTimelineID();
537 // 既にIDが存在していたらここで例外発生
540 actionAddTab(id, period, new TweetTimelineGetter(tweetManager),
541 TweetMainAction.TAB_TIMELINE_STRING);
542 } catch (ExistTimerIDException ex) {
543 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
544 JOptionPane.ERROR_MESSAGE);
554 public void actionAddDirectMessageTab(int period) {
555 TimerID timerID = TimerID.getInstance();
556 String id = TimerID.createDirectMessageID();
558 // 既にIDが存在していたらここで例外発生
561 if (this.isNotifyDirectMessage == true) {
562 actionAddTab(id, period, new TweetDirectMessageGetter(
563 tweetManager, this.trayIcon),
564 TweetMainAction.TAB_DIRECT_MESSAGE_STRING);
566 actionAddTab(id, period, new TweetDirectMessageGetter(
568 TweetMainAction.TAB_DIRECT_MESSAGE_STRING);
570 } catch (ExistTimerIDException ex) {
571 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
572 JOptionPane.ERROR_MESSAGE);
581 public void actionAddSendDirectMessageTab(int period) {
582 TimerID timerID = TimerID.getInstance();
583 String id = TimerID.createSendDirectMessageID();
585 // 既にIDが存在していたらここで例外発生
588 actionAddTab(id, period, new TweetSendDirectMessageGetter(
590 TweetMainAction.TAB_SEND_DIRECT_MESSAGE_STRING);
591 } catch (ExistTimerIDException ex) {
592 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
593 JOptionPane.ERROR_MESSAGE);
602 * @param listFullname
605 public void actionAddListTab(String username, int listID,
606 String listFullname, int period) {
607 TimerID timerID = TimerID.getInstance();
608 String id = TimerID.createUserListID(username, listID);
610 // 既にIDが存在していたらここで例外発生
613 actionAddTab(id, period, new TweetListGetter(tweetManager,
614 username, listID), listFullname);
615 } catch (ExistTimerIDException ex) {
616 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
617 JOptionPane.ERROR_MESSAGE);
622 * ツイート検索結果を表示するタブを新しく追加
626 * 更新周期[sec] 0以下の場合は更新しない
628 public void actionAddNewSearchResultTab(String searchWord, int period) {
629 TimerID timerID = TimerID.getInstance();
630 String id = TimerID.createSearchTimerID(searchWord);
632 // 既にIDが存在していたらここで例外発生
635 actionAddTab(id, period, new TweetSearchResultGetter(
636 this.tweetManager, searchWord), searchWord);
637 } catch (ExistTimerIDException ex) {
638 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
639 JOptionPane.ERROR_MESSAGE);
651 public void actionAddUserTimelineTab(String username,
653 TimerID timerID = TimerID.getInstance();
654 String id = TimerID.createUserTimelineID(username);
656 // 既にIDが存在していたらここで例外発生
659 actionAddTab(id, period, new TweetUserTimelineGetter(tweetManager,
660 username), username + "の発言");
661 } catch (ExistTimerIDException ex) {
662 JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
663 JOptionPane.ERROR_MESSAGE);
672 public boolean isExistTimelineTab() {
673 TimerID timerID = TimerID.getInstance();
674 String id = TimerID.createTimelineID();
675 return timerID.contains(id);
683 public boolean isExistMentionTab() {
684 TimerID timerID = TimerID.getInstance();
685 String id = TimerID.createMentionID();
686 return timerID.contains(id);
694 public boolean isExistDirectMessageTab() {
695 TimerID timerID = TimerID.getInstance();
696 String id = TimerID.createDirectMessageID();
697 return timerID.contains(id);
705 public boolean isExistSendDirectMessageTab() {
706 TimerID timerID = TimerID.getInstance();
707 String id = TimerID.createSendDirectMessageID();
708 return timerID.contains(id);
714 public void actionBasicSettingDialog() {
715 // ダイレクトメッセージ送信用ダイアログを開く
716 Point loc = getConfigurationDialog().getLocation();
717 loc.translate(20, 20);
718 ConfigurationDialog dialog = getConfigurationDialog();
719 dialog.setLocation(loc);
720 dialog.setVisible(true);
726 public void actionSetReplyStatusToTweetBoxPane() {
728 this.setReplyStatus(currentStatus);
730 Status s = this.getCurrentStatus();
732 s = s.getRetweetedStatus();
735 String username = s.getUser().getScreenName();
736 this.tweetBoxPane.setText("@" + username + " ");
739 this.information(username + "さんに返信");
745 public void actionSetReplyAllStatusToTweetBoxPane() {
747 this.setReplyStatus(null);
749 Status s = this.getCurrentStatus();
751 s = s.getRetweetedStatus();
754 String username = s.getUser().getScreenName();
755 this.tweetBoxPane.setText("@" + username + " ");
758 this.information(username + "さんに返信");
764 public void actionSetQuoteStatusToTweetBoxPane() {
766 this.setReplyStatus(currentStatus);
767 Status s = this.getCurrentStatus();
769 s = s.getRetweetedStatus();
772 String username = s.getUser().getScreenName();
774 String message = s.getText();
775 this.tweetBoxPane.setText("QT @" + username + ": " + message);
778 this.information(username + "さんのメッセージを引用ツイート");
784 public void actionCopySelectedStatusToTweetBoxPane() {
785 Status s = this.getCurrentStatus();
787 s = s.getRetweetedStatus();
790 String username = s.getUser().getScreenName();
792 String message = s.getText();
793 this.tweetBoxPane.setText("RT @" + username + ": " + message);
801 public void actionDetailInfoButton(ActionEvent e) {
802 if (detailInfoPanel.isVisible()) {
803 detailInfoPanel.setVisible(false);
805 detailInfoPanel.setVisible(true);
814 public boolean isDetailInfoPanelVisible() {
815 return detailInfoPanel.isVisible();
819 * 書き込みメッセージボックスの表示ONOFFボタンを押した時の動作
823 public void actionShowTweetboxButton(ActionEvent e) {
824 if (this.tweetBoxRegionPane.isVisible()) {
825 this.tweetBoxRegionPane.setVisible(false);
827 this.tweetBoxRegionPane.setVisible(true);
832 * 書き込みメッセージボックス領域が表示されているか
834 public boolean isShowTweetBoxVisible() {
835 return this.tweetBoxRegionPane.isVisible();
841 public void actionRemoveFocusedTabbedTable() {
842 int selected = this.tweetMainTab.getSelectedIndex();
843 actionRemoveTabbedTable(selected);
851 public void actionRemoveTabbedTable(String timerID) {
852 int deleteTabIndex = -1;
854 for (int i = 0; i < tweetTabbedTableList.size(); i++) {
855 TweetTabbedTable table = tweetTabbedTableList.get(i);
856 if (table.getTimerID().equals(timerID)) {
863 if (deleteTabIndex >= 0) {
864 int selected = this.tweetTabbedTableList.get(deleteTabIndex)
867 this.tweetMainTab.remove(selected);
869 this.tweetTabbedTableList.remove(deleteTabIndex);
871 this.tweetTaskManager.shutdownTask(timerID);
873 TimerID idManager = TimerID.getInstance();
874 idManager.removeID(timerID);
877 this.updateCheckboxInformation();
881 } catch (IOException e) {
890 * @param removeTabIndex
892 public void actionRemoveTabbedTable(int removeTabIndex) {
893 int selected = removeTabIndex;
894 // タブの何番目に消したいテーブルがあるのかと,tweetTabbedTableListの何番目に消したいテーブルがあるのかは違う
898 int deleteTabIndex = -1;
899 for (int i = 0; i < tweetTabbedTableList.size(); i++) {
900 TweetTabbedTable table = tweetTabbedTableList.get(i);
901 if (selected == table.getTabSetNum()) {
908 if (deleteTabIndex >= 0) {
910 this.tweetMainTab.remove(selected);
912 String timerID = this.tweetTabbedTableList.get(deleteTabIndex)
915 this.tweetTabbedTableList.remove(deleteTabIndex);
917 this.tweetTaskManager.shutdownTask(timerID);
919 TimerID idManager = TimerID.getInstance();
920 idManager.removeID(timerID);
923 this.updateCheckboxInformation();
927 } catch (IOException e) {
938 public void actionExitButton(ActionEvent e) {
945 public void actionOpenStatusURL() {
948 String userName = this.getCurrentStatus().getUser().getScreenName();
950 long statusID = this.getCurrentStatus().getId();
951 Desktop.getDesktop().browse(
952 new URI(TWITTER_URL + userName + "/statuses/" + statusID));
953 } catch (Exception ex) {
954 ex.printStackTrace();
955 JOptionPane.showMessageDialog(null, "エラーによりブラウザを起動できませんでした.",
956 "Error", JOptionPane.ERROR_MESSAGE);
963 public void actionOpenUserFav() {
965 Status s = this.getCurrentStatus();
967 s = s.getRetweetedStatus();
969 String userName = s.getUser().getScreenName();
970 this.actionAddFavoriteTab(userName);
971 } catch (Exception ex) {
972 ex.printStackTrace();
979 public void actionOpenFav() {
980 String username = this.tweetManager.getScreenName();
981 this.actionAddFavoriteTab(username);
987 public void actionOpenUserURL() {
989 Status s = this.getCurrentStatus();
991 s = s.getRetweetedStatus();
993 String userName = s.getUser().getScreenName();
994 Desktop.getDesktop().browse(new URI(TWITTER_URL + userName));
995 } catch (Exception ex) {
996 ex.printStackTrace();
997 JOptionPane.showMessageDialog(null, "エラーによりブラウザを起動できませんでした.",
998 "Error", JOptionPane.ERROR_MESSAGE);
1005 public void actionRefreshTime() {
1007 for (TweetTabbedTable t : this.tweetTabbedTableList) {
1008 TweetTableModel model = t.getModel();
1009 if (model != null) {
1010 model.refreshTime();
1016 * TweetMessageBox内にある#ハッシュタグ の部分をa hrefリンクに変換
1020 public String actionReplaceTweetMessageBoxHashTab(String message) {
1022 Pattern userPtn = Pattern.compile("#[0-9A-Z_]+",
1023 Pattern.CASE_INSENSITIVE);
1024 Matcher matcher = userPtn.matcher(message);
1027 Set<String> findList = new TreeSet<String>();
1028 while (matcher.find()) {
1029 findList.add(matcher.group(0));
1032 for (String f : findList) {
1034 message = message.replaceAll(f + "$|" + f + "\\s", "<a href=\""
1035 + SEARCH_TWITTER_URL + SEARCH_QUERY
1036 + URLEncoder.encode(f, DEFAULT_CHARACTER_ENCODING)
1037 + "\">" + "$0</a>");
1038 } catch (UnsupportedEncodingException e) {
1039 e.printStackTrace();
1046 * TweetMessageBox内にあるリンクをa hrefリンクに変換
1050 public String actionReplaceTweetMessageBoxURLLink(String message) {
1051 Matcher matcher = convURLLinkPtn.matcher(message);
1052 return matcher.replaceAll("<a href=\"$0\">$0</a>");
1056 * @ユーザ名の部分をa hrefリンクに変換
1059 public String actionReplaceTweetMessageBoxUserInfo(String message) {
1061 Pattern userPtn = Pattern.compile("@[0-9A-Z_]+",
1062 Pattern.CASE_INSENSITIVE);
1063 Matcher matcher = userPtn.matcher(message);
1065 Set<String> findList = new TreeSet<String>();
1066 while (matcher.find()) {
1067 findList.add(matcher.group(0));
1069 // 指定したユーザ名をすべてリンクへ変更
1070 for (String f : findList) {
1071 message = message.replaceAll(f, "<a href=\"" + TWITTER_URL
1072 + f.substring(1) + "\">" + f + "</a>");
1078 * まだ見ていないdirectMessage数を0にする
1080 public void actionResetUncheckedDirectMessageCount() {
1081 uncheckedDirectMessageCount = 0;
1082 tweetMainTab.setTitleAt(2, TAB_DIRECT_MESSAGE_STRING);
1086 * まだ見ていないmention数を0にする
1088 public void actionResetUncheckedMentionTweetCount() {
1089 uncheckedMentionTweetCount = 0;
1090 tweetMainTab.setTitleAt(1, TAB_MENTION_STRING);
1094 * まだ見ていないtweet数を0にする
1096 public void actionResetUncheckedTimelineTweetCount() {
1097 uncheckedTimelineTweetCount = 0;
1098 tweetMainTab.setTitleAt(0, TAB_TIMELINE_STRING);
1104 public void actionSelectedUserTimeline() {
1105 Status status = null;
1106 if (this.getCurrentStatus().isRetweet()) {
1107 status = this.getCurrentStatus().getRetweetedStatus();
1109 status = this.getCurrentStatus();
1111 String username = status.getUser().getScreenName();
1113 actionAddUserTimelineTab(username, this.getGetTimelinePeriod());
1117 * 選択したユーザが作成したリスト一覧を表示
1121 public void actionShowSelectedUserList(ListGetterSelection selection) {
1122 Status status = null;
1123 if (this.getCurrentStatus().isRetweet()) {
1124 status = this.getCurrentStatus().getRetweetedStatus();
1126 status = this.getCurrentStatus();
1128 String username = status.getUser().getScreenName();
1129 actionShowUserListDialog(status.getUser().getScreenName(), selection);
1133 * 選択しているツイートをお気に入りに追加
1135 public void actionCreateFavorite() {
1136 Status status = null;
1137 if (this.getCurrentStatus().isRetweet()) {
1138 status = this.getCurrentStatus().getRetweetedStatus();
1140 status = this.getCurrentStatus();
1142 // 選択しているtweetのstatus id
1143 long statusID = status.getId();
1145 String username = status.getUser().getScreenName();
1147 String message = status.getText();
1149 if (message.length() > 30) {
1150 message = message.substring(0, 30) + " ...(以下略)";
1152 // Retweetしていいかどうかの確認
1153 int ret = JOptionPane.showConfirmDialog(mainFrame, username + " さんの発言:"
1154 + message + "\nをお気に入りに追加しますか?", "Favの確認",
1155 JOptionPane.YES_NO_OPTION);
1156 if (ret == JOptionPane.YES_OPTION) {
1159 this.tweetManager.createFavorite(statusID);
1160 } catch (TwitterException e) {
1161 JOptionPane.showMessageDialog(null, "エラーによりお気に入りに追加できませんでした.",
1162 "Fav Error", JOptionPane.ERROR_MESSAGE);
1168 * 選択しているツイートをお気に入りから外す
1170 public void actionDestroyFavorite() {
1171 Status status = null;
1172 if (this.getCurrentStatus().isRetweet()) {
1173 status = this.getCurrentStatus().getRetweetedStatus();
1175 status = this.getCurrentStatus();
1177 // 選択しているtweetのstatus id
1178 long statusID = status.getId();
1180 String username = status.getUser().getScreenName();
1182 String message = status.getText();
1184 if (message.length() > 30) {
1185 message = message.substring(0, 30) + " ...(以下略)";
1187 // Retweetしていいかどうかの確認
1188 int ret = JOptionPane.showConfirmDialog(mainFrame, username + " さんの発言:"
1189 + message + "\nをお気に入りから削除しますか?", "Favの確認",
1190 JOptionPane.YES_NO_OPTION);
1191 if (ret == JOptionPane.YES_OPTION) {
1194 this.tweetManager.destroyFavorite(statusID);
1195 } catch (TwitterException e) {
1196 JOptionPane.showMessageDialog(null, "エラーによりお気に入りから削除できませんでした.",
1197 "Fav Error", JOptionPane.ERROR_MESSAGE);
1203 * 現在選択しているステータスを公式Retweet
1205 public void actionRetweet() {
1206 Status status = null;
1207 if (this.getCurrentStatus().isRetweet()) {
1208 status = this.getCurrentStatus().getRetweetedStatus();
1210 status = this.getCurrentStatus();
1213 // 選択しているtweetのstatus id
1214 long statusID = status.getId();
1216 String username = status.getUser().getScreenName();
1218 String message = status.getText();
1220 if (message.length() > 30) {
1221 message = message.substring(0, 30) + " ...(以下略)";
1223 // Retweetしていいかどうかの確認
1224 int ret = JOptionPane.showConfirmDialog(mainFrame, username + " さんの発言:"
1225 + message + "\nをRetweetしますか?", "Retweetの確認",
1226 JOptionPane.YES_NO_OPTION);
1227 if (ret == JOptionPane.YES_OPTION) {
1230 this.tweetManager.retweet(statusID);
1231 } catch (TwitterException e) {
1232 JOptionPane.showMessageDialog(null, "エラーによりRetweetできませんでした.",
1233 "Retweet Error", JOptionPane.ERROR_MESSAGE);
1243 public void updateTableHeight(int height) {
1244 this.tableElementHeight = height;
1245 for (TweetTabbedTable t : this.tweetTabbedTableList) {
1246 t.getTable().setRowHeight(tableElementHeight);
1253 public void actionShowDirectMessageDialog() {
1254 // ダイレクトメッセージ送信用ダイアログを開く
1255 Point loc = getDirectMessageDialog().getLocation();
1256 // loc.translate(20, 20);
1257 DirectMessageDialog dialog = getDirectMessageDialog();
1258 // dialog.setLocation(loc);
1259 dialog.setLocationRelativeTo(null);
1260 dialog.setVisible(true);
1261 dialog.setUserInformation(this.selectedUsername,
1262 this.selectedUserImageURL, this.tweetManager);
1268 public void actionShowAboutDialog() {
1269 Point loc = getDirectMessageDialog().getLocation();
1270 // loc.translate(20, 20);
1271 AboutDialog dialog = getAboutDialog();
1272 dialog.setLocationRelativeTo(null);
1273 // dialog.setLocation(loc);
1274 dialog.setVisible(true);
1280 public void actionShowAccountDialog() {
1281 // TODO: location取得のコードおかしい
1282 Point loc = getDirectMessageDialog().getLocation();
1283 // loc.translate(20, 20);
1284 AccountDialog dialog = getAccountDialog();
1285 dialog.setLocationRelativeTo(null);
1286 // dialog.setLocation(loc);
1287 dialog.setVisible(true);
1291 * Twitter全体からキーワード検索ダイアログを表示
1293 public void actionShowKeywordSearchDialog() {
1294 Point loc = getDirectMessageDialog().getLocation();
1295 KeywordSearchDialog dialog = getKeywordSearchDialog();
1296 dialog.setSearchWord("");
1297 dialog.setLocationRelativeTo(null);
1298 dialog.setVisible(true);
1302 * Twitter全体からキーワード検索ダイアログを表示
1305 * searchwordボックスに予め設定するワード
1307 public void actionShowKeywordSearchDialog(String searchWord) {
1308 Point loc = getDirectMessageDialog().getLocation();
1309 KeywordSearchDialog dialog = getKeywordSearchDialog();
1310 dialog.setSearchWord(searchWord);
1311 dialog.setLocationRelativeTo(null);
1312 dialog.setVisible(true);
1318 public void actionShowUserSearchDialog() {
1319 UserSearchDialog dialog = getUserSearchDialog();
1320 dialog.setLocationRelativeTo(null);
1321 dialog.setVisible(true);
1327 public void actionShowHashtagSearchDialog() {
1328 Point loc = getDirectMessageDialog().getLocation();
1329 HashtagSearchDialog dialog = getHashtagSearchDialog();
1330 dialog.setLocationRelativeTo(null);
1331 dialog.setVisible(true);
1337 * @param listUserName
1340 * CREATED: 指定したユーザが作成したリスト SUBSCRIPTION: 指定したユーザがフォローしているリスト
1341 * MEMBERSHIPS: 指定したユーザが追加されているリスト
1343 public void actionShowUserListDialog(String listUserName,
1344 ListGetterSelection selection) {
1345 UserListDialog dialog = getUserListDialog(listUserName, selection);
1346 Point loc = dialog.getLocation();
1347 dialog.setLocationRelativeTo(null);
1348 dialog.setVisible(true);
1352 * tweetBoxPaneに書かれた文字をつぶやく
1354 public void actionTweet() {
1355 boolean isTweet = false;
1357 if (this.replyStatus != null) {
1358 tweetManager.replyTweet(tweetBoxPane.getText(),
1359 this.replyStatus.getId());
1361 tweetManager.tweet(tweetBoxPane.getText());
1364 } catch (Exception e) {
1365 e.printStackTrace();
1370 this.information("メッセージをつぶやきました. 発言:" + tweetBoxPane.getText());
1371 tweetBoxPane.setText(""); // テキストをクリア
1373 this.information("つぶやきに失敗しました");
1374 JOptionPane.showMessageDialog(null,
1375 "つぶやきに失敗しました。文字数がオーバーしているか、ツイッターに接続ができませんでした。",
1376 "Tweet Error", JOptionPane.ERROR_MESSAGE);
1386 public void actionUpdateButton(java.awt.event.ActionEvent e) {
1388 // タブ上に存在するテーブルの情報を更新
1389 for (TweetTabbedTable t : this.tweetTabbedTableList) {
1390 String timerID = t.getTimerID();
1391 this.tweetTaskManager.resetTask(timerID, true);
1395 int remainingHits = tweetManager.getRateLimitStatus()
1396 .getRemainingHits();
1397 // 取得したコメント数をステータスバーに表示
1398 information("新しいツイートを取得しました. (APIリクエスト残数は" + remainingHits + "回です)");
1399 } catch (Exception e1) {
1400 e1.printStackTrace();
1405 * 新しく追加したタブにフォーカスを移す
1407 public void actionRequestForusToLastTab() {
1408 int lasttab = this.tweetMainTab.getTabCount() - 1;
1410 this.tweetMainTab.setSelectedIndex(lasttab);
1415 * 指定した番号のタブにフォーカスを移す
1419 public void actionRequestFocusToTab(int index) {
1421 this.tweetMainTab.setSelectedIndex(index);
1426 * 選択しているタブにあるテーブル情報だけを更新
1428 public void actionFocusedTableUpdate() {
1429 int selected = this.tweetMainTab.getSelectedIndex();
1431 if (selected >= 0) {
1432 // タブ上に存在するテーブルの情報を更新
1433 TweetTabbedTable t = this.tweetTabbedTableList.get(selected);
1434 String timerID = t.getTimerID();
1435 this.tweetTaskManager.resetTask(timerID, true);
1437 int remainingHits = tweetManager.getRateLimitStatus()
1438 .getRemainingHits();
1439 // 取得したコメント数をステータスバーに表示
1440 information(t.getTitle() + "タブのツイートを" + t.getUncheckedTweet()
1441 + "件取得しました. (APIリクエスト残数は" + remainingHits + "回です)");
1443 } catch (Exception e1) {
1444 e1.printStackTrace();
1453 public void actionUpdateTweetMessageCount() {
1454 int len = 140 - (tweetBoxPane.getText().length());
1455 boolean over = false;
1462 tweetMessageCountLabel.setForeground(Color.RED);
1464 tweetMessageCountLabel.setText("Over(" + len + ")");
1466 tweetMessageCountLabel.setForeground(Color.BLACK);
1468 tweetMessageCountLabel.setText(len + "");
1471 // 残りつぶやき数140の場合,reply状態も解除する
1473 this.setReplyStatus(null);
1482 public ConfigurationDialog getConfigurationDialog() {
1483 if (configurationDialog == null) {
1484 configurationDialog = new ConfigurationDialog(mainFrame, true, this);
1486 return configurationDialog;
1492 * @param listUserName
1497 public UserListDialog getUserListDialog(String listUserName,
1498 ListGetterSelection selection) {
1499 UserListGetter getter = null;
1500 switch (selection) {
1502 getter = new UserListSpecificUserListsGetter(tweetManager);
1505 getter = new UserListMembershipsGetter(tweetManager);
1507 case SUBSCRIPTION: /* fall through */
1509 getter = new UserListSubscriptionGetter(tweetManager);
1512 userListDialog = new UserListDialog(mainFrame, true, this, getter,
1514 return userListDialog;
1522 public String getScreenName() {
1523 return tweetManager.getScreenName();
1527 * twitter全体からキーワード検索ダイアログを表示
1531 public KeywordSearchDialog getKeywordSearchDialog() {
1532 if (keywordSearchDialog == null) {
1533 keywordSearchDialog = new KeywordSearchDialog(mainFrame, true, this);
1535 return keywordSearchDialog;
1542 public UserSearchDialog getUserSearchDialog() {
1543 if( this.userSearchDialog == null ) {
1544 this.userSearchDialog = new UserSearchDialog(mainFrame, true, this);
1546 return this.userSearchDialog;
1554 public HashtagSearchDialog getHashtagSearchDialog() {
1555 if (hashtagSearchDialog == null) {
1556 hashtagSearchDialog = new HashtagSearchDialog(mainFrame, true,
1557 this, tweetManager);
1559 return hashtagSearchDialog;
1567 public AccountDialog getAccountDialog() {
1568 if (accountDialog == null) {
1569 accountDialog = new AccountDialog(mainFrame, true, tweetManager,
1572 return accountDialog;
1576 * ダイレクトメッセージ送信用ダイアログを取得
1580 public DirectMessageDialog getDirectMessageDialog() {
1581 if (directMessageDialog == null) {
1582 directMessageDialog = new DirectMessageDialog(mainFrame);
1583 directMessageDialog.setTitle("ダイレクトメッセージを送信");
1585 return directMessageDialog;
1589 * テーブルで選択したツイートを詳細情報としてセット
1593 public void setDetailInformationFromTable(JTable table) {
1594 int sc = table.getSelectedRowCount();
1595 String infoMessage = "";
1597 // 選択している行が1行だけの場合,情報を表示する
1598 if (sc == 1 && table != null) {
1599 Status st = getTweetTableInformation(table, table.getModel());
1601 if (st.isRetweet()) {
1602 st = st.getRetweetedStatus();
1604 infoMessage = st.getText();
1605 // メッセージのHTMLエンコードを行う
1606 infoMessage = HTMLEncode.encode(infoMessage);
1607 // tweetMessageBox内のURLをhtmlリンクへ変換
1608 infoMessage = actionReplaceTweetMessageBoxURLLink(infoMessage);
1609 // @ユーザ情報をhtmlリンクへ変換
1610 infoMessage = actionReplaceTweetMessageBoxUserInfo(infoMessage);
1611 // #ハッシュタグ情報をhtmlリンクへ変換
1612 infoMessage = actionReplaceTweetMessageBoxHashTab(infoMessage);
1613 // 詳細情報にテーブルで選択した人のツイート情報を表示
1614 tweetMessageBox.setText(infoMessage);
1617 ImageIcon icon = TwitterImageCache.getInstance().getProfileImage(
1618 st.getUser().getProfileImageURL().toString());
1619 userImageLabel.setIcon(icon);
1621 userNameLabel.setText(st.getUser().getName() + " / "
1622 + st.getUser().getScreenName());
1624 updateTimeLabel.setText(DateFormat.getInstance().format(
1625 st.getCreatedAt()));
1627 userIntroBox.setText(st.getUser().getDescription());
1629 followerLabel.setText(st.getUser().getFollowersCount() + "");
1631 followingLabel.setText(st.getUser().getFriendsCount() + "");
1633 locationLabel.setText(st.getUser().getLocation());
1635 if (st.getUser().getURL() != null) {
1636 userWebBox.setText("<a href=\"" + st.getUser().getURL() + "\">"
1637 + st.getUser().getScreenName() + "のWebを開く" + "</a>");
1639 userWebBox.setText("");
1642 clientNameLabel.setText(" via " + st.getSource());
1644 updateLabel.setText(st.getUser().getStatusesCount() + "");
1652 public AboutDialog getAboutDialog() {
1653 if (aboutDialog == null) {
1654 aboutDialog = new AboutDialog(mainFrame, true);
1660 * テーブルで選択した場所のTweet情報を取得
1664 public Status getTweetTableInformation(JTable table, TableModel model) {
1665 int index = table.convertRowIndexToModel(table.getSelectedRow());
1666 Status status = null;
1667 if (model instanceof TweetTableModel) {
1668 status = ((TweetTableModel) model).getTweetStatus(index);
1669 // 現在選択したセルのユーザ名を保存しておく
1670 this.selectedUsername = status.getUser().getScreenName();
1671 // 現在選択したセルのユーザURLを保存しておく
1672 this.selectedUserImageURL = status.getUser().getProfileImageURL();
1673 // 選択したStatusを保存しておく
1674 this.setCurrentStatus(status);
1684 public void information(String message) {
1685 statusBarLabel.setText(message);
1692 public boolean isTempOpenedTimelineTab() {
1693 return isTempOpenedTimelineTab;
1700 public boolean isTempOpenedMentionTab() {
1701 return isTempOpenedMentionTab;
1708 public boolean isTempOpenedDMTab() {
1709 return isTempOpenedDMTab;
1716 public boolean isTempOpenedSendDMTab() {
1717 return isTempOpenedSendDMTab;
1723 * @throws IOException
1724 * @throws FileNotFoundException
1726 public void loadProperties() throws FileNotFoundException, IOException {
1727 if (property == null) {
1728 this.property = new Properties();
1730 property.load(new FileInputStream("./" + PROPERTIES_DIRECTORY + "/"
1731 + BASIC_SETTING_FILENAME));
1733 String gtp = this.property.getProperty("getTimelinePeriod");
1734 String gmp = this.property.getProperty("getMentionPeriod");
1735 String gdmp = this.property.getProperty("getDirectMessagePeriod");
1736 String gsdmp = this.property.getProperty("getSendDirectMessagePeriod");
1738 String ntrgb = this.property.getProperty("newTableColorRGB");
1740 this.tlFontName = this.property.getProperty("tlFontName");
1741 this.detailFontName = this.property.getProperty("detailFontName");
1743 String tfs = this.property.getProperty("tlFontSize");
1744 String dfs = this.property.getProperty("detailFontSize");
1745 String teh = this.property.getProperty("tableElementHeight");
1748 String mfw = this.property.getProperty("mainFrameWidth");
1749 String mfh = this.property.getProperty("mainFrameHeight");
1752 String nm = this.property.getProperty("notifyMention");
1753 String ndm = this.property.getProperty("notifyDirectMessage");
1756 String ptl = this.property.getProperty("openTimelineTab");
1757 String pm = this.property.getProperty("openMentionTab");
1758 String podm = this.property.getProperty("openDirectMessageTab");
1759 String posdmt = this.property.getProperty("openSendDirectMessageTab");
1762 this.newTableColor = new Color(Integer.parseInt(ntrgb));
1763 this.tlFontSize = Integer.parseInt(tfs);
1764 this.detailFontSize = Integer.parseInt(dfs);
1765 this.tableElementHeight = Integer.parseInt(teh);
1766 this.mainFrameWidth = Integer.parseInt(mfw);
1767 this.mainFrameHeight = Integer.parseInt(mfh);
1770 this.getTimelinePeriod = Integer.parseInt(gtp);
1771 this.getMentionPeriod = Integer.parseInt(gmp);
1772 this.getDirectMessagePeriod = Integer.parseInt(gdmp);
1773 this.getSendDirectMessagePeriod = Integer.parseInt(gsdmp);
1776 this.isNotifyMentionMessage = Boolean.parseBoolean(nm);
1777 this.isNotifyDirectMessage = Boolean.parseBoolean(ndm);
1780 this.isTempOpenedTimelineTab = Boolean.parseBoolean(ptl);
1781 this.isTempOpenedMentionTab = Boolean.parseBoolean(pm);
1782 this.isTempOpenedDMTab = Boolean.parseBoolean(podm);
1783 this.isTempOpenedSendDMTab = Boolean.parseBoolean(posdmt);
1784 } catch (NumberFormatException e) {
1785 e.printStackTrace();
1792 * @throws IOException
1794 public void saveProperties() throws IOException {
1796 File logDir = new File("./" + PROPERTIES_DIRECTORY);
1797 if (!logDir.exists()) {
1798 // ディレクトリが存在しないので作成する
1799 if (logDir.mkdir() == false) {
1800 throw new IOException(PROPERTIES_DIRECTORY
1801 + "ディレクトリを作成できませんでした.");
1804 if (property == null) {
1805 this.property = new Properties();
1809 this.property.setProperty("getTimelinePeriod", this.getTimelinePeriod
1811 this.property.setProperty("getMentionPeriod", this.getMentionPeriod
1813 this.property.setProperty("getDirectMessagePeriod",
1814 this.getDirectMessagePeriod + "");
1815 this.property.setProperty("getSendDirectMessagePeriod",
1816 this.getSendDirectMessagePeriod + "");
1818 this.property.setProperty("newTableColorRGB", newTableColor.getRGB()
1820 this.property.setProperty("tlFontName", this.tlFontName);
1821 this.property.setProperty("tlFontSize", this.tlFontSize + "");
1822 this.property.setProperty("detailFontName", this.detailFontName);
1823 this.property.setProperty("detailFontSize", this.detailFontSize + "");
1824 this.property.setProperty("tableElementHeight", this.tableElementHeight
1828 if (this.mainFrame.getExtendedState() == JFrame.NORMAL) {
1829 this.mainFrameWidth = this.mainFrame.getWidth();
1830 this.mainFrameHeight = this.mainFrame.getHeight();
1832 this.property.setProperty("mainFrameWidth", this.mainFrameWidth + "");
1833 this.property.setProperty("mainFrameHeight", this.mainFrameHeight + "");
1836 this.property.setProperty("notifyMention", this.isNotifyMentionMessage
1838 this.property.setProperty("notifyDirectMessage",
1839 this.isNotifyDirectMessage + "");
1842 this.property.setProperty("openTimelineTab", this.isExistTimelineTab() + "");
1843 this.property.setProperty("openMentionTab", this.isExistMentionTab() + "");
1844 this.property.setProperty("openDirectMessageTab", this.isExistDirectMessageTab() + "");
1845 this.property.setProperty("openSendDirectMessageTab", this.isExistSendDirectMessageTab() + "");
1848 property.store(new FileOutputStream("./" + PROPERTIES_DIRECTORY + "/"
1849 + BASIC_SETTING_FILENAME), null);
1853 * newTableColorを取得します。
1855 * @return newTableColor
1857 public Color getNewTableColor() {
1858 return newTableColor;
1862 * newTableColorを設定します。
1864 * @param newTableColor
1867 public void setNewTableColor(Color newTableColor) {
1868 this.newTableColor = newTableColor;
1874 * @return tlFontName
1876 public String getTlFontName() {
1886 public void setTlFontName(String tlFontName) {
1887 this.tlFontName = tlFontName;
1893 * @return tlFontSize
1895 public int getTlFontSize() {
1905 public void setTlFontSize(int tlFontSize) {
1906 this.tlFontSize = tlFontSize;
1910 * detailFontNameを取得します。
1912 * @return detailFontName
1914 public String getDetailFontName() {
1915 return detailFontName;
1919 * detailFontNameを設定します。
1921 * @param detailFontName
1924 public void setDetailFontName(String detailFontName) {
1925 this.detailFontName = detailFontName;
1929 * detailFontSizeを取得します。
1931 * @return detailFontSize
1933 public int getDetailFontSize() {
1934 return detailFontSize;
1938 * detailFontSizeを設定します。
1940 * @param detailFontSize
1943 public void setDetailFontSize(int detailFontSize) {
1944 this.detailFontSize = detailFontSize;
1948 * tableElementHeightを取得します。
1950 * @return tableElementHeight
1952 public int getTableElementHeight() {
1953 return tableElementHeight;
1957 * tableElementHeightを設定します。
1959 * @param tableElementHeight
1960 * tableElementHeight
1962 public void setTableElementHeight(int tableElementHeight) {
1963 this.tableElementHeight = tableElementHeight;
1967 * @return the getTimelinePeriod
1969 public int getGetTimelinePeriod() {
1970 return getTimelinePeriod;
1977 public void setNotifyMention(boolean notify) {
1978 this.isNotifyMentionMessage = notify;
1985 public boolean getNotifyMention() {
1986 return this.isNotifyMentionMessage;
1994 public void setNotifyDirectMessage(boolean notify) {
1995 this.isNotifyDirectMessage = notify;
2002 public boolean getNotifyDirectMessage() {
2003 return this.isNotifyDirectMessage;
2007 * @param getTimelinePeriod
2008 * the getTimelinePeriod to set
2010 public void setGetTimelinePeriod(int getTimelinePeriod) {
2011 this.getTimelinePeriod = getTimelinePeriod;
2015 * @return the getMentionPeriod
2017 public int getGetMentionPeriod() {
2018 return getMentionPeriod;
2022 * @param getMentionPeriod
2023 * the getMentionPeriod to set
2025 public void setGetMentionPeriod(int getMentionPeriod) {
2026 this.getMentionPeriod = getMentionPeriod;
2030 * @return the getDirectMessagePeriod
2032 public int getGetDirectMessagePeriod() {
2033 return getDirectMessagePeriod;
2037 * @param getDirectMessagePeriod
2038 * the getDirectMessagePeriod to set
2040 public void setGetDirectMessagePeriod(int getDirectMessagePeriod) {
2041 this.getDirectMessagePeriod = getDirectMessagePeriod;
2045 * @return the getSendDirectMessagePeriod
2047 public int getGetSendDirectMessagePeriod() {
2048 return getSendDirectMessagePeriod;
2052 * @param getSendDirectMessagePeriod
2053 * the getSendDirectMessagePeriod to set
2055 public void setGetSendDirectMessagePeriod(int getSendDirectMessagePeriod) {
2056 this.getSendDirectMessagePeriod = getSendDirectMessagePeriod;
2060 * @return the currentStatus
2062 public Status getCurrentStatus() {
2063 return currentStatus;
2067 * @param currentStatus
2068 * the currentStatus to set
2070 public void setCurrentStatus(Status currentStatus) {
2071 this.currentStatus = currentStatus;
2078 public Status getReplyStatus() {
2087 public void setReplyStatus(Status status) {
2088 this.replyStatus = status;