亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? resourcemanager.java

?? 精美開源Swing組件
?? JAVA
字號:
/**
 * L2FProd.com Common Components 7.3 License.
 *
 * Copyright 2005-2007 L2FProd.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.l2fprod.common.util;

import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

/**
 * Manages application resources. <br>
 */
public class ResourceManager {

  static Map nameToRM = new HashMap();

  private ResourceBundle bundle;

  /**
   * Gets the ResourceManager associated with <code>clazz</code>.
   * It looks for a ResourceBundle named against the class name plus
   * the string "RB". For example, for the com.mypackage.Main, the
   * ResourceBundle com.mypackage.MainRB will be looked up.
   * 
   * @param clazz
   * @return the ResourceManager associated with the class
   */
  public static ResourceManager get(Class clazz) {
    String bundleName = clazz.getName() + "RB";
    return get(bundleName);
  }

  /**
   * Gets the ResourceManager with the given name.
   * 
   * @param bundleName
   * @return the ResourceManager with the given name.
   */
  public static ResourceManager get(String bundleName) {
    ResourceManager rm = (ResourceManager)nameToRM.get(bundleName);
    if (rm == null) {
      ResourceBundle rb = ResourceBundle.getBundle(bundleName);
      rm = new ResourceManager(rb);
      nameToRM.put(bundleName, rm);
    }
    return rm;
  }

  /**
   * @param clazz
   * @return the "AllRB" in the class package
   */
  public static ResourceManager all(Class clazz) {
    return get(getPackage(clazz) + ".AllRB");
  }

  /**
   * Gets the default ResourceManager. This is equivalent to
   * <code>all(ResourceManager.class)</code>. It returns the
   * ResourceManager named "AllRB" located in the same package
   * ResourceManager class (i.e com.l2fprod.common.util.AllRB).
   * 
   * @return the default ResourceManager
   */
  public static ResourceManager common() {
    return all(ResourceManager.class);
  }

  /**
   * @return the default ResourceManager for ui specific resources.
   */
  public static ResourceManager ui() {
    return get("com.l2fprod.common.swing.AllRB");
  }
  
  /**
   * Resolves any references to a resource bundle contained in
   * <code>rbAndProperty</code>. To reference a resource bundle
   * inside a property use <code>${com.package.FileRB:key}</code>,
   * this will look for <code>key</code> in the ResourceBundle
   * <code>com.package.FileRB</code>.
   * 
   * @param rbAndProperty
   * @return the resolved resource or rbAndProperty if no resource was
   *         found
   */
  public static String resolve(String rbAndProperty) {
    return common().resolve0(rbAndProperty);
  }

  /**
   * Same as {@link #resolve(String)} but once the value as been
   * resolved, a MessageFormatter is applied with the given
   * <code>args</code>.
   * 
   * @param rbAndProperty
   * @param args
   * @return the value for the resource parametrized by args
   */
  public static String resolve(String rbAndProperty, Object[] args) {
    String value = common().resolve0(rbAndProperty);
    return MessageFormat.format(value, args);
  }

  /**
   * Can't be directly constructed
   * 
   * @param bundle
   */
  private ResourceManager(ResourceBundle bundle) {
    this.bundle = bundle;
  }

  /**
   * Gets the String associated with <code>key</code> after having
   * resolved any nested keys ({@link #resolve(String)}).
   * 
   * @param key the key to lookup
   * @return the String associated with <code>key</code>
   */
  public String getString(String key) {
    return resolve0(String.valueOf(bundle.getObject(key)));
  }

  /**
   * Gets the String associated with <code>key</code> after having
   * resolved any nested keys ({@link #resolve(String)}) and applied
   * a formatter using the given <code>args</code>.
   * 
   * @param key the key to lookup
   * @param args the arguments to pass to the formatter
   * @return the String associated with <code>key</code>
   */
  public String getString(String key, Object[] args) {
    String value = getString(key);
    return MessageFormat.format(value, args);
  }

