Search in sources :

Example 41 with ScreenView

use of com.android.tools.idea.uibuilder.surface.ScreenView in project android by JetBrains.

the class SelectParentAction method update.

@Override
public void update(AnActionEvent e) {
    boolean enabled;
    ScreenView screenView = mySurface.getCurrentScreenView();
    if (screenView != null) {
        List<NlComponent> selection = screenView.getSelectionModel().getSelection();
        enabled = selection.size() == 1 && !selection.get(0).isRoot();
    } else {
        enabled = false;
    }
    e.getPresentation().setEnabled(enabled);
}
Also used : ScreenView(com.android.tools.idea.uibuilder.surface.ScreenView) NlComponent(com.android.tools.idea.uibuilder.model.NlComponent)

Example 42 with ScreenView

use of com.android.tools.idea.uibuilder.surface.ScreenView in project android by JetBrains.

the class CoordinatesTest method testSwingToAndroid.

public void testSwingToAndroid() {
    ScreenView screenView = createScreenView(0.5, 100, 110);
    assertEquals(0, Coordinates.getAndroidX(screenView, 100));
    assertEquals(0, Coordinates.getAndroidY(screenView, 110));
    assertEquals(1000, Coordinates.getAndroidX(screenView, 100 + 500));
    assertEquals(1000, Coordinates.getAndroidY(screenView, 110 + 500));
    assertEquals(1000, Coordinates.getAndroidDimension(screenView, 500));
}
Also used : ScreenView(com.android.tools.idea.uibuilder.surface.ScreenView)

Aggregations

ScreenView (com.android.tools.idea.uibuilder.surface.ScreenView)42 NlComponent (com.android.tools.idea.uibuilder.model.NlComponent)16 NlModel (com.android.tools.idea.uibuilder.model.NlModel)6 SelectionModel (com.android.tools.idea.uibuilder.model.SelectionModel)6 DesignSurface (com.android.tools.idea.uibuilder.surface.DesignSurface)6 Nullable (org.jetbrains.annotations.Nullable)5 NotNull (org.jetbrains.annotations.NotNull)4 Configuration (com.android.tools.idea.configurations.Configuration)3 LintAnnotationsModel (com.android.tools.idea.uibuilder.lint.LintAnnotationsModel)2 Presentation (com.intellij.openapi.actionSystem.Presentation)2 BufferedImage (java.awt.image.BufferedImage)2 GradleCoordinate (com.android.ide.common.repository.GradleCoordinate)1 FolderConfiguration (com.android.ide.common.resources.configuration.FolderConfiguration)1 GradleDependencyManager (com.android.tools.idea.gradle.dependencies.GradleDependencyManager)1 RenderResult (com.android.tools.idea.rendering.RenderResult)1 InsertType (com.android.tools.idea.uibuilder.api.InsertType)1 ViewEditor (com.android.tools.idea.uibuilder.api.ViewEditor)1 ViewHandler (com.android.tools.idea.uibuilder.api.ViewHandler)1 ViewEditorImpl (com.android.tools.idea.uibuilder.handlers.ViewEditorImpl)1 LintNotificationPanel (com.android.tools.idea.uibuilder.lint.LintNotificationPanel)1