update copyright
[fedora-idea.git] / plugins / ui-designer / src / com / intellij / uiDesigner / propertyInspector / properties / IntroRectangleProperty.java
blob50673cfcd1feb29f0561a7266ce69736a4e4c952
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.
16 package com.intellij.uiDesigner.propertyInspector.properties;
18 import com.intellij.uiDesigner.XmlWriter;
19 import com.intellij.uiDesigner.propertyInspector.IntrospectedProperty;
20 import com.intellij.uiDesigner.propertyInspector.Property;
21 import com.intellij.uiDesigner.propertyInspector.PropertyEditor;
22 import com.intellij.uiDesigner.propertyInspector.PropertyRenderer;
23 import com.intellij.uiDesigner.propertyInspector.editors.IntRegexEditor;
24 import com.intellij.uiDesigner.propertyInspector.renderers.RectangleRenderer;
25 import com.intellij.uiDesigner.radComponents.RadComponent;
26 import org.jetbrains.annotations.NotNull;
28 import java.awt.Rectangle;
29 import java.lang.reflect.Method;
31 /**
32 * @author Anton Katilin
33 * @author Vladimir Kondratyev
35 public final class IntroRectangleProperty extends IntrospectedProperty<Rectangle> {
36 private final RectangleRenderer myRenderer;
37 private final Property[] myChildren;
38 private final IntRegexEditor<Rectangle> myEditor;
40 public IntroRectangleProperty(final String name, final Method readMethod, final Method writeMethod, final boolean storeAsClient){
41 super(name, readMethod, writeMethod, storeAsClient);
42 myRenderer=new RectangleRenderer();
43 myChildren=new Property[]{
44 new IntFieldProperty(this, "x", Integer.MIN_VALUE, new Rectangle(0, 0, 0, 0)),
45 new IntFieldProperty(this, "y", Integer.MIN_VALUE, new Rectangle(0, 0, 0, 0)),
46 new IntFieldProperty(this, "width", 0, new Rectangle(0, 0, 0, 0)),
47 new IntFieldProperty(this, "height", 0, new Rectangle(0, 0, 0, 0)),
49 myEditor = new IntRegexEditor<Rectangle>(Rectangle.class, myRenderer, new int[] { Integer.MIN_VALUE, Integer.MIN_VALUE, 0, 0 });
52 public void write(final Rectangle value,final XmlWriter writer){
53 writer.addAttribute("x",value.x);
54 writer.addAttribute("y",value.y);
55 writer.addAttribute("width",value.width);
56 writer.addAttribute("height",value.height);
59 @NotNull
60 public Property[] getChildren(final RadComponent component){
61 return myChildren;
64 @NotNull
65 public PropertyRenderer<Rectangle> getRenderer() {
66 return myRenderer;
69 public PropertyEditor<Rectangle> getEditor() {
70 return myEditor;