Android widgets
@@ -177,6 +177,8 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
|
||||
ModelParser.updateRootComponent(rootComponent, mySession, rootView);
|
||||
|
||||
myLayeredPane.repaint();
|
||||
|
||||
DesignerToolWindowManager.getInstance(getProject()).refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,8 +81,15 @@ public class DropToOperation implements EditOperation {
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
for (RadComponent component : myComponents) {
|
||||
ModelParser.addComponent(myContainer, (RadViewComponent)component, null);
|
||||
if (myContext.isAdd()) {
|
||||
for (RadComponent component : myComponents) {
|
||||
ModelParser.moveComponent(myContainer, (RadViewComponent)component, null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (RadComponent component : myComponents) {
|
||||
ModelParser.addComponent(myContainer, (RadViewComponent)component, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,18 @@ public class TreeDropToOperation extends TreeEditOperation {
|
||||
|
||||
@Override
|
||||
protected void execute(RadComponent insertBefore) throws Exception {
|
||||
ModelParser.addComponent((RadViewComponent)myHost, (RadViewComponent)myComponents.get(0), (RadViewComponent)insertBefore);
|
||||
RadViewComponent host = (RadViewComponent)myHost;
|
||||
RadViewComponent before = (RadViewComponent)insertBefore;
|
||||
|
||||
if (myContext.isAdd()) {
|
||||
for (RadComponent component : myComponents) {
|
||||
ModelParser.moveComponent(host, (RadViewComponent)component, before);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (RadComponent component : myComponents) {
|
||||
ModelParser.addComponent(host, (RadViewComponent)component, before);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 550 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 481 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 178 B |
@@ -27,7 +27,6 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.XmlElementFactory;
|
||||
import com.intellij.psi.XmlRecursiveElementVisitor;
|
||||
@@ -36,7 +35,6 @@ import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.xml.util.XmlUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -123,6 +121,45 @@ public class ModelParser extends XmlRecursiveElementVisitor {
|
||||
return component;
|
||||
}
|
||||
|
||||
public static void moveComponent(final RadViewComponent container,
|
||||
final RadViewComponent movedComponent,
|
||||
@Nullable final RadViewComponent insertBefore)
|
||||
throws Exception {
|
||||
movedComponent.getParent().getChildren().remove(movedComponent);
|
||||
movedComponent.setParent(container);
|
||||
|
||||
List<RadComponent> children = container.getChildren();
|
||||
if (insertBefore == null) {
|
||||
children.add(movedComponent);
|
||||
}
|
||||
else {
|
||||
children.add(children.indexOf(insertBefore), movedComponent);
|
||||
}
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XmlTag xmlTag = movedComponent.getTag();
|
||||
|
||||
XmlTag parentTag = container.getTag();
|
||||
XmlTag nextTag = insertBefore == null ? null : insertBefore.getTag();
|
||||
XmlTag newXmlTag;
|
||||
if (nextTag == null) {
|
||||
newXmlTag = parentTag.addSubTag(xmlTag, false);
|
||||
}
|
||||
else {
|
||||
newXmlTag = (XmlTag)parentTag.addBefore(xmlTag, nextTag);
|
||||
}
|
||||
|
||||
xmlTag.delete();
|
||||
movedComponent.setTag(newXmlTag);
|
||||
}
|
||||
});
|
||||
|
||||
PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY);
|
||||
propertyParser.load(movedComponent);
|
||||
}
|
||||
|
||||
public static void addComponent(RadViewComponent container, RadViewComponent newComponent, @Nullable RadViewComponent insertBefore)
|
||||
throws Exception {
|
||||
newComponent.setParent(container);
|
||||
@@ -135,13 +172,13 @@ public class ModelParser extends XmlRecursiveElementVisitor {
|
||||
children.add(children.indexOf(insertBefore), newComponent);
|
||||
}
|
||||
|
||||
setComponentTag(container.getTag(), newComponent, insertBefore == null ? null : insertBefore.getTag());
|
||||
addComponentTag(container.getTag(), newComponent, insertBefore == null ? null : insertBefore.getTag());
|
||||
|
||||
PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY);
|
||||
propertyParser.load(newComponent);
|
||||
}
|
||||
|
||||
public static void setComponentTag(final XmlTag parentTag, final RadViewComponent component, final XmlTag nextTag) {
|
||||
public static void addComponentTag(final XmlTag parentTag, final RadViewComponent component, final XmlTag nextTag) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -197,6 +197,17 @@ public class PropertyParser {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public boolean isAssignableFrom(MetaModel base, MetaModel test) {
|
||||
try {
|
||||
Class<?> baseClass = myClassLoader.loadClass(base.getTarget());
|
||||
Class<?> testClass = myClassLoader.loadClass(test.getTarget());
|
||||
return baseClass.isAssignableFrom(testClass);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ResourceDialog createResourceDialog(ResourceType[] types) {
|
||||
return new ResourceDialog(myModule, types);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadImageSwitcherLayout extends RadTypeSwitcherLayout {
|
||||
public RadImageSwitcherLayout() {
|
||||
super("ImageView");
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,62 @@
|
||||
*/
|
||||
package com.intellij.android.designer.model;
|
||||
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.model.MetaManager;
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadScrollViewComponent extends RadViewComponent {
|
||||
private static final Icon SCROLL = IconLoader.getIcon("/com/intellij/android/designer/icons/scroll_to_h_v.png");
|
||||
|
||||
@Override
|
||||
public void addSelectionActions(DesignerEditorPanel designer,
|
||||
DefaultActionGroup actionGroup,
|
||||
JComponent shortcuts,
|
||||
List<RadComponent> selection) {
|
||||
if (selection.size() == 1) {
|
||||
addScrollAction(designer, actionGroup, shortcuts, this);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addScrollAction(final DesignerEditorPanel designer,
|
||||
DefaultActionGroup actionGroup,
|
||||
JComponent shortcuts,
|
||||
final RadViewComponent scrollContainer) {
|
||||
String text = "Convert ScrollView to horizontal/vertical";
|
||||
actionGroup.add(new AnAction(text, text, SCROLL) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
designer.getToolProvider().execute(new ThrowableRunnable<Exception>() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
MetaManager manager = ViewsMetaManager.getInstance(scrollContainer.getTag().getProject());
|
||||
MetaModel vScrollView = manager.getModelByTag("ScrollView");
|
||||
MetaModel hScrollView = manager.getModelByTag("HorizontalScrollView");
|
||||
|
||||
scrollContainer.setMetaModel(scrollContainer.getMetaModel() == vScrollView ? hScrollView : vScrollView);
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
scrollContainer.getTag().setName(scrollContainer.getMetaModel().getTag());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadScrollViewLayout extends RadSingleChildrenViewLayout {
|
||||
@Override
|
||||
public void addSelectionActions(DesignerEditorPanel designer,
|
||||
DefaultActionGroup actionGroup,
|
||||
JComponent shortcuts,
|
||||
List<RadComponent> selection) {
|
||||
if (selection.size() == 1) {
|
||||
RadScrollViewComponent.addScrollAction(designer, actionGroup, shortcuts, (RadViewComponent)myContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,9 @@ import com.intellij.designer.designSurface.OperationContext;
|
||||
public class RadSingleChildrenViewLayout extends RadViewLayout {
|
||||
@Override
|
||||
public EditOperation processChildOperation(OperationContext context) {
|
||||
if (myContainer.getChildren().isEmpty() && (context.isCreate() || context.isPaste()) && context.getComponents().size() == 1) {
|
||||
if (myContainer.getChildren().isEmpty() &&
|
||||
(context.isCreate() || context.isPaste() || context.isAdd()) &&
|
||||
context.getComponents().size() == 1) {
|
||||
if (context.isTree()) {
|
||||
return new TreeDropToOperation(myContainer, context);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.designSurface.OperationContext;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadTextSwitcherLayout extends RadTypeSwitcherLayout {
|
||||
public RadTextSwitcherLayout() {
|
||||
super("TextView");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.designSurface.OperationContext;
|
||||
import com.intellij.designer.model.MetaManager;
|
||||
import com.intellij.designer.model.MetaModel;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadTypeSwitcherLayout extends RadViewSwitcherLayout {
|
||||
private final String myTypeTag;
|
||||
private MetaModel myTypeModel;
|
||||
|
||||
public RadTypeSwitcherLayout(String tag) {
|
||||
myTypeTag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkChildOperation(OperationContext context) {
|
||||
if (super.checkChildOperation(context)) {
|
||||
if (myTypeModel == null) {
|
||||
MetaManager manager = ViewsMetaManager.getInstance(((RadViewComponent)myContainer).getTag().getProject());
|
||||
myTypeModel = manager.getModelByTag(myTypeTag);
|
||||
}
|
||||
|
||||
PropertyParser parser = myContainer.getRoot().getClientProperty(PropertyParser.KEY);
|
||||
|
||||
for (RadComponent component : context.getComponents()) {
|
||||
if (!parser.isAssignableFrom(myTypeModel, component.getMetaModel())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.android.designer.designSurface.DropToOperation;
|
||||
import com.intellij.android.designer.designSurface.TreeDropToOperation;
|
||||
import com.intellij.designer.designSurface.EditOperation;
|
||||
import com.intellij.designer.designSurface.OperationContext;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadViewAnimatorLayout extends RadViewLayout {
|
||||
public EditOperation processChildOperation(OperationContext context) {
|
||||
if ((context.isCreate() || context.isPaste() || context.isAdd()) && checkChildOperation(context)) {
|
||||
if (context.isTree()) {
|
||||
return new TreeDropToOperation(myContainer, context);
|
||||
}
|
||||
return new DropToOperation((RadViewComponent)myContainer, context);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean checkChildOperation(OperationContext context) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.designSurface.OperationContext;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public class RadViewSwitcherLayout extends RadViewAnimatorLayout {
|
||||
@Override
|
||||
protected boolean checkChildOperation(OperationContext context) {
|
||||
return myContainer.getChildren().size() < 2;
|
||||
}
|
||||
}
|
||||
@@ -567,6 +567,7 @@
|
||||
<!-- ================= Containers ================= -->
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.DatePicker"
|
||||
tag="DatePicker">
|
||||
|
||||
@@ -586,6 +587,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.CalendarView"
|
||||
tag="CalendarView">
|
||||
|
||||
@@ -606,6 +608,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.TimePicker"
|
||||
tag="TimePicker">
|
||||
|
||||
@@ -626,6 +629,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.NumberPicker"
|
||||
tag="NumberPicker">
|
||||
|
||||
@@ -643,6 +647,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.ZoomControls"
|
||||
tag="ZoomControls">
|
||||
|
||||
@@ -660,6 +665,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.SearchView"
|
||||
tag="SearchView">
|
||||
|
||||
@@ -678,7 +684,12 @@
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta class="android.widget.AbsListView">
|
||||
<properties important="choiceMode"/>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.ListView"
|
||||
tag="ListView">
|
||||
|
||||
@@ -698,6 +709,26 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
class="android.widget.ExpandableListView"
|
||||
tag="ExpandableListView">
|
||||
|
||||
<palette title="ExpandableListView" icon="/com/intellij/android/designer/icons/ExpandableListView.png"
|
||||
tooltip="A view that shows items in a vertically scrolling two-level list. This differs from the ListView by allowing two levels: groups which can individually be expanded to show its children."/>
|
||||
|
||||
<properties important="groupIndicator childIndicator indicatorLeft indicatorRight childIndicatorLeft childIndicatorRight childDivider"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<ExpandableListView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.GridView"
|
||||
tag="GridView">
|
||||
|
||||
@@ -717,6 +748,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.webkit.WebView"
|
||||
tag="WebView">
|
||||
|
||||
@@ -734,7 +766,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadScrollViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadSingleChildrenViewLayout"
|
||||
layout="com.intellij.android.designer.model.RadScrollViewLayout"
|
||||
class="android.widget.ScrollView"
|
||||
tag="ScrollView">
|
||||
|
||||
@@ -754,7 +786,7 @@
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadScrollViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadSingleChildrenViewLayout"
|
||||
layout="com.intellij.android.designer.model.RadScrollViewLayout"
|
||||
class="android.widget.HorizontalScrollView"
|
||||
tag="HorizontalScrollView">
|
||||
|
||||
@@ -773,6 +805,198 @@
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.Gallery"
|
||||
tag="Gallery">
|
||||
|
||||
<palette title="Gallery" icon="/com/intellij/android/designer/icons/Gallery.png"
|
||||
tooltip="A view that shows items in a center-locked, horizontally scrolling list."/>
|
||||
|
||||
<properties important="gravity"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<Gallery
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.Spinner"
|
||||
tag="Spinner">
|
||||
|
||||
<palette title="Spinner" icon="/com/intellij/android/designer/icons/Spinner.png"
|
||||
tooltip="A view that displays one child at a time and lets the user pick among them."/>
|
||||
|
||||
<properties important="entries prompt spinnerMode gravity"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<Spinner
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.MediaController"
|
||||
tag="MediaController">
|
||||
|
||||
<palette title="MediaController" icon="/com/intellij/android/designer/icons/MediaController.png"
|
||||
tooltip="A view containing controls for a MediaPlayer. Typically contains the buttons like 'Play/Pause', 'Rewind', 'Fast Forward' and a progress slider. It takes care of synchronizing the controls with the state of the MediaPlayer."/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<MediaController
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.StackView"
|
||||
tag="StackView">
|
||||
|
||||
<palette title="StackView" icon="/com/intellij/android/designer/icons/StackView.png"
|
||||
tooltip="A view that displays its children in a stack and allows users to discretely swipe through the children."/>
|
||||
|
||||
<properties important="resOutColor clickColor"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<StackView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewLayout"
|
||||
class="android.widget.AdapterViewFlipper"
|
||||
tag="AdapterViewFlipper">
|
||||
|
||||
<palette title="AdapterViewFlipper" icon="/com/intellij/android/designer/icons/AdapterViewFlipper.png"
|
||||
tooltip="Simple ViewAnimator that will animate between two or more views that have been added to it. Only one child is shown at a time. If requested, can automatically flip between each child at a regular interval."/>
|
||||
|
||||
<properties important="flipInterval autoStart"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<AdapterViewFlipper
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewAnimatorLayout"
|
||||
class="android.widget.ViewAnimator"
|
||||
tag="ViewAnimator">
|
||||
|
||||
<palette title="ViewAnimator" icon="/com/intellij/android/designer/icons/ViewAnimator.png"
|
||||
tooltip="Container that will perform animations when switching between its views."/>
|
||||
|
||||
<properties important="inAnimation outAnimation animateFirstView"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<ViewAnimator
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewAnimatorLayout"
|
||||
class="android.widget.ViewFlipper"
|
||||
tag="ViewFlipper">
|
||||
|
||||
<palette title="ViewFlipper" icon="/com/intellij/android/designer/icons/ViewFlipper.png"
|
||||
tooltip="Simple ViewAnimator that will animate between two or more views that have been added to it. Only one child is shown at a time. If requested, can automatically flip between each child at a regular interval."/>
|
||||
|
||||
<properties important="flipInterval autoStart"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<ViewFlipper
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadViewSwitcherLayout"
|
||||
class="android.widget.ViewSwitcher"
|
||||
tag="ViewSwitcher">
|
||||
|
||||
<palette title="ViewSwitcher" icon="/com/intellij/android/designer/icons/ViewSwitcher.png"
|
||||
tooltip="ViewAnimator that switches between two views, and has a factory from which these views are created. You can either use the factory to create the views, or add them yourself. A ViewSwitcher can only have two child views, of which only one is shown at a time."/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<ViewSwitcher
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadImageSwitcherLayout"
|
||||
class="android.widget.ImageSwitcher"
|
||||
tag="ImageSwitcher">
|
||||
|
||||
<palette title="ImageSwitcher" icon="/com/intellij/android/designer/icons/ImageSwitcher.png"
|
||||
tooltip="ImageSwitcher"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<ImageSwitcher
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
layout="com.intellij.android.designer.model.RadTextSwitcherLayout"
|
||||
class="android.widget.TextSwitcher"
|
||||
tag="TextSwitcher">
|
||||
|
||||
<palette title="TextSwitcher" icon="/com/intellij/android/designer/icons/TextSwitcher.png"
|
||||
tooltip="Specialized ViewSwitcher that contains only children of type TextView. A TextSwitcher is useful to animate a label on screen."/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
<TextSwitcher
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
]]>
|
||||
</creation>
|
||||
</meta>
|
||||
|
||||
<!-- ================= Layouts ================= -->
|
||||
|
||||
<meta model="com.intellij.android.designer.model.RadViewComponent"
|
||||
@@ -783,9 +1007,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"/>
|
||||
|
||||
<creation>
|
||||
<![CDATA[
|
||||
@@ -826,6 +1048,8 @@
|
||||
<item tag="Space"/>
|
||||
<item tag="ViewStub"/>
|
||||
<item tag="VideoView"/>
|
||||
<item tag="MediaController"/>
|
||||
<item tag="WebView"/>
|
||||
<item tag="KeyboardView"/>
|
||||
<item tag="SurfaceView"/>
|
||||
<item tag="TextureView"/>
|
||||
@@ -839,9 +1063,18 @@
|
||||
<item tag="SearchView"/>
|
||||
<item tag="ListView"/>
|
||||
<item tag="GridView"/>
|
||||
<item tag="Gallery"/>
|
||||
<item tag="Spinner"/>
|
||||
<item tag="ExpandableListView"/>
|
||||
<item tag="HorizontalScrollView"/>
|
||||
<item tag="ScrollView"/>
|
||||
<item tag="WebView"/>
|
||||
<item tag="StackView"/>
|
||||
<item tag="ViewAnimator"/>
|
||||
<item tag="ViewFlipper"/>
|
||||
<item tag="ViewSwitcher"/>
|
||||
<item tag="ImageSwitcher"/>
|
||||
<item tag="TextSwitcher"/>
|
||||
<item tag="AdapterViewFlipper"/>
|
||||
</group>
|
||||
<group name="Layouts">
|
||||
<item tag="LinearLayout"/>
|
||||
|
||||
@@ -121,7 +121,12 @@ public final class DesignerToolWindowManager implements ProjectComponent {
|
||||
|
||||
public void refresh() {
|
||||
if (myTreeBuilder != null) {
|
||||
myTreeBuilder.queueUpdate();
|
||||
myTreeBuilder.queueUpdate().doWhenDone(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myComponentTree.repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,12 @@ public class DesignerActionPanel implements DataProvider {
|
||||
private final DefaultActionGroup myStaticGroup = new DefaultActionGroup();
|
||||
private final DefaultActionGroup myDynamicGroup = new DefaultActionGroup();
|
||||
private JComponent myToolbar;
|
||||
private final DesignerEditorPanel myDesigner;
|
||||
private final CommonEditActionsProvider myCommonEditActionsProvider;
|
||||
private final JComponent myShortcuts;
|
||||
|
||||
public DesignerActionPanel(DesignerEditorPanel designer, JComponent shortcuts) {
|
||||
myDesigner = designer;
|
||||
myCommonEditActionsProvider = new CommonEditActionsProvider(designer);
|
||||
myShortcuts = shortcuts;
|
||||
|
||||
@@ -128,10 +130,10 @@ public class DesignerActionPanel implements DataProvider {
|
||||
}
|
||||
|
||||
for (RadComponent parent : parents) {
|
||||
parent.getLayout().addSelectionActions(myDynamicGroup, myShortcuts, selection);
|
||||
parent.getLayout().addSelectionActions(myDesigner, myDynamicGroup, myShortcuts, selection);
|
||||
}
|
||||
for (RadComponent component : selection) {
|
||||
component.addSelectionActions(myDynamicGroup, myShortcuts, selection);
|
||||
component.addSelectionActions(myDesigner, myDynamicGroup, myShortcuts, selection);
|
||||
}
|
||||
update |= isVisible(myDynamicGroup);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.designer.model;
|
||||
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.designSurface.OperationContext;
|
||||
import com.intellij.designer.designSurface.tools.DragTracker;
|
||||
import com.intellij.designer.designSurface.tools.InputTool;
|
||||
@@ -103,7 +104,10 @@ public abstract class RadComponent {
|
||||
public void processDropOperation(OperationContext context) {
|
||||
}
|
||||
|
||||
public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List<RadComponent> selection) {
|
||||
public void addSelectionActions(DesignerEditorPanel designer,
|
||||
DefaultActionGroup actionGroup,
|
||||
JComponent shortcuts,
|
||||
List<RadComponent> selection) {
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.designer.model;
|
||||
|
||||
import com.intellij.designer.designSurface.ComponentDecorator;
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.designSurface.EditOperation;
|
||||
import com.intellij.designer.designSurface.OperationContext;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
@@ -41,6 +42,9 @@ public abstract class RadLayout {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List<RadComponent> selection) {
|
||||
public void addSelectionActions(DesignerEditorPanel designer,
|
||||
DefaultActionGroup actionGroup,
|
||||
JComponent shortcuts,
|
||||
List<RadComponent> selection) {
|
||||
}
|
||||
}
|
||||