return;
}
- final Talk targetTalk = talkList.get(0);
- final Period targetPeriod = targetTalk.getPeriod();
- final int tabIndex = targetPeriod.getDay() + 1;
- final PeriodView target = browser.getPeriodView(tabIndex);
+ Talk targetTalk = talkList.get(0);
+ Period targetPeriod = targetTalk.getPeriod();
+ int periodIndex = targetPeriod.getDay();
+ PeriodView target = browser.getPeriodView(periodIndex);
EventQueue.invokeLater(() -> {
- browser.setSelectedIndex(tabIndex);
+ browser.showPeriodTab(periodIndex);
target.setPeriod(targetPeriod);
target.scrollToTalk(targetTalk);
});
modifyTabCount(0);
updateVillageInfo();
- selectVillageInfoTab();
+ showVillageInfoTab();
repaint();
revalidate();
}
if(this.village != oldVillage){
- selectVillageInfoTab();
+ showVillageInfoTab();
}
updateVillageInfo();
}
/**
- * 村情報表示タブを選択表示する。
- */
- private void selectVillageInfoTab(){
- setSelectedIndex(0);
- return;
- }
-
- /**
* PeriodViewインスタンスを生成する。
*
* <p>フォント設定、会話表示設定、各種リスナの設定が行われる。
}
/**
- * 指定したタブインデックスに関連付けられたPeriodViewを返す。
+ * 指定したPeriod日付に関連付けられたPeriodViewを返す。
*
* <p>Periodに関係ないタブが指定されたらnullを返す。
*
- * @param tabIndex タブインデックス
+ * @param periodIndex Period日付インデックス
* @return 指定されたPeriodView
*/
- public PeriodView getPeriodView(int tabIndex){
+ public PeriodView getPeriodView(int periodIndex){
+ int tabIndex = periodIndex + PERIODTAB_OFFSET;
if(tabIndex < PERIODTAB_OFFSET || getTabCount() <= tabIndex){
return null;
}
*/
public PeriodView currentPeriodView(){
int tabIndex = getSelectedIndex();
- PeriodView result = getPeriodView(tabIndex);
- return result;
- }
-
- /**
- * 指定したタブインデックスに関連付けられたDiscussionを返す。
- *
- * <p>Periodに関係ないタブが指定されたらnullを返す。
- *
- * @param tabIndex タブインデックス
- * @return 指定されたDiscussion
- */
- private Discussion getDiscussion(int tabIndex){
- PeriodView periodView = getPeriodView(tabIndex);
- if(periodView == null) return null;
-
- Discussion result = periodView.getDiscussion();
- return result;
- }
-
- /**
- * 現在タブ選択中のDiscussionを返す。
- *
- * <p>Periodに関係ないタブが選択されていたらnullを返す。
- *
- * @return 現在選択中のDiscussion
- */
- public Discussion currentDiscussion(){
- int tabIndex = getSelectedIndex();
- Discussion result = getDiscussion(tabIndex);
+ int periodIndex = tabIndex - PERIODTAB_OFFSET;
+ PeriodView result = getPeriodView(periodIndex);
return result;
}
}
/**
+ * 村情報表示タブを選択表示する。
+ */
+ private void showVillageInfoTab(){
+ setSelectedIndex(0);
+ return;
+ }
+
+ /**
+ * 指定した日付インデックスのPeriodのタブを表示する。
+ *
+ * @param periodIndex 日付インデックス
+ */
+ public void showPeriodTab(int periodIndex){
+ int tabIndex = periodIndex + PERIODTAB_OFFSET;
+ setSelectedIndex(tabIndex);
+ return;
+ }
+
+ /**
* ActionListenerを追加する。
*
* <p>配下のDiscussionへもリスナは登録される。