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.cli.RunImportAgent;
013:
014: import javax.servlet.http.HttpServletRequest;
015: import javax.servlet.http.HttpServletResponse;
016: import javax.servlet.jsp.JspWriter;
017: import com.iplanet.jato.RequestContext;
018:
019: import com.iplanet.jato.view.event.DisplayEvent;
020: import com.iplanet.jato.view.event.ChildDisplayEvent;
021: import com.iplanet.jato.view.event.JspChildDisplayEvent;
022: import com.iplanet.jato.view.event.RequestInvocationEvent;
023:
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.*;
033:
034: //import com.iplanet.am.console.components.view.html.ParentagePath;
035: import com.iplanet.am.console.components.view.html.IPlanetButton;
036:
037: //import com.sun.portal.search.admin.model.PropertiesModel;
038: //import com.sun.portal.search.admin.model.PropertiesModelImpl;
039:
040: /**
041: * iPS admin console view bean: TODO
042: */
043: public class RunImportViewBean extends CSViewBeanBase {
044: public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/RunImport.jsp";
045: public static final String PAGE_NAME = "RunImport";
046: public static final String PROGRESS_TEXT = "ProgressText";
047: public static final String CLOSE_BUTTON = "CloseButton";
048:
049: /**
050: * constructor
051: *
052: * @param PageName of this view bean
053: * @param displayURL default display URL
054: */
055: public RunImportViewBean() {
056: super (PAGE_NAME);
057: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
058: registerChildren();
059: }
060:
061: /**
062: * register child component
063: */
064: protected void registerChildren() {
065: registerChild(PROGRESS_TEXT, StaticTextField.class);
066: registerChild(CLOSE_BUTTON, IPlanetButton.class);
067:
068: }
069:
070: /**
071: * create child component
072: *
073: * @param name of component
074: * @return child component
075: */
076: protected View createChild(String name) {
077: View Headerchild = super .createChild(name);
078: if (Headerchild != null)
079: return Headerchild;
080: if (name.equals(PROGRESS_TEXT)) {
081: return new StaticTextField(this , PROGRESS_TEXT, "");
082: }
083: if (name.equals(CLOSE_BUTTON)) {
084: return new IPlanetButton(this , CLOSE_BUTTON, "");
085: }
086: throw new IllegalArgumentException("Invalid child name ["
087: + name + "]");
088: }
089:
090: public void beginDisplay(DisplayEvent event) {
091: setPageEncoding();
092: setDisplayFieldValue(CLOSE_BUTTON,
093: getLocalizedString("close.text"));
094: }
095:
096: public boolean beginProgressTextDisplay(ChildDisplayEvent event)
097: throws IOException {
098: RunImportAgent runImp = new RunImportAgent(null, null, null,
099: null, null, null);
100: // This demonstates how to use the supplied display event to output
101: // directly to the JSP output stream
102: JspWriter out = ((JspChildDisplayEvent) event).getPageContext()
103: .getOut();
104: out.println("<pre>");
105: runImp.run(out);
106: out.println("</pre>");
107: return true;
108: }
109:
110: }
|