001: /*
002: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005:
006: package com.sun.portal.search.admin;
007:
008: import java.lang.*;
009:
010: import javax.servlet.*;
011: import javax.servlet.http.*;
012:
013: import com.iplanet.jato.RequestContext;
014: import com.iplanet.jato.RequestHandler;
015:
016: import com.iplanet.jato.view.event.DisplayEvent;
017: import com.iplanet.jato.view.event.RequestInvocationEvent;
018:
019: import com.iplanet.jato.view.html.OptionList;
020: import com.iplanet.jato.view.html.Option;
021: import com.iplanet.jato.view.html.CheckBox;
022: import com.iplanet.jato.view.html.TextField;
023: import com.iplanet.jato.view.html.ListBox;
024: import com.iplanet.jato.view.html.StaticTextField;
025:
026: import com.iplanet.jato.view.View;
027: import com.iplanet.jato.view.ViewBean;
028: import com.iplanet.jato.view.ViewBeanBase;
029:
030: import com.iplanet.jato.ViewBeanManager;
031:
032: import com.iplanet.jato.model.ModelControlException;
033:
034: import com.iplanet.am.console.components.view.html.IPlanetButton;
035:
036: /**
037: */
038:
039: public class ExpireViewBean extends CSViewBeanBase implements
040: RequestHandler {
041:
042: // The "logical" name for this page.
043: public static final String PAGE_NAME = "Expire";
044: public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/Expire.jsp";
045:
046: // String constants for child field names. This is simply good coding practice
047: // to minimize use of string literals.
048: public static final String CHK_Expire = "Expire";
049: public static final String BTN_OK = "ok";
050:
051: /*
052: * Default constructor
053: *
054: */
055: public ExpireViewBean() {
056: super (PAGE_NAME);
057: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
058: registerChildren();
059: }
060:
061: /**
062: * Child methods
063: */
064: protected void registerChildren() {
065: // Add an entry for each child. Note, the children are not instantiated
066: // at this time. Instead, child instantiation is handled in a lazy fashion.
067:
068: registerChild(CHK_Expire, CheckBox.class);
069: registerChild(BTN_OK, IPlanetButton.class);
070: }
071:
072: protected View createChild(String name) {
073: // Create HeaderView Child
074: View child = super .createChild(name);
075: if (child != null) {
076: return child;
077:
078: } else if (name.equals(BTN_OK)) {
079: return new IPlanetButton(this , BTN_OK, "");
080: } else if (name.equals(CHK_Expire)) {
081: return new CheckBox(this , CHK_Expire, "true", "false",
082: false);
083: } else
084: throw new IllegalArgumentException("Invalid child name \""
085: + name + "\"");
086: }
087:
088: /*
089: * Begin displaying page. we set the required information
090: * @param event display event
091: * @throws ModelControlException if problem access value of component
092: **/
093: public void beginDisplay(DisplayEvent event)
094: throws ModelControlException {
095: setPageEncoding();
096: setDisplayFieldValue(BTN_OK, getLocalizedString("ok.text"));
097:
098: }
099:
100: /*
101: * Request event handler methods - for button and HREF fields
102: *
103: */
104: public void handleOkRequest(RequestInvocationEvent event)
105: throws ServletException {
106:
107: if (!getDisplayFieldBooleanValue(CHK_Expire)) {
108: forwardTo();
109: return;
110: }
111:
112: forwardTo();
113: }
114:
115: }
|