/*
* Created on 2004-6-20
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.north.phonebook.ui;
import com.north.phonebook.model.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import com.north.phonebook.PhoneBookMIDlet;
/**
* @author P2800
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class UIController implements DialogListener
{
private Display display;
private Alert alert;
private PhoneBookMIDlet phoneBookMIDlet;
private Model model;
private WaitCanvas waitCanvas;
private IndexFunctionUI indexFunctionUI;
private WelcomeUI infomationUI;
private NewPhoneUI newPhoneUI;
private ListPhoneUI listPhoneUI;
private SearchPhoneUI searchPhoneUI;
private DetailInfoUI detailInfoUI;
private MerchantGroupDetailInfoUI merchantGroupDetailInfoUI;
private ConfirmationDialog dialog;
private ListMerchantGroupUI listMerchantGroupUI;
private LoginUI loginUI;
public static class EventID
{
private EventID()
{
}
public static final byte EVENT_NEW_RECORD_SELECTED = 1;
public static final byte EVENT_SAVE_RECORD_SELECTED = 2;
public static final byte EVENT_NEWPHONE_BACK_MAINUI = 3;
public static final byte EVENT_LISTPHONE_BACK_MAINUI = 4;
public static final byte EVENT_SEARCHUI_BACK_MAINNUI = 5;
public static final byte EVENT_CLEAR_RECORD_YES = 6;
public static final byte EVENT_CLEAR_RECORD_NO = 7;
public static final byte EVENT_DELETE_RECORD = 8;
public static final byte EVENT_DELETE_RECORD_YES = 9;
public static final byte EVENT_DELETE_RECORD_NO = 10;
public static final byte EVENT_DISPLAY_INFOMATION = 11;
public static final byte EVENT_DETAIL_BACK_LIST = 12;
public static final byte EVENT_SEARCH_RECORD = 13;
public static final byte EVENT_SEARCH_RECORD_ANYWAY = 14;
public static final byte EVENT_DISPLAY_MERCHANT_INFOMATION = 15;
public static final byte EVENT_DETAIL_BACK_MERCHANT_LIST =16;
public static final byte ADD_NEW_RECORD = 100;
public static final byte SEARCH_RECORD = 101;
public static final byte CLEAR_RECORD = 102;
public static final byte LIST_RECORD = 103;
public static final byte HELP = 104;
public static final byte ListMerchantGroup = 105;
}
public UIController(PhoneBookMIDlet pbm)
{
this.phoneBookMIDlet = pbm;
}
public void init(Model model)
{
this.display = Display.getDisplay(phoneBookMIDlet);
this.model = model;
waitCanvas = new WaitCanvas("", true);
indexFunctionUI = new IndexFunctionUI(this);
infomationUI = new WelcomeUI();
newPhoneUI = new NewPhoneUI(this);
listPhoneUI = new ListPhoneUI(this);
loginUI = new LoginUI(this);
listMerchantGroupUI = new ListMerchantGroupUI(this);
searchPhoneUI = new SearchPhoneUI(this);
detailInfoUI = new DetailInfoUI(this);
merchantGroupDetailInfoUI = new MerchantGroupDetailInfoUI(this);
dialog = new ConfirmationDialog(display, null);
dialog.setDialogListener(this);
displayWelcome();
}
public void setCurrent(Displayable disp)
{
display.setCurrent(disp);
}
public void setCurrent(Alert alert, Displayable disp)
{
display.setCurrent(alert, disp);
}
public void displayWelcome()
{
setCurrent(infomationUI);
try
{
Thread.sleep(20);
} catch (InterruptedException e)
{
}
// setCurrent(indexFunctionUI);
setCurrent(loginUI);
}
public void showAlert(String message, Displayable next, AlertType type)
{
alert = new Alert(Title.alertTitle, message, null, type);
alert.setTimeout(1500);
setCurrent(alert, next);
}
public void handleEvent(int eventID)
{
System.out.println("eventID"+eventID);
switch (eventID)
{
case EventID.ADD_NEW_RECORD:
{
newPhoneUI.clear();
display.setCurrent(newPhoneUI);
break;
}
case EventID.CLEAR_RECORD:
{
dialog.setMessage(Title.delete_phonebook);
dialog.display(EventID.CLEAR_RECORD);
break;
}
case EventID.EVENT_CLEAR_RECORD_YES:
{
try
{
model.clearAllRecord();
display.setCurrent(indexFunctionUI);
} catch (ApplicationException e)
{
e.printStackTrace();
}
break;
}
case EventID.LIST_RECORD:
{
new Thread()
{
public void run()
{
try
{
waitCanvas.setMMessage(Title.gettingList);
display.setCurrent(waitCanvas);
Index[] index = model.listRecord();
listPhoneUI.init(index);
display.setCurrent(listPhoneUI);
} catch (ApplicationException e)
{
e.printStackTrace();
}
}
}.start();
break;
}
case EventID.ListMerchantGroup:
{
// new Thread()
// {
// public void run()
// {
try
{
Index[] index = model.listRecord();
listMerchantGroupUI.init(index);
display.setCurrent(listMerchantGroupUI);
}catch (Exception e) {
e.printStackTrace();
}
// }
// }.start();
break;
}
case EventID.SEARCH_RECORD:
{
searchPhoneUI.init();
display.setCurrent(searchPhoneUI);
break;
}
case EventID.EVENT_NEWPHONE_BACK_MAINUI:
{
display.setCurrent(indexFunctionUI);
break;
}
case EventID.EVENT_LISTPHONE_BACK_MAINUI:
{
display.setCurrent(indexFunctionUI);
break;
}
case EventID.EVENT_SEARCHUI_BACK_MAINNUI:
{
display.setCurrent(indexFunctionUI);
break;
}
case EventID.EVENT_DETAIL_BACK_LIST:
{
display.setCurrent(listPhoneUI);
break;
}
case EventID.EVENT_DETAIL_BACK_MERCHANT_LIST:
{
display.setCurrent(listMerchantGroupUI);
break;
}
default:
break;
}
}
public void handleEvent(int eventID, Object[] obj)
{
System.out.println("eventID"+eventID);
switch (eventID)
{
case EventID.EVENT_SAVE_RECORD_SELECTED:
{
try
{
Account account = (Account) obj[0];
if (model.isRecordExist(account.getUse
没有合适的资源?快使用搜索试试~ 我知道了~
基于java的开发源码-通讯录手机版源码.zip
共95个文件
class:56个
java:22个
png:4个
1 下载量 85 浏览量
2024-02-24
20:30:38
上传
评论
收藏 215KB ZIP 举报
温馨提示
php伪协议 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip 基于java的开发源码-通讯录手机版源码.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于java的开发源码-通讯录手机版源码.zip (95个子文件)
codefans.net
PhoneBook
.classpath 242B
.settings
org.eclipse.jdt.core.prefs 214B
org.eclipse.core.resources.prefs 92B
src
com
north
phonebook
PhoneBookMIDlet.java 2KB
model
logo.gif 4KB
Preference.java 965B
Model.java 10KB
UserModel.java 3KB
Index.java 2KB
Account.java 4KB
ApplicationException.java 1KB
ui
Title.java 2KB
LoginUI.java 2KB
MerchantGroupDetailInfoUI.java 2KB
ListMerchantGroupUI.java 4KB
NewPhoneUI.java 4KB
ListPhoneUI.java 3KB
SearchPhoneUI.java 2KB
DialogListener.java 455B
WaitCanvas.java 2KB
Dialog.java 4KB
ConfirmationDialog.java 2KB
UIController.java 13KB
DetailInfoUI.java 2KB
WelcomeUI.java 2KB
IndexFunctionUI.java 3KB
deployed
PhoneBook.jar 38KB
PhoneBook.jad 285B
.eclipseme 243B
res
logo.gif 4KB
welcome.png 7KB
icon.png 308B
.eclipseme.tmp
emulation
PhoneBook.jar 44KB
PhoneBook.jad 285B
verified
classes
com
north
phonebook
model
Account.class 3KB
Model$IndexFilter.class 1KB
Model.class 6KB
Model$AccountFilter.class 904B
Index.class 2KB
ApplicationException.class 1KB
Preference.class 1KB
UserModel.class 4KB
PhoneBookMIDlet.class 2KB
ui
Title.class 2KB
IndexFunctionUI.class 2KB
Dialog.class 2KB
IndexFunctionUI$ListIndex.class 658B
UIController.class 9KB
DetailInfoUI.class 3KB
UIController$1.class 2KB
WaitCanvas.class 2KB
MerchantGroupDetailInfoUI.class 2KB
ListMerchantGroupUI.class 3KB
DialogListener.class 196B
LoginUI.class 3KB
NewPhoneUI.class 4KB
ConfirmationDialog.class 3KB
WelcomeUI.class 2KB
UIController$EventID.class 1KB
ListPhoneUI.class 3KB
WaitCanvas$1.class 816B
SearchPhoneUI.class 2KB
libs
bin
logo.gif 4KB
welcome.png 7KB
icon.png 308B
com
north
phonebook
model
Account.class 3KB
Model$IndexFilter.class 1KB
Model.class 6KB
Model$AccountFilter.class 867B
Index.class 2KB
ApplicationException.class 1KB
Preference.class 1KB
UserModel.class 4KB
PhoneBookMIDlet.class 2KB
ui
Title.class 2KB
IndexFunctionUI.class 2KB
Dialog.class 2KB
IndexFunctionUI$ListIndex.class 658B
UIController.class 8KB
DetailInfoUI.class 2KB
UIController$1.class 2KB
WaitCanvas.class 2KB
MerchantGroupDetailInfoUI.class 2KB
ListMerchantGroupUI.class 3KB
DialogListener.class 196B
LoginUI.class 3KB
NewPhoneUI.class 4KB
ConfirmationDialog.class 2KB
WelcomeUI.class 1KB
UIController$EventID.class 1KB
ListPhoneUI.class 3KB
WaitCanvas$1.class 816B
SearchPhoneUI.class 2KB
.project 541B
PhoneBook.jad 259B
共 95 条
- 1
资源评论
快乐无限出发
- 粉丝: 1200
- 资源: 7394
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功