Commit d1d8e3bc authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Improve MockFeatureCollection behavior (#1076)

1. Makes the GeoJSON asset picker show "None..." instead of "..." when
   nothing is selected
2. Makes MockFeatureCollection icon show when dragging from the palette
3. Centers the "From URL" dialog that appears when retrieving GeoJSON
   from a URL

Fixes #1074

Change-Id: Ib88eb768df5421b8be4defb472e4b516a3ca94fa
parent 5f80b746
...@@ -11,6 +11,7 @@ import com.google.appinventor.client.editor.simple.SimpleEditor; ...@@ -11,6 +11,7 @@ import com.google.appinventor.client.editor.simple.SimpleEditor;
import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONObject; import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.SimplePanel;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -31,8 +32,11 @@ public class MockFeatureCollection extends MockContainer implements MockMapFeatu ...@@ -31,8 +32,11 @@ public class MockFeatureCollection extends MockContainer implements MockMapFeatu
super(editor, TYPE, images.featurecollection(), new MockFeatureCollectionLayout()); super(editor, TYPE, images.featurecollection(), new MockFeatureCollectionLayout());
SimplePanel panel = new SimplePanel(); SimplePanel panel = new SimplePanel();
panel.setWidth("0px"); panel.setWidth("16px");
panel.setHeight("0px"); panel.setHeight("16px");
panel.setStylePrimaryName("ode-SimpleMockComponent");
Image icon = new Image(images.featurecollection());
panel.add(icon);
initComponent(panel); initComponent(panel);
initCollection(); initCollection();
...@@ -45,6 +49,9 @@ public class MockFeatureCollection extends MockContainer implements MockMapFeatu ...@@ -45,6 +49,9 @@ public class MockFeatureCollection extends MockContainer implements MockMapFeatu
@Override @Override
public void addToMap(MockMap map) { public void addToMap(MockMap map) {
setVisible(false); // MockFeatureCollection is managed by Leaflet
layout.layoutWidth = 0;
layout.layoutHeight = 0;
this.map = map; this.map = map;
setContainer(map); setContainer(map);
addToMap(map.getMapInstance()); addToMap(map.getMapInstance());
......
...@@ -12,8 +12,8 @@ import java.util.Map; ...@@ -12,8 +12,8 @@ import java.util.Map;
public class MockFeatureCollectionLayout extends MockLayout { public class MockFeatureCollectionLayout extends MockLayout {
MockFeatureCollectionLayout() { MockFeatureCollectionLayout() {
layoutWidth = 0; layoutWidth = 16;
layoutHeight = 0; layoutHeight = 16;
} }
@Override @Override
......
...@@ -107,6 +107,7 @@ public class YoungAndroidGeoJSONPropertyEditor extends AdditionalChoicePropertyE ...@@ -107,6 +107,7 @@ public class YoungAndroidGeoJSONPropertyEditor extends AdditionalChoicePropertyE
} }
}; };
UrlImportWizard wizard = new UrlImportWizard(assetsFolder, callback); UrlImportWizard wizard = new UrlImportWizard(assetsFolder, callback);
wizard.center();
wizard.show(); wizard.show();
} }
}); });
...@@ -142,6 +143,15 @@ public class YoungAndroidGeoJSONPropertyEditor extends AdditionalChoicePropertyE ...@@ -142,6 +143,15 @@ public class YoungAndroidGeoJSONPropertyEditor extends AdditionalChoicePropertyE
super.orphan(); super.orphan();
} }
@Override
protected String getPropertyValueSummary() {
String value = property.getValue();
if (choices.containsValue(value)) {
return choices.getDisplayItemForValue(value);
}
return value;
}
@Override @Override
protected boolean okAction() { protected boolean okAction() {
int selected = assetsList.getSelectedIndex(); int selected = assetsList.getSelectedIndex();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment