📄 upgraderomizedproperties.java
字号:
/* * * * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. *//** * This tool converts RomizedProperties.java from the old format, * used in JTWI-HI 1.1.2 release, where properties values are indexed * via properties names (strings) and therefore stored in hashtable * internally by Chameleon, to the new format, where properties values * are indexed by integer constants and stored in arrays. * * Apart from changing the way properties are stored and accessed, this * tool also does following conversions: * * - Assigns default values to the properties which are used by Chameleon, * but aren't present in RomizedProperties.java being converted. Old * format assumes that if property isn't present in RomizedProperties.java, * then its value is property's name for a string valued property and -1 * for integer valued property. Therefore, old format allows omitting * some properties from RomizedProperties.java. New format forbids that. * All the properties used by Chameleon must be explicitly given values * in RomizedProperties.java. * - Converts sequence of integer valued properties used by soft button skin * element into a new string valued property, where this new property's * value consists of values from the sequence separated by comma. * One example of such sequence is softbtn.button_align_x0, * softbtn.button_align_x1, softbtn.button_align_x2 and so on properties. * * Usage: * javac UpgradeRomizedProperties.java * java -cp . UpgradeRomizedProperties <infile> <outfile> * * Where, * <infile> is path to RomizedProperties.java to convert, * <outfile> is name of converted RomizedProperties.java * */import java.lang.*;import java.lang.reflect.*;import java.util.*;import java.io.*;/** * Represents skin property */class SkinProperty { /** * Properties types */ /** Integer property */ public static final int INT_T = 0; /** String property */ public static final int STRING_T = 1; /** Font property */ public static final int FONT_T = 2; /** Image property */ public static final int IMAGE_T = 3; /** Composite image property */ public static final int C_IMAGE_T = 4; /** Integers sequence property */ public static final int INT_SEQ_T = 5; /** Total numbers of types */ public static final int TOTAL_T = 6; /** Property's name as used in RomizedProperties.java */ String name; /** Property's value */ String value; /** * Name of the integer constant that is used for getting property * value in new format instead of property's name used in old format */ String id; /** * true, if this property is newly introduced, i.e. isn't used by * RomizedProperties.java. New properties get its values as the * result of conversion of some other properties. */ boolean isNew; /** Property type */ int type; /** Number of pieces in composite image */ int totalPieces; /** * Constructor */ SkinProperty(String name, String defaultValue, String id, int type) { this.name = name; this.value = defaultValue; this.id = id; this.isNew = false; this.type = type; this.totalPieces = 1; } /** * Constructor */ SkinProperty(String name, String defaultValue, String id, int type, boolean isNew) { this.name = name; this.value = defaultValue; this.id = id; this.isNew = isNew; this.type = type; this.totalPieces = 1; } /** * All the properties used by Chameleon */ static SkinProperty[] properties = { new SkinProperty("screen.text_orient", "-1", "SCREEN_TEXT_ORIENT", INT_T), new SkinProperty("screen.pad_form_items", "-1", "SCREEN_PAD_FORM_ITEMS", INT_T), new SkinProperty("screen.pad_label_vert", "-1", "SCREEN_PAD_LABEL_VERT", INT_T), new SkinProperty("screen.pad_label_horiz", "-1", "SCREEN_PAD_LABEL_HORIZ", INT_T), new SkinProperty("screen.color_bg", "-1", "SCREEN_COLOR_BG", INT_T), new SkinProperty("screen.color_hs_bg", "-1", "SCREEN_COLOR_HS_BG", INT_T), new SkinProperty("screen.color_fg", "-1", "SCREEN_COLOR_FG", INT_T), new SkinProperty("screen.color_bg_hl", "-1", "SCREEN_COLOR_BG_HL", INT_T), new SkinProperty("screen.color_fg_hl", "-1", "SCREEN_COLOR_FG_HL", INT_T), new SkinProperty("screen.color_border", "-1", "SCREEN_COLOR_BORDER", INT_T), new SkinProperty("screen.color_border_hl", "-1", "SCREEN_COLOR_BORDER_HL", INT_T), new SkinProperty("screen.color_traverse_ind", "-1", "SCREEN_COLOR_TRAVERSE_IND", INT_T), new SkinProperty("screen.border_style", "-1", "SCREEN_BORDER_STYLE", INT_T), new SkinProperty("screen.scroll_amount", "-1", "SCREEN_SCROLL_AMOUNT", INT_T), new SkinProperty("screen.font_label", "500", "SCREEN_FONT_LABEL", FONT_T), new SkinProperty("screen.font_input_text", "500", "SCREEN_FONT_INPUT_TEXT", FONT_T), new SkinProperty("screen.font_static_text", "500", "SCREEN_FONT_STATIC_TEXT", FONT_T), new SkinProperty("screen.image_wash", "screen.image_wash", "SCREEN_IMAGE_WASH", IMAGE_T), new SkinProperty("screen.image_bg", "screen.image_bg", "SCREEN_IMAGE_BG", IMAGE_T), new SkinProperty("screen.image_bg_w_title", "screen.image_bg_w_title", "SCREEN_IMAGE_BG_W_TITLE", C_IMAGE_T), new SkinProperty("screen.image_bg_wo_title", "screen.image_bg_wo_title", "SCREEN_IMAGE_BG_WO_TITLE", C_IMAGE_T), new SkinProperty("screen.image_hs_bg_tile", "screen.image_hs_bg_tile", "SCREEN_IMAGE_HS_BG_TILE", IMAGE_T), new SkinProperty("screen.image_hs_bg_w_title", "screen.image_hs_bg_w_title", "SCREEN_IMAGE_HS_BG_W_TITLE", C_IMAGE_T), new SkinProperty("screen.image_hs_bg_wo_title", "screen.image_hs_bg_wo_title", "SCREEN_IMAGE_HS_BG_WO_TITLE", C_IMAGE_T), new SkinProperty("scroll.mode", "-1", "SCROLL_MODE", INT_T), new SkinProperty("scroll.width", "-1", "SCROLL_WIDTH", INT_T), new SkinProperty("scroll.color_bg", "-1", "SCROLL_COLOR_BG", INT_T), new SkinProperty("scroll.color_fg", "-1", "SCROLL_COLOR_FG", INT_T), new SkinProperty("scroll.color_frame", "-1", "SCROLL_COLOR_FRAME", INT_T), new SkinProperty("scroll.color_up_arrow", "-1", "SCROLL_COLOR_UP_ARROW", INT_T), new SkinProperty("scroll.color_dn_arrrow", "-1", "SCROLL_COLOR_DN_ARROW", INT_T), new SkinProperty("scroll.image_bg", "scroll.image_bg", "SCROLL_IMAGE_BG", C_IMAGE_T), new SkinProperty("scroll.image_fg", "scroll.image_fg", "SCROLL_IMAGE_FG", C_IMAGE_T), new SkinProperty("scroll.image_up", "scroll.image_up", "SCROLL_IMAGE_UP", IMAGE_T), new SkinProperty("scroll.image_dn", "scroll.image_dn", "SCROLL_IMAGE_DN", IMAGE_T), new SkinProperty("scroll.color_au_bg", "-1", "SCROLL_COLOR_AU_BG", INT_T), new SkinProperty("scroll.color_au_fg", "-1", "SCROLL_COLOR_AU_FG", INT_T), new SkinProperty("scroll.image_au_bg", "scroll.image_au_bg", "SCROLL_IMAGE_AU_BG", C_IMAGE_T), new SkinProperty("scroll.image_au_fg", "scroll.image_au_fg", "SCROLL_IMAGE_AU_FG", C_IMAGE_T), new SkinProperty("scroll.image_au_up", "scroll.image_au_up", "SCROLL_IMAGE_AU_UP", IMAGE_T), new SkinProperty("scroll.image_au_dn", "scroll.image_au_dn", "SCROLL_IMAGE_AU_DN", IMAGE_T), new SkinProperty("softbtn.height", "-1", "SOFTBTN_HEIGHT", INT_T), new SkinProperty("softbtn.num_buttons", "-1", "SOFTBTN_NUM_BUTTONS", INT_T), new SkinProperty("softbtn.button_shd_align", "-1", "SOFTBTN_BUTTON_SHD_ALIGN", INT_T), new SkinProperty("softbtn.color_fg", "-1", "SOFTBTN_COLOR_FG", INT_T), new SkinProperty("softbtn.color_fg_shd", "-1", "SOFTBTN_COLOR_FG_SHD", INT_T), new SkinProperty("softbtn.color_bg", "-1", "SOFTBTN_COLOR_BG", INT_T), new SkinProperty("softbtn.color_mu_fg", "-1", "SOFTBTN_COLOR_MU_FG", INT_T), new SkinProperty("softbtn.color_mu_fg_shd", "-1", "SOFTBTN_COLOR_MU_FG_SHD", INT_T), new SkinProperty("softbtn.color_mu_bg", "-1", "SOFTBTN_COLOR_MU_BG", INT_T), new SkinProperty("softbtn.color_au_fg", "-1", "SOFTBTN_COLOR_AU_FG", INT_T), new SkinProperty("softbtn.color_au_fg_shd", "-1", "SOFTBTN_COLOR_AU_FG_SHD", INT_T), new SkinProperty("softbtn.color_au_bg", "-1", "SOFTBTN_COLOR_AU_BG", INT_T), new SkinProperty("softbtn.font", "500", "SOFTBTN_FONT", FONT_T), new SkinProperty("softbtn.text_menucmd", "softbtn.text_menucmd", "SOFTBTN_TEXT_MENUCMD", STRING_T), new SkinProperty("softbtn.text_backcmd", "softbtn.text_backcmd", "SOFTBTN_TEXT_BACKCMD", STRING_T), new SkinProperty("softbtn.image_bg", "softbtn.image_bg", "SOFTBTN_IMAGE_BG", C_IMAGE_T), new SkinProperty("softbtn.image_mu_bg", "softbtn.image_mu_bg", "SOFTBTN_IMAGE_MU_BG", C_IMAGE_T), new SkinProperty("softbtn.image_au_bg", "softbtn.image_au_bg", "SOFTBTN_IMAGE_AU_BG", C_IMAGE_T), new SkinProperty("ticker.height", "-1", "TICKER_HEIGHT", INT_T), new SkinProperty("ticker.align", "-1", "TICKER_ALIGN", INT_T), new SkinProperty("ticker.direction", "-1", "TICKER_DIRECTION", INT_T), new SkinProperty("ticker.rate", "-1", "TICKER_RATE", INT_T), new SkinProperty("ticker.speed", "-1", "TICKER_SPEED", INT_T), new SkinProperty("ticker.text_anchor_y", "-1", "TICKER_TEXT_ANCHOR_Y", INT_T), new SkinProperty("ticker.text_shd_align", "-1", "TICKER_TEXT_SHD_ALIGN", INT_T), new SkinProperty("ticker.color_bg", "-1", "TICKER_COLOR_BG", INT_T), new SkinProperty("ticker.color_fg", "-1", "TICKER_COLOR_FG", INT_T), new SkinProperty("ticker.color_fg_shd", "-1", "TICKER_COLOR_FG_SHD", INT_T), new SkinProperty("ticker.font", "500", "TICKER_FONT", FONT_T), new SkinProperty("ticker.image_bg", "ticker.image_bg", "TICKER_IMAGE_BG", C_IMAGE_T), new SkinProperty("ticker.image_au_bg", "ticker.image_au_bg", "TICKER_IMAGE_AU_BG", C_IMAGE_T), new SkinProperty("pti.height", "-1", "PTI_HEIGHT", INT_T), new SkinProperty("pti.margin", "-1", "PTI_MARGIN", INT_T), new SkinProperty("pti.color_bg", "-1", "PTI_COLOR_BG", INT_T), new SkinProperty("pti.color_fg", "-1", "PTI_COLOR_FG", INT_T), new SkinProperty("pti.color_bg_hl", "-1", "PTI_COLOR_BG_HL", INT_T), new SkinProperty("pti.color_fg_hl", "-1", "PTI_COLOR_FG_HL", INT_T), new SkinProperty("pti.color_bdr", "-1", "PTI_COLOR_BDR", INT_T), new SkinProperty("pti.font", "500", "PTI_FONT", FONT_T), new SkinProperty("pti.image_bg", "pti.image_bg", "PTI_IMAGE_BG", C_IMAGE_T), new SkinProperty("pti.left_arrow", "pti.left_arrow", "PTI_LEFT_ARROW", IMAGE_T), new SkinProperty("pti.right_arrow", "pti.right_arrow", "PTI_RIGHT_ARROW", IMAGE_T), new SkinProperty("inputmode.margin", "-1", "INPUT_MODE_MARGIN", INT_T), new SkinProperty("inputmode.color_bg", "-1", "INPUT_MODE_COLOR_BG", INT_T), new SkinProperty("inputmode.color_fg", "-1", "INPUT_MODE_COLOR_FG", INT_T), new SkinProperty("inputmode.color_bdr", "-1", "INPUT_MODE_COLOR_BDR", INT_T), new SkinProperty("inputmode.font", "500", "INPUT_MODE_FONT", FONT_T), new SkinProperty("inputmode.image_bg", "inputmode.image_bg", "INPUT_MODE_IMAGE_BG", C_IMAGE_T), new SkinProperty("title.height", "-1", "TITLE_HEIGHT", INT_T), new SkinProperty("title.margin", "-1", "TITLE_MARGIN", INT_T), new SkinProperty("title.text_align_x", "-1", "TITLE_TEXT_ALIGN_X", INT_T),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -