使用Input Text with LOV + Transient Attribute 实现显示名称保存ID
来源:互联网 发布:淘宝网高腰半身a字裙 编辑:程序博客网 时间:2024/05/22 13:14
开发环境:JDevloper 11.1.2.1.0+ Oracle Database 10g Express Edition 10.2.0.1。
在上一个文章中,实现的方法是基于多个EO创建一个新VO,然后基于名称字段建立LOV。
有些开发人员不喜欢这种方式,因为使用了多个EO,觉得不够简明。
在本实验中,我在原有的VO上添加了一个临时字段(Transient Attribute):JobTitle。
通过Override VO的Row Impl类的GetJobTitle方法来实现显示名称保存ID。
以下是重点步骤说明:
1. 在EmployeesView上增加Transient Attribute:JobTitle
注意,这里要把Updatable改为Always,否则显示在页面上时,该字段为只读状态。
2. 为JobTitle设置LOV
(1)
(2)
(3)
3. 定制并生成EmployeesViewRowImpl.java
重写getJobTitle方法,把内容从
/**
* Gets the attribute value for the calculated attribute JobTitle.
* @return the JobTitle
*/
public String getJobTitle() {
return (String) getAttributeInternal(JOBTITLE);
}
改成
public String getJobTitle() {
Object jobId = getAttributeInternal(JOBID);
String jobTitle = null;
if (jobId != null) {
Object[] obj = { jobId };
Key key = new Key(obj);
Row[] rows = getJobsView1().findByKey(key, 1);
if (rows != null && rows.length > 0) {
jobTitle = (String)rows[0].getAttribute(1);
}
}
return jobTitle;
}
注意,这里因为JobTitle在JobsView中是第2个Attribute,所以这里使用的是getAttribute(1)。
在上一个文章中,实现的方法是基于多个EO创建一个新VO,然后基于名称字段建立LOV。
有些开发人员不喜欢这种方式,因为使用了多个EO,觉得不够简明。
在本实验中,我在原有的VO上添加了一个临时字段(Transient Attribute):JobTitle。
通过Override VO的Row Impl类的GetJobTitle方法来实现显示名称保存ID。
以下是重点步骤说明:
1. 在EmployeesView上增加Transient Attribute:JobTitle
注意,这里要把Updatable改为Always,否则显示在页面上时,该字段为只读状态。
2. 为JobTitle设置LOV
(1)
(2)
(3)
3. 定制并生成EmployeesViewRowImpl.java
重写getJobTitle方法,把内容从
/**
* Gets the attribute value for the calculated attribute JobTitle.
* @return the JobTitle
*/
public String getJobTitle() {
return (String) getAttributeInternal(JOBTITLE);
}
改成
public String getJobTitle() {
Object jobId = getAttributeInternal(JOBID);
String jobTitle = null;
if (jobId != null) {
Object[] obj = { jobId };
Key key = new Key(obj);
Row[] rows = getJobsView1().findByKey(key, 1);
if (rows != null && rows.length > 0) {
jobTitle = (String)rows[0].getAttribute(1);
}
}
return jobTitle;
}
注意,这里因为JobTitle在JobsView中是第2个Attribute,所以这里使用的是getAttribute(1)。
Project 下载:ADF_LOV_InputText_TransientName.7z
http://maping930883.blogspot.com/2012/08/adf184input-text-with-lov-transient.html
0 0
- 使用Input Text with LOV + Transient Attribute 实现显示名称保存ID
- 使用Input Text with LOV 实现显示名称保存ID
- 使用Input Text with LOV 实现LOV
- 使用ReturnPopupListener接收Input Text with LOV的返回值
- 使用LaunchPopupListener过滤Input Text with LOV(1)
- 使用LaunchPopupListener过滤Input Text with LOV(2)
- 使用LaunchPopupListener过滤Input Text with LOV(3)
- 使用LaunchPopupListener过滤Input Text with LOV(4)
- No label views point to this text field with an android:labelFor="@+id/@+id/***" attribute
- 使用Choice List 实现LOV
- LOV 之Text Field LOV
- input text 显示文字
- input(file)点击选择图片后,图片附件名称在另一个input(text)出现的实现
- Notification Bubble with Text Input Control.(MFC)
- jquery: input text with array name selector
- 2.19 Accepting User Text Input with UITextField
- input attribute
- Workaround for LOV on Primary Key Attribute
- Fedora11下找回/dev/dsp设备
- 使用Input Text with LOV 实现显示名称保存ID
- JS函数定义方式的区别
- 图片格式及内存占用
- POJ 2387 Til the Cows Come Home
- 使用Input Text with LOV + Transient Attribute 实现显示名称保存ID
- 黑马程序员----IOS笔记 #pragma mark的用法
- POJ3525-Most Distant Point from the Sea(二分+半平面交)
- 使用Choice List 实现查询
- Libgdx的使用(16)——内存管理和对象池
- Linux bash shell 逐行读取文件的三种方法
- 元数据驱动
- [小技巧] 快速给目录打包
- c++:array