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: import java.util.StringTokenizer;
011:
012: import com.sun.portal.search.util.SearchConfig;
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.IPlanetButton;
035: import com.sun.portal.search.admin.model.ReindexModel;
036:
037: public class RunTaxonomyReindexViewBean extends CSViewBeanBase {
038: public static final String DEFAULT_DISPLAY_URL = "/ps/searchadmin/RunTaxonomyReindex.jsp";
039: public static final String PAGE_NAME = "RunTaxonomyReindex";
040: public static final String CHILD_PROGRESS_TEXT = "ProgressText";
041: public static final String CHILD_CLOSEBUTTON = "CloseButton";
042: public static final String CHILD_ACTION_TEXT = "Action";
043:
044: private String action = null;
045: ReindexModel model = null;
046:
047: /**
048: * constructor
049: *
050: * @param PageName of this view bean
051: * @param displayURL default display URL
052: */
053: public RunTaxonomyReindexViewBean() {
054: super (PAGE_NAME);
055: setDefaultDisplayURL(DEFAULT_DISPLAY_URL);
056: registerChildren();
057: }
058:
059: /**
060: * register child component
061: */
062: protected void registerChildren() {
063: registerChild(CHILD_PROGRESS_TEXT, StaticTextField.class);
064: registerChild(CHILD_CLOSEBUTTON, IPlanetButton.class);
065: registerChild(CHILD_ACTION_TEXT, StaticTextField.class);
066:
067: }
068:
069: /**
070: * create child component
071: *
072: * @param name of component
073: * @return child component
074: */
075: protected View createChild(String name) {
076: View Headerchild = super .createChild(name);
077: if (Headerchild != null)
078: return Headerchild;
079: if (name.equals(CHILD_PROGRESS_TEXT)) {
080: return new StaticTextField(this , CHILD_PROGRESS_TEXT, "");
081: }
082: if (name.equals(CHILD_ACTION_TEXT)) {
083: return new StaticTextField(this , CHILD_ACTION_TEXT, "");
084: }
085: if (name.equals(CHILD_CLOSEBUTTON)) {
086: return new IPlanetButton(this , CHILD_CLOSEBUTTON, "");
087: }
088: throw new IllegalArgumentException("Invalid child name ["
089: + name + "]");
090: }
091:
092: public void beginDisplay(DisplayEvent event) {
093: setPageEncoding();
094: setDisplayFieldValue(CHILD_ACTION_TEXT,
095: getLocalizedString("category.reindex.title"));
096: setDisplayFieldValue(CHILD_CLOSEBUTTON,
097: getLocalizedString("close.text"));
098: }
099:
100: public boolean beginProgressTextDisplay(ChildDisplayEvent event)
101: throws IOException {
102: JspWriter out = ((JspChildDisplayEvent) event).getPageContext()
103: .getOut();
104: out.println("<pre>");
105: ReindexModel model = getModel();
106: model.purgeSecString = getLocalizedString("category.reindex.status1");
107: model.reindexSecString = getLocalizedString("category.reindex.status2");
108: model.indexCategories(out);
109: return true;
110: }
111:
112: protected ReindexModel getModel() {
113: if (model == null) {
114: model = new ReindexModel();
115: }
116: return model;
117: }
118:
119: }
|