Examples of DeviceInfo


Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

      // execute dialog
      if (inputDialog.open() == Window.OK) {
        commands_add(new CategoryNameCommand(category, inputDialog.getValue()));
      }
    } else if (element instanceof DeviceInfo) {
      DeviceInfo device = (DeviceInfo) element;
      DeviceEditDialog dialog = new DeviceEditDialog(device);
      // execute dialog
      if (dialog.open() == Window.OK) {
        commands_add(dialog.getCommand());
      }
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

          int targetIndex = index + delta;
          CategoryInfo nextCategory =
              targetIndex < categories.size() ? (CategoryInfo) categories.get(targetIndex) : null;
          commands_add(new CategoryMoveCommand(category, nextCategory));
        } else if (element instanceof DeviceInfo) {
          DeviceInfo device = (DeviceInfo) element;
          CategoryInfo category = device.getCategory();
          List<DeviceInfo> devices = category.getDevices();
          int index = devices.indexOf(device);
          if (index + delta < devices.size()) {
            commands_add(new DeviceMoveCommand(device, category, devices.get(index + delta)));
          } else {
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

          }
        } else if (target instanceof CategoryInfo) {
          Assert.isTrue(location == LOCATION_ON);
          CategoryInfo targetCategory = (CategoryInfo) target;
          for (Object element : m_dragElements) {
            DeviceInfo device = (DeviceInfo) element;
            commands_add(new DeviceMoveCommand(device, targetCategory, null));
          }
        } else {
          DeviceInfo targetDevice = (DeviceInfo) target;
          CategoryInfo targetCategory = targetDevice.getCategory();
          // prepare next device
          DeviceInfo nextDevice;
          {
            List<DeviceInfo> entries = targetCategory.getDevices();
            int index = entries.indexOf(targetDevice);
            if (location == LOCATION_BEFORE) {
              nextDevice = entries.get(index);
            } else {
              nextDevice = GenericsUtils.getNextOrNull(entries, index);
            }
          }
          // add commands
          for (Object element : m_dragElements) {
            DeviceInfo device = (DeviceInfo) element;
            commands_add(new DeviceMoveCommand(device, targetCategory, nextDevice));
          }
        }
        // refresh viewer to show result of applying commands
        refreshViewer();
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

    CategoryInfo category = DeviceManager.getCategories().get(0);
    List<DeviceInfo> devices = category.getDevices();
    // add Device
    addDevice(category, "devA", "a");
    // has expected order
    DeviceInfo deviceA = DeviceManager.getDevice("devA");
    int index = devices.indexOf(deviceA);
    // ignored - move before itself
    DeviceManager.commandsAdd(new DeviceMoveCommand(deviceA, category, deviceA));
    // no change
    assertEquals(index, devices.indexOf(deviceA));
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

  public void test_DeviceMoveCommand_noSource() throws Exception {
    CategoryInfo category = DeviceManager.getCategories().get(0);
    List<DeviceInfo> devices = category.getDevices();
    // add Device
    addDevice(category, "dev", "device");
    DeviceInfo device = DeviceManager.getDevice("dev");
    // ignored - we remove device before executing
    {
      DeviceMoveCommand command = new DeviceMoveCommand(device, category, null);
      devices.remove(device);
      DeviceManager.commandsAdd(command);
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

    CategoryInfo category = DeviceManager.getCategories().get(0);
    // add Device
    addDevice(category, "dev", "device");
    // remove Device
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertNotNull(device);
      // do remove
      DeviceManager.commandsAdd(new DeviceRemoveCommand(device));
      assertNull(DeviceManager.getDevice("dev"));
    }
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

          TestUtils.createImagePNG(m_testProject, "imA.png", 1, 2).getLocation().toPortableString();
      addDevice(category, "dev", "name", imagePath, new Rectangle(1, 2, 10, 20));
    }
    // initial Device state
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertEquals("name", device.getName());
      assertEquals(new Rectangle(1, 2, 10, 20), device.getDisplayBounds());
      assertEquals(1, device.getImage().getBounds().width);
      assertEquals(2, device.getImage().getBounds().height);
    }
    // edit
    {
      String imagePath =
          TestUtils.createImagePNG(m_testProject, "imB.png", 10, 20).getLocation().toPortableString();
      // this command will be ignored
      DeviceManager.commandsAdd(new DeviceEditCommand("dev",
          "otherName",
          imagePath,
          new Rectangle(0, 0, 0, 0)));
      // we will use this command
      DeviceManager.commandsAdd(new DeviceEditCommand("dev",
          "newName",
          imagePath,
          new Rectangle(10, 20, 100, 200)));
    }
    // Device was updated
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertEquals("newName", device.getName());
      assertEquals(new Rectangle(10, 20, 100, 200), device.getDisplayBounds());
      assertEquals(10, device.getImage().getBounds().width);
      assertEquals(20, device.getImage().getBounds().height);
    }
    // reload
    DeviceManager.commandsWrite();
    DeviceManager.forceReload();
    // still updated Device
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertEquals("newName", device.getName());
      assertEquals(new Rectangle(10, 20, 100, 200), device.getDisplayBounds());
      assertEquals(10, device.getImage().getBounds().width);
      assertEquals(20, device.getImage().getBounds().height);
    }
  }
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

          {
            List<DeviceInfo> devices = category.getDevices();
            assertThat(devices).hasSize(2);
            // devA
            {
              DeviceInfo device = devices.get(0);
              assertTrue(device.isContributed());
              assertSame(category, device.getCategory());
              // id
              assertEquals("devA", device.getId());
              assertSame(device, DeviceManager.getDevice("devA"));
              // name
              assertEquals("Device A", device.getName());
              // image
              assertEquals(new Rectangle(1, 2, 10, 20), device.getDisplayBounds());
              assertEquals("icons/devA.png", device.getImagePath());
              assertEquals(1, device.getImage().getBounds().width);
            }
            // devB
            {
              DeviceInfo device = devices.get(1);
              assertTrue(device.isContributed());
              assertSame(category, device.getCategory());
              // id
              assertEquals("devB", device.getId());
              assertSame(device, DeviceManager.getDevice("devB"));
              // name
              assertEquals("Device B", device.getName());
              // image
              assertEquals(new Rectangle(10, 20, 100, 200), device.getDisplayBounds());
              assertEquals("icons/devB.png", device.getImagePath());
              assertEquals(2, device.getImage().getBounds().width);
            }
          }
        }
        // not found
        assertSame(null, DeviceManager.getCategory("noSuchCategory"));
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

    CategoryInfo category = DeviceManager.getCategories().get(0);
    // add Device
    addDevice(category, "dev", "device");
    // visible initially
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertTrue(device.isVisible());
      // show (will be removed by second command)
      DeviceManager.commandsAdd(new ElementVisibilityCommand(device, true));
      // hide
      DeviceManager.commandsAdd(new ElementVisibilityCommand(device, false));
      assertFalse(device.isVisible());
    }
    // reload
    DeviceManager.commandsWrite();
    DeviceManager.forceReload();
    // still hidden
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertFalse(device.isVisible());
    }
  }
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.model.DeviceInfo

    CategoryInfo category = DeviceManager.getCategories().get(0);
    // add Device
    addDevice(category, "dev", "device");
    // can use new Device
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertEquals("device", device.getName());
      assertEquals(new Rectangle(1, 2, 10, 20), device.getDisplayBounds());
      assertEquals(10, device.getImage().getBounds().width);
      assertEquals(20, device.getImage().getBounds().height);
    }
    // reload
    DeviceManager.commandsWrite();
    DeviceManager.forceReload();
    // still can use new Device
    {
      DeviceInfo device = DeviceManager.getDevice("dev");
      assertEquals("device", device.getName());
      assertEquals(new Rectangle(1, 2, 10, 20), device.getDisplayBounds());
      assertEquals(10, device.getImage().getBounds().width);
      assertEquals(20, device.getImage().getBounds().height);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.