1 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 16 public class UIVisitedPages extends UIExoCommand { 17 final static public int DEFAULT_NUMBER = 5; 18 final static public String MORE_ACTION = "more" ; 19 final static public String 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 { 26 setId("UIVisitedPages"); 27 setRendererType("VisitedPagesRenderer"); 28 addActionListener(MoreActionListener.class, MORE_ACTION) ; 29 addActionListener(LessActionListener.class, LESS_ACTION) ; 30 } 31 32 public String 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 { 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 { 46 UIVisitedPages uiComponent =(UIVisitedPages)event.getSource() ; 47 uiComponent.numberOfPages_ = DEFAULT_NUMBER; 48 } 49 } 50 } 51 | Popular Tags |