ofbiz实战——课程管理界面以及代码实现

课程管理主要有:查询,修改,删除,添加功能。

查询:


新增:


修改:



CourseScreens.xml

<?xml version="1.0" encoding="UTF-8"?>
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://ofbiz.apache.org/Widget-Screen" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen http://ofbiz.apache.org/dtds/widget-screen.xsd">
	<screen name="FindCourse">
        <section>
            <actions>
                <set field="titleProperty" value="CourseManange"/>
				<set field="headerItem" value="CourseManange"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <property-to-field resource="widget" property="widget.form.defaultViewSize" field="viewSizeDefaultValue"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="component://booking/widget/booking/CommonScreens.xml">
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                                    <decorator-section name="menu-bar">
                                        <container style="button-bar">
                                            <link target="EditCourse" text="${uiLabelMap.EditCourse}" style="buttontext"/>
                                        </container>
                                    </decorator-section>
                                    <decorator-section name="search-options">
                                        <include-form name="FindCourse" location="component://booking/widget/booking/CourseForms.xml"/>
                                    </decorator-section>
                                    <decorator-section name="search-results">
                                        <include-form name="ListFindCourse" location="component://booking/widget/booking/CourseForms.xml"/>
                                    </decorator-section>
                                </decorator-screen>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
	<screen name="EditCourse">
        <section>
            <actions>
                <set field="titleProperty" value="CourseManange"/>
                <set field="headerItem" value="CourseManange"/>
				<entity-one entity-name="Course" value-field="course"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonBookingDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
						<container style="button-bar">
							<link target="FindCourse" text="${uiLabelMap.CommonBack}" style="buttontext"/>
						</container>
                        <screenlet title="${groovy: parameters.courseId ? uiLabelMap.CommonEdit : uiLabelMap.CommonAdd}">
                            <include-form name="EditCourse" location="component://booking/widget/booking/CourseForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
	<screen name="LookupCourse">
        <section>
            <actions>
                <property-map resource="BookingUiLabels" map-name="uiLabelMap" global="true"/>
                <set field="title" value="${uiLabelMap.PageTitleLookupCourse}"/>
                <set field="queryString" from-field="result.queryString"/>
                <set field="entityName" value="Course"/>
                <set field="searchFields" value="[courseId, courseName]"/>
            </actions>
            <widgets>
                <decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml">
                    <decorator-section name="search-options">
                        <include-form name="LookupCourse" location="component://booking/widget/booking/CourseForms.xml"/>
                    </decorator-section>
                    <decorator-section name="search-results">
                        <include-form name="ListLookupCourse" location="component://booking/widget/booking/CourseForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
</screens>

CourseForms.xml

<?xml version="1.0" encoding="UTF-8"?>

<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
    
    <form name="FindCourse" target="FindCourse" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="courseName" title="${uiLabelMap.BookingCourseName}"><text-find/></field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit/></field>
    </form>

    <form name="ListFindCourse" list-name="listIt" title="" type="list" paginate-target="FindCourse"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" value="Course"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
				<field-map field-name="noConditionFind" value="Y"/>
            </service>
        </actions>
		<field name="courseId" title="${uiLabelMap.BookingCourseId}"><display/></field>
        <field name="courseName" title="${uiLabelMap.BookingCourseName}"><display/></field>
		<field name="updateLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonUpdate}" target="EditCourse" >
                <parameter param-name="courseId"/>
            </hyperlink>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteCourse" also-hidden="false">
                <parameter param-name="courseId"/>
            </hyperlink>
        </field>
        
    </form>
	
	<form name="EditCourse" target="updateCourse" title="" type="single" header-row-style="header-row" 
		default-table-style="basic-table" default-map-name="course" default-entity-name="Course">
		<alt-target use-when="course==null" target="createCourse"/>
		<auto-fields-service service-name="updateCourse" map-name=""/>
		<field use-when="course!=null" name="courseId" title="${uiLabelMap.BookingCourseId}" tooltip="${uiLabelMap.BookingNotModification}." ><display/></field>
        <field use-when="course==null" name="courseId" title="${uiLabelMap.BookingCourseId}" ><text size="20" maxlength="20" /></field>
		<field name="courseName" title="${uiLabelMap.BookingCourseName}"><text size="20" maxlength="20" /></field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}">
			<submit/>
		</field>
    </form>
	
	<form name="LookupCourse" target="LookupCourse" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <!-- <auto-fields-entity entity-name="Course" default-field-type="hidden"/> -->
        <field name="courseName" title="${uiLabelMap.BookingCourseName}"><text-find/></field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit/></field>
    </form>
    <form name="ListLookupCourse" list-name="listIt" title="" type="list" paginate-target="LookupCourse"
        odd-row-style="alternate-row" default-table-style="basic-table" view-size="20">       
		<actions>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" value="Course"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
				<field-map field-name="noConditionFind" value="Y"/>
            </service>
        </actions>
		<field name="courseId" title="${uiLabelMap.BookingCourseId}" widget-style="buttontext">  
			<hyperlink description="${courseId}" target="javascript:set_value('${courseId}')" also-hidden="false" target-type="plain"/>  
		</field>
        <field name="courseName" title="${uiLabelMap.BookingCourseName}"><display/></field>
    </form>
</forms>

返回导航页




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值