update copyright
[fedora-idea.git] / plugins / ui-designer / src / com / intellij / uiDesigner / propertyInspector / properties / IntroEnumProperty.java
blob7e91ccc40eadc02653e04de8d4615bb9d8c992fe
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.intellij.uiDesigner.propertyInspector.properties;
19 import com.intellij.uiDesigner.propertyInspector.IntrospectedProperty;
20 import com.intellij.uiDesigner.propertyInspector.PropertyEditor;
21 import com.intellij.uiDesigner.propertyInspector.PropertyRenderer;
22 import com.intellij.uiDesigner.propertyInspector.editors.EnumEditor;
23 import com.intellij.uiDesigner.propertyInspector.renderers.LabelPropertyRenderer;
24 import org.jetbrains.annotations.NotNull;
26 import java.lang.reflect.Method;
28 /**
29 * @author yole
31 public class IntroEnumProperty extends IntrospectedProperty<Enum> {
32 private final Class myEnumClass;
33 private LabelPropertyRenderer<Enum> myRenderer;
34 private EnumEditor myEditor;
36 public IntroEnumProperty(final String name, final Method readMethod, final Method writeMethod, final boolean storeAsClient,
37 Class enumClass) {
38 super(name, readMethod, writeMethod, storeAsClient);
39 myEnumClass = enumClass;
42 @NotNull
43 public PropertyRenderer<Enum> getRenderer() {
44 if (myRenderer == null) {
45 myRenderer = new LabelPropertyRenderer<Enum>();
47 return myRenderer;
50 public PropertyEditor<Enum> getEditor() {
51 if (myEditor == null) {
52 myEditor = new EnumEditor(myEnumClass);
54 return myEditor;