Examples of DeviceMoveCommand


Examples of com.google.gdt.eclipse.designer.mobile.device.command.DeviceMoveCommand

          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 {
            commands_add(new DeviceMoveCommand(device, category, null));
          }
        }
      }
      refreshViewer();
      updateButtons();
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.command.DeviceMoveCommand

        } 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();
        return true;
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.command.DeviceMoveCommand

      // has expected order
      DeviceInfo deviceA = DeviceManager.getDevice("devA");
      DeviceInfo deviceB = DeviceManager.getDevice("devB");
      assertEquals(devices.indexOf(deviceA), devices.indexOf(deviceB) - 1);
      // do move
      DeviceManager.commandsAdd(new DeviceMoveCommand(deviceB, category, deviceA));
      // new order
      assertEquals(devices.indexOf(deviceB), devices.indexOf(deviceA) - 1);
    }
    // reload
    DeviceManager.commandsWrite();
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.command.DeviceMoveCommand

      }
      // has expected order
      DeviceInfo deviceA = DeviceManager.getDevice("devA");
      assertEquals(devices.indexOf(deviceA), devices.size() - 2);
      // do move
      DeviceManager.commandsAdd(new DeviceMoveCommand(deviceA, category, null));
      // new order
      assertEquals(devices.indexOf(deviceA), devices.size() - 1);
    }
    // reload
    DeviceManager.commandsWrite();
View Full Code Here

Examples of com.google.gdt.eclipse.designer.mobile.device.command.DeviceMoveCommand

    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.command.DeviceMoveCommand

    // 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
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.