View Javadoc
1   /**
2    * 
3    * Copyright (c) 2014, Openflexo
4    * 
5    * This file is part of Gina-swing-editor, a component of the software infrastructure 
6    * developed at Openflexo.
7    * 
8    * 
9    * Openflexo is dual-licensed under the European Union Public License (EUPL, either 
10   * version 1.1 of the License, or any later version ), which is available at 
11   * https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
12   * and the GNU General Public License (GPL, either version 3 of the License, or any 
13   * later version), which is available at http://www.gnu.org/licenses/gpl.html .
14   * 
15   * You can redistribute it and/or modify under the terms of either of these licenses
16   * 
17   * If you choose to redistribute it and/or modify under the terms of the GNU GPL, you
18   * must include the following additional permission.
19   *
20   *          Additional permission under GNU GPL version 3 section 7
21   *
22   *          If you modify this Program, or any covered work, by linking or 
23   *          combining it with software containing parts covered by the terms 
24   *          of EPL 1.0, the licensors of this Program grant you additional permission
25   *          to convey the resulting work. * 
26   * 
27   * This software is distributed in the hope that it will be useful, but WITHOUT ANY 
28   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
29   * PARTICULAR PURPOSE. 
30   *
31   * See http://www.openflexo.org/license.html for details.
32   * 
33   * 
34   * Please contact Openflexo (openflexo-contacts@openflexo.org)
35   * or visit www.openflexo.org if you need additional information.
36   * 
37   */
38  
39  package org.openflexo.gina.swing.editor.widget;
40  
41  import java.util.logging.Logger;
42  
43  import org.openflexo.gina.ApplicationFIBLibrary.ApplicationFIBLibraryImpl;
44  import org.openflexo.gina.FIBLibrary;
45  import org.openflexo.gina.model.FIBComponent;
46  import org.openflexo.gina.swing.utils.FIBJPanel;
47  import org.openflexo.localization.FlexoLocalization;
48  import org.openflexo.localization.LocalizedDelegate;
49  import org.openflexo.rm.Resource;
50  import org.openflexo.rm.ResourceLocator;
51  
52  /**
53   * Browser for FIBEditor elements
54   * 
55   * @author sylvain
56   * 
57   */
58  @SuppressWarnings("serial")
59  public class FIBLibraryBrowser extends FIBJPanel<FIBLibrary> {
60  
61  	protected static final Logger logger = Logger.getLogger(FIBLibraryBrowser.class.getPackage().getName());
62  
63  	public static Resource FIB_FILE = ResourceLocator.locateResource("Fib/FIBLibraryBrowser.fib");
64  
65  	public FIBLibraryBrowser(FIBLibrary fibLibrary) {
66  		super(FIB_FILE, fibLibrary, ApplicationFIBLibraryImpl.instance(), FlexoLocalization.getMainLocalizer());
67  	}
68  
69  	@Override
70  	protected LibraryBrowserFIBController makeFIBController(FIBComponent fibComponent, LocalizedDelegate parentLocalizer) {
71  		LibraryBrowserFIBController returned = new LibraryBrowserFIBController(fibComponent);
72  		returned.setFIBLibraryBrowser(this);
73  		return returned;
74  	}
75  
76  	@Override
77  	public LibraryBrowserFIBController getController() {
78  		return (LibraryBrowserFIBController) super.getController();
79  	}
80  
81  	@Override
82  	public Class<FIBLibrary> getRepresentedType() {
83  		return FIBLibrary.class;
84  	}
85  
86  	@Override
87  	public void delete() {
88  	}
89  
90  	private Resource selectedComponentResource;
91  
92  	public Resource getSelectedComponentResource() {
93  		return selectedComponentResource;
94  	}
95  
96  	public void setSelectedComponentResource(Resource selectedComponentResource) {
97  		logger.info(">>>>setSelectedComponentResource with " + selectedComponentResource);
98  		this.selectedComponentResource = selectedComponentResource;
99  	}
100 
101 	public void doubleClickOnComponentResource(Resource selectedComponentResource) {
102 		setSelectedComponentResource(selectedComponentResource);
103 		logger.info(">>>>doubleClickOnComponentResource with " + selectedComponentResource);
104 	}
105 
106 }