EA-36352 - IOOBE: ModelParser.updateComponent

This commit is contained in:
Alexander Lobas
2012-05-30 12:55:40 +04:00
parent 3c194c31b6
commit a6effbe171
4 changed files with 53 additions and 9 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -377,12 +377,7 @@ public class ModelParser extends XmlRecursiveElementVisitor {
public static void updateRootComponent(RadViewComponent rootComponent,
RenderSession session,
RootView nativeComponent) {
List<ViewInfo> views = session.getRootViews();
List<RadComponent> children = rootComponent.getChildren();
int size = children.size();
for (int i = 0; i < size; i++) {
updateComponent((RadViewComponent)children.get(i), views.get(i), nativeComponent, 0, 0);
}
updateChildren(rootComponent, session.getRootViews(), nativeComponent, 0, 0);
rootComponent.setNativeComponent(nativeComponent);
rootComponent.setBounds(0, 0, nativeComponent.getWidth(), nativeComponent.getHeight());
@@ -407,12 +402,18 @@ public class ModelParser extends XmlRecursiveElementVisitor {
component.setBounds(left, top, Math.max(width, EMPTY_COMPONENT_SIZE), Math.max(height, EMPTY_COMPONENT_SIZE));
List<ViewInfo> views = view.getChildren();
updateChildren(component, view.getChildren(), nativeComponent, left, top);
}
private static void updateChildren(RadViewComponent component, List<ViewInfo> views, RootView nativeComponent, int left, int top) {
List<RadComponent> children = component.getChildren();
int size = children.size();
for (int i = 0; i < size; i++) {
updateComponent((RadViewComponent)children.get(i), views.get(i), nativeComponent, left, top);
for (int componentIndex = 0, viewIndex = 0; componentIndex < size; componentIndex++) {
RadViewComponent childComponent = (RadViewComponent)children.get(componentIndex);
if (!(childComponent instanceof RadRequestFocus)) {
updateComponent(childComponent, views.get(viewIndex++), nativeComponent, left, top);
}
}
}
}
@@ -0,0 +1,34 @@
/*
* 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.model;
import com.intellij.designer.propertyTable.Property;
import java.util.Collections;
import java.util.List;
/**
* @author Alexander Lobas
*/
public class RadRequestFocus extends RadViewComponent {
public RadRequestFocus() {
super.setProperties(Collections.<Property>emptyList());
}
@Override
public void setProperties(List<Property> properties) {
}
}
@@ -19,6 +19,15 @@
<palette title="Device Screen (#merge)" icon="/com/intellij/android/designer/icons/DeviceScreen.png"/>
</meta>
<meta model="com.intellij.android.designer.model.RadRequestFocus"
class="java.lang.Object"
tag="requestFocus">
<palette title="requestFocus" icon="/com/intellij/android/designer/icons/requestFocus.png"
tooltip="Requests focus for the parent element or one of its descendants."/>
</meta>
<meta model="com.intellij.android.designer.model.RadIncludeLayout"
class="java.lang.Object"
tag="include">