KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > component > UISearchForm


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.portal.faces.component;
6
7 import java.util.ArrayList JavaDoc;
8 import java.util.List JavaDoc;
9 import org.exoplatform.faces.core.component.UISelectBox;
10 import org.exoplatform.faces.core.component.UISimpleForm;
11 import org.exoplatform.faces.core.component.UIStringInput;
12 import org.exoplatform.faces.core.component.model.*;
13 import org.exoplatform.faces.core.event.ExoActionEvent;
14 import org.exoplatform.faces.core.event.ExoActionListener;
15
16 /**
17  * Sat, Jan 03, 2004 @ 11:16
18  * @author: Tuan Nguyen
19  * @email: tuan08@users.sourceforge.net
20  * @version: $Id: UISearchForm.java,v 1.4 2004/09/29 17:44:51 benjmestrallet Exp $
21  */

22 public class UISearchForm extends UISimpleForm {
23   private static List JavaDoc PERMISSIONS ;
24   static {
25     PERMISSIONS = new ArrayList JavaDoc(10) ;
26     PERMISSIONS.add(new SelectItem("All", "")) ;
27     PERMISSIONS.add(new SelectItem("owner", "owner")) ;
28     PERMISSIONS.add(new SelectItem("any", "any")) ;
29   }
30   
31   private UIStringInput ownerInput_ ;
32   private UISelectBox viewPermissionInput_ ;
33   private UISelectBox editPermissionInput_ ;
34
35   public UISearchForm() {
36     super("searchForm", "post", null) ;
37     setId("UISearchForm");
38     ownerInput_ = new UIStringInput("owner", "") ;
39     viewPermissionInput_ = new UISelectBox("viewPermission","" , PERMISSIONS) ;
40     editPermissionInput_ = new UISelectBox("editPermission","" , PERMISSIONS) ;
41     add(new Row().
42         add(new LabelCell("#{UISearchForm.label.owner}")).
43         add(new ComponentCell(this, ownerInput_))) ;
44     add(new Row().
45         add(new LabelCell("#{UISearchForm.label.view-permission}")).
46         add(new ComponentCell(this, viewPermissionInput_))) ;
47     add(new Row().
48         add(new LabelCell("#{UISearchForm.label.edit-permission}")).
49         add(new ComponentCell(this, editPermissionInput_))) ;
50     add(new Row().
51         add(new ListComponentCell().
52             add(new FormButton("#{UISearchForm.button.search}", "searchPages")).
53             addColspan("2").addAlign("center"))) ;
54     
55     addActionListener(SearchPagesActionListener.class, "searchPages") ;
56   }
57   
58   public String JavaDoc getOwner() { return ownerInput_.getValue() ;}
59   public void setOwner(String JavaDoc owner) { ownerInput_.setValue(owner) ;}
60   
61   public String JavaDoc getViewPermission() { return viewPermissionInput_.getValue() ;}
62   public void setViewPermission(String JavaDoc s) { viewPermissionInput_.setValue(s) ;}
63   
64   public String JavaDoc getEditPermission() { return editPermissionInput_.getValue() ;}
65   public void setEditPermission(String JavaDoc s) { editPermissionInput_.setValue(s) ;}
66   
67   static public class SearchPagesActionListener extends ExoActionListener {
68         public void execute(ExoActionEvent event) throws Exception JavaDoc {
69           UISearchForm uiForm = (UISearchForm) event.getSource() ;
70           UIPageList uiList = (UIPageList) uiForm.getParent();
71       uiList.queryDescriptions(uiForm.ownerInput_.getValue(),
72                                uiForm.viewPermissionInput_.getValue(),
73                                uiForm.editPermissionInput_.getValue()) ;
74         }
75   }
76  
77 }
Popular Tags