HomeTabPane.java
资源名称:src.zip [点击查看]
上传用户:luxiaowei
上传日期:2022-06-06
资源大小:58k
文件大小:5k
源码类别:
J2ME
开发平台:
Java
- /*
- * MOMTabPane.java
- *
- * Created on April 22, 2010, 12:45 PM
- *
- * To change this template, choose Tools | Template Manager
- * and open the template in the editor.
- */
- package com.MOM.ui.design;
- import com.MOM.ui.control.*;
- import com.MOM.Constants;
- import com.MOM.resources.Resources;
- import com.MOM.ui.MOMUiFactory;
- import com.framework.DisplayManager;
- import com.framework.EditControl;
- import com.framework.ImageControl;
- import com.framework.RadioControl;
- import com.framework.RadioGroup;
- import com.framework.ScrollableContainer;
- import com.framework.SpacerControl;
- import com.framework.TickerTextControl;
- import javax.microedition.lcdui.Graphics;
- /**
- *
- * @author Tejaswi
- */
- public class HomeTabPane extends MOMTabPane {
- /** Variables */
- TickerTextControl searchButton;
- EditControl searchEditControl;
- RadioGroup searchRadioGroup;
- ShareMarketReadingControl shareMarketControl;
- MOMewsGroupControl topNewsGroup;
- MOMewsGroupControl preMarket;
- /** Creates a new instance of MOMTabPane */
- public HomeTabPane() {
- }
- public void init() {
- // creating tab button
- tabButton = new SpacerControl();
- tabButton.setBgImage(Resources.getInstance().getImage(Resources.HOME_ICON_OFF_IMAGE));
- tabButton.setSelectionBgImage(Resources.getInstance().getImage(Resources.HOME_ICON_ON_IMAGE));
- tabButton.setHeight(Resources.getInstance().getImage(Resources.TAB_BUTTON_ON_IMAGE).getHeight());
- // creating tab body
- tabBody = new ScrollableContainer();
- tabBody.setLayout(Constants.TAB_PANE_LIST_LAYOUT);
- // Adding search lable
- tabBody.addChildren(MOMUiFactory.getDarckLabel(Constants.SEARCH_STRING));
- tabBody.addChildren(getSearchBox());
- tabBody.addChildren(getSearchRadioPane());
- shareMarketControl = new ShareMarketReadingControl();
- tabBody.addChildren(shareMarketControl);
- shareMarketControl.setNiftyChange("Change");
- shareMarketControl.setSensexChange("Change");
- shareMarketControl.setNiftyReading("Reading");
- shareMarketControl.setSexsexReading("Reading");
- MultilineArrowControl label1 = new MultilineArrowControl(Constants.GLOBAL_MARKET_UPDATE_STRING, true, false,Resources.getInstance().getFontBlackMediumBold());
- label1.setSelectable(false);
- tabBody.addChildren(label1);
- topNewsGroup = new MOMewsGroupControl(Constants.TOP_NEWS_LABEL);
- tabBody.addChildren(topNewsGroup);
- topNewsGroup.addInformation("Dubai connection: Indian compaines may get extra hit.");
- topNewsGroup.addInformation("Tata Moters Q2 cons seen at Rs. 170 cr");
- topNewsGroup.addExtraInformation("More top news");
- preMarket = new MOMewsGroupControl(Constants.PRE_MARKET_STRING);
- tabBody.addChildren(preMarket);
- preMarket.addInformation("Asian Market end over.");
- preMarket.addInformation("Dubai connection: Indian compaines may get extra hit.");
- preMarket.addExtraInformation("More");
- }
- private ScrollableContainer getSearchBox() {
- ScrollableContainer container = new ScrollableContainer();
- container.setLayout(Constants.HORIZONAL_LAYOUT_01);
- searchButton = MOMUiFactory.getSearchButton(Constants.SEARCH_STRING);
- ImageControl imgControl = MOMUiFactory.getUnselectbleImageControl(Resources.getInstance().getImage(Resources.SEARCH_ICON_IMAGE));
- searchEditControl = MOMUiFactory.getEditControl(DisplayManager.getInst().getWidth() - (4 * Constants.LEFT_PADDING) - searchButton.getWidth() - imgControl.getWidth(), searchButton.getHeight());
- imgControl.setHeight(searchButton.getHeight());
- imgControl.setAllignment(Graphics.HCENTER | Graphics.VCENTER);
- container.addChildren(searchEditControl);
- container.addChildren(searchButton);
- container.addChildren(imgControl);
- return container;
- }
- private ScrollableContainer getSearchRadioPane() {
- ScrollableContainer container = new ScrollableContainer();
- searchRadioGroup = new RadioGroup();
- container.setLayout(Constants.HORIZONAL_LAYOUT_01);
- for (int i = 0; i < Constants.SEARCH_RADIO_BUTTONS.length; i++) {
- RadioControl control = MOMUiFactory.getRadioControl(Constants.SEARCH_RADIO_BUTTONS[i]);
- container.addChildren(control);
- searchRadioGroup.addRadioControl(control);
- }
- container.resize();
- container.setHeight(container.getHeight() + Constants.TOP_PADDING);
- return container;
- }
- }