View Javadoc
1   /*
2    * Copyright (C) 2003-2007 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (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 General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.ecm.webui.component.explorer.popup.info;
18  
19  import org.exoplatform.webui.application.WebuiRequestContext;
20  import org.exoplatform.webui.config.annotation.ComponentConfig;
21  import org.exoplatform.webui.config.annotation.EventConfig;
22  import org.exoplatform.webui.core.UIComponent;
23  import org.exoplatform.webui.core.UITabPane;
24  import org.exoplatform.webui.event.Event;
25  import org.exoplatform.webui.event.EventListener;
26  
27  /**
28   * Created by The eXo Platform SARL
29   * Author : Dang Van Minh
30   *          minh.dang@exoplatform.com
31   * Jan 25, 2007
32   * 1:59:57 PM
33   */
34  @ComponentConfig(
35                   template = "app:/groovy/webui/component/explorer/UIViewMetadataContainer.gtmpl",
36                   events = { @EventConfig(listeners = UIViewMetadataContainer.SelectTabActionListener.class)
37  })
38  public class UIViewMetadataContainer extends UITabPane {
39  
40    private boolean hasMoreOneMetaData;
41    
42    public UIViewMetadataContainer() throws Exception {
43    }
44    
45    /**
46     * @return the hasMoreOneMetaData
47     */
48    public boolean isHasMoreOneMetaData() {
49      return hasMoreOneMetaData;
50    }
51  
52    /**
53     * @param hasMoreOneMetaData the hasMoreOneMetaData to set
54     */
55    public void setHasMoreOneMetaData(boolean hasMoreOneMetaData) {
56      this.hasMoreOneMetaData = hasMoreOneMetaData;
57    }
58    
59    public static class SelectTabActionListener extends EventListener<UITabPane> {
60      public void execute(Event<UITabPane> event) throws Exception {
61        WebuiRequestContext context = event.getRequestContext();
62        String renderTab = context.getRequestParameter(UIComponent.OBJECTID);
63        if (renderTab == null)
64            return;
65        event.getSource().setSelectedTab(renderTab);
66        WebuiRequestContext parentContext = (WebuiRequestContext) context.getParentAppRequestContext();
67        if (parentContext != null) {
68            parentContext.setResponseComplete(true);
69        } else {
70            context.setResponseComplete(true);
71        }
72        
73        event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource());
74      }
75    }
76  }