From d44ec23a574e9bd740196eafcbf03bd068661aa7 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Thu, 5 Apr 2012 15:49:09 +0400 Subject: [PATCH] Properties --- .../designer/model/PropertyParser.java | 114 +++++++++--------- .../designer/model/views-meta-model.xml | 4 +- .../propertyTable/AttributeProperty.java | 10 +- .../AttributePropertyWithDefault.java | 16 ++- .../CompoundDimensionProperty.java | 70 +++++++++++ .../propertyTable/CompoundProperty.java | 89 +++++++++++--- .../designer/propertyTable/FlagProperty.java | 39 +++--- .../renderers/ResourceRenderer.java | 10 +- .../intellij/designer/model/MetaModel.java | 29 ++++- .../propertyTable/IPropertyDecorator.java | 26 ++++ .../designer/propertyTable/Property.java | 8 +- 11 files changed, 312 insertions(+), 103 deletions(-) create mode 100644 plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundDimensionProperty.java create mode 100644 plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/IPropertyDecorator.java diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java index a0a4c86c87ae..ba0b682c85c5 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java @@ -18,10 +18,7 @@ package com.intellij.android.designer.model; import com.android.ide.common.rendering.api.ViewInfo; import com.android.resources.ResourceType; import com.android.sdklib.IAndroidTarget; -import com.intellij.android.designer.propertyTable.AttributeProperty; -import com.intellij.android.designer.propertyTable.AttributePropertyWithDefault; -import com.intellij.android.designer.propertyTable.CompoundProperty; -import com.intellij.android.designer.propertyTable.FlagProperty; +import com.intellij.android.designer.propertyTable.*; import com.intellij.android.designer.propertyTable.editors.ResourceDialog; import com.intellij.designer.model.MetaManager; import com.intellij.designer.model.MetaModel; @@ -138,7 +135,7 @@ public class PropertyParser { StyleableDefinition definitions = myDefinitions.getStyleableByName(component); if (definitions != null) { - Property padding = null; + boolean padding = false; for (AttributeDefinition definition : definitions.getAttributes()) { String name = definition.getName(); @@ -146,10 +143,10 @@ public class PropertyParser { Property property; if ("padding".equals(name) && "View".equals(component)) { - property = padding = new CompoundProperty(name, definition); + padding = true; } - else if (formats.contains(AttributeFormat.Flag)) { - property = new FlagProperty(name, definition, model); + if (formats.contains(AttributeFormat.Flag)) { + property = new FlagProperty(name, definition); } else { property = new AttributeProperty(name, definition); @@ -158,19 +155,21 @@ public class PropertyParser { if (model != null) { model.decorate(property, name); } - properties.add(property); } - if (padding != null) { - List children = padding.getChildren(null); - - children.add(PropertyTable.extractProperty(properties, "paddingLeft")); - children.add(PropertyTable.extractProperty(properties, "paddingTop")); - children.add(PropertyTable.extractProperty(properties, "paddingRight")); - children.add(PropertyTable.extractProperty(properties, "paddingBottom")); - children.add(PropertyTable.extractProperty(properties, "paddingStart")); - children.add(PropertyTable.extractProperty(properties, "paddingEnd")); + if (padding) { + CompoundDimensionProperty paddingProperty = new CompoundDimensionProperty("padding"); + moveProperties(properties, paddingProperty, + "padding", "all", + "paddingLeft", "left", + "paddingTop", "top", + "paddingRight", "right", + "paddingBottom", "bottom", + "paddingStart", "start", + "paddingEnd", "end"); + paddingProperty.decorate(model); + properties.add(paddingProperty); } } @@ -188,25 +187,7 @@ public class PropertyParser { properties.add(superProperty); } else { - String name = superProperty.getName(); - boolean normal = model.isNormalProperty(name); - boolean important = model.isImportantProperty(name); - boolean expert = model.isExpertProperty(name); - boolean deprecated = model.isDeprecatedProperty(name); - - if ((normal && (superProperty.isImportant() || superProperty.isExpert())) || - (important && !superProperty.isImportant()) || - (expert && !superProperty.isExpert()) || - (deprecated && !superProperty.isDeprecated())) { - Property property = superProperty.createForNewPresentation(); - property.setImportant(important); - property.setExpert(expert); - property.setDeprecated(deprecated); - properties.add(property); - } - else { - properties.add(superProperty); - } + properties.add(model.decorateWithOverride(superProperty)); } } } @@ -236,7 +217,7 @@ public class PropertyParser { StyleableDefinition definitions = myDefinitions.getStyleableByName(component); if (definitions != null) { - Property margin = null; + boolean margin = false; for (AttributeDefinition definition : definitions.getAttributes()) { String name = definition.getName(); @@ -244,7 +225,7 @@ public class PropertyParser { Set formats = definition.getFormats(); Property property; - if (name.startsWith(LAYOUT_MARGIN_PREFIX) && name.length() > LAYOUT_MARGIN_PREFIX.length()) { + if (name.startsWith(LAYOUT_MARGIN_PREFIX)) { name = name.substring(LAYOUT_PREFIX.length()); important = false; } @@ -252,45 +233,54 @@ public class PropertyParser { name = "layout:" + name.substring(LAYOUT_PREFIX.length()); } - if ("layout:margin".equals(name) && "ViewGroup_MarginLayout".equals(component)) { - property = margin = new CompoundProperty(name, definition); + if ("margin".equals(name) && "ViewGroup_MarginLayout".equals(component)) { + margin = true; } - else if ("layout:width".equals(name) || "layout:height".equals(name)) { + if ("layout:width".equals(name) || "layout:height".equals(name)) { property = new AttributePropertyWithDefault(name, definition, "wrap_content"); } else if (formats.contains(AttributeFormat.Flag)) { - property = new FlagProperty(name, definition, model); + property = new FlagProperty(name, definition); } else { property = new AttributeProperty(name, definition); } + if (model != null) { + model.decorate(property, name); + } property.setImportant(important); properties.add(property); } - if (margin != null) { - List children = margin.getChildren(null); - - PropertyTable.moveProperty(properties, "marginLeft", children, -1); - PropertyTable.moveProperty(properties, "marginTop", children, -1); - PropertyTable.moveProperty(properties, "marginRight", children, -1); - PropertyTable.moveProperty(properties, "marginBottom", children, -1); - PropertyTable.moveProperty(properties, "marginStart", children, -1); - PropertyTable.moveProperty(properties, "marginEnd", children, -1); - + if (margin) { + CompoundDimensionProperty marginProperty = new CompoundDimensionProperty("layout:margin"); + moveProperties(properties, marginProperty, + "margin", "all", + "marginLeft", "left", + "marginTop", "top", + "marginRight", "right", + "marginBottom", "bottom", + "marginStart", "start", + "marginEnd", "end"); if (model != null) { - for (Property child : children) { - model.decorate(child, "layout:margin." + child.getName()); - } + marginProperty.decorate(model); } + marginProperty.setImportant(true); + properties.add(marginProperty); } } if (++index < components.length) { for (Property property : loadLayoutProperties(components, index, model)) { if (PropertyTable.findProperty(properties, property) == -1) { - properties.add(property); + if (model == null) { + properties.add(property); + } + else { + property = model.decorateWithOverride(property); + properties.add(property); + } } } } @@ -313,6 +303,16 @@ public class PropertyParser { return properties; } + private static void moveProperties(List source, Property destination, String... names) { + List children = destination.getChildren(null); + for (int i = 0; i < names.length; i += 2) { + Property property = PropertyTable.extractProperty(source, names[i]); + if (property != null) { + children.add(property.createForNewPresentation(destination, names[i + 1])); + } + } + } + public boolean isAssignableFrom(MetaModel base, MetaModel test) { try { Class baseClass = myClassLoader.loadClass(base.getTarget()); diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml index 0be0e93bf296..2fd7fd6d54c7 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml +++ b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml @@ -1012,8 +1012,8 @@ - diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java index 9ebc9d7c3f28..739bd12025c9 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java @@ -45,7 +45,11 @@ public class AttributeProperty extends Property { private final PropertyEditor myEditor; public AttributeProperty(@NotNull String name, @NotNull AttributeDefinition definition) { - super(null, name); + this(null, name, definition); + } + + public AttributeProperty(@Nullable Property parent, @NotNull String name, @NotNull AttributeDefinition definition) { + super(parent, name); myDefinition = definition; Set formats = definition.getFormats(); @@ -76,8 +80,8 @@ public class AttributeProperty extends Property { } @Override - public Property createForNewPresentation() { - return new AttributeProperty(getName(), myDefinition); + public Property createForNewPresentation(@Nullable Property parent, @NotNull String name) { + return new AttributeProperty(parent, name, myDefinition); } @Override diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java index 2a8d41fe0818..7d42fb382bb8 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributePropertyWithDefault.java @@ -16,9 +16,11 @@ package com.intellij.android.designer.propertyTable; import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.designer.propertyTable.Property; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.android.dom.attrs.AttributeDefinition; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @author Alexander Lobas @@ -27,10 +29,22 @@ public class AttributePropertyWithDefault extends AttributeProperty { private final String myDefaultValue; public AttributePropertyWithDefault(@NotNull String name, @NotNull AttributeDefinition definition, @NotNull String defaultValue) { - super(name, definition); + this(null, name, definition, defaultValue); + } + + public AttributePropertyWithDefault(@Nullable Property parent, + @NotNull String name, + @NotNull AttributeDefinition definition, + @NotNull String defaultValue) { + super(parent, name, definition); myDefaultValue = defaultValue; } + @Override + public Property createForNewPresentation(@Nullable Property parent, @NotNull String name) { + return new AttributePropertyWithDefault(parent, name, myDefinition, myDefaultValue); + } + @Override public boolean isDefaultValue(RadViewComponent component) throws Exception { return myDefaultValue.equals(getValue(component)); diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundDimensionProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundDimensionProperty.java new file mode 100644 index 000000000000..bca550170e15 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundDimensionProperty.java @@ -0,0 +1,70 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.propertyTable; + +import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer; +import com.intellij.designer.propertyTable.PropertyRenderer; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.ui.SimpleTextAttributes; +import org.jetbrains.android.dom.attrs.AttributeFormat; +import org.jetbrains.annotations.NotNull; + +import java.util.EnumSet; + +/** + * @author Alexander Lobas + */ +public class CompoundDimensionProperty extends CompoundProperty { + private ResourceRenderer myRenderer = new ResourceRenderer(EnumSet.of(AttributeFormat.Dimension)) { + @Override + protected void formatValue(String value) { + myColoredComponent.append("["); + if (!StringUtil.isEmpty(value)) { + int index = 0; + for (String childValue : StringUtil.split(value, ",")) { + if (index++ > 0) { + myColoredComponent.append(", "); + } + childValue = childValue.trim(); + if (childValue.length() > 0) { + if (childValue.equals("?")) { + myColoredComponent.append("?", SimpleTextAttributes.EXCLUDED_ATTRIBUTES); + } + else { + super.formatValue(childValue); + } + } + } + } + myColoredComponent.append("]"); + } + }; + + public CompoundDimensionProperty(@NotNull String name) { + super(name); + } + + @Override + protected CompoundProperty createForNewPresentation(@NotNull String name) { + return new CompoundDimensionProperty(name); + } + + @NotNull + @Override + public PropertyRenderer getRenderer() { + return myRenderer; + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java index 5a0b3f4936e0..4f18cb19d424 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/CompoundProperty.java @@ -16,8 +16,11 @@ package com.intellij.android.designer.propertyTable; import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.designer.model.MetaModel; +import com.intellij.designer.propertyTable.IPropertyDecorator; import com.intellij.designer.propertyTable.Property; -import org.jetbrains.android.dom.attrs.AttributeDefinition; +import com.intellij.designer.propertyTable.PropertyEditor; +import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -27,25 +30,81 @@ import java.util.List; /** * @author Alexander Lobas */ -public class CompoundProperty extends AttributeProperty { - private List myChildren = new ArrayList(); +public abstract class CompoundProperty extends Property implements IPropertyDecorator { + private List> myChildren = new ArrayList>(); - public CompoundProperty(@NotNull String name, @NotNull AttributeDefinition definition) { - super(name, definition); + public CompoundProperty(@NotNull String name) { + super(null, name); } @Override - public List getChildren(@Nullable RadViewComponent component) { - return myChildren; - } - - @Override - public Property createForNewPresentation() { - CompoundProperty property = new CompoundProperty(getName(), myDefinition); - List children = property.getChildren(null); - for (Property childProperty : myChildren) { - children.add(childProperty.createForNewPresentation()); + public Property createForNewPresentation(@Nullable Property parent, @NotNull String name) { + CompoundProperty property = createForNewPresentation(name); + List> children = property.getChildren(null); + for (Property childProperty : myChildren) { + children.add(childProperty.createForNewPresentation(property, childProperty.getName())); } return property; } + + public void decorate(@NotNull MetaModel model) { + String name = getName(); + model.decorate0(this, name); + for (Property childProperty : myChildren) { + model.decorate(childProperty, name + "." + childProperty.getName()); + } + } + + @Override + public List> getChildren(@Nullable RadViewComponent component) { + return myChildren; + } + + protected abstract CompoundProperty createForNewPresentation(@NotNull String name); + + @Override + public Object getValue(RadViewComponent component) throws Exception { + StringBuilder value = new StringBuilder(); + int index = 0; + int empty = 0; + for (Property childProperty : myChildren) { + if (index++ > 0) { + value.append(", "); + } + String childValue = (String)childProperty.getValue(component); + if (StringUtil.isEmpty(childValue)) { + empty++; + value.append("?"); + } + else { + value.append(childValue); + } + } + if (empty == myChildren.size()) { + return ""; + } + return value.toString(); + } + + @Override + public boolean isDefaultValue(RadViewComponent component) throws Exception { + for (Property childProperty : myChildren) { + if (!childProperty.isDefaultValue(component)) { + return false; + } + } + return true; + } + + @Override + public void setDefaultValue(RadViewComponent component) throws Exception { + for (Property childProperty : myChildren) { + childProperty.setDefaultValue(component); + } + } + + @Override + public PropertyEditor getEditor() { + return null; + } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java index 6be484046935..449d3c2c6c1f 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/FlagProperty.java @@ -17,6 +17,7 @@ package com.intellij.android.designer.propertyTable; import com.intellij.android.designer.model.RadViewComponent; import com.intellij.designer.model.MetaModel; +import com.intellij.designer.propertyTable.IPropertyDecorator; import com.intellij.designer.propertyTable.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; @@ -35,39 +36,41 @@ import java.util.*; /** * @author Alexander Lobas */ -public class FlagProperty extends Property { +public class FlagProperty extends Property implements IPropertyDecorator { private final PropertyRenderer myRenderer = new LabelPropertyRenderer(null); private final AttributeDefinition myDefinition; - private final List myOptions = new ArrayList(); + private final List> myOptions = new ArrayList>(); - public FlagProperty(@NotNull String name, @NotNull AttributeDefinition definition, @Nullable MetaModel model) { + public FlagProperty(@NotNull String name, @NotNull AttributeDefinition definition) { super(null, name); myDefinition = definition; for (String option : definition.getValues()) { myOptions.add(new OptionProperty(this, option, option)); } + } - if (model != null) { - for (Property option : myOptions) { - model.decorate(option, name + "." + option.getName()); - } + @Override + public Property createForNewPresentation(@Nullable Property parent, @NotNull String name) { + return new FlagProperty(name, myDefinition); + } + + @Override + public void decorate(@NotNull MetaModel model) { + String name = getName(); + for (Property option : myOptions) { + model.decorate(option, name + "." + option.getName()); } } @Override - public Property createForNewPresentation() { - return new FlagProperty(getName(), myDefinition, null); - } - - @Override - public List getChildren(@Nullable RadViewComponent component) { + public List> getChildren(@Nullable RadViewComponent component) { return myOptions; } @Override public Object getValue(RadViewComponent component) throws Exception { - StringBuffer value = new StringBuffer("["); + StringBuilder value = new StringBuilder("["); Set options = getOptions(component); int index = 0; for (Property option : myOptions) { @@ -158,6 +161,12 @@ public class FlagProperty extends Property { }); } + ////////////////////////////////////////////////////////////////////////////////////////// + // + // Option + // + ////////////////////////////////////////////////////////////////////////////////////////// + private class OptionProperty extends Property { private PropertyRenderer myRenderer = new BooleanRenderer(); private PropertyEditor myEditor = new BooleanEditor(); @@ -173,7 +182,7 @@ public class FlagProperty extends Property { } @Override - public Property createForNewPresentation() { + public Property createForNewPresentation(@Nullable Property parent, @NotNull String name) { return null; } diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java index e679288ffd3f..4288b7a7da4b 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java @@ -41,7 +41,7 @@ public class ResourceRenderer implements PropertyRenderer { private final ColorIcon myColorIcon = new ColorIcon(10, 9); private BooleanRenderer myBooleanRenderer; - private final SimpleColoredComponent myColoredComponent; + protected final SimpleColoredComponent myColoredComponent; private final Set myFormats; public ResourceRenderer(Set formats) { @@ -75,6 +75,12 @@ public class ResourceRenderer implements PropertyRenderer { myColoredComponent.setBackground(UIUtil.getTableBackground()); } + formatValue(value); + + return myColoredComponent; + } + + protected void formatValue(String value) { if (!StringUtil.isEmpty(value)) { int prefix = -1; if (value.startsWith("#")) { @@ -113,8 +119,6 @@ public class ResourceRenderer implements PropertyRenderer { } } } - - return myColoredComponent; } @Override diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java index 4bb2fd945785..5b37f41b759a 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/MetaModel.java @@ -16,6 +16,7 @@ package com.intellij.designer.model; import com.intellij.designer.palette.Item; +import com.intellij.designer.propertyTable.IPropertyDecorator; import com.intellij.designer.propertyTable.Property; import com.intellij.openapi.util.IconLoader; import org.jetbrains.annotations.NotNull; @@ -114,10 +115,6 @@ public class MetaModel { myPaletteItem.setMetaModel(this); } - public boolean isNormalProperty(String name) { - return myNormalProperties.contains(name); - } - public void setNormalProperties(List normalProperties) { myNormalProperties = normalProperties; } @@ -146,9 +143,31 @@ public class MetaModel { myDeprecatedProperties = deprecatedProperties; } - public void decorate(Property property, String name) { + public void decorate0(Property property, String name) { property.setImportant(isImportantProperty(name)); property.setExpert(isExpertProperty(name)); property.setDeprecated(isDeprecatedProperty(name)); } + + public void decorate(Property property, String name) { + decorate0(property, name); + + if (property instanceof IPropertyDecorator) { + ((IPropertyDecorator)property).decorate(this); + } + } + + public Property decorateWithOverride(Property property) { + String name = property.getName(); + + if (myNormalProperties.contains(name) || + myImportantProperties.contains(name) || + myExpertProperties.contains(name) || + myDeprecatedProperties.contains(name)) { + property = property.createForNewPresentation(); + decorate(property, name); + } + + return property; + } } \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/IPropertyDecorator.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/IPropertyDecorator.java new file mode 100644 index 000000000000..ab422d745634 --- /dev/null +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/IPropertyDecorator.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.designer.propertyTable; + +import com.intellij.designer.model.MetaModel; +import org.jetbrains.annotations.NotNull; + +/** + * @author Alexander Lobas + */ +public interface IPropertyDecorator { + void decorate(@NotNull MetaModel model); +} \ No newline at end of file diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/Property.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/Property.java index eda3c2457be5..326058e67bad 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/Property.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/Property.java @@ -37,7 +37,11 @@ public abstract class Property { myName = name; } - public abstract Property createForNewPresentation(); + public Property createForNewPresentation() { + return createForNewPresentation(myParent, myName); + } + + public abstract Property createForNewPresentation(@Nullable Property parent, @NotNull String name); ////////////////////////////////////////////////////////////////////////////////////////// // // Hierarchy @@ -48,7 +52,7 @@ public abstract class Property { return myParent; } - public List getChildren(@Nullable T component) { + public List> getChildren(@Nullable T component) { return Collections.emptyList(); }