📄 upgraderomizedproperties.java
字号:
/** * Constructor * * @param allProps All properties used by Chameleon * @param romizedProps Properties from RomizedProperties.java * being converted */ Converter(SkinProperty[] allProps, Hashtable romizedProps) { this.allProps = new Hashtable(); for (int i = 0; i < allProps.length; ++i) { SkinProperty p = allProps[i]; this.allProps.put(p.name, p); } this.allPropsArray = allProps; this.romizedProps = romizedProps; this.missingProps = new Vector(); this.unknownProps = new Vector(); } /** * Do the conversion. Mostly its about assigning values from * RomizedProperties.java to the corresponding properties in * "all Chameleon properties" table, but also there is some * real conversion as well. */ void convert() { checkForUnknownProps(); assignPropsValues(); Enumeration keys = allProps.keys(); while (keys.hasMoreElements()) { String key = (String)keys.nextElement(); SkinProperty p = (SkinProperty)allProps.get(key); if (p.isNew) { convertPropsSequenceToString(p); } } assignPiecesCounts(); } /** * Check if romized properties being convertedhave some properties * that aren't used by Chameleon (most likely it means that those * properties come from some modified version of Chameleon). */ void checkForUnknownProps() { Enumeration keys = romizedProps.keys(); while (keys.hasMoreElements()) { String key = (String)keys.nextElement(); SkinProperty p = (SkinProperty)allProps.get(key); if (p == null) { String propValue = (String)romizedProps.get(key); p = new SkinProperty(key, propValue, null, SkinProperty.STRING_T); } } } /** * Assign values from romized properties being converted to the * corresponding properties in "all Chameleon properties" * table. If some property used by Chameleon isn't present in romized * properties, then this property will keep its default value. */ void assignPropsValues() { Enumeration keys = allProps.keys(); while (keys.hasMoreElements()) { String key = (String)keys.nextElement(); SkinProperty p = (SkinProperty)allProps.get(key); String propValue = (String)romizedProps.get(key); if (propValue != null) { p.value = propValue; } else { if (!p.isNew) { missingProps.add(p); } } } } /** * Convert sequence of integer valued properties from * romized properties being converted, like * softbtn.button_align_x0, softbtn.button_align_x1, * softbtn.button_align_x2 and so on (thats the sequence * with softbtn.button_align_x being a prefix), into a * single property with string value, where string holds * all integer values from the sequence separated by * comma. * * @param newProp Property that will get new string value. * The name of this property is used as a prefix for the * sequence being converted. */ void convertPropsSequenceToString(SkinProperty newProp) { String newPropValue = null; String seqPropNamePrefix = newProp.name; int index = 0; String seqPropName = seqPropNamePrefix + index; String seqPropValue = (String)romizedProps.get(seqPropName); while (seqPropValue != null) { if (newPropValue == null) { newPropValue = seqPropValue; } else { newPropValue += "," + seqPropValue; } index += 1; seqPropName = seqPropNamePrefix + index; seqPropValue = (String)romizedProps.get(seqPropName); } newProp.value = newPropValue; } /** * For properties that corresponds to composite images, * assign images pieces counts. */ void assignPiecesCounts() { SkinProperty p; p = (SkinProperty)allProps.get("alert.image_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("busycrsr.image_frame"); if (p != null) { SkinProperty parts = (SkinProperty)allProps.get("busycrsr.num_frames"); if (parts != null) { p.totalPieces = Integer.parseInt(parts.value); } } p = (SkinProperty)allProps.get("choice.image_radio"); if (p != null) { p.totalPieces = 2; } p = (SkinProperty)allProps.get("choice.image_chkbx"); if (p != null) { p.totalPieces = 2; } p = (SkinProperty)allProps.get("choice.image_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("choice.image_btn_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("choice.image_popup_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("dateeditor.image_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("dateeditor.image_radio"); if (p != null) { p.totalPieces = 2; } p = (SkinProperty)allProps.get("datefield.image_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("datefield.image_btn_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("imageitem.image_button"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("menu.image_bg"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("menu.image_item_sel_bg"); if (p != null) { p.totalPieces = 3; } p = (SkinProperty)allProps.get("screen.image_bg_w_title"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("screen.image_bg_wo_title"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("screen.image_hs_bg_w_title"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("screen.image_hs_bg_wo_title"); if (p != null) { p.totalPieces = 9; } p = (SkinProperty)allProps.get("scroll.image_bg"); if (p != null) { p.totalPieces = 3; } p = (SkinProperty)allProps.get("scroll.image_fg"); if (p != null) { p.totalPieces = 3; } p = (SkinProperty)allProps.get("scroll.image_au_bg"); if (p != null) { p.totalPieces = 3; } p = (SkinProperty)allProps.get("scroll.image_au_fg"); if (p != null) { p.totalPieces = 3; } p = (SkinProperty)allProps.get("softbtn.image_bg"); if (p != null) { p.totalPieces = 3; } p = (SkinProperty)allProps.get("softbtn.image_mu_bg"); if (p != null) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -