import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
protected Composite buttonComp = null;
protected int ITEM_COUNT = 11;
+ protected int itemListCount = 0;
public int checkItemCountwithSize() {
int h = parent.getSize().y - 30 - 36 - 60;
}
public void settingItemList() {
- Image image = PatchImageResources.getDetailListView(checkItemCountwithSize());
- Image image2 = PatchImageResources.getDetailListView2(checkItemCountwithSize());
+ int beforeItemCount = ITEM_COUNT;
+ int currentItemCount = checkItemCountwithSize();
+ boolean needItemListCheck = false;
+ if (beforeItemCount != currentItemCount
+ || itemListBack.getBackgroundImage() == null ) {
+ needItemListCheck = true;
+ Image image = PatchImageResources.getDetailListView(currentItemCount);
+ Image image2 = PatchImageResources.getDetailListView2(currentItemCount);
- itemListBack.setBackgroundImage(image);
- scrolledList.setBackgroundImage(image2);
+ if (itemListBack.getBackgroundImage() != null) {
+ itemListBack.getBackgroundImage().dispose();
+ }
+ if (scrolledList.getBackgroundImage() != null) {
+ scrolledList.getBackgroundImage().dispose();
+ }
- FormData data = new FormData();
- data.left = new FormAttachment(0, 10);
- data.top = new FormAttachment(itemListTop, 0);
- data.height = image.getImageData().height;
- data.width = image.getImageData().width;
- itemListBack.setLayoutData(data);
- itemListBack.setSize(data.width, data.height);
+ itemListBack.setBackgroundImage(image);
+ scrolledList.setBackgroundImage(image2);
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(0, 0);
- int bottomGap = image.getImageData().height - image2.getImageData().height;
- data.bottom = new FormAttachment(100, -bottomGap);
- data.height = image2.getImageData().height;
- data.width = image2.getImageData().width;
- scrolledList.setSize(data.width, data.height);
- scrolledList.setLayoutData(data);
-
- int count = checkItemCount();
- if (count != 0) {
- Image image3 = PatchImageResources.getDetailListView2(count);
- Point size = new Point(image3.getImageData().width,
- image3.getImageData().height);
- if (stackLayout.topControl != null) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 10);
+ data.top = new FormAttachment(itemListTop, 0);
+ data.height = image.getImageData().height;
+ data.width = image.getImageData().width;
+ itemListBack.setLayoutData(data);
+ itemListBack.setSize(data.width, data.height);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ int bottomGap = image.getImageData().height - image2.getImageData().height;
+ data.bottom = new FormAttachment(100, -bottomGap);
+ data.height = image2.getImageData().height;
+ data.width = image2.getImageData().width;
+ scrolledList.setSize(data.width, data.height);
+ scrolledList.setLayoutData(data);
+ }
+
+ int beforeItemListCount = itemListCount;
+ int currentItemListCount = checkItemCount();
+ if (stackLayout.topControl == null) {
+ if (beforeItemListCount != currentItemListCount) {
+ Image image3 = PatchImageResources.getDetailListView2(currentItemListCount);
+ Point size = new Point(image3.getImageData().width,image3.getImageData().height);
+ image3.dispose();
+ itemList.setSize(size);
+ itemList.layout();
+ }
+ } else {
+ if (stackLayout.topControl.getBackgroundImage() == null) {
+ Image image3 = PatchImageResources.getDetailListView2(currentItemListCount);
+ Point size = new Point(image3.getImageData().width,image3.getImageData().height);
stackLayout.topControl.setBackgroundImage(image3);
stackLayout.topControl.setSize(size);
+ itemList.setSize(size);
+ itemList.layout();
+ } else {
+ Point size = new Point(stackLayout.topControl.getBackgroundImage().getImageData().width,
+ stackLayout.topControl.getBackgroundImage().getImageData().height);
+ if (needItemListCheck || beforeItemListCount != currentItemListCount) {
+ stackLayout.topControl.getBackgroundImage().dispose();
+ Image image3 = PatchImageResources.getDetailListView2(currentItemListCount);
+ size = new Point(image3.getImageData().width,image3.getImageData().height);
+ stackLayout.topControl.setBackgroundImage(image3);
+ stackLayout.topControl.setSize(size);
+ }
+ itemList.setSize(size);
+ itemList.layout();
}
- itemList.setSize(size);
- itemList.layout();
}
+
itemListBack.layout(true, false);
}
public class EmulatorVMList {
static EmulatorVMList instance = null;
+ static JAXBContext context = null;
static {
synchronized(EmulatorVMList.class) {
instance = new EmulatorVMList();
+ try {
+ context = JAXBContext.newInstance(EmulatorConfiguration.class);
+ } catch (JAXBException e){
+ EMLogger.getLogger().info(e.getMessage());
+ }
}
}
}
public VMProperty parseXML(File configFile) {
- JAXBContext context = null;
JAXBElement<EmulatorConfiguration> element = null;
try {
- context = JAXBContext.newInstance(EmulatorConfiguration.class);
-
Unmarshaller unmarshaller = context.createUnmarshaller();
element = unmarshaller.unmarshal(new StreamSource(configFile), EmulatorConfiguration.class);
} catch (JAXBException e) {
}
public boolean storeXML(VMProperty property) {
- JAXBContext context = null;
-
try {
- context = JAXBContext.newInstance(EmulatorConfiguration.class);
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);