View Javadoc
1   /**
2    * 
3    * Copyright (c) 2013-2014, Openflexo
4    * Copyright (c) 2011-2012, AgileBirds
5    * 
6    * This file is part of Gina-swing-editor, a component of the software infrastructure 
7    * developed at Openflexo.
8    * 
9    * 
10   * Openflexo is dual-licensed under the European Union Public License (EUPL, either 
11   * version 1.1 of the License, or any later version ), which is available at 
12   * https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
13   * and the GNU General Public License (GPL, either version 3 of the License, or any 
14   * later version), which is available at http://www.gnu.org/licenses/gpl.html .
15   * 
16   * You can redistribute it and/or modify under the terms of either of these licenses
17   * 
18   * If you choose to redistribute it and/or modify under the terms of the GNU GPL, you
19   * must include the following additional permission.
20   *
21   *          Additional permission under GNU GPL version 3 section 7
22   *
23   *          If you modify this Program, or any covered work, by linking or 
24   *          combining it with software containing parts covered by the terms 
25   *          of EPL 1.0, the licensors of this Program grant you additional permission
26   *          to convey the resulting work. * 
27   * 
28   * This software is distributed in the hope that it will be useful, but WITHOUT ANY 
29   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
30   * PARTICULAR PURPOSE. 
31   *
32   * See http://www.openflexo.org/license.html for details.
33   * 
34   * 
35   * Please contact Openflexo (openflexo-contacts@openflexo.org)
36   * or visit www.openflexo.org if you need additional information.
37   * 
38   */
39  
40  package org.openflexo.gina.swing.editor.view.widget;
41  
42  import java.util.logging.Logger;
43  
44  import javax.swing.JComponent;
45  
46  import org.openflexo.gina.model.widget.FIBRadioButtonList;
47  import org.openflexo.gina.swing.editor.controller.FIBEditorController;
48  import org.openflexo.gina.swing.editor.view.FIBSwingEditableView;
49  import org.openflexo.gina.swing.editor.view.FIBSwingEditableViewDelegate;
50  import org.openflexo.gina.swing.view.widget.JFIBRadioButtonListWidget;
51  import org.openflexo.gina.swing.view.widget.JFIBRadioButtonListWidget.JRadioButtonPanel;
52  import org.openflexo.logging.FlexoLogger;
53  
54  public class JFIBEditableRadioButtonListWidget<T> extends JFIBRadioButtonListWidget<T>
55  		implements FIBSwingEditableView<FIBRadioButtonList, JRadioButtonPanel<T>> {
56  
57  	@SuppressWarnings("unused")
58  	private static final Logger logger = FlexoLogger.getLogger(JFIBEditableRadioButtonListWidget.class.getPackage().getName());
59  
60  	private final FIBSwingEditableViewDelegate<FIBRadioButtonList, JRadioButtonPanel<T>> delegate;
61  
62  	private final FIBEditorController editorController;
63  
64  	@Override
65  	public JComponent getDraggableComponent() {
66  		return getTechnologyComponent();
67  	}
68  
69  	@Override
70  	public FIBEditorController getEditorController() {
71  		return editorController;
72  	}
73  
74  	public JFIBEditableRadioButtonListWidget(FIBRadioButtonList model, FIBEditorController editorController) {
75  		super(model, editorController.getController());
76  		this.editorController = editorController;
77  
78  		delegate = new FIBSwingEditableViewDelegate<>(this);
79  	}
80  
81  	@Override
82  	public synchronized void delete() {
83  		delegate.delete();
84  		super.delete();
85  	}
86  
87  	@Override
88  	public FIBSwingEditableViewDelegate<FIBRadioButtonList, JRadioButtonPanel<T>> getDelegate() {
89  		return delegate;
90  	}
91  
92  	private boolean operatorContentsStart = false;
93  
94  	// TODO: avoid code duplication in FIBSwingEditableView
95  	@Override
96  	public boolean isOperatorContentsStart() {
97  		return operatorContentsStart;
98  	}
99  
100 	// TODO: avoid code duplication in FIBSwingEditableView
101 	@Override
102 	public void setOperatorContentsStart(boolean operatorContentsStart) {
103 		if (operatorContentsStart != this.operatorContentsStart) {
104 			this.operatorContentsStart = operatorContentsStart;
105 			FIBSwingEditableView.updateOperatorContentsStart(this, operatorContentsStart);
106 			getPropertyChangeSupport().firePropertyChange("operatorContentsStart", !operatorContentsStart, operatorContentsStart);
107 		}
108 	}
109 
110 }