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: import java.util.logging.Logger;
010:
011: import javax.servlet.*;
012: import javax.servlet.http.*;
013:
014: import com.iplanet.jato.RequestContext;
015: import com.iplanet.jato.RequestHandler;
016:
017: import com.iplanet.jato.view.event.DisplayEvent;
018: import com.iplanet.jato.view.event.RequestInvocationEvent;
019:
020: import com.iplanet.jato.view.html.OptionList;
021: import com.iplanet.jato.view.html.Option;
022: import com.iplanet.jato.view.html.CheckBox;
023: import com.iplanet.jato.view.html.TextField;
024: import com.iplanet.jato.view.html.ListBox;
025: import com.iplanet.jato.view.html.StaticTextField;
026:
027: import com.iplanet.jato.view.View;
028: import com.iplanet.jato.view.ViewBean;
029: import com.iplanet.jato.view.ViewBeanBase;
030:
031: import com.iplanet.jato.ViewBeanManager;
032:
033: import com.iplanet.jato.model.ModelControlException;
034:
035: import com.iplanet.am.console.components.view.html.IPlanetButton;
036:
037: import com.sun.portal.search.admin.model.*;
038: import com.sun.portal.search.admin.*;
039: import com.sun.portal.log.common.PortalLogger;
040:
041: /**
042: * It extends from <code>CSViewBeanBase</code>.
043: */
044:
045: public class PartitionViewBean extends CSViewBeanBase implements
046: RequestHandler {
047:
048: // The "logical" name for this page.
049: public static final String PAGE_NAME = "Partition";
050: public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/Partition.jsp";
051:
052: public static final String FLD_LOCATION1 = "location1";
053: public static final String FLD_LOCATION2 = "location2";
054: public static final String BTN_UPDATE = "update";
055: public static final String BTN_ADD = "add";
056: public static final String BTN_OK = "ok";
057: public static final String BTN_RESET = "reset";
058:
059: private PartitionModel model;
060:
061: // Create a Logger for this class
062: private static Logger debugLogger = PortalLogger
063: .getLogger(PartitionViewBean.class);
064:
065: /*
066: * Default constructor
067: *
068: */
069: public PartitionViewBean() {
070: super (PAGE_NAME);
071: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
072: registerChildren();
073: }
074:
075: /**
076: * Child methods
077: */
078: protected void registerChildren() {
079: // Add an entry for each child. Note, the children are not instantiated
080: // at this time. Instead, child instantiation is handled in a lazy fashion.
081: registerChild(FLD_LOCATION1, TextField.class);
082: registerChild(FLD_LOCATION2, TextField.class);
083: registerChild(BTN_UPDATE, IPlanetButton.class);
084: registerChild(BTN_ADD, IPlanetButton.class);
085: registerChild(BTN_OK, IPlanetButton.class);
086: registerChild(BTN_RESET, IPlanetButton.class);
087: }
088:
089: protected View createChild(String name) {
090: // Create HeaderView Child
091: View child = super .createChild(name);
092:
093: if (child != null) {
094: return child;
095:
096: } else if (name.equals(BTN_ADD)) {
097: return new IPlanetButton(this , BTN_ADD, "Add Partition");
098:
099: } else if (name.equals(BTN_UPDATE)) {
100: return new IPlanetButton(this , BTN_UPDATE,
101: "Update Partitions");
102:
103: } else if (name.equals(BTN_OK)) {
104: return new IPlanetButton(this , BTN_OK, "OK");
105:
106: } else if (name.equals(BTN_RESET)) {
107: return new IPlanetButton(this , BTN_RESET, "Reset");
108:
109: } else if (name.equals(FLD_LOCATION1)) {
110: return new TextField(this , FLD_LOCATION1, "");
111:
112: } else if (name.equals(FLD_LOCATION2)) {
113: return new TextField(this , FLD_LOCATION2, "");
114: } else
115: throw new IllegalArgumentException("Invalid child name \""
116: + name + "\"");
117: }
118:
119: /*
120: * Begin displaying page. we set the required information
121: * @param event display event
122: * @throws ModelControlException if problem access value of component
123: **/
124: public void beginDisplay(DisplayEvent event)
125: throws ModelControlException {
126: setPageEncoding();
127: }
128:
129: public void handleAddRequest(RequestInvocationEvent event) {
130: forwardTo();
131: }
132:
133: public void handleUpdateRequest(RequestInvocationEvent event) {
134: forwardTo();
135: }
136:
137: public void handleOkRequest(RequestInvocationEvent event) {
138: forwardTo();
139: }
140:
141: public void handleResetRequest(RequestInvocationEvent event) {
142: forwardTo();
143: }
144:
145: public PartitionModel getModel() {
146: if (model == null) {
147: debugLogger.finer("PSSH_CSPSA0067");
148: model = new PartitionModel();
149: }
150: return model;
151: }
152:
153: }
|