diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/AbsoluteLayoutOperation.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/AbsoluteLayoutOperation.java new file mode 100644 index 000000000000..c42fec4c6987 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/AbsoluteLayoutOperation.java @@ -0,0 +1,46 @@ +/* + * 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.designSurface.layout; + +import com.intellij.android.designer.designSurface.AbstractEditOperation; +import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.designer.designSurface.OperationContext; + +/** + * @author Alexander Lobas + */ +public class AbsoluteLayoutOperation extends AbstractEditOperation { + public AbsoluteLayoutOperation(RadViewComponent container, OperationContext context) { + super(container, context); + } + + @Override + public void showFeedback() { + // TODO: Auto-generated method stub + } + + @Override + public void eraseFeedback() { + // TODO: Auto-generated method stub + } + + @Override + public void execute() throws Exception { + if (!myContext.isMove()) { + super.execute(); + } + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/AbsoluteLayout.png b/plugins/android-designer/src/com/intellij/android/designer/icons/AbsoluteLayout.png new file mode 100644 index 000000000000..382b11a207b1 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/AbsoluteLayout.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/layout/RadAbsoluteLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/layout/RadAbsoluteLayout.java new file mode 100644 index 000000000000..5f8b525c7f7f --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/layout/RadAbsoluteLayout.java @@ -0,0 +1,69 @@ +/* + * 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.layout; + +import com.intellij.android.designer.designSurface.TreeDropToOperation; +import com.intellij.android.designer.designSurface.layout.AbsoluteLayoutOperation; +import com.intellij.android.designer.designSurface.layout.ResizeOperation; +import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.android.designer.model.RadViewLayoutWithData; +import com.intellij.designer.designSurface.ComponentDecorator; +import com.intellij.designer.designSurface.EditOperation; +import com.intellij.designer.designSurface.OperationContext; +import com.intellij.designer.designSurface.selection.ResizeSelectionDecorator; +import com.intellij.designer.model.RadComponent; +import org.jetbrains.annotations.NotNull; + +import java.awt.*; +import java.util.List; + +/** + * @author Alexander Lobas + */ +public class RadAbsoluteLayout extends RadViewLayoutWithData { + private static final String[] LAYOUT_PARAMS = {"AbsoluteLayout_Layout", "ViewGroup_Layout"}; + + private ResizeSelectionDecorator mySelectionDecorator; + + @Override + @NotNull + public String[] getLayoutParams() { + return LAYOUT_PARAMS; + } + + @Override + public EditOperation processChildOperation(OperationContext context) { + if (context.isCreate() || context.isPaste() || context.isAdd() || context.isMove()) { + if (context.isTree()) { + return new TreeDropToOperation(myContainer, context); + } + return new AbsoluteLayoutOperation((RadViewComponent)myContainer, context); + } + if (context.is(ResizeOperation.TYPE)) { + return new ResizeOperation(context); + } + return null; + } + + @Override + public ComponentDecorator getChildSelectionDecorator(RadComponent component, List selection) { + if (mySelectionDecorator == null) { + mySelectionDecorator = new ResizeSelectionDecorator(Color.red, 1); + ResizeOperation.points(mySelectionDecorator); + } + return mySelectionDecorator; + } +} \ No newline at end of file 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 d1f9fdf69833..8f9b927d0e53 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 @@ -1074,6 +1074,24 @@ + + + + + + + + ]]> + + +