01: /**
02: * $Id: ViewBean.java,v 1.4 2005/09/21 10:52:09 dg154973 Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and iPlanet
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wireless.taglibs.commprefs;
14:
15: import com.sun.portal.log.common.PortalLogger;
16: import com.sun.ssoadapter.config.Configuration;
17:
18: import javax.servlet.jsp.PageContext;
19: import java.util.Vector;
20: import java.util.logging.Level;
21: import java.util.logging.Logger;
22:
23: /**
24: * ViewBean
25: *
26: * Backed by an SSO configuration to allow editing of properties.
27: *
28: * @version 1.1
29: * @see
30: */
31: public class ViewBean extends SSOConfigurationBean {
32:
33: private static Logger logger = PortalLogger
34: .getLogger(ViewBean.class);
35:
36: /**
37: * Construct a ViewBean, given a configuration (called from MailPrefsContext).
38: * @param name
39: * @param configuration
40: */
41: public ViewBean(String name, Configuration configuration) {
42: super (name, configuration);
43: }
44:
45: /*
46: * Construct a ViewBean from a <mail:view> tag from within a <mail:preferences>
47: * (MailPrefsContext)
48: * No associated configuration or name yet.
49: */
50: public ViewBean(PageContext pageContext) {
51: super ();
52: // Get mail context & add new bean
53: MailPrefsContext context = null;
54: try {
55: context = MailPrefsContext.getPrefsContext(pageContext);
56: context.addView(this );
57: } catch (Exception e) {
58: logger.log(Level.WARNING, "PSMA_CSPWTP0009", e);
59: }
60: }
61:
62: /**
63: * Default Constructor
64: */
65: public ViewBean() {
66: }
67:
68: public Vector getRules() {
69: return new Vector(getPropertyList("ruleName"));
70: }
71:
72: public void setRules(Vector rules) {
73: if (rules == null)
74: rules = new Vector();
75: setPropertyList("ruleName", rules);
76: }
77:
78: /**
79: * Add a single value (or clear all values).
80: * @param rule
81: */
82: public void setRule(String rule) {
83: addValueToList("ruleName", rule);
84: }
85:
86: public String getApplyAll() {
87: return getProperty("applyAll");
88: }
89:
90: public void setApplyAll(String value) {
91: setProperty("applyAll", value);
92: }
93:
94: }
|