01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter.rom.html;
06:
07: import com.sun.portal.rewriter.rom.Data;
08: import com.sun.portal.rewriter.rom.Rule;
09: import com.sun.portal.rewriter.util.Constants;
10: import com.sun.portal.rewriter.util.StringHelper;
11:
12: public final class Applet extends Data {
13: private String code;
14: private String param;
15: private final String valuePatterns;
16:
17: public Applet(final String aCode, final String aParam) {
18: this (aCode, aParam, null, null);
19: }//constructor
20:
21: public Applet(final String aCode, final String aParam,
22: final String aValuePatterns, final String aSource) {
23: super (Rule.APPLET, aSource);
24: code = StringHelper.normalize(aCode,
25: Constants.DEFAULT_REGULAR_EXPRESSION);
26: param = StringHelper.normalize(aParam,
27: Constants.DEFAULT_REGULAR_EXPRESSION);
28: valuePatterns = StringHelper.normalize(aValuePatterns);
29: }//constructor
30:
31: public String getCode() {
32: return code;
33: }//getCode()
34:
35: public String getParam() {
36: return param;
37: }//getParam()
38:
39: public String getValuePatterns() {
40: return valuePatterns;
41: }//getValuePatterns()
42:
43: public Applet recycleMatchee(final String aCode,
44: final String aParam, final String aSource) {
45: code = aCode;
46: param = aParam;
47: setSource(aSource);
48: return this ;
49: }//recycleMatchee()
50:
51: public void writeCustomAttributes(final StringBuffer aBuffer) {
52: aBuffer.append(Rule.CODE).append(Constants.EQUALS).append(
53: Constants.DOUBLE_QUOTES).append(getCode()).append(
54: Constants.DOUBLE_QUOTES);
55:
56: if (!getParam().equals(Constants.DEFAULT_REGULAR_EXPRESSION)) {
57: aBuffer.append(Constants.SINGLE_SPACE).append(Rule.PARAM)
58: .append(Constants.EQUALS).append(
59: Constants.DOUBLE_QUOTES).append(getParam())
60: .append(Constants.DOUBLE_QUOTES);
61: }
62:
63: if (getValuePatterns().length() > 0) {
64: aBuffer.append(Constants.SINGLE_SPACE).append(
65: Rule.VALUE_PATTERNS).append(Constants.EQUALS)
66: .append(Constants.DOUBLE_QUOTES).append(
67: getValuePatterns()).append(
68: Constants.DOUBLE_QUOTES);
69: }
70: }//writeCustomAttributes()
71:
72: }//class Applet
|