001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026:
027: package com.sun.midp.chameleon.skins.resources;
028:
029: import com.sun.midp.chameleon.skins.SkinPropertiesIDs;
030: import com.sun.midp.chameleon.skins.AlertSkin;
031: import com.sun.midp.chameleon.skins.ScreenSkin;
032:
033: import javax.microedition.lcdui.Image;
034: import javax.microedition.lcdui.Font;
035:
036: public class AlertResources {
037: private static boolean init;
038:
039: private AlertResources() {
040: }
041:
042: public static void load() {
043: load(false);
044: }
045:
046: public static void load(boolean reload) {
047: if (init && !reload) {
048: return;
049: }
050:
051: AlertSkin.WIDTH = SkinResources
052: .getInt(SkinPropertiesIDs.ALERT_WIDTH);
053: if (AlertSkin.WIDTH == -1) {
054: AlertSkin.WIDTH = (int) (.95 * ScreenSkin.WIDTH);
055: }
056: AlertSkin.HEIGHT = SkinResources
057: .getInt(SkinPropertiesIDs.ALERT_HEIGHT);
058: if (AlertSkin.HEIGHT == -1) {
059: AlertSkin.HEIGHT = (int) (.75 * ScreenSkin.HEIGHT);
060: }
061:
062: int alignX = SkinResources
063: .getInt(SkinPropertiesIDs.ALERT_ALIGN_X);
064: AlertSkin.ALIGN_X = SkinResources
065: .resourceConstantsToGraphics(alignX);
066:
067: int alignY = SkinResources
068: .getInt(SkinPropertiesIDs.ALERT_ALIGN_Y);
069: AlertSkin.ALIGN_Y = SkinResources
070: .resourceConstantsToGraphics(alignY);
071:
072: AlertSkin.MARGIN_H = SkinResources
073: .getInt(SkinPropertiesIDs.ALERT_MARGIN_H);
074: AlertSkin.MARGIN_V = SkinResources
075: .getInt(SkinPropertiesIDs.ALERT_MARGIN_V);
076:
077: int titleAlign = SkinResources
078: .getInt(SkinPropertiesIDs.ALERT_TITLE_ALIGN);
079: AlertSkin.TITLE_ALIGN = SkinResources
080: .resourceConstantsToGraphics(titleAlign);
081:
082: AlertSkin.TITLE_HEIGHT = SkinResources
083: .getInt(SkinPropertiesIDs.ALERT_TITLE_HEIGHT);
084: AlertSkin.TITLE_MARGIN = SkinResources
085: .getInt(SkinPropertiesIDs.ALERT_TITLE_MARGIN);
086: AlertSkin.TEXT_TITLE_INFO = SkinResources
087: .getString(SkinPropertiesIDs.ALERT_TEXT_TITLE_INFO);
088: AlertSkin.TEXT_TITLE_WARN = SkinResources
089: .getString(SkinPropertiesIDs.ALERT_TEXT_TITLE_WARN);
090: AlertSkin.TEXT_TITLE_ERRR = SkinResources
091: .getString(SkinPropertiesIDs.ALERT_TEXT_TITLE_ERRR);
092: AlertSkin.TEXT_TITLE_ALRM = SkinResources
093: .getString(SkinPropertiesIDs.ALERT_TEXT_TITLE_ALRM);
094: AlertSkin.TEXT_TITLE_CNFM = SkinResources
095: .getString(SkinPropertiesIDs.ALERT_TEXT_TITLE_CNFM);
096: AlertSkin.PAD_HORIZ = SkinResources
097: .getInt(SkinPropertiesIDs.ALERT_PAD_HORIZ);
098: AlertSkin.PAD_VERT = SkinResources
099: .getInt(SkinPropertiesIDs.ALERT_PAD_VERT);
100: AlertSkin.SCROLL_AMOUNT = SkinResources
101: .getInt(SkinPropertiesIDs.ALERT_SCROLL_AMOUNT);
102: AlertSkin.TIMEOUT = SkinResources
103: .getInt(SkinPropertiesIDs.ALERT_TIMEOUT);
104: AlertSkin.COLOR_BG = SkinResources
105: .getInt(SkinPropertiesIDs.ALERT_COLOR_BG);
106: AlertSkin.COLOR_TITLE = SkinResources
107: .getInt(SkinPropertiesIDs.ALERT_COLOR_TITLE);
108: AlertSkin.COLOR_FG = SkinResources
109: .getInt(SkinPropertiesIDs.ALERT_COLOR_FG);
110: AlertSkin.FONT_TITLE = SkinResources
111: .getFont(SkinPropertiesIDs.ALERT_FONT_TITLE);
112: AlertSkin.FONT_TEXT = SkinResources
113: .getFont(SkinPropertiesIDs.ALERT_FONT_TEXT);
114: AlertSkin.IMAGE_BG = SkinResources.getCompositeImage(
115: SkinPropertiesIDs.ALERT_IMAGE_BG, 9);
116: AlertSkin.IMAGE_ICON_INFO = SkinResources
117: .getImage(SkinPropertiesIDs.ALERT_IMAGE_ICON_INFO);
118: AlertSkin.IMAGE_ICON_WARN = SkinResources
119: .getImage(SkinPropertiesIDs.ALERT_IMAGE_ICON_WARN);
120: AlertSkin.IMAGE_ICON_ERRR = SkinResources
121: .getImage(SkinPropertiesIDs.ALERT_IMAGE_ICON_ERRR);
122: AlertSkin.IMAGE_ICON_ALRM = SkinResources
123: .getImage(SkinPropertiesIDs.ALERT_IMAGE_ICON_ALRM);
124: AlertSkin.IMAGE_ICON_CNFM = SkinResources
125: .getImage(SkinPropertiesIDs.ALERT_IMAGE_ICON_CNFM);
126:
127: init = true;
128: }
129:
130: }
|