package asandatabasebrowser;

import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.Icon;
import javax.swing.ImageIcon;


/**
 * グローバル変数. 
 */
public class Global {
    public static Icon rootIcon = null;
    public static Icon favoriteIcon = null;
    public static Icon databaseIcon = null;
    public static Icon databaseOffIcon = null;
    public static Icon schemaIcon = null;
    public static Icon tableIcon = null;
    public static Icon viewIcon = null;
    public static Icon systemTableIcon = null;
    public static Icon globalTemporaryIcon = null;
    public static Icon localTemporaryIcon = null;
    public static Icon aliasIcon = null;
    public static Icon synonymIcon = null;
    public static Icon unknownIcon = null;
    public static Icon arrowUpIcon = null;
    public static Icon arrowDownIcon = null;
    public static Icon deleteIcon = null;
    public static Icon groupIcon = null;
    public static Icon favTableIcon = null;
    public static Icon favSqlIcon = null;
    public static Icon recordInsertIcon = null;
    public static Icon recordInsertSelectIcon = null;
    public static Icon recordUpdateIcon = null;
    public static Icon recordDeleteIcon = null;
    public static Icon undoIcon = null;
    public static Icon redoIcon = null;
    public static Icon logIcon = null;
    
    public static ImageIcon asanDatabaseBrowserImage = null;
    static {
        rootIcon = Global.getImageIcon("/resources/Earth.png");
        favoriteIcon = Global.getImageIcon("/resources/Favorite.png");
        databaseIcon = Global.getImageIcon("/resources/database.png");
        databaseOffIcon = Global.getImageIcon("/resources/database_disc.png");
        schemaIcon = Global.getImageIcon("/resources/schema.png");
        tableIcon = Global.getImageIcon("/resources/table.png");
        viewIcon = Global.getImageIcon("/resources/view.png");
        systemTableIcon = Global.getImageIcon("/resources/table.png");
        globalTemporaryIcon = Global.getImageIcon("/resources/temporary.png");
        localTemporaryIcon = Global.getImageIcon("/resources/temporary.png");
        aliasIcon = Global.getImageIcon("/resources/alias.png");
        synonymIcon = Global.getImageIcon("/resources/synonym.png");
        unknownIcon = Global.getImageIcon("/resources/unknown.png");
        arrowUpIcon = Global.getImageIcon("/resources/YellowArrowUp.png");
        arrowDownIcon = Global.getImageIcon("/resources/YellowArrowDown.png");
        deleteIcon = Global.getImageIcon("/resources/EditDelete.png");
        groupIcon = Global.getImageIcon("/resources/eclipse_open.png");
        favTableIcon = Global.getImageIcon("/resources/FavoriteTable.png");
        favSqlIcon = Global.getImageIcon("/resources/FavoriteSQL.png");
        recordInsertIcon = Global.getImageIcon("/resources/RecordInsert.png");
        recordInsertSelectIcon = Global.getImageIcon("/resources/RecordInsert.png");
        recordUpdateIcon = Global.getImageIcon("/resources/RecordUpdate.png");
        recordDeleteIcon = Global.getImageIcon("/resources/RecordDelete.png");
        undoIcon = Global.getImageIcon("/resources/EditUndo.png");
        redoIcon = Global.getImageIcon("/resources/EditRedo.png");
        logIcon = Global.getImageIcon("/resources/Log.png");
//        asanDatabaseBrowserImage = Global.getImageIcon("/resources/AsanDatabaseBrowser.png");
    }

	
	/**
	 * リソースからイメージを取得する.
	 * @param name	"/resources/xxx.png"など
	 * @return
	 */
	public static Image getImage(String name) {
        java.net.URL url = Global.class.getResource(name);
        assert url != null: name;
        Image image = Toolkit.getDefaultToolkit().createImage(url);
        assert image != null: name;
        return image;
	}
	/**
	 * リソースからアイコンを取得する.
	 * @param name	"/resources/xxx.png"など
	 * @return
	 */
	public static ImageIcon getImageIcon(String name) {
        java.net.URL url = Global.class.getResource(name);
        assert url != null: name;
        return new ImageIcon(url);
	}
	
}
