/**
* GUIのアクション部分
- *
+ *
* @author nishio
- *
+ *
*/
public class TweetMainAction {
private int getSendDirectMessagePeriod = 60 * 30;
/**
- *
+ *
* @param mainFrame
* @param tweetManager
* @param statusBarLabel
/**
* 新しいタブを追加
- *
+ *
* @param timerID
* TimerIDクラスで生成したタイマーID
* @param period
/**
* mentionタブを追加する
- *
+ *
* @param period
* 情報更新間隔[sec]
*/
/**
* お気に入りタブを追加
- *
+ *
* @param screenName
* nullで自分自身を取得,指定するとscreenNameのFav取得
*/
/**
* timelineタブを追加する
- *
+ *
* @param period
* [sec]
*/
/**
* ダイレクトメッセージタブを追加する
- *
+ *
* @param period
* 更新間隔[sec]
*/
/**
* SendDMタブを追加する
- *
+ *
* @param period
*/
public void actionAddSendDirectMessageTab(int period) {
/**
* 指定したリストをタブに追加
- *
+ *
* @param username
* @param listID
* @param listFullname
/**
* ツイート検索結果を表示するタブを新しく追加
- *
+ *
* @param searchWord
* @param period
* 更新周期[sec] 0以下の場合は更新しない
/**
* 指定したユーザの発言を表示
- *
+ *
* @param username
* タブのタイトルにつけるユーザ名
* @param period
/**
* タイムラインタブが存在しているか
- *
+ *
* @return
*/
public boolean isExistTimelineTab() {
/**
* Mentionタブが存在するか
- *
+ *
* @return
*/
public boolean isExistMentionTab() {
/**
* DMタブが存在するか
- *
+ *
* @return
*/
public boolean isExistDirectMessageTab() {
/**
* 送信済みDMタブが存在するか
- *
+ *
* @return
*/
public boolean isExistSendDirectMessageTab() {
/**
* 詳細情報表示ボタンを押した時の動作
- *
+ *
* @param e
*/
public void actionDetailInfoButton(ActionEvent e) {
/**
* 詳細情報ボタンが表示されているか
- *
+ *
* @return
*/
public boolean isDetailInfoPanelVisible() {
/**
* 書き込みメッセージボックスの表示ONOFFボタンを押した時の動作
- *
+ *
* @param e
*/
public void actionShowTweetboxButton(ActionEvent e) {
/**
* 指定したIDのタブを削除
- *
+ *
* @param timerID
*/
public void actionRemoveTabbedTable(String timerID) {
/**
* 指定した場所にあるタブを削除
- *
+ *
* @param removeTabIndex
*/
public void actionRemoveTabbedTable(int removeTabIndex) {
/**
* 終了ボタンを押した時の動作
- *
+ *
* @param e
*/
public void actionExitButton(ActionEvent e) {
/**
* TweetMessageBox内にある#ハッシュタグ の部分をa hrefリンクに変換
- *
+ *
* @param message
*/
public String actionReplaceTweetMessageBoxHashTab(String message) {
// #で始まる情報
- Pattern userPtn = Pattern.compile("#[0-9A-Z_]+",
+ Pattern userPtn = Pattern.compile( TweetConfiguration.HASHTAG_PATTERN,
Pattern.CASE_INSENSITIVE);
Matcher matcher = userPtn.matcher(message);
/**
* TweetMessageBox内にあるリンクをa hrefリンクに変換
- *
+ *
* @param message
*/
public String actionReplaceTweetMessageBoxURLLink(String message) {
Matcher matcher = convURLLinkPtn.matcher(message);
return matcher.replaceAll("<a href=\"$0\">$0</a>");
}
-
+
/**
* メッセージ内にあるURLをBitlyに変換する
* @param message
}
return result;
}
-
+
/**
* つぶやきボックス内のURLをbitlyに変換
*/
/**
* 選択したユーザが作成したリスト一覧を表示
- *
+ *
* @param selection
*/
public void actionShowSelectedUserList(ListGetterSelection selection) {
/**
* テーブルの高さを更新
- *
+ *
* @param height
*/
public void updateTableHeight(int height) {
/**
* Twitter全体からキーワード検索ダイアログを表示
- *
+ *
* @param searchWord
* searchwordボックスに予め設定するワード
*/
/**
* リストダイアログを表示
- *
+ *
* @param listUserName
* リストを保持しているユーザの名前
* @param selection
/**
* Tweet情報を更新
- *
+ *
* @param e
*/
public void actionUpdateButton(java.awt.event.ActionEvent e) {
/**
* 指定した番号のタブにフォーカスを移す
- *
+ *
* @param index
*/
public void actionRequestFocusToTab(int index) {
/**
* つぶやける残り文字数の更新
- *
+ *
* @param e
*/
public void actionUpdateTweetMessageCount() {
this.setReplyStatus(null);
}
}
-
+
/**
* デバッグ用
*/
/**
* 基本設定用ダイアログを取得
- *
+ *
* @return
*/
public ConfigurationDialog getConfigurationDialog() {
/**
* リストダイアログを取得
- *
+ *
* @param listUserName
* リストを保持しているユーザの名前
* @param selection
/**
* 自身のスクリーン名を取得
- *
+ *
* @return
*/
public String getScreenName() {
/**
* twitter全体からキーワード検索ダイアログを表示
- *
+ *
* @return
*/
public KeywordSearchDialog getKeywordSearchDialog() {
/**
* hashtag検索ダイアログ
- *
+ *
* @return
*/
public HashtagSearchDialog getHashtagSearchDialog() {
/**
* アカウント情報設定ダイアログを取得
- *
+ *
* @return
*/
public AccountDialog getAccountDialog() {
/**
* ダイレクトメッセージ送信用ダイアログを取得
- *
+ *
* @return
*/
public DirectMessageDialog getDirectMessageDialog() {
/**
* テーブルで選択したツイートを詳細情報としてセット
- *
+ *
* @param table
*/
public void setDetailInformationFromTable(JTable table) {
}
/**
- *
+ *
* @return
*/
public AboutDialog getAboutDialog() {
/**
* テーブルで選択した場所のTweet情報を取得
- *
+ *
* @return
*/
public Status getTweetTableInformation(JTable table, TableModel model) {
/**
* ステータスバーに情報を表示する
- *
+ *
* @param message
*/
public void information(String message) {
/**
* 設定ファイルを読み込む
- *
+ *
* @throws IOException
* @throws FileNotFoundException
*/
// メッセージ通知を行うか
String nm = this.property.getProperty("notifyMention");
String ndm = this.property.getProperty("notifyDirectMessage");
-
+
//前回開いていたタブの情報
String ptl = this.property.getProperty("openTimelineTab");
String pm = this.property.getProperty("openMentionTab");
// 通知関係
this.isNotifyMentionMessage = Boolean.parseBoolean(nm);
this.isNotifyDirectMessage = Boolean.parseBoolean(ndm);
-
+
//前回開いていたタブ情報
this.isTempOpenedTimelineTab = Boolean.parseBoolean(ptl);
this.isTempOpenedMentionTab = Boolean.parseBoolean(pm);
/**
* 設定ファイルを保存する
- *
+ *
* @throws IOException
*/
public void saveProperties() throws IOException {
+ "");
this.property.setProperty("notifyDirectMessage",
this.isNotifyDirectMessage + "");
-
+
//タブの保存
this.property.setProperty("openTimelineTab", this.isExistTimelineTab() + "");
this.property.setProperty("openMentionTab", this.isExistMentionTab() + "");
/**
* newTableColorを取得します。
- *
+ *
* @return newTableColor
*/
public Color getNewTableColor() {
/**
* newTableColorを設定します。
- *
+ *
* @param newTableColor
* newTableColor
*/
/**
* tlFontNameを取得します。
- *
+ *
* @return tlFontName
*/
public String getTlFontName() {
/**
* tlFontNameを設定します。
- *
+ *
* @param tlFontName
* tlFontName
*/
/**
* tlFontSizeを取得します。
- *
+ *
* @return tlFontSize
*/
public int getTlFontSize() {
/**
* tlFontSizeを設定します。
- *
+ *
* @param tlFontSize
* tlFontSize
*/
/**
* detailFontNameを取得します。
- *
+ *
* @return detailFontName
*/
public String getDetailFontName() {
/**
* detailFontNameを設定します。
- *
+ *
* @param detailFontName
* detailFontName
*/
/**
* detailFontSizeを取得します。
- *
+ *
* @return detailFontSize
*/
public int getDetailFontSize() {
/**
* detailFontSizeを設定します。
- *
+ *
* @param detailFontSize
* detailFontSize
*/
/**
* tableElementHeightを取得します。
- *
+ *
* @return tableElementHeight
*/
public int getTableElementHeight() {
/**
* tableElementHeightを設定します。
- *
+ *
* @param tableElementHeight
* tableElementHeight
*/
}
/**
- *
+ *
* @param notify
*/
public void setNotifyMention(boolean notify) {
}
/**
- *
+ *
* @return
*/
public boolean getNotifyMention() {
}
/**
- *
+ *
* @param notify
* @return
*/
}
/**
- *
+ *
* @return
*/
public boolean getNotifyDirectMessage() {
}
/**
- *
+ *
* @return
*/
public Status getReplyStatus() {
}
/**
- *
+ *
* @param status
* @return
*/
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
+import twitter.manage.TweetConfiguration;
import twitter.manage.TweetManager;
import twitter.util.MultiSortedMap;
import twitter4j.Status;
//twitter管理クラス
private TweetManager tweetManager;
//ハッシュタグのパターン
- private static final String HASHTAG_PATTERN = "#[0-9A-Za-z_]+";
+ private static final String HASHTAG_PATTERN =
+ TweetConfiguration.HASHTAG_PATTERN;
//検索情報数
- private static final int MAX_SEARCH_NUM = 100;
+ private static final int MAX_SEARCH_NUM = 200;
/**
*
Map<String, Integer> oneTweet = getHashtagCount(message);
//出現回数
Set<String> keyset = oneTweet.keySet();
-
+
for(String key : keyset) {
//いままでその単語が出現していたかどうか
Integer count = counter.get(key);
// #で始まる情報
Pattern userPtn = Pattern.compile(HASHTAG_PATTERN);
Matcher matcher = userPtn.matcher(message);
-
+
// #で始まる情報一覧を抜き出す
Map<String, Integer> counter = new HashMap<String, Integer>();