/android/LGame-Android-0.2.95/src/org/loon/framework/android/game/core/graphics/window/UIFactory.java
http://loon-simple.googlecode.com/ · Java · 138 lines · 36 code · 17 blank · 85 comment · 2 complexity · 99354a19e8f3dd32743788e593e0aaee MD5 · raw file
- package org.loon.framework.android.game.core.graphics.window;
- import java.util.HashMap;
- import org.loon.framework.android.game.core.graphics.LComponent;
- import org.loon.framework.android.game.core.graphics.LImage;
- import org.loon.framework.android.game.core.graphics.device.LGraphics;
- /**
- *
- * Copyright 2008 - 2009
- *
- * 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.
- *
- * @project loonframework
- * @author chenpeng
- * @email?ceponline@yahoo.com.cn
- * @version 0.1
- */
- public abstract class UIFactory {
- private final HashMap<String, Object> uiResource = new HashMap<String, Object>(30);
- /**
- * ???????????
- */
- public boolean immutable = false;
- /**
- * ???????
- *
- */
- public UIFactory() {
- }
- /**
- * ???????
- *
- * @return
- */
- public abstract String getUIName();
- /**
- * ???????
- *
- * @return
- */
- public abstract String[] getUIDescription();
- /**
- * ????UI????????
- *
- * @param component
- * @param width
- * @param height
- * @return
- */
- public abstract LImage[] createUI(LComponent component, int width,
- int height);
- /**
- * ????UI
- *
- * @param component
- * @param ui
- */
- public abstract void processUI(LComponent component, LImage[] ui);
- /**
- * ??UI?????
- *
- * @param g
- * @param x
- * @param y
- * @param component
- * @param ui
- */
- public abstract void createUI(LGraphics g, int x, int y,
- LComponent component, LImage[] ui);
- /**
- * ?????UI??
- *
- * @param key
- * @param component
- * @return
- */
- public Object get(String key, LComponent component) {
- if (component == null) {
- return this.uiResource.get(key);
- }
- return (component.getUIResource().containsKey(key)) ? component
- .getUIResource().get(key) : this.uiResource.get(key);
- }
- /**
- * ??????UI?
- *
- * @param key
- * @param value
- */
- public void put(String key, Object value) {
- this.uiResource.put(key, value);
- }
- /**
- * ??????
- *
- * @param key
- * @return
- */
- protected final Object remove(String key) {
- return this.uiResource.remove(key);
- }
- /**
- * ??????????????
- *
- * @return
- */
- public final String[] getUIResource() {
- String[] temp = new String[this.uiResource.size()];
- String[] keys = (String[]) this.uiResource.keySet().toArray(temp);
- return keys;
- }
- }