View Javadoc
1   /*
2    * Copyright (C) 2003-2012 eXo Platform SAS.
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU Affero General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU Affero General Public License for more details.
13   *
14   * You should have received a copy of the GNU Affero General Public License
15   * along with this program. If not, see <http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.wcm.webui.authoring;
18  
19  import java.util.List;
20  
21  import javax.jcr.Node;
22  
23  import org.exoplatform.ecm.webui.utils.Utils;
24  import org.exoplatform.services.wcm.core.NodeLocation;
25  import org.exoplatform.webui.config.annotation.ComponentConfig;
26  import org.exoplatform.webui.config.annotation.ComponentConfigs;
27  import org.exoplatform.webui.config.annotation.EventConfig;
28  import org.exoplatform.webui.core.UIContainer;
29  import org.exoplatform.webui.core.UIPageIterator;
30  import org.exoplatform.webui.core.lifecycle.Lifecycle;
31  
32  /**
33   * Created by The eXo Platform SAS
34   * Author : eXoPlatform
35   *          exo@exoplatform.com
36   * Aug 22, 2012  
37   */
38  
39  @ComponentConfigs( {
40    @ComponentConfig(lifecycle = Lifecycle.class, 
41                     template = "app:/groovy/authoring/UIDashboardColumn.gtmpl", 
42                     events = {
43        @EventConfig(listeners = UIDashboardForm.ShowDocumentActionListener.class),
44        @EventConfig(listeners = UIDashboardForm.RefreshActionListener.class) }),
45    @ComponentConfig(type = UIPageIterator.class,
46                     template = "app:/groovy/authoring/UIDashBoardColumnIterator.gtmpl",
47                     events = {@EventConfig(listeners = UIPageIterator.ShowPageActionListener.class)})
48  })
49  public class UIDashBoardColumn extends UIContainer {
50  
51    private static final String locale = "locale.portlet.AuthoringDashboard.AuthoringDashboardPortlet";
52    
53    private UIPageIterator uiPageIterator_;
54    private String label_;
55    
56    public UIDashBoardColumn() throws Exception {
57      uiPageIterator_ = addChild(UIPageIterator.class, null, "UIDashboardColumnIterator" + Math.random());
58    }
59    
60    public UIPageIterator getUIPageIterator() {
61      return uiPageIterator_;
62    }
63    
64    public List<Node> getNodes() throws Exception {
65      return NodeLocation.getNodeListByLocationList(uiPageIterator_.getCurrentPageData());
66    }
67    
68    public void setLabel(String value) {
69      label_ = Utils.getResourceBundle(locale,
70                                       value,
71                                       this.getClass().getClassLoader());
72    }
73    
74    public String getLabel() {
75      return label_;
76    }
77  }