public boolean equals(DeviceEntry test) { if (test == null) { return false; } if (test.getDescriptorLocation().equals(getDescriptorLocation())) { return true; } return false; }
public static void addDeviceEntry(DeviceEntry entry) { for (Enumeration en = getDeviceEntries().elements(); en.hasMoreElements();) { DeviceEntry test = (DeviceEntry) en.nextElement(); if (test.getDescriptorLocation().equals(entry.getDescriptorLocation())) { return; } } XMLElement devicesXml = configXml.getChildOrNew("devices"); XMLElement deviceXml = devicesXml.addChild("device"); if (entry.isDefaultDevice()) { deviceXml.setAttribute("default", "true"); } deviceXml.addChild("name", entry.getName()); deviceXml.addChild("filename", entry.getFileName()); deviceXml.addChild("descriptor", entry.getDescriptorLocation()); saveConfig(); }
emulatorContext, classLoader, entry.getDescriptorLocation()); this.deviceEntry = entry; setDevice(device);
if (devices.containsKey(entry.getDescriptorLocation())) { devices.remove(entry.getDescriptorLocation());
public static void changeDeviceEntry(DeviceEntry entry) { XMLElement devicesXml = configXml.getChild("devices"); if (devicesXml == null) { return; } for (Enumeration e_device = devicesXml.enumerateChildren(); e_device.hasMoreElements();) { XMLElement tmp_device = (XMLElement) e_device.nextElement(); if (tmp_device.getName().equals("device")) { String testDescriptor = tmp_device.getChildString("descriptor", null); if (testDescriptor.equals(entry.getDescriptorLocation())) { if (entry.isDefaultDevice()) { tmp_device.setAttribute("default", "true"); } else { tmp_device.removeAttribute("default"); } saveConfig(); break; } } } }
public static void removeDeviceEntry(DeviceEntry entry) { XMLElement devicesXml = configXml.getChild("devices"); if (devicesXml == null) { return; } for (Enumeration e_device = devicesXml.enumerateChildren(); e_device.hasMoreElements();) { XMLElement tmp_device = (XMLElement) e_device.nextElement(); if (tmp_device.getName().equals("device")) { String testDescriptor = tmp_device.getChildString("descriptor", null); // this is needed by migration config.xml -> config2.xml if (testDescriptor == null) { devicesXml.removeChild(tmp_device); saveConfig(); continue; } if (testDescriptor.equals(entry.getDescriptorLocation())) { devicesXml.removeChild(tmp_device); saveConfig(); break; } } } }
if (devices.containsKey(entry.getDescriptorLocation())) { devices.remove(entry.getDescriptorLocation());
if (deviceInput != null && deviceInput.getDescriptorLocation().equals(DeviceImpl.DEFAULT_LOCATION)) { deviceInput = null;
public static void setDeviceEntryDisplaySize(DeviceEntry entry, Rectangle rect) { if (entry == null) { return; } XMLElement devicesXml = configXml.getChild("devices"); if (devicesXml == null) { return; } for (Enumeration e_device = devicesXml.enumerateChildren(); e_device.hasMoreElements();) { XMLElement tmp_device = (XMLElement) e_device.nextElement(); if (tmp_device.getName().equals("device")) { String testDescriptor = tmp_device.getChildString("descriptor", null); if (testDescriptor.equals(entry.getDescriptorLocation())) { XMLElement mainXml = tmp_device.getChildOrNew("rectangle"); XMLElement xml = mainXml.getChildOrNew("x"); xml.setContent(String.valueOf(rect.x)); xml = mainXml.getChildOrNew("y"); xml.setContent(String.valueOf(rect.y)); xml = mainXml.getChildOrNew("width"); xml.setContent(String.valueOf(rect.width)); xml = mainXml.getChildOrNew("height"); xml.setContent(String.valueOf(rect.height)); saveConfig(); break; } } } }
public static Rectangle getDeviceEntryDisplaySize(DeviceEntry entry) { XMLElement devicesXml = configXml.getChild("devices"); if (devicesXml != null) { for (Enumeration e_device = devicesXml.enumerateChildren(); e_device.hasMoreElements();) { XMLElement tmp_device = (XMLElement) e_device.nextElement(); if (tmp_device.getName().equals("device")) { String testDescriptor = tmp_device.getChildString("descriptor", null); if (testDescriptor.equals(entry.getDescriptorLocation())) { XMLElement rectangleXml = tmp_device.getChild("rectangle"); if (rectangleXml != null) { Rectangle result = new Rectangle(); result.x = rectangleXml.getChildInteger("x", -1); result.y = rectangleXml.getChildInteger("y", -1); result.width = rectangleXml.getChildInteger("width", -1); result.height = rectangleXml.getChildInteger("height", -1); return result; } } } } } return null; }
classLoader = createExtensionsClassLoader(urls); setDevice(DeviceImpl.create(emulatorContext, classLoader, defaultDevice.getDescriptorLocation(), defaultDeviceClass)); defaultDeviceSelected = true; } else {
Device device = DeviceImpl.create(emulatorContext, classLoader, entry.getDescriptorLocation(), J2SEDevice.class); this.deviceEntry = entry;