X.XXX.X (XXXX-XX-XX)
・JinParser 2.101.4 に対応。
+ ・JDK9以降のWindows HiDPI環境に対応。
+ ・-nosplashオプションの廃止。
3.302.4 (2017-04-09)
・F国URL修正に伴い JinCore 1.206.10 に対応。
final LookAndFeel lnf;
try{
lnf = (LookAndFeel) ( lnfClass.newInstance() );
- }catch(InstantiationException e){
- String warnMsg = MessageFormat.format(ERRFORM_LAF, className);
- warnDialog(ERRTITLE_LAF, warnMsg, e);
- return;
- }catch(IllegalAccessException e){
- String warnMsg = MessageFormat.format(ERRFORM_LAF, className);
- warnDialog(ERRTITLE_LAF, warnMsg, e);
- return;
- }catch(ClassCastException e){
+ }catch( InstantiationException
+ | IllegalAccessException
+ | ClassCastException
+ e){
String warnMsg = MessageFormat.format(ERRFORM_LAF, className);
warnDialog(ERRTITLE_LAF, warnMsg, e);
return;
return;
}
});
- }catch(InvocationTargetException e){
- LOGGER.log(Level.SEVERE,
- "タブ操作で致命的な障害が発生しました", e);
- }catch(InterruptedException e){
+ }catch(InvocationTargetException | InterruptedException e){
LOGGER.log(Level.SEVERE,
"タブ操作で致命的な障害が発生しました", e);
}
return;
}
});
- }catch(InvocationTargetException e){
- LOGGER.log(Level.SEVERE,
- "ブラウザ表示で致命的な障害が発生しました",
- e );
- }catch(InterruptedException e){
+ }catch( InvocationTargetException
+ | InterruptedException
+ e){
LOGGER.log(Level.SEVERE,
"ブラウザ表示で致命的な障害が発生しました",
e );
}else{
try{
SwingUtilities.invokeAndWait(microJob);
- }catch(InvocationTargetException e){
- LOGGER.log(Level.SEVERE, "ビジー処理で失敗", e);
- }catch(InterruptedException e){
+ }catch(InvocationTargetException | InterruptedException e){
LOGGER.log(Level.SEVERE, "ビジー処理で失敗", e);
}
}
import java.awt.Dimension;
import java.awt.EventQueue;
-import java.awt.Window;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.swing.ImageIcon;
import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JWindow;
import javax.swing.UIManager;
import jp.sfjp.jindolf.config.AppSetting;
import jp.sfjp.jindolf.config.CmdOption;
/** ロガー。 */
private static final Logger LOGGER = Logger.getAnonymousLogger();
- /** スプラッシュロゴ。 */
- private static final String RES_LOGOICON =
- "resources/image/logo.png";
-
private static final String LOG_LOADED =
"{0} は {1,date} {2,time} に"
+ "VM上のクラス {3} としてロードされました。 ";
"設定格納ディレクトリに[ {0} ]が指定されました。";
private static final String LOG_NOCONF =
"設定格納ディレクトリは使いません。";
- private static final String WARNMSG_SPLASH =
- "JRE1.6以降では、Jindolfの-nosplashオプションは無効です。"
- + "Java実行系の方でスプラッシュ画面の非表示を"
- + "指示してください(おそらく空の-splash:オプション)";
private static final String FATALMSG_INITFAIL =
"アプリケーション初期化に失敗しました";
private static final String ERRMSG_HELP =
}
/**
- * スプラッシュウィンドウを表示する。
- *
- * <p>JRE1.6以降では何も表示しない。
- *
- * @return スプラッシュウィンドウ。JRE1.6以降ならnullを返す。
- */
- @SuppressWarnings("CallToThreadYield")
- private static Window showSplash(){
- if(JreChecker.has16Runtime()) return null;
-
- Window splashWindow = new JWindow();
-
- ImageIcon logo = ResourceManager.getImageIcon(RES_LOGOICON);
- JLabel splashLabel = new JLabel(logo);
- splashWindow.add(splashLabel);
-
- splashWindow.pack();
- splashWindow.setLocationRelativeTo(null); // locate center
- splashWindow.setVisible(true);
-
- Thread.yield();
-
- return splashWindow;
- }
-
- /**
- * スプラッシュウィンドウを隠す。
- * @param splashWindow スプラッシュウィンドウ。nullならなにもしない。
- */
- private static void hideSplash(final Window splashWindow){
- if(splashWindow == null) return;
-
- EventQueue.invokeLater(new Runnable(){
- /** {@inheritDoc} */
- @Override
- public void run(){
- splashWindow.setVisible(false);
- splashWindow.dispose();
- return;
- }
- });
-
- return;
- }
-
- /**
* 起動時の諸々の情報をログ出力する。
* @param appSetting アプリ設定
*/
LOGGER.info(LOG_NOCONF);
}
- if( JreChecker.has16Runtime()
- && optinfo.hasOption(CmdOption.OPT_NOSPLASH) ){
- LOGGER.warning(WARNMSG_SPLASH);
- }
-
return;
}
}
UIManager.put("swing.boldMetal", boldFlag);
- // JRE1.5用スプラッシュウィンドウ。だけどもういらん。
- Window splashWindow = null;
- if( ! optinfo.hasOption(CmdOption.OPT_NOSPLASH) ){
- splashWindow = showSplash();
- }
-
- try{
- exitCode = splashedMain(optinfo);
- }finally{
- hideSplash(splashWindow);
- }
+ exitCode = splashedMain(optinfo);
return exitCode;
}
/**
* JindolfMain のスタートアップエントリ。
*
- * <p>スプラッシュウィンドウが出ている状態。
+ * <p>JRE1.5までの間、
+ * スプラッシュウィンドウが出ている状態として想定されていた。
* 時間のかかる初期化処理はなるべくこの中へ。
*
* @param optinfo コマンドライン引数情報
return;
}
});
- }catch(InvocationTargetException e){
- LOGGER.log(Level.SEVERE, FATALMSG_INITFAIL, e);
- e.printStackTrace(STDERR);
- exitCode = 1;
- }catch(InterruptedException e){
+ }catch(InvocationTargetException | InterruptedException e){
LOGGER.log(Level.SEVERE, FATALMSG_INITFAIL, e);
e.printStackTrace(STDERR);
exitCode = 1;
import java.nio.charset.Charset;
import java.util.Properties;
import javax.imageio.ImageIO;
+import javax.swing.Icon;
import javax.swing.ImageIcon;
+import jp.sfjp.jindolf.view.FlexiIcon;
/**
* 各種リソースファイルの管理。
private static final Charset CS_UTF8 = Charset.forName("UTF-8");
+ private static final int BTN_SZ = 24;
+
static{
Class<?> rootKlass = Jindolf.class;
}
/**
+ * リソース名を用いて正方形ボタン用アイコン画像を取得する。
+ *
+ * @param resPath アイコン画像リソース名
+ * @return アイコン画像。リソースが見つからなければnull。
+ */
+ public static Icon getButtonIcon(String resPath){
+ Icon result = getSquareIcon(resPath, BTN_SZ);
+ return result;
+ }
+
+ /**
+ * リソース名を用いて正方形アイコン画像を取得する。
+ *
+ * @param resPath アイコン画像リソース名
+ * @param sz 正方形アイコン寸法
+ * @return アイコン画像。リソースが見つからなければnull。
+ */
+ public static Icon getSquareIcon(String resPath, int sz){
+ BufferedImage image = getBufferedImage(resPath);
+ Icon result = new FlexiIcon(image, sz, sz);
+ return result;
+ }
+
+ /**
* リソース名を用いてプロパティを取得する。
* @param resPath プロパティファイルのリソース名
* @return プロパティ。リソースが読み込めなければnull。
OPT_VERSION("-version"),
/** UI文字制御。 */
OPT_BOLDMETAL("-boldMetal"),
- /** スプラッシュ制御。 */
- OPT_NOSPLASH("-nosplash"),
/** ウィンドウ位置指定。 */
OPT_GEOMETRY("-geometry"),
/** 実行環境出力。 */
OPT_VERSION,
OPT_VMINFO,
OPT_BOLDMETAL,
- OPT_NOSPLASH,
OPT_CONSOLELOG,
OPT_NOCONF
);
"コピーすれば、そちらの設定が優先して使われます。");
writer.println(
"「lock」の名前を持つファイルはロックファイルです。");
- }catch(IOException e){
- abortCantWrite(file);
- }catch(SecurityException e){
+ }catch(IOException | SecurityException e){
abortCantWrite(file);
}finally{
if(writer != null){
package jp.sfjp.jindolf.config;
import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
/**
* 諸々のファイル操作ユーティリティ。
- * JRE1.6 API へのリフレクションアクセスを含む。
*/
public final class FileUtils{
private static final String SCHEME_FILE = "file";
private static final String ENTITY_YEN = "¥";
- /** JRE1.6の{@link java.io.File#setReadable(boolean,boolean)}に相当。 */
- private static final Method METHOD_SETREADABLE;
- /** JRE1.6の{@link java.io.File#setWritable(boolean,boolean)}に相当。 */
- private static final Method METHOD_SETWRITABLE;
- /** Locale.ROOT代替品。 */
- private static final Locale ROOT = new Locale("", "", "");
-
static{
- Method method;
- int modifiers;
-
- try{
- method = File.class.getMethod(
- "setReadable", Boolean.TYPE, Boolean.TYPE);
- modifiers = method.getModifiers();
- if( ! Modifier.isPublic(modifiers) ){
- method = null;
- }
- }catch(NoSuchMethodException e){
- method = null;
- }catch(SecurityException e){
- method = null;
- }
- METHOD_SETREADABLE = method;
-
- try{
- method = File.class.getMethod(
- "setWritable", Boolean.TYPE, Boolean.TYPE);
- modifiers = method.getModifiers();
- if( ! Modifier.isPublic(modifiers) ){
- method = null;
- }
- }catch(NoSuchMethodException e){
- method = null;
- }catch(SecurityException e){
- method = null;
- }
- METHOD_SETWRITABLE = method;
-
assert ! ( isMacOSXFs() && isWindowsOSFs() );
new FileUtils().hashCode();
}
/**
- * パーミッション操作メソッドの下請け。
- * リフレクション機構に関する異常系を吸収する。
- * @param method setReadableかsetWritableのいずれかの2引数版メソッド。
- * @param file 捜査対象のファイル
- * @param flag 操作フラグ
- * @param ownerOnly 対象は所有者のみか否か
- * @return メソッドの戻り値。成功すればtrue
- * @throws InvocationTargetException メソッドが発した異常系
- */
- private static boolean reflectFilePermOp(
- Method method, File file, boolean flag, boolean ownerOnly)
- throws InvocationTargetException {
- Object result;
- try{
- result = method.invoke(file, flag, ownerOnly);
- }catch(IllegalAccessException e){
- assert false;
- throw new AssertionError(e);
- }catch(IllegalArgumentException e){
- assert false;
- throw new AssertionError(e);
- }catch(ExceptionInInitializerError e){
- assert false;
- throw new AssertionError(e);
- }
-
- assert result instanceof Boolean;
- Boolean boolResult = (Boolean) result;
-
- return boolResult;
- }
-
- /**
- * パーミッション操作メソッドの下請け。
- * @param method setReadableかsetWritableのいずれかの2引数版メソッド。
- * @param file 操作対象のファイル。
- * @param flag 操作フラグ
- * @param ownerOnly 対象は所有者のみか否か
- * @return 成功すればtrue
- * @throws SecurityException セキュリティ上の許可が無い場合
- */
- private static boolean invokeFilePermOp(
- Method method, File file, boolean flag, boolean ownerOnly)
- throws SecurityException{
- boolean result;
-
- try{
- result = reflectFilePermOp(method, file, flag, ownerOnly);
- }catch(InvocationTargetException e){
- Throwable cause = e.getCause();
- if(cause instanceof SecurityException){
- throw (SecurityException) cause;
- }else if(cause instanceof RuntimeException){
- throw (RuntimeException) cause;
- }else if(cause instanceof Error){
- throw (Error) cause;
- }
-
- assert false;
- throw new AssertionError(e);
- }
-
- return result;
- }
-
- /**
- * ファイルの読み込みパーミッションを操作する。
- * JRE1.6の{@link java.io.File#setReadable(boolean,boolean)}
- * の代用品。
- *
- * <p>JRE1.6でなければなにもせずにfalseを返す。
- *
- * @param file ファイルorディレクトリ
- * @param flag 操作フラグ
- * @param ownerOnly 対象は所有者のみか否か
- * @return 成功すればtrue
- * @throws SecurityException セキュリティ上の許可が無い場合
- */
- public static boolean setReadable(
- File file, boolean flag, boolean ownerOnly )
- throws SecurityException {
- if(file == null) throw new NullPointerException();
- if(METHOD_SETREADABLE == null) return false;
-
- boolean result;
- result = invokeFilePermOp(METHOD_SETREADABLE, file, flag, ownerOnly);
- return result;
- }
-
- /**
- * ファイルの書き込みパーミッションを操作する。
- * JRE1.6の{@link java.io.File#setWritable(boolean,boolean)}
- * の代用品。
- *
- * <p>JRE1.6でなければなにもせずにfalseを返す。
- *
- * @param file ファイルorディレクトリ
- * @param flag 操作フラグ
- * @param ownerOnly 対象は所有者のみか否か
- * @return 成功すればtrue
- * @throws SecurityException セキュリティ上の許可が無い場合
- */
- public static boolean setWritable(
- File file, boolean flag, boolean ownerOnly )
- throws SecurityException {
- if(file == null) throw new NullPointerException();
- if(METHOD_SETWRITABLE == null) return false;
-
- boolean result;
- result = invokeFilePermOp(METHOD_SETWRITABLE, file, flag, ownerOnly);
- return result;
- }
-
- /**
* なるべく自分にだけ読み書き許可を与え
* 自分以外には読み書き許可を与えないように
* ファイル属性を操作する。
- * JRE1.6環境でなければなにもしない。
+ *
* @param file 操作対象ファイル
* @return 成功すればtrue
* @throws SecurityException セキュリティ上の許可が無い場合
throws SecurityException{
boolean result = true;
- result &= setReadable(file, false, false);
- result &= setReadable(file, true, true);
+ result &= file.setReadable(false, false);
+ result &= file.setReadable(true, true);
- result &= setWritable(file, false, false);
- result &= setWritable(file, true, true);
+ result &= file.setWritable(false, false);
+ result &= file.setWritable(true, true);
return result;
}
/**
* 任意の絶対パスの祖先の内、存在するもっとも近い祖先を返す。
+ *
* @param file 任意の絶対パス
* @return 存在するもっとも近い祖先。一つも存在しなければnull。
* @throws IllegalArgumentException 引数が絶対パスでない
/**
* 任意の絶対パスのルートファイルシステムもしくはドライブレターを返す。
+ *
* @param file 任意の絶対パス
* @return ルートファイルシステムもしくはドライブレター
* @throws IllegalArgumentException 引数が絶対パスでない
/**
* 相対パスの絶対パス化を試みる。
+ *
* @param file 対象パス
* @return 絶対パス。絶対化に失敗した場合は元の引数。
*/
/**
* 任意のディレクトリがアクセス可能な状態にあるか判定する。
- * アクセス可能の条件を満たすためには、与えられたパスが
+ *
+ * <p>アクセス可能の条件を満たすためには、与えられたパスが
* <ul>
* <li>存在し、
* <li>かつディレクトリであり、
* <li>かつ書き込み可能
* </ul>
* でなければならない。
+ *
* @param path 任意のディレクトリ
* @return アクセス可能ならtrue
*/
/**
* クラスがローカルファイルからロードされたのであれば
* そのファイルを返す。
+ *
* @param klass 任意のクラス
* @return ロード元ファイル。見つからなければnull。
*/
/**
* すでに存在するJARファイルか判定する。
+ *
* @param file 任意のファイル
* @return すでに存在するJARファイルであればtrue
*/
/**
* クラスがローカルJARファイルからロードされたのであれば
* その格納ディレクトリを返す。
+ *
* @param klass 任意のクラス
* @return ロード元JARファイルの格納ディレクトリ。
* JARが見つからない、もしくはロード元がJARファイルでなければnull。
/**
* このクラスがローカルJARファイルからロードされたのであれば
* その格納ディレクトリを返す。
+ *
* @return ロード元JARファイルの格納ディレクトリ。
* JARが見つからない、もしくはロード元がJARファイルでなければnull。
*/
/**
* ホームディレクトリを得る。
- * システムプロパティuser.homeで示されたホームディレクトリを返す。
+ *
+ * <p>システムプロパティuser.homeで示されたホームディレクトリを返す。
+ *
* @return ホームディレクトリ。何らかの事情でnullを返す場合もあり。
*/
public static File getHomeDirectory(){
/**
* MacOSX環境か否か判定する。
+ *
* @return MacOSX環境ならtrue
*/
public static boolean isMacOSXFs(){
if(osName == null) return false;
- osName = osName.toLowerCase(ROOT);
+ osName = osName.toLowerCase(Locale.ROOT);
if(osName.startsWith("mac os x")){
return true;
/**
* Windows環境か否か判定する。
+ *
* @return Windows環境ならtrue
*/
public static boolean isWindowsOSFs(){
if(osName == null) return false;
- osName = osName.toLowerCase(ROOT);
+ osName = osName.toLowerCase(Locale.ROOT);
if(osName.startsWith("windows")){
return true;
/**
* アプリケーション設定ディレクトリを返す。
- * 存在の有無、アクセスの可否は関知しない。
+ *
+ * <p>存在の有無、アクセスの可否は関知しない。
*
* <p>WindowsやLinuxではホームディレクトリ。
* Mac OS X ではさらにホームディレクトリの下の
/**
* ファイル名を表示するためのJLabel用HTML文字列を生成する。
- * Windows日本語環境では、バックスラッシュ記号が円通貨記号に置換される。
+ *
+ * <p>Windows日本語環境では、バックスラッシュ記号が円通貨記号に置換される。
+ *
* @param file 対象ファイル
* @return HTML文字列断片
*/
boolean created = false;
try{
created = this.lockFile.createNewFile();
- }catch(IOException e){
- assert true; // IGNORE
- }catch(SecurityException e){
+ }catch(IOException | SecurityException e){
assert true; // IGNORE
}finally{
if(created){
/**
* コマンドラインオプション情報。
- * public static void main()の引数から展開される。
+ *
+ * <p>public static void main()の引数から展開される。
*/
public class OptionInfo{
/**
* 文字列が可変引数のいずれかと英字大小無視で等しいか判定する。
*
- * <p>※ JRE1.6のString#equalsIgnoreCase の代替も兼ねる。
- *
* @param text 文字列
* @param names 文字列の可変引数
* @return 等しい物があればtrue
*/
private static boolean equalsIgnoreCase(String text, String ... names){
for(String name : names){
- if(text.compareToIgnoreCase(name) == 0) return true;
+ if(text.equalsIgnoreCase(name)) return true;
}
return false;
}
/**
* 真偽二値をとるオプション解析の下請け。
+ *
* @param info オプション情報格納先
* @param option オプション種別
* @param optTxt オプション名文字列
/**
* 引数付きオプションを解析する。
+ *
* @param info オプション情報
* @param optTxt オプション文字列
* @param option オプション種別
/**
* オプション文字列を解析する。
+ *
* @param args main()に渡されるオプション文字列
* @return 解析済みのオプション情報。
* @throws IllegalArgumentException 構文エラー
/**
* 全引数のリストを返す。
+ *
* @return 全引数のリスト
*/
public List<String> getInvokeArgList(){
/**
* オプションが指定されていたか否か判定する。
+ *
* @param option オプション
* @return 指定されていたらtrue
*/
/**
* 真偽値をとるオプション値を返す。
- * 複数回指定された場合は最後の値。
+ *
+ * <p>複数回指定された場合は最後の値。
+ *
* @param option オプション
* @return 真偽値。オプション指定がなかった場合はnull
* @throws IllegalArgumentException 真偽値を取るオプションではない。
/**
* 文字列引数をとるオプション値を返す。
- * 複数回指定された場合は最後の値。
+ *
+ * <p>複数回指定された場合は最後の値。
+ *
* @param option オプション
* @return 文字列。オプション指定がなかった場合はnull
*/
/**
* 排他的オプションのいずれかが指定されたか判定する。
- * 後から指定された方が有効となる。
+ *
+ * <p>後から指定された方が有効となる。
+ *
* @param options 排他的オプション群
* @return いずれかのオプション。どれも指定されなければnull
*/
/**
* 初期のフレーム幅を返す。
+ *
* @return 初期のフレーム幅。オプション指定されてなければnull
*/
public Integer initialFrameWidth(){
/**
* 初期のフレーム高を返す。
+ *
* @return 初期のフレーム高。オプション指定されてなければnull
*/
public Integer initialFrameHeight(){
/**
* 初期のフレーム位置のX座標を返す。
+ *
* @return 初期のフレーム位置のX座標。オプション指定されてなければnull
*/
public Integer initialFrameXpos(){
/**
* 初期のフレーム位置のY座標を返す。
+ *
* @return 初期のフレーム位置のY座標。オプション指定されてなければnull
*/
public Integer initialFrameYpos(){
try{
DocumentBuilder builder = XmlUtils.createDocumentBuilder();
predefs = PreDefAvatar.buildPreDefAvatarList(builder);
- }catch(IOException e){
- throw new ExceptionInInitializerError(e);
- }catch(ParserConfigurationException e){
- throw new ExceptionInInitializerError(e);
- }catch(SAXException e){
- throw new ExceptionInInitializerError(e);
- }catch(URISyntaxException e){
+ }catch( IOException
+ | ParserConfigurationException
+ | SAXException
+ | URISyntaxException
+ e){
throw new ExceptionInInitializerError(e);
}
try{
DocumentBuilder builder = XmlUtils.createDocumentBuilder();
landDefList = LandDef.buildLandDefList(builder);
- }catch(IOException e){
- LOGGER.log(Level.SEVERE, "failed to load land list", e);
- return;
- }catch(SAXException e){
- LOGGER.log(Level.SEVERE, "failed to load land list", e);
- return;
- }catch(URISyntaxException e){
- LOGGER.log(Level.SEVERE, "failed to load land list", e);
- return;
- }catch(ParserConfigurationException e){
+ }catch( IOException
+ | SAXException
+ | URISyntaxException
+ | ParserConfigurationException
+ e){
LOGGER.log(Level.SEVERE, "failed to load land list", e);
return;
}
+++ /dev/null
-/*
- * Inter Process Communication with Web browser
- *
- * License : The MIT License
- * Copyright(c) 2009 olyutorskii
- */
-
-package jp.sfjp.jindolf.dxchg;
-
-import java.awt.GraphicsEnvironment;
-import java.awt.HeadlessException;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URI;
-
-/**
- * Webブラウザとのプロセス間通信。
- * java.awt.Desktopの代用品。
- * JRE1.6でしか使えない。がしかし、JRE1.5でもコンパイル&ロード可能。
- * ※参照: java.awt.Desktop
- */
-public final class WebIPC{
-
- private static final Class<?> DESKTOP_KLASS;
- private static final Method METHOD_ISDESKTOPSUPPORTED;
- private static final Method METHOD_GETDESKTOP;
- private static final Method METHOD_ISSUPPORTED;
- private static final Method METHOD_BROWSE;
-
- private static final Class<?> DESKTOP_ACTION_KLASS;
- private static final Enum<?> BROWSE_ENUM;
-
- static{
- DESKTOP_KLASS = getClass("java.awt.Desktop");
- DESKTOP_ACTION_KLASS = getInnerClass(DESKTOP_KLASS,
- "java.awt.Desktop.Action");
-
- METHOD_ISDESKTOPSUPPORTED = getMethod("isDesktopSupported");
- METHOD_GETDESKTOP = getMethod("getDesktop");
- METHOD_ISSUPPORTED = getMethod("isSupported",
- DESKTOP_ACTION_KLASS);
- METHOD_BROWSE = getMethod("browse",
- URI.class);
-
- BROWSE_ENUM = getEnumMember(DESKTOP_ACTION_KLASS, "BROWSE");
- }
-
-
- private final Object desktop;
-
-
- /**
- * 見えないコンストラクタ。
- * @throws HeadlessException GUI環境が未接続
- * @throws UnsupportedOperationException 未サポート
- */
- private WebIPC()
- throws HeadlessException,
- UnsupportedOperationException {
- super();
-
- try{
- this.desktop = METHOD_GETDESKTOP.invoke(null, (Object[]) null);
- }catch(InvocationTargetException e){
- Throwable targetException = e.getTargetException();
-
- if(targetException instanceof RuntimeException){
- throw (RuntimeException) targetException;
- }
- if(targetException instanceof Error){
- throw (Error) targetException;
- }
-
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }catch(IllegalAccessException e){
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }
-
- return;
- }
-
-
- /**
- * クラス名からClassインスタンスを探す。
- * @param klassName クラス名
- * @return Classインスタンス。クラスが見つからなければnull。
- */
- private static Class<?> getClass(String klassName){
- Class<?> result;
- try{
- result = Class.forName(klassName);
- }catch(ClassNotFoundException e){
- result = null;
- }
- return result;
- }
-
- /**
- * 内部クラス名からClassインスタンスを探す。
- * @param parent 囲む親クラス。
- * @param canonical 内部クラスのカノニカル名
- * @return Classインスタンス。クラスが見つからなければnull。
- */
- private static Class<?> getInnerClass(Class<?> parent,
- String canonical){
- if(parent == null) return null;
-
- Class<?> result = null;
-
- Class<?>[] innerKlasses = parent.getClasses();
- for(Class<?> klass : innerKlasses){
- if(klass.getCanonicalName().equals(canonical)){
- result = klass;
- break;
- }
- }
-
- return result;
- }
-
- /**
- * Desktopクラスのメソッド名からMethodインスタンスを探す。
- * @param methodName メソッド名
- * @param paramTypes 引数型並び
- * @return Methodインスタンス。見つからなければnull。
- */
- private static Method getMethod(String methodName,
- Class<?>... paramTypes){
- if(DESKTOP_KLASS == null) return null;
-
- Method result;
-
- try{
- result = DESKTOP_KLASS.getMethod(methodName, paramTypes);
- }catch(NoSuchMethodException e){
- result = null;
- }
-
- return result;
- }
-
- /**
- * Enumのメンバを探す。
- * @param parent Enumの型
- * @param memberName メンバ名
- * @return Enumインスタンス。見つからなければnull。
- */
- private static Enum<?> getEnumMember(Class<?> parent,
- String memberName){
- if(parent == null) return null;
-
- Field field;
- try{
- field = parent.getField(memberName);
- }catch(NoSuchFieldException e){
- return null;
- }
-
- Object value;
- try{
- value = field.get(null);
- }catch(IllegalAccessException e){
- return null;
- }catch(IllegalArgumentException e){
- return null;
- }
-
- if( ! (value instanceof Enum) ) return null;
-
- return (Enum<?>) value;
- }
-
- /**
- * JRE1.6より提供されたjava.awt.Desktopが利用可能か判定する。
- * ※参照: java.awt.DesktopのisDesktopSupported()
- * @return Desktopが利用可能ならtrue。JRE1.5以前だとたぶんfalse。
- */
- public static boolean isDesktopSupported(){
- if(METHOD_ISDESKTOPSUPPORTED == null) return false;
-
- Object invokeResult;
- try{
- invokeResult = METHOD_ISDESKTOPSUPPORTED.invoke(null,
- (Object[]) null);
- }catch(InvocationTargetException e){
- Throwable targetException = e.getTargetException();
-
- if(targetException instanceof RuntimeException){
- throw (RuntimeException) targetException;
- }else if(targetException instanceof Error){
- throw (Error) targetException;
- }
-
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }catch(IllegalAccessException e){
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }
-
- if( ! (invokeResult instanceof Boolean) ){
- assert false;
- return false;
- }
-
- boolean result = (Boolean) invokeResult;
-
- return result;
- }
-
- /**
- * WebIPCインスタンスを得る。
- * ※参照: java.awt.DesktopのgetDesktop()
- * @return インスタンス
- * @throws java.awt.HeadlessException スクリーンデバイスが見つからない
- * @throws java.lang.UnsupportedOperationException 未サポートの機能
- */
- public static WebIPC getWebIPC()
- throws HeadlessException,
- UnsupportedOperationException {
- if(GraphicsEnvironment.isHeadless()) throw new HeadlessException();
- if( ! isDesktopSupported() ){
- throw new UnsupportedOperationException();
- }
-
- WebIPC webIPC = new WebIPC();
-
- return webIPC;
- }
-
- /**
- * Webブラウザに任意のURIを表示させる。
- * ※参照: java.awt.Desktopのbrowse(java.net.URI)
- * @param uri URI
- * @throws NullPointerException 引数がnull
- * @throws UnsupportedOperationException 未サポートの機能
- * @throws IOException ブラウザが見つからない
- * @throws SecurityException セキュリティ違反
- * @throws IllegalArgumentException URI形式が変
- */
- public void browse(URI uri)
- throws NullPointerException,
- UnsupportedOperationException,
- IOException,
- SecurityException,
- IllegalArgumentException {
- if(uri == null) throw new NullPointerException();
- if( ! isSupported(Action.BROWSE) ){
- throw new UnsupportedOperationException();
- }
-
- try{
- METHOD_BROWSE.invoke(this.desktop, uri);
- }catch(InvocationTargetException e){
- Throwable targetException = e.getTargetException();
-
- if(targetException instanceof IOException){
- throw (IOException) targetException;
- }
- if(targetException instanceof RuntimeException){
- throw (RuntimeException) targetException;
- }
- if(targetException instanceof Error){
- throw (Error) targetException;
- }
-
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }catch(IllegalAccessException e){
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }
-
- return;
- }
-
- /**
- * 指定した機能(アクション)がサポートされているか否か判定する。
- * ※参照: java.awt.Desktop#isSupported(java.awt.Desktop.Action)
- * @param action アクション
- * @return アクションがサポートされていればtrue。
- */
- public boolean isSupported(Action action){
- switch(action){
- case BROWSE:
- break;
- default:
- return false;
- }
-
- Object invokeResult;
- try{
- invokeResult = METHOD_ISSUPPORTED.invoke(this.desktop,
- BROWSE_ENUM);
- }catch(InvocationTargetException e){
- Throwable targetException = e.getTargetException();
-
- if(targetException instanceof RuntimeException){
- throw (RuntimeException) targetException;
- }
- if(targetException instanceof Error){
- throw (Error) targetException;
- }
-
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }catch(IllegalAccessException e){
- AssertionError thw = new AssertionError();
- thw.initCause(e);
- throw thw;
- }
-
- if( ! (invokeResult instanceof Boolean) ){
- assert false;
- return false;
- }
-
- boolean result = (Boolean) invokeResult;
-
- return result;
- }
-
- /**
- * 各種デスクトップアクション。
- * ※参照 java.awt.Desktop.Action
- */
- public static enum Action{
- /** Webブラウザでのブラウズ。 */
- BROWSE,
- // EDIT,
- // MAIL,
- // OPEN,
- // PRINT,
- }
-
-}
/*
- * Dialog for WebIPC
+ * Dialog for Desktop
*
* License : The MIT License
* Copyright(c) 2009 olyutorskii
package jp.sfjp.jindolf.dxchg;
import java.awt.Container;
+import java.awt.Desktop;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.text.MessageFormat;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
-import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.JRootPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.TransferHandler;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
-import jp.sfjp.jindolf.JreChecker;
import jp.sfjp.jindolf.VerInfo;
import jp.sfjp.jindolf.util.GUIUtils;
import jp.sfjp.jindolf.util.Monodizer;
* Webブラウザ起動用の専用ダイアログ。
*/
@SuppressWarnings("serial")
-public class WebIPCDialog
- extends JDialog
- implements ActionListener {
+public class WebIPCDialog extends JDialog {
+
+ /** logger. */
+ protected static final Logger LOGGER = Logger.getAnonymousLogger();
+
+ /** browse command. */
+ protected static final String CMD_BROWSE = "browse";
+ /** clipboard copy command. */
+ protected static final String CMD_CLIPCOPY = "clipcopy";
+ /** cancel command. */
+ protected static final String CMD_CANCEL = "cancel";
+
+ private static final String MSG_NODESKTOP =
+ "何らかの理由でこの機能は利用不可になっています";
+ private static final String MSG_DND =
+ "URL {0} がどこかへドラッグ&ドロップされました";
+ private static final String MSG_CLIPCOPY =
+ "文字列「{0}」をクリップボードにコピーしました";
+ private static final String MSG_BROWSE =
+ "URL {0} へのアクセスをWebブラウザに指示しました";
private static final String TITLE_WWW =
VerInfo.getFrameTitle("URLへのアクセス確認");
+ private static final DragIgniter DNDIGNITER = new DragIgniter();
- private static final Logger LOGGER = Logger.getAnonymousLogger();
+ private static final URI URI_EMPTY;
+ static{
+ try{
+ URI_EMPTY = new URI("");
+ }catch(URISyntaxException e){
+ throw new ExceptionInInitializerError(e);
+ }
+ }
- private final String warnMessage;
private final JLabel info =
new JLabel("以下のURLへのアクセスが指示されました。");
private final JButton cancel =
new JButton("閉じる");
- private final WebIPC ipc;
+ private final Desktop desktop;
private URI uri;
/**
* コンストラクタ。
+ *
* @param owner オーナーフレーム
*/
- public WebIPCDialog(Frame owner){
+ protected WebIPCDialog(Frame owner){
super(owner);
- setModal(true);
-
- GUIUtils.modifyWindowAttributes(this, true, false, true);
- WebIPC webipc = null;
- if(WebIPC.isDesktopSupported()){
- webipc = WebIPC.getWebIPC();
- if( ! webipc.isSupported(WebIPC.Action.BROWSE) ){
- webipc = null;
- }
+ this.desktop = getBrowserCntl();
+ if(this.desktop == null){
+ this.browse.setEnabled(false);
}
- this.ipc = webipc;
-
- if(this.ipc == null){
- if( ! JreChecker.has16Runtime() ){
- this.warnMessage =
- "この機能を利用するには、JRE1.6以上が必要です";
- }else{
- this.warnMessage =
- "何らかの理由でこの機能は利用不可になっています";
- }
- }else{
- this.warnMessage = "";
- }
-
- Border inside =
- BorderFactory.createEmptyBorder(1, 4, 1, 4);
- Border outside =
- BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
- Border border =
- BorderFactory.createCompoundBorder(outside, inside);
- this.urltext.setBorder(border);
- this.urltext.setEditable(false);
- this.urltext.setLineWrap(true);
- this.urltext.setComponentPopupMenu(new TextPopup());
- Monodizer.monodize(this.urltext);
- this.dndLabel.setIcon(GUIUtils.getWWWIcon());
- this.dndLabel.setHorizontalTextPosition(SwingConstants.LEFT);
- this.dndLabel.setTransferHandler(new DnDHandler());
- this.dndLabel.addMouseListener(new DragIgniter());
+ buildUrlLabel();
+ buildEventCatcher();
+ buildDnDLabel();
Container container = getContentPane();
design(container);
- this.browse .addActionListener(this);
- this.clipcopy.addActionListener(this);
- this.cancel .addActionListener(this);
+ return;
+ }
- getRootPane().setDefaultButton(this.browse);
- this.browse.requestFocusInWindow();
- if(this.ipc == null){
- this.browse.setToolTipText(this.warnMessage);
- }
+ /**
+ * ブラウザ制御オブジェクトを返す。
+ *
+ * @return ブラウザ制御オブジェクト。サポートされなければnull。
+ */
+ private static Desktop getBrowserCntl(){
+ if( ! Desktop.isDesktopSupported()) return null;
- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
- addWindowListener(new WindowAdapter(){
- @Override
- public void windowClosing(WindowEvent event){
- actionCancel();
- return;
- }
- });
+ Desktop result = Desktop.getDesktop();
+ assert result != null;
- return;
+ if( ! result.isSupported(Desktop.Action.BROWSE) ) return null;
+
+ return result;
}
/**
* Webブラウザ起動用のモーダルダイアログを表示する。
+ *
* @param owner オーナーフレーム
* @param url URL文字列
*/
public static void showDialog(Frame owner, String url){
- WebIPCDialog dialog = new WebIPCDialog(owner);
+ WebIPCDialog dialog = createDialog(owner);
- dialog.setTitle(TITLE_WWW);
dialog.setUrlText(url);
+
dialog.pack();
- dialog.setLocationRelativeTo(owner);
dialog.setVisible(true);
return;
}
/**
+ * ダイアログを生成する。
+ *
+ * @param owner オーナーフレーム
+ * @return ダイアログ
+ */
+ protected static WebIPCDialog createDialog(Frame owner){
+ WebIPCDialog dialog = new WebIPCDialog(owner);
+
+ decorateDialog(dialog);
+ dialog.setLocationRelativeTo(owner);
+
+ return dialog;
+ }
+
+ /**
+ * ダイアログを装飾する。
+ *
+ * @param dialog ダイアログ
+ */
+ protected static void decorateDialog(WebIPCDialog dialog){
+ dialog.setResizable(true);
+ dialog.setLocationByPlatform(true);
+
+ dialog.setTitle(TITLE_WWW);
+
+ dialog.setModalityType(ModalityType.APPLICATION_MODAL);
+
+ return;
+ }
+
+ /**
* 有効なURIか判定する。
+ *
* @param uri URI
* @return 有効ならtrue
*/
if( ! uri.isAbsolute() ) return false;
String scheme = uri.getScheme();
- if(scheme == null) return false;
- if( ! scheme.equalsIgnoreCase("http")
- && ! scheme.equalsIgnoreCase("https") ) return false;
+ if( ! "http".equalsIgnoreCase(scheme)
+ && ! "https".equalsIgnoreCase(scheme) ) return false;
String host = uri.getHost();
if(host == null) return false;
return true;
}
+
+ /**
+ * URL表示部を構成する。
+ */
+ private void buildUrlLabel(){
+ Border inside =
+ BorderFactory.createEmptyBorder(1, 4, 1, 4);
+ Border outside =
+ BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
+ Border border =
+ BorderFactory.createCompoundBorder(outside, inside);
+
+ this.urltext.setBorder(border);
+
+ this.urltext.setEditable(false);
+ this.urltext.setLineWrap(true);
+ this.urltext.setComponentPopupMenu(new TextPopup());
+
+ Monodizer.monodize(this.urltext);
+
+ return;
+ }
+
+ /**
+ * ボタンを構成する。
+ */
+ private void buildEventCatcher(){
+ this.browse .setActionCommand(CMD_BROWSE);
+ this.clipcopy.setActionCommand(CMD_CLIPCOPY);
+ this.cancel .setActionCommand(CMD_CANCEL);
+
+ EventCatcher catcher = new EventCatcher();
+ this.browse .addActionListener(catcher);
+ this.clipcopy.addActionListener(catcher);
+ this.cancel .addActionListener(catcher);
+
+ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+ addWindowListener(catcher);
+
+ JRootPane pane = getRootPane();
+ pane.setDefaultButton(this.browse);
+ this.browse.requestFocusInWindow();
+
+ if(this.desktop == null){
+ this.browse.setToolTipText(MSG_NODESKTOP);
+ }
+
+ return;
+ }
+
+ /**
+ * DragAndDropラベルを構成する。
+ */
+ private void buildDnDLabel(){
+ this.dndLabel.setIcon(GUIUtils.getWWWIcon());
+ this.dndLabel.setHorizontalTextPosition(SwingConstants.LEFT);
+ this.dndLabel.setTransferHandler(new DnDHandler());
+ this.dndLabel.addMouseListener(DNDIGNITER);
+ return;
+ }
+
/**
* レイアウトを行う。
+ *
* @param container レイアウトコンテナ
*/
private void design(Container container){
GridBagLayout layout = new GridBagLayout();
- GridBagConstraints constraints = new GridBagConstraints();
container.setLayout(layout);
- JComponent buttonPanel = buildButtonPanel();
-
+ GridBagConstraints constraints = new GridBagConstraints();
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.insets = new Insets(5, 5, 5, 5);
- container.add(this.info, constraints);
+ JComponent buttonPanel = buildButtonPanel();
+
+ container.add(this.info, constraints);
container.add(this.urltext, constraints);
- container.add(buttonPanel, constraints);
- container.add(this.cancel, constraints);
+ container.add(buttonPanel, constraints);
+ container.add(this.cancel, constraints);
return;
}
/**
* ボタンパネルを生成する。
+ *
* @return ボタンパネル
*/
private JComponent buildButtonPanel(){
buttonPanel.setBorder(border);
GridBagLayout layout = new GridBagLayout();
- GridBagConstraints constraints = new GridBagConstraints();
buttonPanel.setLayout(layout);
+ GridBagConstraints constraints = new GridBagConstraints();
+
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.insets = new Insets(3, 3, 3, 3);
/**
* URL文字列を設定する。
+ *
* @param url URL文字列
*/
public void setUrlText(String url){
- URI uriarg = null;
+ URI argUri;
try{
- uriarg = new URI(url);
+ argUri = new URI(url);
}catch(URISyntaxException e){
- // NOTHING
+ argUri = null;
}
- this.uri = uriarg;
- if(this.uri == null) return;
+ setUri(argUri);
+
+ return;
+ }
- if( ! isValidURI(this.uri) ) return;
+ /**
+ * URIを設定する。
+ *
+ * @param uriArg URI
+ */
+ public void setUri(URI uriArg){
+ if(isValidURI(uriArg)){
+ this.uri = uriArg;
+ }else{
+ this.uri = URI_EMPTY;
+ }
String uriText = this.uri.toASCIIString();
this.urltext.setText(uriText);
}
/**
- * ボタン押下リスナ。
- * @param event ボタン押下イベント
+ * URIを返す。
+ *
+ * @return URI
*/
- @Override
- public void actionPerformed(ActionEvent event){
- Object source = event.getSource();
- if(source == this.browse){
- actionBrowse();
- }else if(source == this.clipcopy){
- actionClipboardCopy();
- }else if(source == this.cancel){
- actionCancel();
+ public URI getURI(){
+ return this.uri;
+ }
+
+ /**
+ * WebブラウザでURLを表示。
+ *
+ * <p>ダイアログは必ず閉じられる。
+ */
+ protected void actionBrowse(){
+ try{
+ actionBrowseImpl();
+ }finally{
+ closeDialog();
}
- return;
}
/**
* WebブラウザでURLを表示。
*/
- private void actionBrowse(){
- if(this.uri == null){
- close();
+ private void actionBrowseImpl(){
+ if( ! isValidURI(this.uri) ){
return;
}
- if(this.ipc == null){
- String title;
- if( ! JreChecker.has16Runtime() ){
- title = "新しいJavaを入手しましょう";
- }else{
- title = "報告";
- }
+ if(this.desktop == null){
+ String title = "報告";
JOptionPane.showMessageDialog(
this,
- this.warnMessage, title,
+ MSG_NODESKTOP, title,
JOptionPane.INFORMATION_MESSAGE);
return;
}
try{
- try{
- this.ipc.browse(this.uri);
- }catch(NullPointerException e){
- assert false;
- }catch(UnsupportedOperationException e){
- // NOTHING
- }catch(IOException e){
- // NOTHING
- }catch(SecurityException e){
- // NOTHING
- }catch(IllegalArgumentException e){
- // NOTHING
- }
- String logmsg = "URL "
- + this.uri.toASCIIString()
- + " へのアクセスをWebブラウザに指示しました";
- LOGGER.info(logmsg);
- }finally{
- close();
+ this.desktop.browse(this.uri);
+ }catch(IOException e){
+ return;
}
+ String uriText = this.uri.toASCIIString();
+ String logMessage =
+ MessageFormat.format(MSG_BROWSE, uriText);
+ LOGGER.info(logMessage);
+
return;
}
/**
* URLをクリップボードにコピーする。
*/
- private void actionClipboardCopy(){
- if(this.uri == null){
- close();
+ protected void actionClipboardCopy(){
+ if( ! isValidURI(this.uri) ){
+ closeDialog();
return;
}
- String uristring = this.uri.toASCIIString();
+ String uriText = this.uri.toASCIIString();
try{
- ClipboardAction.copyToClipboard(uristring);
- String logmsg = "文字列「"
- + uristring
- + "」をクリップボードにコピーしました";
- LOGGER.info(logmsg);
+ ClipboardAction.copyToClipboard(uriText);
+ String logMessage =
+ MessageFormat.format(MSG_CLIPCOPY, uriText);
+ LOGGER.info(logMessage);
}finally{
- close();
+ closeDialog();
}
return;
/**
* 何もせずダイアログを閉じる。
*/
- private void actionCancel(){
- close();
+ protected void actionCancel(){
+ closeDialog();
return;
}
/**
* ダイアログを閉じる。
*/
- private void close(){
+ protected void closeDialog(){
setVisible(false);
+ dispose();
return;
}
+
+ /**
+ * イベント受信リスナ。
+ */
+ private class EventCatcher
+ extends WindowAdapter
+ implements ActionListener {
+
+ /**
+ * コンストラクタ。
+ */
+ EventCatcher(){
+ super();
+ return;
+ }
+
+ /**
+ * ボタン押下受信。
+ *
+ * <p>{@inheritDoc}
+ *
+ * @param event {@inheritDoc}
+ */
+ @Override
+ public void actionPerformed(ActionEvent event){
+ String cmd = event.getActionCommand();
+ if(cmd == null) return;
+
+ switch(cmd){
+ case CMD_BROWSE:
+ actionBrowse();
+ break;
+ case CMD_CLIPCOPY:
+ actionClipboardCopy();
+ break;
+ case CMD_CANCEL:
+ actionCancel();
+ break;
+ default:
+ break;
+ }
+
+ return;
+ }
+
+ /**
+ * ウィンドウクローズ受信。
+ *
+ * <p>{@inheritDoc}
+ *
+ * @param event {@inheritDoc}
+ */
+ @Override
+ public void windowClosing(WindowEvent event){
+ actionCancel();
+ return;
+ }
+
+ }
+
+
/**
* Drag&Dropの転送処理を管理。
*/
/**
* コンストラクタ。
*/
- public DnDHandler(){
+ DnDHandler(){
super();
return;
}
/**
- * {@inheritDoc}
* コピー動作のみをサポートすることを伝える。
+ *
+ * <p>{@inheritDoc}
+ *
* @param comp {@inheritDoc}
* @return {@inheritDoc}
*/
}
/**
- * {@inheritDoc}
* URIエクスポータを生成する。
- * URIも指定される。
+ *
+ * <p>URIも指定される。
+ *
+ * <p>{@inheritDoc}
+ *
* @param comp {@inheritDoc}
* @return {@inheritDoc}
*/
@Override
protected Transferable createTransferable(JComponent comp){
- UriExporter result = new UriExporter(WebIPCDialog.this.uri);
+ UriExporter result = new UriExporter(getURI());
return result;
}
/**
- * {@inheritDoc}
* D&Dに成功したらダイアログを閉じる。
+ *
+ * <p>{@inheritDoc}
+ *
* @param source {@inheritDoc}
* @param data {@inheritDoc}
* @param action {@inheritDoc}
*/
@Override
protected void exportDone(JComponent source,
- Transferable data,
- int action ){
+ Transferable data,
+ int action ){
if(action == NONE) return;
- String logmsg = "URL "
- + WebIPCDialog.this.uri.toASCIIString()
- + " がどこかへドラッグ&ドロップされました";
+ String uriAscii = getURI().toASCIIString();
+ String logmsg = MessageFormat.format(MSG_DND, uriAscii);
LOGGER.info(logmsg);
- close();
+ closeDialog();
return;
}
- /**
- * {@inheritDoc}
- * ※ SunのJRE1.6.0_11前後では、BugID 4816922のため決して呼ばれない。
- * @param tx {@inheritDoc}
- * @return {@inheritDoc}
- */
- @Override
- public Icon getVisualRepresentation(Transferable tx){
- return GUIUtils.getWWWIcon();
- }
-
}
+
/**
* ドラッグ開始イベント処理。
*/
/**
* コンストラクタ。
*/
- public DragIgniter(){
+ DragIgniter(){
super();
return;
}
/**
- * {@inheritDoc}
* ドラッグ開始イベント受信。
+ *
+ * <p>{@inheritDoc}
+ *
* @param event {@inheritDoc}
*/
@Override
public void mousePressed(MouseEvent event){
- JComponent comp = (JComponent) event.getSource();
+ Object source = event.getSource();
+ assert source instanceof JComponent;
+ JComponent comp = (JComponent) source;
+
TransferHandler handler = comp.getTransferHandler();
handler.exportAsDrag(comp, event, TransferHandler.COPY);
+
return;
}
* <li>任意の文字列を表示可能な全フォントを列挙すること
* </ul>
*
- * <p>
- * この二つをバックグラウンドで非同期に収集する。
- * </p>
+ * <p>この二つをバックグラウンドで非同期に収集する。
*
- * <p>
- * 各種フォント環境収集メソッドの遅さをカバーするのが実装目的。
- * </p>
+ * <p>各種フォント環境収集メソッドの遅さをカバーするのが実装目的。
*/
public class FontEnv {
*/
public static final FontEnv DEFAULT;
- /** {@link java.awt.Font#DIALOG} 代替品。 */
- private static final String FAMILY_DIALOG = "Dialog";
-
/** フォントファミリ選択肢。 */
private static final String[] INIT_FAMILY_NAMES = {
"Hiragino Kaku Gothic Pro", // for MacOS X
/** JIS X0208:1990 表示確認用文字列。 */
private static final String JPCHECK_CODE = "あ凜熙峠ゑアアヴヰ┼ЖΩ9A";
- /** {@link java.util.Locale#ROOT} 代替品。 */
- private static final Locale LOCALE_ROOT = new Locale("", "", "");
-
private static final int POOL_SZ = 2;
private static final int STRIDE = 15;
/**
* コンストラクタ。
- * 完了と同時に裏でフォント情報収集タスクが走る。
+ *
+ * <p>完了と同時に裏でフォント情報収集タスクが走る。
+ *
* @param proveChars 表示判定用文字列
* @param fontFamilyList フォント候補
* @throws NullPointerException 引数がnull
/**
* コンストラクタ。
- * 完了と同時に裏でフォント情報収集タスクが走る。
+ *
+ * <p>完了と同時に裏でフォント情報収集タスクが走る。
+ *
* @param proveChars 表示判定用文字列
* @param fontFamilyList フォント候補
* @throws NullPointerException 引数がnull
/**
* システムに存在する有効なファミリ名か判定する。
+ *
* @param familyName フォントファミリ名。
* @return 存在する有効なファミリ名ならtrue
*/
int size = 1;
Font dummyFont = new Font(familyName, style, size);
- String dummyFamilyName = dummyFont.getFamily(LOCALE_ROOT);
+ String dummyFamilyName = dummyFont.getFamily(Locale.ROOT);
if(dummyFamilyName.equals(familyName)) return true;
String dummyLocalFamilyName = dummyFont.getFamily();
/**
* 複数の候補から利用可能なフォントを一つ選び、生成する。
- * 候補から適当なファミリが見つからなかったら"Dialog"が選択される。
+ *
+ * <p>候補から適当なファミリが見つからなかったら"Dialog"が選択される。
+ *
* @param fontList フォントファミリ名候補
* @return フォント
*/
protected static String availableFontFamily(Iterable<String> fontList){
- String defaultFamilyName = FAMILY_DIALOG;
+ String defaultFamilyName = Font.DIALOG;
for(String familyName : fontList){
if(isValidFamilyName(familyName)){
defaultFamilyName = familyName;
/**
* フォントファミリー名のリストを返す。
+ *
* @return フォントファミリー名のリスト
* @throws IllegalStateException 収集タスクに異常が発生
*/
try{
result = this.listLoadFuture.get();
- }catch(ExecutionException e){
- throw new IllegalStateException(e);
- }catch(InterruptedException e){
+ }catch(ExecutionException | InterruptedException e){
throw new IllegalStateException(e);
}
/**
* 利用可能なフォントファミリ名を返す。
+ *
* @return フォントファミリー名
* @throws IllegalStateException 収集タスクに異常が発生
*/
try{
result = this.fontSelectFuture.get();
- }catch(ExecutionException e){
- throw new IllegalStateException(e);
- }catch(InterruptedException e){
+ }catch(ExecutionException | InterruptedException e){
throw new IllegalStateException(e);
}
/**
* {@inheritDoc}
+ *
* @return {@inheritDoc}
*/
@Override
/**
* {@inheritDoc}
+ *
* @return {@inheritDoc}
*/
@Override
/** デフォルトのフォントスタイル。 */
public static final int DEF_STYLE = 0x00 | Font.PLAIN;
- /** {@link java.util.Locale#ROOT}代替品。 */
- private static final Locale LOCALE_ROOT = new Locale("", "", "");
/** MSリコー系日本語ベクトルフォント下限ポイントサイズ。 */
private static final int MS_VEC_LIMIT = 24;
/** 二重引用符。 */
/**
* コンストラクタ。
- * デフォルトフォントとそれに適した描画属性が指定される。
+ *
+ * <p>デフォルトフォントとそれに適した描画属性が指定される。
*/
public FontInfo(){
this((Font) null, (FontRenderContext) null);
/**
* コンストラクタ。
+ *
* @param font フォント
* @param context 描画設定
*/
* @return 見当が付けばtrue
*/
protected static boolean isMsRicohJpFont(Font font){
- String rootFamilyName = font.getFamily(LOCALE_ROOT);
+ String rootFamilyName = font.getFamily(Locale.ROOT);
if(rootFamilyName.startsWith("MS")){
if(rootFamilyName.contains("Gothic")) return true;
if(rootFamilyName.contains("Mincho")) return true;
/**
* ファミリ名を返す。
+ *
* @return ファミリ名
*/
private String getFamilyName(){
/**
* フォントを返す。
+ *
* @return フォント
*/
public Font getFont(){
/**
* 描画属性を返す。
+ *
* @return 描画属性
*/
public FontRenderContext getFontRenderContext(){
/**
* アンチエイリアス機能を使うか判定する。
+ *
* @return アンチエイリアス機能を使うならtrue
*/
public boolean isAntiAliased(){
/**
* サブピクセル精度を使うか判定する。
+ *
* @return サブピクセル精度を使うならtrue
*/
public boolean usesFractionalMetrics(){
/**
* フォントの最大寸法を返す。
+ *
* @return 最大寸法
* @see java.awt.Font#getMaxCharBounds(FontRenderContext)
*/
/**
* フォントのみ異なる設定を派生させる。
+ *
* @param newFont 新フォント
* @return 新設定
*/
/**
* 描画属性のみ異なる設定を派生させる。
+ *
* @param newContext 新描画設定
* @return 新設定
*/
/**
* 描画属性のみ異なる設定を派生させる。
+ *
* @param isAntiAliases アンチエイリアス設定
* @param useFractional サブピクセル精度設定
* @return 新設定
/**
* 文字列からグリフ集合を生成する。
+ *
* @param iterator 文字列
* @return グリフ集合
*/
/**
* ロケール中立なフォントファミリ名を返す。
- * JRE1.5対策
+ *
+ * <p>JRE1.5対策
+ *
* @return ファミリ名
* @see Font#getFamily(Locale)
*/
public String getRootFamilyName(){
Font thisFont = getFont();
- String result = thisFont.getFamily(LOCALE_ROOT);
+ String result = thisFont.getFamily(Locale.ROOT);
return result;
}
/**
* Font#decode()用の名前を返す。
- * 空白が含まれる場合は二重引用符で囲まれる。
+ *
+ * <p>空白が含まれる場合は二重引用符で囲まれる。
+ *
* @return {@link java.awt.Font#decode(String)}用の名前
* @see java.awt.Font#decode(String)
*/
/**
* {@inheritDoc}
+ *
* @param obj {@inheritDoc}
* @return {@inheritDoc}
*/
/**
* {@inheritDoc}
+ *
* @return {@inheritDoc}
*/
@Override
}
/**
- * {@link setModel(ListModel)} の下請けメソッド。
+ * {@link #setModel(ListModel)} の下請けメソッド。
* 与えられたモデルの更新は監視対象となる。
* @param model リストモデル
*/
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.RenderingHints;
import java.io.IOException;
import jp.osdn.jindolf.parser.content.DecodedContent;
import jp.sfjp.jindolf.data.DialogPref;
public void paint(Graphics2D g){
g.setColor(this.fgColor);
+ RenderingHints.Key aaHintKey = RenderingHints.KEY_ANTIALIASING;
+ Object aaHintTemp = RenderingHints.VALUE_ANTIALIAS_OFF;
+ Object aaHintOrig = g.getRenderingHint(aaHintKey);
+
+ RenderingHints.Key strokeHintKey = RenderingHints.KEY_STROKE_CONTROL;
+ Object strokeHintTemp = RenderingHints.VALUE_STROKE_NORMALIZE;
+ Object strokeHintOrig = g.getRenderingHint(strokeHintKey);
+
+ g.setRenderingHint(aaHintKey, aaHintTemp);
+ g.setRenderingHint(strokeHintKey, strokeHintTemp);
+
if(this.dialogPref.isSimpleMode()){
g.drawLine(this.bounds.x, this.bounds.y,
this.bounds.x + this.bounds.width, this.bounds.y );
this.bounds.height - UNDER_MARGIN);
}
+ g.setRenderingHint(aaHintKey, aaHintOrig);
+ g.setRenderingHint(strokeHintKey, strokeHintOrig);
+
this.sysMessage.paint(g);
return;
this.caption.paint(g);
if(this.dialogPref.isSimpleMode() ){
+ RenderingHints.Key aaHintKey = RenderingHints.KEY_ANTIALIASING;
+ Object aaHintTemp = RenderingHints.VALUE_ANTIALIAS_OFF;
+ Object aaHintOrig = g.getRenderingHint(aaHintKey);
+
+ RenderingHints.Key strokeHintKey =
+ RenderingHints.KEY_STROKE_CONTROL;
+ Object strokeHintTemp = RenderingHints.VALUE_STROKE_NORMALIZE;
+ Object strokeHintOrig = g.getRenderingHint(strokeHintKey);
+
+ g.setRenderingHint(aaHintKey, aaHintTemp);
+ g.setRenderingHint(strokeHintKey, strokeHintTemp);
+
g.drawLine(xPos, this.bounds.y,
xPos + this.bounds.width, this.bounds.y );
+
+ g.setRenderingHint(aaHintKey, aaHintOrig);
+ g.setRenderingHint(strokeHintKey, strokeHintOrig);
}else{
g.drawImage(this.faceImage,
xPos + this.imageOrigin.x,
protected void dispatchEvent(AWTEvent event){
try{
super.dispatchEvent(event);
- }catch(RuntimeException e){
+ }catch(RuntimeException | Error e){
logThrowable(e);
throw e;
}catch(Exception e){
logThrowable(e);
- }catch(Error e){
- logThrowable(e);
- throw e;
}
// TODO Toolkit#beep()もするべきか
// TODO モーダルダイアログを出すべきか
URL url = new URL(urlText);
URI uri = url.toURI();
urlText = uri.toASCIIString();
- }catch(MalformedURLException e){
- // NOTHING
- }catch(URISyntaxException e){
+ }catch(MalformedURLException | URISyntaxException e){
// NOTHING
}
// PukiWikiではURL内の&のエスケープは不要?
return wwwIcon;
}
- wwwIcon = ResourceManager.getImageIcon(RES_WWWICON);
+ wwwIcon = ResourceManager.getSquareIcon(RES_WWWICON, 16);
return wwwIcon;
}
try{
SwingUtilities.invokeAndWait(TASK_NOTHING);
- }catch(InterruptedException e){
- // IGNORE
- }catch(InvocationTargetException e){
+ }catch(InterruptedException | InvocationTargetException e){
// IGNORE
}
+ // IGNORE
return;
}
/**
* Swingコンポーネントのフォント等幅化。
- * L&F変更にも対処。
+ *
+ * <p>L&F変更にも対処。
*/
public final class Monodizer implements PropertyChangeListener{
public static final String PROPNAME_FONT = "font";
/** L&F変更時のプロパティ名。 */
public static final String PROPNAME_UI = "UI";
- /** Font.MONOSPACED代替品。 */
- public static final String FAMILY_MONO = "Monospaced";
private static final Map<TextAttribute, String> TEXTATTR_MONO =
- Collections.singletonMap(TextAttribute.FAMILY, FAMILY_MONO);
+ Collections.singletonMap(TextAttribute.FAMILY, Font.MONOSPACED);
private static final Monodizer CHANGER = new Monodizer();
/**
* 等幅フォントか否か判定する。
+ *
* @param font フォント
* @return 等幅フォントならtrue
*/
if( ! (attr instanceof String) ) return false;
String family = (String) attr;
- if(family.equals(FAMILY_MONO)) return true;
+ if(family.equals(Font.MONOSPACED)) return true;
return false;
}
/**
* 任意のフォントの等幅化を行う。
- * 等幅以外の属性は可能な限り保持する。
+ *
+ * <p>等幅以外の属性は可能な限り保持する。
+ *
* @param font 任意のフォント
* @return 等幅フォント
*/
/**
* 任意のコンポーネントをフォント等幅化する。
- * L&F変更に対処するためのリスナ組み込みも行われる。
+ *
+ * <p>L&F変更に対処するためのリスナ組み込みも行われる。
+ *
* @param comp コンポーネント
*/
public static void monodize(JComponent comp){
/**
* コンポーネントに微修正を加える。
+ *
* @param comp コンポーネント
*/
private static void modifyComponent(JComponent comp){
/**
* テキストコンポーネントへの微修正を行う。
+ *
* @param textComp テキストコンポーネント
*/
private static void modifyTextComponent(JTextComponent textComp){
/**
* コンボボックスのエディタを等幅化する。
+ *
* @param comboBox コンボボックス
*/
private static void modifyComboBox(JComboBox<?> comboBox){
/**
* フォント変更イベントの受信。
+ *
* @param event フォント変更イベント
*/
@Override
static{
ICON_FIND =
- ResourceManager.getImageIcon("resources/image/tb_find.png");
+ ResourceManager.getButtonIcon("resources/image/tb_find.png");
ICON_SEARCH_PREV =
- ResourceManager.getImageIcon("resources/image/tb_findprev.png");
+ ResourceManager.getButtonIcon("resources/image/tb_findprev.png");
ICON_SEARCH_NEXT =
- ResourceManager.getImageIcon("resources/image/tb_findnext.png");
+ ResourceManager.getButtonIcon("resources/image/tb_findnext.png");
ICON_RELOAD =
- ResourceManager.getImageIcon("resources/image/tb_reload.png");
+ ResourceManager.getButtonIcon("resources/image/tb_reload.png");
ICON_FILTER =
- ResourceManager.getImageIcon("resources/image/tb_filter.png");
+ ResourceManager.getButtonIcon("resources/image/tb_filter.png");
ICON_EDITOR =
- ResourceManager.getImageIcon("resources/image/tb_editor.png");
+ ResourceManager.getButtonIcon("resources/image/tb_editor.png");
}
private final Set<AbstractButton> actionItems =
--- /dev/null
+/*
+ * Flexible Icon
+ *
+ * License : The MIT License
+ * Copyright(c) 2018 olyutorskii
+ */
+
+package jp.sfjp.jindolf.view;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+/**
+ * 任意の寸法でイメージ描画を行うIcon。
+ *
+ * <p>Swingでのみサポート。
+ */
+public class FlexiIcon implements Icon{
+
+ private BufferedImage image = null;
+ private int iconWidth = -1;
+ private int iconHeight = -1;
+
+
+ /**
+ * コンストラクタ。
+ *
+ * <p>イメージと寸法は未設定となる。
+ */
+ public FlexiIcon(){
+ this(null, -1, -1);
+ ImageIcon.class.hashCode();
+ VolatileImage.class.hashCode();
+ return;
+ }
+
+ /**
+ * コンストラクタ。
+ *
+ * <p>寸法はイメージから受け継がれる。
+ *
+ * @param image 描画イメージ
+ */
+ public FlexiIcon(BufferedImage image){
+ this(image, image.getWidth(), image.getHeight());
+ return;
+ }
+
+ /**
+ * コンストラクタ。
+ *
+ * @param image 描画イメージ
+ * @param width 幅
+ * @param height 高さ
+ */
+ public FlexiIcon(BufferedImage image, int width, int height){
+ super();
+ this.image = image;
+ this.iconWidth = width;
+ this.iconHeight = height;
+ return;
+ }
+
+
+ /**
+ * 描画イメージを設定する。
+ *
+ * <p>寸法は変わらない。
+ *
+ * @param image 描画イメージ
+ */
+ public void setImage(BufferedImage image){
+ this.image = image;
+ return;
+ }
+
+ /**
+ * アイコン寸法の幅を設定する。
+ *
+ * @param width 幅
+ */
+ public void setIconWidth(int width){
+ this.iconWidth = width;
+ return;
+ }
+
+ /**
+ * アイコン寸法の高さを設定する。
+ *
+ * @param height 高さ
+ */
+ public void setIconHeight(int height){
+ this.iconHeight = height;
+ return;
+ }
+
+ /**
+ * アイコン寸法の幅を返す。
+ *
+ * @return 幅
+ */
+ @Override
+ public int getIconWidth(){
+ return this.iconWidth;
+ }
+
+ /**
+ * アイコン寸法の高さを返す。
+ *
+ * @return 高さ
+ */
+ @Override
+ public int getIconHeight(){
+ return this.iconHeight;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param comp {@inheritDoc}
+ * @param g {@inheritDoc}
+ * @param x {@inheritDoc}
+ * @param y {@inheritDoc}
+ */
+ @Override
+ public void paintIcon(Component comp, Graphics g, int x, int y){
+ assert g instanceof Graphics2D;
+ Graphics2D g2 = (Graphics2D)g;
+
+ RenderingHints.Key hintKey = RenderingHints.KEY_INTERPOLATION;
+ Object hintVal = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
+ g2.setRenderingHint(hintKey, hintVal);
+
+ g2.drawImage(
+ this.image,
+ x, y,
+ this.iconWidth, this.iconHeight,
+ comp
+ );
+
+ return;
+ }
+
+}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
-import javax.swing.ImageIcon;
+import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
private static final String TIP_ASCEND = "押すと降順に";
private static final String TIP_DESCEND = "押すと昇順に";
private static final String TIP_ORDER = "選択中の国の村一覧を読み込み直す";
- private static final ImageIcon ICON_ASCEND;
- private static final ImageIcon ICON_DESCEND;
+ private static final Icon ICON_ASCEND;
+ private static final Icon ICON_DESCEND;
static{
ICON_ASCEND =
- ResourceManager.getImageIcon("resources/image/tb_ascend.png");
+ ResourceManager.getButtonIcon("resources/image/tb_ascend.png");
ICON_DESCEND =
- ResourceManager.getImageIcon("resources/image/tb_descend.png");
+ ResourceManager.getButtonIcon("resources/image/tb_descend.png");
}
private final JButton orderButton = new JButton();
this.orderButton.setActionCommand(ActionManager.CMD_SWITCHORDER);
this.orderButton.addActionListener(this);
- ImageIcon icon =
- ResourceManager.getImageIcon("resources/image/tb_reload.png");
+ Icon icon = ResourceManager
+ .getButtonIcon("resources/image/tb_reload.png");
this.reloadButton.setIcon(icon);
this.reloadButton.setToolTipText(TIP_ORDER);
this.reloadButton.setMargin(new Insets(1, 1, 1, 1));
package jp.sfjp.jindolf.view;
import java.awt.Component;
-import javax.swing.ImageIcon;
+import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import jp.sfjp.jindolf.ResourceManager;
@SuppressWarnings("serial")
public class VillageIconRenderer extends DefaultTreeCellRenderer{
- private static final ImageIcon ICON_PROLOGUE;
- private static final ImageIcon ICON_PROGRESS;
- private static final ImageIcon ICON_EPILOGUE;
- private static final ImageIcon ICON_GAMEOVER;
- private static final ImageIcon ICON_INVALID;
+ private static final Icon ICON_PROLOGUE;
+ private static final Icon ICON_PROGRESS;
+ private static final Icon ICON_EPILOGUE;
+ private static final Icon ICON_GAMEOVER;
+ private static final Icon ICON_INVALID;
+
+ private static final int MARK_SZ = 16;
static{
- ICON_PROLOGUE =
- ResourceManager.getImageIcon("resources/image/vs_prologue.png");
- ICON_PROGRESS =
- ResourceManager.getImageIcon("resources/image/vs_progress.png");
- ICON_EPILOGUE =
- ResourceManager.getImageIcon("resources/image/vs_epilogue.png");
- ICON_GAMEOVER =
- ResourceManager.getImageIcon("resources/image/vs_gameover.png");
- ICON_INVALID =
- ResourceManager.getImageIcon("resources/image/vs_cross.png");
+ ICON_PROLOGUE = ResourceManager
+ .getSquareIcon("resources/image/vs_prologue.png", MARK_SZ);
+ ICON_PROGRESS = ResourceManager
+ .getSquareIcon("resources/image/vs_progress.png", MARK_SZ);
+ ICON_EPILOGUE = ResourceManager
+ .getSquareIcon("resources/image/vs_epilogue.png", MARK_SZ);
+ ICON_GAMEOVER = ResourceManager
+ .getSquareIcon("resources/image/vs_gameover.png", MARK_SZ);
+ ICON_INVALID = ResourceManager
+ .getSquareIcon("resources/image/vs_cross.png", MARK_SZ);
}
/**
boolean hasFocus ){
if(leaf && value instanceof Village){
Village village = (Village) value;
- ImageIcon icon = null;
+ Icon icon = null;
switch(village.getState()){
case PROLOGUE: icon = ICON_PROLOGUE; break;
case PROGRESS: icon = ICON_PROGRESS; break;
-?
このヘルプ表示を出力して即時終了する。
--nosplash
- スプラッシュ画面を表示しない。
- ※JRE1.5以前のJava実行系のみ有効
-
-version
バージョン情報を出力して即時終了する。
<html lang="ja-JP">
<head>
- <meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jindolf ヘルプ</title>
<link rel="stylesheet" type="text/css" href="./help.css">
J i n d o l f ヘ ル プ
</div>
<div class="centering">
- <img src="../image/logo.png">
+ <img src="../image/logo.png" alt="logo">
</div>
<div>
<h1>Jindolfとは</h1>
<p>
人狼BBSっていうのは、
- インターネットを介してWebブラウザで遊ぶ、
- 今最高にナウくてCoolなCGIゲームなんだ。
+ 昔から「人狼」の名で知られているパーティーゲームが
+ Webブラウザで遊べるようになったWebサイトなんだ。
</p>
<p>
Jindolfは、
専用のプログラムだよ。
</p>
<p>
- 今、巷で大ブームのリッチクライアントってやつだね!
- これならママも安心さ!
+ Jindolf開発から10年経って、
+ 先行きが不透明になってきたJavaクライアントアプリ界隈だけど、
+ もう少しの間、頑張るよ!
</p>
</div>
<div>
<html lang="ja-JP">
<head>
- <meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jindolf キーアサイン</title>
<link rel="stylesheet" type="text/css" href="./help.css">
<html lang="ja-JP">
<head>
- <meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jindolf ライセンス表記</title>
<link rel="stylesheet" type="text/css" href="./help.css">
<html lang="ja-JP">
<head>
- <meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jindolf 起動オプション一覧</title>
<link rel="stylesheet" type="text/css" href="./help.css">
<dt>--help</dt>
<dt>-?</dt>
<dd>ヘルプ表示を出力して即時終了する。</dd>
- <dt>-nosplash</dt>
- <dd>スプラッシュ画面を表示しない。<br>
- ※JRE1.5以前のJava実行系のみ有効</dd>
<dt>-version</dt>
<dd>バージョン情報を出力して即時終了する。</dd>
<dt>-vminfo</dt>
CmdOption[] values = CmdOption.values();
- assertEquals(12, values.length);
+ assertEquals(11, values.length);
List<CmdOption> list = Arrays.asList(values);
testList.add(CmdOption.OPT_HELP);
testList.add(CmdOption.OPT_VERSION);
testList.add(CmdOption.OPT_BOLDMETAL);
- testList.add(CmdOption.OPT_NOSPLASH);
testList.add(CmdOption.OPT_GEOMETRY);
testList.add(CmdOption.OPT_VMINFO);
testList.add(CmdOption.OPT_CONSOLELOG);
assertTrue(CmdOption.OPT_VERSION.matches("-version"));
assertTrue(CmdOption.OPT_BOLDMETAL.matches("-boldMetal"));
- assertTrue(CmdOption.OPT_NOSPLASH.matches("-nosplash"));
assertTrue(CmdOption.OPT_GEOMETRY.matches("-geometry"));
assertTrue(CmdOption.OPT_VMINFO.matches("-vminfo"));
assertTrue(CmdOption.OPT_CONSOLELOG.matches("-consolelog"));
case OPT_VERSION:
case OPT_VMINFO:
case OPT_BOLDMETAL:
- case OPT_NOSPLASH:
case OPT_CONSOLELOG:
case OPT_NOCONF:
assertTrue(opt.isIndepOption());
assertEquals("-help", CmdOption.OPT_HELP.toString());
assertEquals("-version", CmdOption.OPT_VERSION.toString());
assertEquals("-boldMetal", CmdOption.OPT_BOLDMETAL.toString());
- assertEquals("-nosplash", CmdOption.OPT_NOSPLASH.toString());
assertEquals("-geometry", CmdOption.OPT_GEOMETRY.toString());
assertEquals("-vminfo", CmdOption.OPT_VMINFO.toString());
assertEquals("-consolelog", CmdOption.OPT_CONSOLELOG.toString());