mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Properties
This commit is contained in:
+34
-11
@@ -89,10 +89,7 @@ public class PropertyParser {
|
||||
component.setProperties(Collections.<Property>emptyList());
|
||||
}
|
||||
else {
|
||||
Class<?> componentClass = myClassLoader.loadClass(info.getClassName());
|
||||
if (componentClass.getName().equals("com.android.layoutlib.bridge.MockView")) {
|
||||
componentClass = myClassLoader.loadClass("android.view.View");
|
||||
}
|
||||
Class<?> componentClass = configureClass(myClassLoader.loadClass(info.getClassName()));
|
||||
component.setProperties(loadWidgetProperties(componentClass, model));
|
||||
}
|
||||
}
|
||||
@@ -113,8 +110,26 @@ public class PropertyParser {
|
||||
}
|
||||
|
||||
if (layoutParams != null) {
|
||||
List<Property> properties = loadLayoutProperties(layoutParams, 0, parent.getMetaModel());
|
||||
MetaModel[] models = new MetaModel[layoutParams.length];
|
||||
models[0] = parent.getMetaModel();
|
||||
|
||||
for (int i = 1; i < layoutParams.length; i++) {
|
||||
if (models[i - 1] == null) {
|
||||
break;
|
||||
}
|
||||
String extendTarget = models[i - 1].getTarget();
|
||||
if (extendTarget == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
Class<?> superClass = myClassLoader.loadClass(extendTarget).getSuperclass();
|
||||
if (superClass != null) {
|
||||
superClass = configureClass(superClass);
|
||||
models[i] = myMetaManager.getModelByTarget(superClass.getName());
|
||||
}
|
||||
}
|
||||
|
||||
List<Property> properties = loadLayoutProperties(layoutParams, 0, models);
|
||||
if (!properties.isEmpty()) {
|
||||
properties = new ArrayList<Property>(properties);
|
||||
properties.addAll(component.getProperties());
|
||||
@@ -168,16 +183,16 @@ public class PropertyParser {
|
||||
"paddingBottom", "bottom",
|
||||
"paddingStart", "start",
|
||||
"paddingEnd", "end");
|
||||
paddingProperty.decorate(model);
|
||||
if (model != null) {
|
||||
paddingProperty.decorate(model);
|
||||
}
|
||||
properties.add(paddingProperty);
|
||||
}
|
||||
}
|
||||
|
||||
Class<?> superComponentClass = componentClass.getSuperclass();
|
||||
if (superComponentClass != null) {
|
||||
if (superComponentClass.getName().equals("com.android.layoutlib.bridge.MockView")) {
|
||||
superComponentClass = myClassLoader.loadClass("android.view.View");
|
||||
}
|
||||
superComponentClass = configureClass(superComponentClass);
|
||||
|
||||
List<Property> superProperties = loadWidgetProperties(superComponentClass,
|
||||
myMetaManager.getModelByTarget(superComponentClass.getName()));
|
||||
@@ -206,8 +221,16 @@ public class PropertyParser {
|
||||
return properties;
|
||||
}
|
||||
|
||||
private List<Property> loadLayoutProperties(String[] components, int index, MetaModel model) throws Exception {
|
||||
private Class<?> configureClass(Class<?> viewClass) throws Exception {
|
||||
if (viewClass.getName().equals("com.android.layoutlib.bridge.MockView")) {
|
||||
return myClassLoader.loadClass("android.view.View");
|
||||
}
|
||||
return viewClass;
|
||||
}
|
||||
|
||||
private List<Property> loadLayoutProperties(String[] components, int index, MetaModel[] models) throws Exception {
|
||||
String component = components[index];
|
||||
MetaModel model = models[index];
|
||||
|
||||
List<Property> properties = myCachedProperties.get(component);
|
||||
|
||||
@@ -272,7 +295,7 @@ public class PropertyParser {
|
||||
}
|
||||
|
||||
if (++index < components.length) {
|
||||
for (Property property : loadLayoutProperties(components, index, model)) {
|
||||
for (Property property : loadLayoutProperties(components, index, models)) {
|
||||
if (PropertyTable.findProperty(properties, property) == -1) {
|
||||
if (model == null) {
|
||||
properties.add(property);
|
||||
|
||||
+3
@@ -15,9 +15,12 @@
|
||||
*/
|
||||
package com.intellij.android.designer.model;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public abstract class RadViewLayoutWithData extends RadViewLayout {
|
||||
@NotNull
|
||||
public abstract String[] getLayoutParams();
|
||||
}
|
||||
+5
-5
@@ -32,9 +32,9 @@
|
||||
/>
|
||||
</meta>
|
||||
|
||||
<meta class="class android.view.ViewGroup">
|
||||
<meta class="android.view.ViewGroup">
|
||||
<properties
|
||||
expert="animateLayoutChanges clipChildren clipToPadding layoutAnimation animationCache persistentDrawingCache alwaysDrawnWithCache addStatesFromChildren descendantFocusability splitMotionEvents"
|
||||
expert="layout:margin.start layout:margin.end animateLayoutChanges clipChildren clipToPadding layoutAnimation animationCache persistentDrawingCache alwaysDrawnWithCache addStatesFromChildren descendantFocusability splitMotionEvents"
|
||||
/>
|
||||
</meta>
|
||||
|
||||
@@ -991,7 +991,7 @@
|
||||
<palette title="LinearLayout" icon="/com/intellij/android/designer/icons/LinearLayout.png"
|
||||
tooltip="A Layout that arranges its children in a single column or a single row."/>
|
||||
|
||||
<properties important="orientation gravity"/>
|
||||
<properties important="orientation gravity baselineAligned measureWithLargestChild showDividers"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
@@ -1012,8 +1012,8 @@
|
||||
<palette title="FrameLayout" icon="/com/intellij/android/designer/icons/FrameLayout.png"
|
||||
tooltip="FrameLayout is designed to block out an area on the screen to display a single item."/>
|
||||
|
||||
<properties important="foreground foregroundGravity layout:margin"
|
||||
expert="layout:gravity.fill layout:gravity.fill_horizontal layout:gravity.fill_vertical layout:gravity.clip_vertical layout:gravity.clip_horizontal layout:margin.start layout:margin.end"
|
||||
<properties important="foreground foregroundGravity"
|
||||
expert="layout:gravity.fill layout:gravity.fill_horizontal layout:gravity.fill_vertical layout:gravity.clip_vertical layout:gravity.clip_horizontal"
|
||||
/>
|
||||
|
||||
<creation>
|
||||
|
||||
Reference in New Issue
Block a user