WebLogic Platform 8.1自訂控制項

來源:互聯網
上載者:User

WebLogic Platform 8.1自訂控制項一般由兩個檔案組成:JCS檔案和JAVA檔案.
JCS是java control source的意思,代表源檔案,實現自訂控制項的功能;JAVA檔案代表

控制項可以被調用的介面.舉例如下:

1)JCS檔案代碼如下
package verifyFunds.poUtil;
import java.util.StringTokenizer;
/**
 * Provides a number formatting utility function for the
 * VerifyFunds sample control.
 * 作者說明:WebLogic Platform 8.1定義了很多JAVADOC,方便我們的開發和布署
 * @jcs:jc-jar label="POUtil"
 * @editor-info:code-gen control-interface="true"
 */
//作者說明:JCS檔案預設在JAVA檔案後加"Impl"尾碼,POUtil.java是JCS要實現的介面
//JCS都實現com.bea.control.ControlSource介面
public class POUtilImpl implements POUtil,com.bea.control.ControlSource
{
    /**
     * Formats a purchase order number, removing
     * non-numeric characters.
     * 下面是具體的功能實現,如果你不感興趣,可以不用管
     * @common:operation
     */
    public int formatNumber(String stringNumber)
    {
        StringBuffer delimiters = new StringBuffer();

        for (int i = 0; i < stringNumber.length(); i++)
        {
            if (stringNumber.charAt(i) < '0' || stringNumber.charAt(i) >

'9')
                delimiters.append(stringNumber.charAt(i));
        }

        StringTokenizer tokens = new StringTokenizer(stringNumber,

delimiters.toString());
        StringBuffer cleanString = new StringBuffer();
       
        while(tokens.hasMoreTokens())
        {
            cleanString.append(tokens.nextToken());
        }
        int number = new Integer(cleanString.toString()).intValue();
        return number;
    }
}
Javadoc 批註 @common:operation 表示此方法屬於公用介面的一部分。出現此批註時

,WebLogic Workshop 將此方法包括在 .java 中列出的公用介面中。在設計檢視中,

此批註由藍色箭頭表徵圖表示。

2)JAVA檔案代碼如下
package verifyFunds.poUtil;

import com.bea.control.Control;
//介面都繼承com.bea.control.Control
public interface POUtil extends Control
{
    /**
     * Formats a purchase order number, removing non-numeric characters.
     */
    //對應JCS檔案中的@common:operation標示的方法
    int formatNumber(java.lang.String stringNumber);
}
WebLogic WorkShop提供了不錯的介面,讓我們可以用圖性化的方式來開發和理解,還是

相當不錯的.
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.