Make preview size listbox invisible when Sizing = Fixed
@@ -92,27 +92,15 @@ public final class SimpleVisibleComponentsPanel extends Composite implements Dro
@Override
protected void onLoad() {
// onLoad is called immediately after a widget becomes attached to the browser's document.
- String val = projectEditor.getProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS,
- SettingsConstants.YOUNG_ANDROID_SETTINGS_PHONE_TABLET);
-
- int idx = 0;
- int width = 320;
- int height = 505;
-
- if (val.equals("True")) {
- idx = 1;
- width = drop_lst[idx][0];
- height = drop_lst[idx][1];
- }
-
- String[] parts = val.split(",");
- if (parts.length == 3) {
- idx = Integer.parseInt(parts[0]);
- width = Integer.parseInt(parts[1]);
- height = Integer.parseInt(parts[2]);
+ String sizing = projectEditor.getProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS,
+ SettingsConstants.YOUNG_ANDROID_SETTINGS_SIZING);
+ boolean fixed = (sizing.equals("Fixed"));
+ listboxPhoneTablet.setVisible(!fixed);
+ if (fixed) {
+ changeFormPreviewSize(0, 320, 505);
+ } else {
+ getUserSettingChangeSize();
}
- listboxPhoneTablet.setItemSelected(idx, true);
- changeFormPreviewSize(idx, width, height);
}
};
listboxPhoneTablet.addItem("Phone size");
@@ -131,11 +119,36 @@ public final class SimpleVisibleComponentsPanel extends Composite implements Dro
changeFormPreviewSize(idx, width, height);
}
});
+
phoneScreen.add(listboxPhoneTablet);
initWidget(phoneScreen);
}
+ // get width and height stored in user settings, and change the preview size.
+ private void getUserSettingChangeSize() {
+ String val = projectEditor.getProjectSettingsProperty(SettingsConstants.PROJECT_YOUNG_ANDROID_SETTINGS,
+ SettingsConstants.YOUNG_ANDROID_SETTINGS_PHONE_TABLET);
+ int idx = 0;
+ int width = 320;
+ int height = 505;
+
+ if (val.equals("True")) {
+ idx = 1;
+ width = drop_lst[idx][0];
+ height = drop_lst[idx][1];
+ }
+
+ String[] parts = val.split(",");
+ if (parts.length == 3) {
+ idx = Integer.parseInt(parts[0]);
+ width = Integer.parseInt(parts[1]);
+ height = Integer.parseInt(parts[2]);
+ }
+ listboxPhoneTablet.setItemSelected(idx, true);
+ changeFormPreviewSize(idx, width, height);
+ }
+
private void changeFormPreviewSize(int idx, int width, int height) {
if (form != null) {
form.changePreviewSize(width, height);
@@ -161,8 +174,11 @@ public final class SimpleVisibleComponentsPanel extends Composite implements Dro
public void enableTabletPreviewCheckBox(boolean enable){
if (form != null){
if (!enable){
- form.changePreviewSize(320, 505);
- listboxPhoneTablet.setItemSelected(0, true);
+ changeFormPreviewSize(0, 320, 505);
+ listboxPhoneTablet.setVisible(enable);
+ } else {
+ getUserSettingChangeSize();
+ listboxPhoneTablet.setVisible(enable);
}
}
listboxPhoneTablet.setEnabled(enable);
