<properties>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<maven.compiler.showWarnings>true</maven.compiler.showWarnings>
<version>[3.3,)</version>
</requireMavenVersion>
<requireJavaVersion>
- <version>[1.6,)</version>
+ <version>[1.7,)</version>
</requireJavaVersion>
</rules>
</configuration>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
- <source>1.6</source> <!-- for NetBeans IDE -->
- <target>1.6</target>
+ <source>1.7</source> <!-- for NetBeans IDE -->
+ <target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArguments>
/**
* Jindolf のスタートアップエントリ。
* <p>互換性検査が行われた後、
- * JRE1.6解除版エントリ{@link JindolfJre16}
+ * JRE1.7解除版エントリ{@link JindolfJre17}
* に制御を渡す。
* @param args コマンドライン引数
*/
exitCode = JreChecker.checkJre();
if(exitCode != 0) System.exit(exitCode);
- exitCode = JindolfJre16.main(args);
+ exitCode = JindolfJre17.main(args);
if(exitCode != 0) System.exit(exitCode);
// デーモンスレッドがいなければ、(アプリ画面が出ていなければ)
import javax.swing.JOptionPane;
/**
- * JRE1.6の利用が解禁されたJindolfエントリ。
+ * JRE1.7の利用が解禁されたJindolfエントリ。
* <p>起動クラスJindolfの下請けとしての機能が想定される。
* <p>必ずしも必要ないが、異常系切り分けに有用な、
* 実行環境やビルドの成否に関する各種診断を行う。
* <p>各種診断を通過した後、JindolfMainに制御を渡す。
*/
-public final class JindolfJre16 {
+public final class JindolfJre17 {
/** GUI環境に接続できないときの終了コード。 */
public static final int EXIT_CODE_HEADLESS = 1;
/**
* 隠しコンストラクタ。
*/
- private JindolfJre16(){
+ private JindolfJre17(){
assert false;
}
/**
* Jindolf のスタートアップエントリ。
- * <p>ここからJRE1.6の利用が解禁される。
+ * <p>ここからJRE1.7の利用が解禁される。
* <p>最終的に{@link JindolfMain}へ制御が渡される。
* @param args コマンドライン引数
* @return 起動に成功すれば0。失敗したら0以外。
/**
* Jindolf スタートアップクラス。
- * <p>{@link JindolfJre16}の下請けとして本格的なJindolf起動処理に入る。
+ * <p>{@link JindolfJre17}の下請けとして本格的なJindolf起動処理に入る。
*/
public final class JindolfMain {
public final class JreChecker {
/** Jindolfが実行時に必要とするJREの版。 */
- public static final String REQUIRED_JRE_VER = "1.6";
+ public static final String REQUIRED_JRE_VER = "1.7";
/** 互換性エラーの終了コード。 */
public static final int EXIT_CODE_INCOMPAT_JRE = 1;
return result;
}
- // TODO JRE1.7,1.8 対応
+ /**
+ * JRE 1.7 相当のランタイムライブラリが提供されているか判定する。
+ * @return 提供されているならtrue
+ * @see java.lang.AutoCloseable
+ */
+ public static boolean has17Runtime(){
+ boolean result;
+ if(has16Runtime()) result = hasClass("java.lang.AutoCloseable");
+ else result = false;
+ return result;
+ }
+
+ // TODO JRE1.8 対応
/**
* JREもしくは<code>java.lang</code>パッケージの
}
/**
- * JRE環境をチェックする。(JRE1.6)
+ * JRE環境をチェックする。(JRE1.7)
* <p>もしJREの非互換性が検出されたらエラーメッセージを報告する。
* @return 互換性があれば0、無ければ非0
*/
public static int checkJre(){
- if(has16Runtime()) return 0;
+ if(has17Runtime()) return 0;
String message = buildErrMessage();
STDERR.println(message);
private static final List<Charset> CHARSET_LIST = buildCharsetList();
private static final FileFilter CSV_FILTER = new CsvFileFilter();
- private static final JComboBox encodeBox = new JComboBox();
+ private static final JComboBox<Charset> encodeBox = new JComboBox<>();
private static final JFileChooser chooser = buildChooser();
// TODO staticなGUIパーツってどうなんだ…
* @return 日本語Charset一覧
*/
private static List<Charset> buildCharsetList(){
- List<Charset> csList = new LinkedList<Charset>();
+ List<Charset> csList = new LinkedList<>();
for(String name : ENCNAMES){
if( ! Charset.isSupported(name) ) continue;
Charset cs = Charset.forName(name);
private final String caption;
private final String author;
private final String urlText;
- private final Map<Avatar, String> wikiMap = new HashMap<Avatar, String>();
+ private final Map<Avatar, String> wikiMap = new HashMap<>();
/**
* コンストラクタ。
private FontInfo lastFontInfo;
private final FontSelectList familySelector;
- private final JComboBox sizeSelector;
+ private final JComboBox<Integer> sizeSelector;
private final JCheckBox isBoldCheck;
private final JCheckBox isItalicCheck;
private final JCheckBox useTextAntiAliaseCheck;
this.familySelector = new FontSelectList();
- this.sizeSelector = new JComboBox();
+ this.sizeSelector = new JComboBox<>();
this.sizeSelector.setEditable(true);
for(int size : POINT_SIZES){
this.sizeSelector.addItem(size);
this.familySelector.setSelectedFamily(defaultFamily);
// サイズ指定コンボボックス
- Integer selectedInteger = Integer.valueOf(currentFont.getSize());
+ Integer selectedInteger = currentFont.getSize();
this.sizeSelector.setSelectedItem(selectedInteger);
int sizeItems = this.sizeSelector.getItemCount();
for(int index = 0; index < sizeItems; index++){
* 基本的にスレッド間競合の問題はEDTで解決すること。
*/
@SuppressWarnings("serial")
-public class FontListModel extends AbstractListModel {
+public class FontListModel extends AbstractListModel<String> {
private static final FontEnv DEFAULT_FONTENV = FontEnv.DEFAULT;
- private final List<String> familyList = new LinkedList<String>();
+ private final List<String> familyList = new LinkedList<>();
/**
* コンストラクタ。
* @return {@inheritDoc}
*/
@Override
- public Object getElementAt(int index){
- Object result = this.familyList.get(index);
+ public String getElementAt(int index){
+ String result = this.familyList.get(index);
return result;
}
* <p>フォント一覧の遅延読み込みに対応。
*/
@SuppressWarnings("serial")
-public class FontSelectList extends JList
+public class FontSelectList extends JList<String>
implements ListDataListener {
private String selectedFamily = null;
public FontSelectList(){
super();
- ListModel fontListModel = new FontListModel();
+ ListModel<String> fontListModel = new FontListModel();
setModelImpl(fontListModel);
setVisibleRowCount(-1);
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
* 与えられたモデルの更新は監視対象となる。
* @param model リストモデル
*/
- private void setModelImpl(ListModel model){
- ListModel oldModel = getModel();
+ private void setModelImpl(ListModel<String> model){
+ ListModel<String> oldModel = getModel();
if(oldModel != null){
oldModel.removeListDataListener(this);
}
* @param model {@inheritDoc}
*/
@Override
- public void setModel(ListModel model){
+ public void setModel(ListModel<String> model){
setModelImpl(model);
return;
}
private final ButtonGroup buttonGroup = new ButtonGroup();
private final JTextField hostname = new JTextField();
- private final JComboBox port = new JComboBox();
+ private final JComboBox<Integer> port = new JComboBox<>();
private final JComponent serverInfo = buildServerPanel();
* ポート番号選択肢を生成する。
* @return ポート番号選択肢
*/
- private static ComboBoxModel buildPortRecommender(){
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- model.addElement("80");
- model.addElement("1080");
- model.addElement("3128");
- model.addElement("8000");
- model.addElement("8080");
- model.addElement("10080");
+ private static ComboBoxModel<Integer> buildPortRecommender(){
+ DefaultComboBoxModel<Integer> model = new DefaultComboBoxModel<>();
+ model.addElement(80);
+ model.addElement(1080);
+ model.addElement(3128);
+ model.addElement(8000);
+ model.addElement(8080);
+ model.addElement(10080);
return model;
}
private final TableColumn avatarColumn;
private final JTable tableComp;
- private final JComboBox typeSelector = new JComboBox();
+ private final JComboBox<String> typeSelector = new JComboBox<>();
private final JButton closeButton = new JButton("閉じる");
private final JLabel caption = new JLabel();
private final JLabel totalSum = new JLabel();
if(this.period == null) return;
- SortedSet<Avatar> avatarSet = new TreeSet<Avatar>();
- Map<Avatar, Integer> talkCount = new HashMap<Avatar, Integer>();
- Map<Avatar, Integer> totalChars = new HashMap<Avatar, Integer>();
- Map<Avatar, Talk> lastTalk = new HashMap<Avatar, Talk>();
+ SortedSet<Avatar> avatarSet = new TreeSet<>();
+ Map<Avatar, Integer> talkCount = new HashMap<>();
+ Map<Avatar, Integer> totalChars = new HashMap<>();
+ Map<Avatar, Talk> lastTalk = new HashMap<>();
List<Topic> topicList = this.period.getTopicList();
for(Topic topic : topicList){
private final JLabel faceLabel = new JLabel();
private final ImageIcon faceIcon = new ImageIcon();
- private final JComboBox playerBox = new JComboBox();
- private final DefaultComboBoxModel playerListModel =
- new DefaultComboBoxModel();
+ private final JComboBox<Avatar> playerBox = new JComboBox<>();
+ private final DefaultComboBoxModel<Avatar> playerListModel =
+ new DefaultComboBoxModel<>();
private final JButton prevPlayer = new JButton("↑");
private final JButton nextPlayer = new JButton("↓");
private final JLabel roleLabel = new JLabel();
private final WebButton urlLine = new WebButton();
private final JComponent playerPanel = buildPlayerPanel();
- private final JComboBox iconSetBox = new JComboBox();
- private final DefaultComboBoxModel iconSetListModel =
- new DefaultComboBoxModel();
+ private final JComboBox<FaceIconSet> iconSetBox = new JComboBox<>();
+ private final DefaultComboBoxModel<FaceIconSet> iconSetListModel =
+ new DefaultComboBoxModel<>();
private final JLabel authorLabel = new JLabel();
private final JLabel authorUrlLabel = new JLabel();
private final WebButton iconCatalog = new WebButton();
JTextComponent textComp = (JTextComponent) comp;
modifyTextComponent(textComp);
}else if(comp instanceof JComboBox){
- JComboBox combo = (JComboBox) comp;
+ JComboBox<?> combo = (JComboBox) comp;
modifyComboBox(combo);
}
* コンボボックスのエディタを等幅化する。
* @param comboBox コンボボックス
*/
- private static void modifyComboBox(JComboBox comboBox){
+ private static void modifyComboBox(JComboBox<?> comboBox){
ComboBoxEditor editor = comboBox.getEditor();
if(editor == null) return;
private final Map<Land, String> landUserIDMap =
- new HashMap<Land, String>();
+ new HashMap<>();
private final Map<Land, char[]> landPasswordMap =
- new HashMap<Land, char[]>();
+ new HashMap<>();
- private final JComboBox landBox = new JComboBox();
+ private final JComboBox<Land> landBox = new JComboBox<>();
private final JTextField idField = new JTextField(15);
private final JPasswordField pwField = new JPasswordField(15);
private final JButton loginButton = new JButton("ログイン");
private static final String LABEL_REENTER = "再入力";
private static final String LABEL_IGNORE = "無視して検索をキャンセル";
- private final JComboBox findBox = new JComboBox();
+ private final JComboBox<Object> findBox = new JComboBox<>();
private final JButton searchButton = new JButton("検索");
private final JButton clearButton = new JButton("クリア");
private final JCheckBox capitalSwitch =
result.putValue("history", array);
List<RegexPattern> history = this.model.getOriginalHistoryList();
- history = new ArrayList<RegexPattern>(history);
+ history = new ArrayList<>(history);
Collections.reverse(history);
for(RegexPattern regex : history){
JsObject obj = RegexPattern.encodeJson(regex);
*/
@Override
public Component getListCellRendererComponent(
- JList list,
+ JList<?> list,
Object value,
int index,
boolean isSelected,
/**
* コンボボックスの独自データモデル。
*/
- private static class CustomModel implements ComboBoxModel{
+ private static class CustomModel implements ComboBoxModel<Object>{
private static final int HISTORY_MAX = 7;
private static final RegexPattern INITITEM =
new RegexPattern(
"", false, RegexPattern.IGNORECASEFLAG | Pattern.DOTALL);
private static final List<RegexPattern> PREDEF_PATTERN_LIST =
- new LinkedList<RegexPattern>();
+ new LinkedList<>();
static{
PREDEF_PATTERN_LIST.add(
}
private final List<RegexPattern> history =
- new LinkedList<RegexPattern>();
+ new LinkedList<>();
private final JSeparator separator1st = new JSeparator();
private final JSeparator separator2nd = new JSeparator();
private Object selected;
private final JScrollPane scroller = new JScrollPane();
private final JLabel caption = new JLabel();
private final JLabel limit = new JLabel();
- private final JComboBox talkSelector = new JComboBox();
- private final DefaultComboBoxModel model = new DefaultComboBoxModel();
+ private final JComboBox<Talk> talkSelector = new JComboBox<>();
+ private final DefaultComboBoxModel<Talk> model =
+ new DefaultComboBoxModel<>();
private DialogPref dialogPref = new DialogPref();
this.limit.setText("更新時刻 " + limitCaption);
this.model.removeAllElements();
- this.model.addElement(" ");
+ this.model.addElement(null);
List<Topic> topicList = this.period.getTopicList();
for(Topic topic : topicList){
if( ! (topic instanceof Talk) ) continue;
*/
@Override
public Component getListCellRendererComponent(
- JList list,
+ JList<?> list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus ){
Talk talk = null;
- Object newValue = value;
+ Object newValue;
if(value instanceof Talk){
talk = (Talk) value;
newValue = new StringBuilder()
.append(' ')
.append(talk.getAvatar().getName())
.toString();
+ }else{
+ newValue=" ";
}
Component superResult =
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
+
import static org.junit.Assert.*;
-import org.junit.BeforeClass;
/**
*
@Test
public void testHas16Runtime() {
System.out.println("has16Runtime");
+ assertTrue(JreChecker.has16Runtime());
+ return;
+ }
- boolean result = JreChecker.has16Runtime();
-
+ /**
+ * Test of has17Runtime method, of class JreChecker.
+ */
+ @Test
+ public void testHas17Runtime() {
+ System.out.println("has17Runtime");
+ assertTrue(JreChecker.has17Runtime());
return;
}
public void testCheckJre() {
System.out.println("checkJre");
- if(false){
- JreChecker.checkJre();
- }
+ JreChecker.checkJre();
return;
}