import java.net.URLEncoder;
import java.text.DateFormat;
import java.util.ArrayList;
+import java.util.BitSet;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import twitter.gui.form.DirectMessageDialog;
import twitter.gui.form.HashtagSearchDialog;
import twitter.gui.form.KeywordSearchDialog;
+import twitter.gui.form.OutputCSVLogDialog;
import twitter.gui.form.UserListDialog;
import twitter.gui.form.UserSearchDialog;
import twitter.log.TwitterLogManager;
import twitter.manage.TweetConfiguration;
import twitter.manage.TweetManager;
+import twitter.manage.URLBitlyConverter;
import twitter.task.ExistTimerIDException;
import twitter.task.TimerID;
import twitter.task.TweetTaskException;
import twitter.util.HTMLEncode;
import twitter4j.Status;
import twitter4j.TwitterException;
+import twitter4j.User;
/**
* GUIのアクション部分
private UserListDialog userListDialog = null;
//ユーザサーチダイアログ
private UserSearchDialog userSearchDialog = null;
+ //CSVログ出力ダイアログ
+ private OutputCSVLogDialog outputCSVLogDialog = null;
// 情報更新間隔[sec]
private int getTimelinePeriod = 60;
Matcher matcher = convURLLinkPtn.matcher(message);
return matcher.replaceAll("<a href=\"$0\">$0</a>");
}
+
+ /**
+ * メッセージ内にあるURLをBitlyに変換する
+ * @param message
+ * @return
+ */
+ public String actionConvertURLToBitly(String message) {
+ String result = new String( message );
+ //URLをbitlyに変換
+ Matcher matcher = convURLLinkPtn.matcher(message);
+ while( matcher.find() ) {
+ String source = matcher.group();
+ String conv = URLBitlyConverter.convertUrlToBitly( source );
+ result = result.replaceAll( source , conv );
+ }
+ return result;
+ }
+
+ /**
+ * つぶやきボックス内のURLをbitlyに変換
+ */
+ public void actionConvertTweetBoxURLToBitly() {
+ String message = this.tweetBoxPane.getText();
+ String conv = actionConvertURLToBitly(message);
+ this.tweetBoxPane.setText( conv );
+ }
/**
* @ユーザ名の部分をa hrefリンクに変換
dialog.setVisible(true);
}
+ /**
+ * CSVログ出力ダイアログを表示
+ */
+ public void actionShowOutputCSVLogDialog() {
+ OutputCSVLogDialog dialog = getOutputCSVLogDialog();
+ dialog.setLocationRelativeTo(null);
+ dialog.setVisible(true);
+ }
+
/**
* ハッシュタグ検索ダイアログを表示
*/
* デバッグ用
*/
public void debug() {
- TwitterLogManager logManager = new TwitterLogManager();
- try {
- List<Status> statuses = logManager.get();
- logManager.outputCSVLog("./test.csv", statuses, true, true, true, true, true, false, false, false, true, true, true);
- } catch (SAXParseException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
+/* String message = "こんにちは http://densan-labs.net/でした。 http://google.com/ あいうえお";
+ System.out.println( this.actionConvertURLToBitly( message ));*/
+ //this.actionConvertTweetBoxURLToBitly();
+ for(int i=0; i < 5; i++) {
+ List<User> lists = this.tweetManager.getFollowingUser("nishio_dens", i);
+ for(User u : lists) {
+ System.out.println( u );
+ }
}
+// String url = "http://google.com";
+// System.out.println( URLBitlyConverter.convertUrlToBitly(url));
}
+ /**
+ * ログデータを保存
+ * @param logFilePath
+ * @param outputFilePath
+ * @param showUsername
+ * @param showScreenName
+ * @param showText
+ * @param showUpdateTime
+ * @param showClient
+ * @param showUserDescription
+ * @param showFollowing
+ * @param showFollower
+ * @param showUpdateCount
+ * @param showUserURL
+ * @param showProfileImageURL
+ * @throws SAXParseException
+ * @throws IOException
+ */
+ public void outputLogToCSV(String logFilePath, String outputFilePath,
+ boolean showUsername, boolean showScreenName,
+ boolean showText,
+ boolean showUpdateTime, boolean showClient,
+ boolean showUserDescription,
+ boolean showFollowing, boolean showFollower,
+ boolean showUpdateCount, boolean showUserURL,
+ boolean showProfileImageURL) throws SAXParseException, IOException {
+ TwitterLogManager logManager = new TwitterLogManager();
+ List<Status> statuses = logManager.get(logFilePath);
+ logManager.outputCSVLog( outputFilePath, statuses, showUsername, showScreenName,
+ showText, showUpdateTime, showClient,
+ showUserDescription, showFollowing, showFollower,
+ showUpdateCount, showUserURL,showProfileImageURL);
+ }
+
/**
* 基本設定用ダイアログを取得
*
return this.userSearchDialog;
}
+ /**
+ * CSVログ出力ダイアログを表示
+ * @return
+ */
+ public OutputCSVLogDialog getOutputCSVLogDialog() {
+ if( this.outputCSVLogDialog == null ) {
+ this.outputCSVLogDialog = new OutputCSVLogDialog(mainFrame, true, this);
+ }
+ return this.outputCSVLogDialog;
+ }
+
/**
* hashtag検索ダイアログ
*