MOMUiFactory.java
资源名称:src.zip [点击查看]
上传用户:luxiaowei
上传日期:2022-06-06
资源大小:58k
文件大小:4k
源码类别:
J2ME
开发平台:
Java
- /*
- * MOMUiFactory.java
- *
- * Created on April 21, 2010, 1:32 PM
- *
- * To change this template, choose Tools | Template Manager
- * and open the template in the editor.
- */
- package com.MOM.ui;
- import com.MOM.Constants;
- import com.MOM.controller.Controller;
- import com.MOM.resources.Resources;
- import com.MOM.ui.control.MOMTitleBar;
- import com.framework.DisplayManager;
- import com.framework.EditControl;
- import com.framework.GTantra;
- import com.framework.ImageControl;
- import com.framework.RadioControl;
- import com.framework.TextControl;
- import com.framework.TickerTextControl;
- import com.framework.TitleBar;
- import com.framework.UiScreen;
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
- /**
- *
- * @author Tejaswi
- */
- public class MOMUiFactory {
- public static UiScreen getMOMScreen(String leftSoftKey,String rightsoftKey)
- {
- UiScreen screen = new UiScreen(){
- public TitleBar getTitleBar() {
- if(titleBar == null)
- titleBar = new MOMTitleBar(this);
- return titleBar;
- }
- };
- screen.getSoftkeybar().setFont(Resources.getInstance().getSoftKeyFont());
- screen.getSoftkeybar().setSetSoftkey(Graphics.LEFT, leftSoftKey);
- screen.getSoftkeybar().setSetSoftkey(Graphics.RIGHT, rightsoftKey);
- screen.getSoftkeybar().setBgColor(0xFFFFFF);
- screen.invalidate();
- screen.setEventManager(Controller.getInstance());
- return screen;
- }
- public static TextControl getCommanTabButton(String text)
- {
- Image bgImage = Resources.getInstance().getImage(Resources.TAB_BUTTON_OFF_IMAGE);
- TextControl textControl = new TextControl(text, bgImage.getWidth(),Resources.getInstance().getTabButtonTitleFont(), GTantra.TEXT_VCENTER_HCENTER , false);
- textControl.setBgImage(bgImage);
- textControl.setHeight(bgImage.getHeight());
- textControl.setSelectionBgImage(Resources.getInstance().getImage(Resources.TAB_BUTTON_ON_IMAGE));
- textControl.setVerticalPadding(0);
- return textControl;
- }
- public static TickerTextControl getDarckLabel(String text)
- {
- TickerTextControl control = new TickerTextControl(text,Resources.getInstance().getLableTitleFont());
- control.setSelectable(false);
- control.setBgColor(0x94a5b5);
- control.setWidth(DisplayManager.getInst().getWidth());
- return control;
- }
- public static TickerTextControl getSearchButton(String text)
- {
- TickerTextControl control = new TickerTextControl(text,Resources.getInstance().getButtonTextFont());
- control.setBgImage(Resources.getInstance().getImage(Resources.SEARCH_BUTTON_IMAGE));
- control.setAllignment(Graphics.HCENTER);
- control.setSelectionBorderColor(Constants.CONTROLS_SELECTION_BORDER_COLOR);
- return control;
- }
- public static EditControl getEditControl(int width,int height)
- {
- EditControl control = new EditControl(Resources.getInstance().getEditControlFont() , width, height , 1024 , false);
- control.setSelectionBorderColor(Constants.CONTROLS_SELECTION_BORDER_COLOR);
- control.setBorderColor(0);
- control.setCursorColor(0);
- return control;
- }
- public static ImageControl getUnselectbleImageControl(Image image)
- {
- ImageControl control = new ImageControl(image);
- control.setSelectable(false);
- return control;
- }
- public static RadioControl getRadioControl(String text)
- {
- RadioControl radioControl = new RadioControl(text,Resources.getInstance().getFontBlackMediumBold(),Resources.getInstance().getImage(Resources.RADIO_BUTTON_IMAGE),Resources.getInstance().getImage(Resources.RADIO_BUTTON_ON_IMAGE));
- radioControl.setRadioCircleBorderColor(Constants.RADIO_CONTROL_CIRCLE_BORDER_COLOR);
- radioControl.setSelectionBorderColor(Constants.CONTROLS_SELECTION_BORDER_COLOR);
- return radioControl;
- }
- public static TickerTextControl getBlueLabel(String text)
- {
- TickerTextControl label = new TickerTextControl(text, Resources.getInstance().getFontWhiteMediumBold());
- label.setBgColor(Constants.BLUE_LABLE_BG_COLOR);
- label.setBorderColor(Constants.BLUE_LABLE_BORDER_COLOR);
- label.setSelectable(false);
- label.setWidth(DisplayManager.getInst().getWidth());
- return label;
- }
- }