KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > nav > component > UIVisitedPages


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.portlets.nav.component;
6
7 import org.exoplatform.faces.core.component.UIExoCommand;
8 import org.exoplatform.faces.core.component.model.Parameter;
9 import org.exoplatform.faces.core.event.ExoActionEvent;
10 import org.exoplatform.faces.core.event.ExoActionListener;
11 /**
12  * Created y the eXo platform team
13  * User: Benjamin Mestrallet
14  * Date: 31 aug 2004
15  */

16 public class UIVisitedPages extends UIExoCommand {
17   final static public int DEFAULT_NUMBER = 5;
18   final static public String JavaDoc MORE_ACTION = "more" ;
19   final static public String JavaDoc LESS_ACTION = "less" ;
20   final static public Parameter[] moreParams = {new Parameter(ACTION, MORE_ACTION) };
21   final static public Parameter[] lessParams = {new Parameter(ACTION, LESS_ACTION) };
22   
23   private int numberOfPages_ = DEFAULT_NUMBER ;
24   
25     public UIVisitedPages() throws Exception JavaDoc {
26         setId("UIVisitedPages");
27         setRendererType("VisitedPagesRenderer");
28     addActionListener(MoreActionListener.class, MORE_ACTION) ;
29     addActionListener(LessActionListener.class, LESS_ACTION) ;
30     }
31
32   public String JavaDoc getFamily( ) { return "org.exoplatform.portlets.nav.component.UIVisitedPages" ; }
33
34   public int getNumberOfPages() { return numberOfPages_ ; }
35   
36   
37   static public class MoreActionListener extends ExoActionListener {
38     public void execute(ExoActionEvent event) throws Exception JavaDoc {
39       UIVisitedPages uiComponent =(UIVisitedPages)event.getSource() ;
40       uiComponent.numberOfPages_ = -1 ;
41     }
42   }
43   
44   static public class LessActionListener extends ExoActionListener {
45     public void execute(ExoActionEvent event) throws Exception JavaDoc {
46       UIVisitedPages uiComponent =(UIVisitedPages)event.getSource() ;
47       uiComponent.numberOfPages_ = DEFAULT_NUMBER;
48     }
49   }
50 }
51
Popular Tags