  /**
   * Gets the first character of the String associated with
   * <code>key</code>.
   * 
   * @param key the key to lookup
   * @return the first character of the String associated with
   *         <code>key</code>.
   */
  public char getChar(String key) {
    String s = getString(key);
    if (s == null || s.trim().length() == 0) {
      return (char)0;
    } else {
      return s.charAt(0);
    }
  }

  private String resolve0(String property) {
    String result = property;
    if (property != null) {
      int index = property.indexOf("${");
      if (index != -1) {
        int endIndex = property.indexOf("}", index);
        String sub = property.substring(index + 2, endIndex);
        // check if sub contains a reference to another RB, key
        int colon = sub.indexOf(":");
        if (colon != -1) {
          String rbName = sub.substring(0, colon);
          String keyName = sub.substring(colon + 1);
          sub = get(rbName).getString(keyName);
        } else {
          // it's a regular nested property
          sub = getString(sub);
        }
        result = property.substring(0, index) + sub
            + resolve0(property.substring(endIndex + 1));
      }
    }
    return result;
  }

  private static String getPackage(Class clazz) {
    String pck = clazz.getName();
    int index = pck.lastIndexOf('.');
    if (index != -1) {
      pck = pck.substring(0, index);
    } else {
      pck = "";
    }
    return pck;
  }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本精品一级二级| 99热精品国产| 亚洲va韩国va欧美va精品| 国产精品嫩草影院com| 久久色在线视频| 日韩欧美国产午夜精品| 日韩欧美在线1卡| 欧美成人精品3d动漫h| 久久亚洲私人国产精品va媚药| 日韩欧美亚洲另类制服综合在线| 成人av电影免费在线播放| 99久久国产综合精品色伊| jlzzjlzz欧美大全| 欧美性生活大片视频| 91精品国产丝袜白色高跟鞋| 日韩久久精品一区| 亚洲国产精品黑人久久久| 一区免费观看视频| 亚洲一区二区三区中文字幕在线 | 日本免费在线视频不卡一不卡二| 午夜免费欧美电影| 久久国产综合精品| 大美女一区二区三区| 在线一区二区三区四区五区| 在线电影欧美成精品| 国产日韩欧美一区二区三区综合| 国产精品久线观看视频| 亚洲一区二区四区蜜桃| 久久精品国产精品青草| 成人福利电影精品一区二区在线观看 | 亚洲图片欧美色图| 黄一区二区三区| 99精品1区2区| 精品国产一区二区三区忘忧草| 国产精品乱码妇女bbbb| 午夜av电影一区| 国产成人av资源| 在线不卡a资源高清| 国产亚洲制服色| 视频一区中文字幕| 成年人国产精品| 精品国产污网站| 一二三区精品视频| 国产成人在线观看| 欧美美女一区二区三区| 国产性色一区二区| 美女视频黄频大全不卡视频在线播放| 成人久久久精品乱码一区二区三区| 在线观看日韩一区| 国产欧美一二三区| 另类小说色综合网站| 亚洲最大的成人av| 91.com视频| 国产不卡一区视频| 亚洲精品国产无套在线观| 777午夜精品免费视频| 91国在线观看| 国产精品女主播av| 国产一区二区三区四区五区美女 | 国产又黄又大久久| 欧美美女直播网站| 亚洲在线观看免费视频| 色综合久久久久久久久久久| 国产拍欧美日韩视频二区| 老司机精品视频一区二区三区| 欧美日韩精品一区二区| 亚洲伊人伊色伊影伊综合网| 成人av免费在线| 欧美在线影院一区二区| 亚洲精品日韩一| 精品电影一区二区| 色婷婷综合久久久中文一区二区| 日韩情涩欧美日韩视频| 亚洲欧美一区二区三区国产精品 | 国产精品网站在线播放| 精品一区二区三区在线观看| 欧美一区三区四区| 日韩专区一卡二卡| 欧美一区二区福利视频| 毛片不卡一区二区| 日韩三级av在线播放| 韩国欧美一区二区| 国产日韩精品视频一区| 国产成人精品免费视频网站| 国产亲近乱来精品视频| 不卡视频在线看| 亚洲一区电影777| 欧美日韩和欧美的一区二区| 日韩不卡一二三区| 26uuu国产一区二区三区| 国产成人在线观看免费网站| 中文字幕一区二区三区不卡在线| 在线视频观看一区| 日日欢夜夜爽一区| 久久久久国产一区二区三区四区 | 国产美女一区二区三区| 国产精品每日更新| 欧美午夜影院一区| 久草这里只有精品视频| 欧美高清在线一区| 精品视频123区在线观看| 丝袜美腿一区二区三区| 久久亚洲精精品中文字幕早川悠里 | 欧美高清视频在线高清观看mv色露露十八| 亚洲成人久久影院| www欧美成人18+| eeuss鲁片一区二区三区在线看| 日韩精彩视频在线观看| 亚洲黄色av一区| 亚洲黄色片在线观看| 亚洲欧美日韩在线不卡| 欧美日韩在线播放三区| 夜色激情一区二区| 国产亚洲一区二区在线观看| 在线看一区二区| 国产91精品在线观看| 日韩av网站在线观看| 亚洲欧美在线视频观看| 日韩视频一区二区在线观看| 99视频在线观看一区三区| 日本美女一区二区三区视频| 国产精品高潮久久久久无| 欧美男男青年gay1069videost| 成人黄色在线网站| 精品在线你懂的| 亚洲午夜久久久久久久久电影院 | 国产综合色产在线精品| 一区二区三区在线高清| 亚洲国产成人一区二区三区| 91精品国产免费久久综合| 91蜜桃传媒精品久久久一区二区 | 久久精品免视看| 日韩欧美亚洲国产另类| 欧美日韩国产一二三| 91亚洲永久精品| 高清在线观看日韩| 国内精品久久久久影院薰衣草 | 99精品视频在线免费观看| 国产一区二区在线看| 日本少妇一区二区| 日日夜夜免费精品视频| 一区二区三区精品在线观看| 欧美国产精品一区| 久久综合九色综合欧美就去吻| 91 com成人网| 日韩一区二区电影| 91精品国产黑色紧身裤美女| 欧美日韩一区二区在线观看视频| 9i在线看片成人免费| 福利一区福利二区| 成人深夜在线观看| 国产日韩在线不卡| 国产高清成人在线| 在线观看91精品国产入口| 精品剧情v国产在线观看在线| 日一区二区三区| 久久精品av麻豆的观看方式| 理论电影国产精品| 国内精品免费**视频| 国产很黄免费观看久久| 国产成+人+日韩+欧美+亚洲| 成人av在线资源网| 一本色道久久综合狠狠躁的推荐 | 精品视频在线免费看| 欧美三级资源在线| 日韩亚洲欧美综合| 亚洲精品一线二线三线| 欧美激情综合网| 一区二区三区蜜桃| 免费观看成人鲁鲁鲁鲁鲁视频| 青青草97国产精品免费观看无弹窗版| 蜜桃av一区二区在线观看| 国产综合色在线| 91在线码无精品| 欧美肥胖老妇做爰| 国产亚洲一区字幕| 亚洲精品成人精品456| 日本三级亚洲精品| 成人小视频免费在线观看| 91免费在线视频观看| 91精品在线免费| 国产亚洲成aⅴ人片在线观看| 亚洲精品菠萝久久久久久久| 日本少妇一区二区| 99国产精品视频免费观看| 欧美一级专区免费大片| 中文字幕精品一区二区精品绿巨人| 一区二区三区四区不卡在线 | 亚洲日本青草视频在线怡红院| 亚洲自拍另类综合| 国产一区二三区| 欧美日韩在线播放三区四区| 国产午夜精品在线观看| 五月天欧美精品| 成人av中文字幕| 久久亚洲综合色一区二区三区| 亚洲午夜私人影院| 成人动漫在线一区| 日韩免费成人网| 视频在线观看91|