技术开发 频道

基于Lotus Expeditor6.1的复合应用开发


数据的发送

    数据变化的发布可以在任何时候,但一般来讲,是用户通过界面的操作来发起,例如,点击一个按钮或选择列表或表中一行元素等。组件 com.ibm.rcp.samples.cityselection 中,是通过点击 Send 按钮来触发的。Property Broker 的 ChangedProperties() 方法告知 Property Broker,开始向其它组件广播,该组件的参数发生了变化。ChangedProperties 的第二个参数是一个字符串,是与线接配置中的 sourceentityid 一致,我们用当前的 ViewID 来赋值,ViewID 可以用如下的语句获得:
viewID = this.getViewSite().getId() + ":" + this.getViewSite().getSecondaryId();
    下面是数据发送所用的完整代码,其中 m_sendBtn 是 View 的成员变量,代表 Send 那个按钮。

m_sendBtn.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { PropertyBroker pb = PropertyBrokerFactory.getBroker(); PropertyValue[] values = new PropertyValue[1]; m_BeijingTime.setText( "Beijing Time: "+new Date().toLocaleString() ); try { Property prop = pb.getProperty("http://www.ibm.com/wps/c2a","CityName_Text"); if(prop!=null) { values[0] = PropertyFactory.createPropertyValue(prop, m_City.getText()); pb.changedProperties(values,viewID); } } catch (PropertyBrokerException e) { e.printStackTrace(); } } });

观看专家视频讲座,了解人员协作信息,赢取免费试用软件。

0
相关文章