WAP之家:为您提供最全最新的WAP技术,CP.SP.3G等行业资讯。 WAP之家交流论坛全新开放 点击进入>>
WAP资讯 | 3G动态 | SP动态 | 运营商动态 | 内容商动态 | 制造商动态 | 论坛讨论>> 每次自动访问
WAP技术 | WAP源码 | 手机编程 | 手机源码 | 无线技术 | J2ME技术 | 手机软件 添加到收藏夹
IVR技术 | SP资料 | SMS MMS技术 | 商业方案 | IVR下载 | 书籍教程 | 工具软件 语言:繁體中文

WAP之家技术文章手机编程BREWBREW & J2ME:在差别中联合

BREW & J2ME:在差别中联合
作者:佚名  来源:本站整理  发布时间:2008-4-8 1:14:52


最后,使登记过程和基于GUID的BREW初始化过程透明化需要一个附助构造——一个工厂。代码的第一行可以这样写:

 

CODE:List* l = List::getList("Title", this);


【未完待续】


源代码下载: cppapp.zip
 


原文地址:http://www.developer.com/ws/j2me/article.php/3116331
 


参考文献

 

1.BREW and J2METM—A Complete Wireless Solution for Operators Committed to Java—Qualcomm http://www.qualcomm.com/brew/images/about/pdf/brew_j2me.pdf

2.Design Patterns: Elements of Reusable Object-Oriented Software—ErichGamma, RichardHelm, RalphJohnson, and John Vlissides, Addison-Wesley, 1994

3.String in BREW Revisited—a BrewString Generalization—http://www.developer.com/ws/brew/article.php/2229051

4.Emulating C++ Exception Handling—Gregory Colvin, C/C++ Users Journal, December 1994

 

5.For Brew Developers, There Are New Kids in Town: IThread & IRscPool, Part 2—http://www.developer.com/ws/brew/article.php/3105131

关于作者

Radu Braniste 是Epicad的技术主任。联系他请发邮件到: rbraniste@epicad.com



论坛浏览】 【我来说两句】 【打印】 【大】 【中】 【小】 【关闭】


相关评论
作者: leon 发布日期: 2005-9-29
什么是List?

BREW不提供List,而是提供MenuCtl。简单的说,“List就是一个暴露MenuCtl功能的IDisplayable。”

CODE:template <class T,
class P=ListStrategy,
class E = ErrorHandler>
class ListImpl : public IDisplayable
{
typedef bool (T::*FNC)(ListImpl<T,P,E>*);
public:
static ListImpl* getList(
 

const WString& title, T* t)
{
ListImpl* l = createList(t);
if (l)
{
l->setTitle(title);
l->setFullScreen();
}
return l;
}

virtual ~ListImpl()
{
if (list_) IMENUCTL_Release(list_);
}

void append(const WString& item)
{
if (!rr_)
return;
int id = rr_->getNextAvailableID();
IMENUCTL_AddItem(list_, 0, 0, id,
const_cast<AECHAR*>
(item.toCharArray()), 0);
indxs_.append(id);
}
 


void append(const WString items[]s, int sz)
{
 

for(int i=0; i < sz; ++i)
{
append(items[i]);
}
}

virtual IControl* getControl() const
{
return reinterpret_cast<IControl*>(list_);
 

}

bool onCmd()
{
if (fnc_ && t_)
return (*t_.*fnc_)(this);
return false;
}

int getSelectedIndex() const
{
return selected_;
}

 

virtual bool containsItem(int ix)
{
selected_ = getIDImpl(ix);
return (selected_ != INDEX_OUT_OF_BOUNDS);
}

virtual int getID() const
{
return id_;
}

void setCbk(FNC f)
{
fnc_ = f;
}
 


void setSelection(int id)
 

{
int lid = IMENUCTL_GetItemID(list_, id);
IMENUCTL_SetSel(list_, lid);
}

int size() const
{
return indxs_.size();
}

void setTitle(const WString& title)
{
if (title.length())
IMENUCTL_SetTitle(list_, NULL, 0, const_cast<AECHAR*>
(title.toCharArray()));
}

private:

ListImpl( T* t, AEECLSID cid ): list_(0), t_(t) , rr_(0),
shell_(getShell()), selected_(0)
{
if (shell_)
ISHELL_CreateInstance(shell_, cid, (void **)&list_);
if (!list_)
{
E::onMemAllocError(WString(__FILE__),
WString((long)__LINE__));
return;
}

rr_ = t_->getDisplayable();
if (rr_)
id_ = rr_->registerResource(this);
 

JAVA手机网[www.cnjm.net]

}

static ListImpl* createList( T* t, AEECLSID cid =
AEECLSID_MENUCTL)
{
ListImpl* l = new ListImpl( t, cid);
if (!l->list_)
{
 

delete l;
return 0;
}
return l;
}

void setFullScreen();

int getIDImpl(int ix);

private:
 

IMenuCtl * list_;
FNC fnc_;
T* t_;
DisplayableRegistry* rr_;
int selected_;
int id_;
IShell * shell_;
BrewVector<int> indxs_;
};

 

上一页  [1] [2] [3] [4] [5]  下一页

[] [返回上一页] [打 印]
文章评论

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码