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.net.URL;
009: import java.io.*;
010:
011: import com.sun.portal.search.admin.CSViewBeanBase;
012: import com.sun.portal.search.admin.model.ScheduleModel;
013: import com.sun.portal.search.admin.cli.CronController;
014:
015: import javax.servlet.http.HttpServletRequest;
016: import javax.servlet.http.HttpServletResponse;
017:
018: import com.iplanet.jato.RequestContext;
019:
020: import com.iplanet.jato.view.event.DisplayEvent;
021: import com.iplanet.jato.view.event.ChildDisplayEvent;
022: import com.iplanet.jato.view.event.RequestInvocationEvent;
023:
024: import com.iplanet.jato.view.html.StaticTextField;
025: import com.iplanet.jato.view.html.TextField;
026: import com.iplanet.jato.view.html.CheckBox;
027: import com.iplanet.jato.view.html.Button;
028: import com.iplanet.jato.view.html.ComboBox;
029: import com.iplanet.jato.view.html.RadioButtonGroup;
030:
031: import com.iplanet.jato.view.html.Option;
032: import com.iplanet.jato.view.html.OptionList;
033:
034: import com.iplanet.jato.view.View;
035: import com.iplanet.jato.view.ViewBean;
036: import com.iplanet.jato.view.ViewBeanBase;
037:
038: import com.iplanet.jato.ViewBeanManager;
039:
040: import com.iplanet.jato.model.*;
041:
042: import com.iplanet.am.console.components.view.html.IPlanetButton;
043:
044: /**
045: * iPS admin console view bean: TODO
046: */
047: public class RobotScheduleViewBean extends CSViewBeanBase {
048: public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/RobotSchedule.jsp";
049: public static final String PAGE_NAME = "RobotSchedule";
050: public static final String START_VIEW = "StartRobot";
051: public static final String STOP_VIEW = "StopRobot";
052: public static final String SUBMIT_BUTTON = "SubmitButton";
053: public static final String RESET_BUTTON = "ResetButton";
054:
055: /**
056: * constructor
057: *
058: * @param PageName of this view bean
059: * @param displayURL default display URL
060: */
061: public RobotScheduleViewBean() {
062: super (PAGE_NAME);
063: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
064: registerChildren();
065: }
066:
067: /**
068: * register child component
069: */
070: protected void registerChildren() {
071: registerChild(SUBMIT_BUTTON, IPlanetButton.class);
072: registerChild(RESET_BUTTON, IPlanetButton.class);
073: registerChild(START_VIEW, ScheduleView.class);
074: registerChild(STOP_VIEW, ScheduleView.class);
075: }
076:
077: /**
078: * create child component
079: *
080: * @param name of component
081: * @return child component
082: */
083: protected View createChild(String name) {
084: View Headerchild = super .createChild(name);
085: if (Headerchild != null)
086: return Headerchild;
087: if (name.equals(SUBMIT_BUTTON)) {
088: return new IPlanetButton(this , SUBMIT_BUTTON, "");
089: }
090: if (name.equals(RESET_BUTTON)) {
091: return new IPlanetButton(this , RESET_BUTTON, "");
092: }
093: if (name.equals(START_VIEW)) {
094: return new ScheduleView(this , START_VIEW);
095: }
096: if (name.equals(STOP_VIEW)) {
097: return new ScheduleView(this , STOP_VIEW);
098: }
099:
100: throw new IllegalArgumentException("Invalid child name ["
101: + name + "]");
102: }
103:
104: /** begin displaying page. we set the required information
105: *
106: * @param event display event
107: * @throws ModelControlException if problem access value of component
108: */
109: public void beginDisplay(DisplayEvent event) {
110: setPageEncoding();
111: setDisplayFieldValue(SUBMIT_BUTTON,
112: getLocalizedString("submit.text"));
113: setDisplayFieldValue(RESET_BUTTON,
114: getLocalizedString("reset.text"));
115:
116: }
117:
118: public void handleSubmitButtonRequest(RequestInvocationEvent event) {
119:
120: ScheduleView child = (ScheduleView) getChild(this .START_VIEW);
121: child.store();
122: child = (ScheduleView) getChild(this .STOP_VIEW);
123: child.store();
124: forwardTo();
125: }
126:
127: public void handleResetButtonRequest(RequestInvocationEvent event) {
128:
129: ScheduleView child = (ScheduleView) getChild(this .START_VIEW);
130: child.reset();
131: child = (ScheduleView) getChild(this.STOP_VIEW);
132: child.reset();
133: forwardTo();
134: }
135:
136: }
|