package twitter.action;
+import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
+import twitter.gui.action.TweetMainAction;
+import twitter.log.TwitterLogManager;
import twitter.manage.TweetManager;
import twitter4j.Status;
import twitter4j.TwitterException;
//tweet管理用
private TweetManager tweetManager;
+ private TweetMainAction mainAction = null;
+ private TwitterLogManager logManager = null;
/**
*
* @param tweetManager
*/
- public TweetTimelineGetter(TweetManager tweetManager) {
+ public TweetTimelineGetter(TweetManager tweetManager, TweetMainAction mainAction) {
this.tweetManager = tweetManager;
+ this.mainAction = mainAction;
+ this.logManager = new TwitterLogManager();
}
/**
List<Status> status = null;
try {
status = tweetManager.getTimeline(num);
+ if( mainAction.isSaveLog() == true && status != null ) {
+ try {
+ // ログ保存
+ logManager.add(status);
+ } catch (IOException ex) {
+ Logger.getLogger(TweetTimelineGetter.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
} catch (TwitterException ex) {
Logger.getLogger(TweetMentionGetter.class.getName()).log(Level.SEVERE, null, ex);
}
List<Status> status = null;
try {
status = tweetManager.getNewTimelineData();
+ if( mainAction.isSaveLog() == true && status != null ) {
+ try {
+ // ログ保存
+ logManager.add(status);
+ } catch (IOException ex) {
+ Logger.getLogger(TweetTimelineGetter.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
} catch (TwitterException ex) {
Logger.getLogger(TweetMentionGetter.class.getName()).log(Level.SEVERE, null, ex);
}
// 既にIDが存在していたらここで例外発生
timerID.addID(id);
// 検索結果を表示するタブを生成
- actionAddTab(id, period, new TweetTimelineGetter(tweetManager),
+ actionAddTab(id, period, new TweetTimelineGetter(tweetManager, this),
TweetMainAction.TAB_TIMELINE_STRING);
} catch (ExistTimerIDException ex) {
JOptionPane.showMessageDialog(null, "そのタブは既に存在しています", "Error",
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane9" min="-2" pref="53" max="-2" attributes="0"/>
- <EmptySpace max="32767" attributes="0"/>
+ <EmptySpace pref="27" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
// twitterログイン
boolean login = false;
try {
- tweetManager.loginTwitter();
- login = true;
+ tweetManager = new TweetManager();
+ tweetManager.loginTwitter();
+ login = true;
} catch (Exception e) {
e.printStackTrace();
}
private JPopupMenu rightClickPopup = null;
private TweetMainAction mainAction = null;
// TweetManager
- private TweetManager tweetManager = new TweetManager();
+ private TweetManager tweetManager = null;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JEditorPane clientNameLabel;
private javax.swing.JLabel followerLabel;
import java.util.logging.Level;
import java.util.logging.Logger;
-import twitter.log.TwitterLogManager;
+import twitter.gui.action.TweetMainAction;
import twitter4j.Annotations;
import twitter4j.DirectMessage;
import twitter4j.GeoLocation;
private Properties property = null;
// アカウント設定ファイル
private Properties accountProperty = null;
- // ログ保存
- private TwitterLogManager logManager = null;
//following IDリスト keyはユーザ名, valueはユーザがfollowingしているid
private Map<String, List<Long>> followingUserIDList = new HashMap<String, List<Long>>();
private Map<String, List<Long>> followerUserIDList = new HashMap<String, List<Long>>();
public TweetManager() {
- logManager = new TwitterLogManager();
}
/**
Collections.reverse(statuses);
tweetList.addAll(statuses);
}
- // ログ保存
- try {
- /*
- * for (Status s : tweetList) { logManager.add(s); }
- */
- logManager.add(tweetList);
- } catch (IOException e) {
- e.printStackTrace();
- }
// 設定ファイル保存
try {
saveProperties();
Collections.reverse(statuses);
tweetList.addAll(statuses);
}
- // ログ保存
- try {
- // for (Status s : tweetList) {
- // logManager.add(s);
- // }
- logManager.add(tweetList);
- } catch (IOException e) {
- e.printStackTrace();
- }
try {
saveProperties();
} catch (IOException e) {