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

Give deprecation warning for FusiontablesControl

Give a warning when a project that uses the FusiontablesControl is
loaded. Google will be shutting down the Fusiontables service on
December 3rd, 2019.

Change-Id: I6a56853ea8a56790495b4462b1c59d5c3059eaef
parent b7f75bfe
...@@ -2112,6 +2112,39 @@ public class Ode implements EntryPoint { ...@@ -2112,6 +2112,39 @@ public class Ode implements EntryPoint {
dialogBox.show(); dialogBox.show();
} }
/**
* Display a dialog box with a provided warning message.
*
* @param message The message to display
*/
public void genericWarning(String inputMessage) {
// Create the UI elements of the DialogBox
final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setText(MESSAGES.warningDialogTitle());
dialogBox.setHeight("100px");
dialogBox.setWidth("400px");
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
dialogBox.center();
VerticalPanel DialogBoxContents = new VerticalPanel();
HTML message = new HTML("<p>" + inputMessage + "</p>");
message.setStyleName("DialogBox-message");
FlowPanel holder = new FlowPanel();
Button okButton = new Button("OK");
okButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
dialogBox.hide();
}
});
holder.add(okButton);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
dialogBox.setWidget(DialogBoxContents);
dialogBox.show();
}
/** /**
* Display a Dialog box that explains that you cannot connect a * Display a Dialog box that explains that you cannot connect a
* device or the emulator to App Inventor until you have a project * device or the emulator to App Inventor until you have a project
......
...@@ -5,12 +5,15 @@ ...@@ -5,12 +5,15 @@
package com.google.appinventor.client.editor.simple.components; package com.google.appinventor.client.editor.simple.components;
import com.google.appinventor.client.Ode;
import com.google.appinventor.client.editor.simple.SimpleEditor; import com.google.appinventor.client.editor.simple.SimpleEditor;
import com.google.appinventor.client.utils.MessageDialog; import com.google.appinventor.client.utils.MessageDialog;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Image;
import static com.google.appinventor.client.Ode.MESSAGES; import static com.google.appinventor.client.Ode.MESSAGES;
...@@ -27,7 +30,8 @@ import static com.google.appinventor.client.Ode.MESSAGES; ...@@ -27,7 +30,8 @@ import static com.google.appinventor.client.Ode.MESSAGES;
public class MockFusionTablesControl extends MockNonVisibleComponent { public class MockFusionTablesControl extends MockNonVisibleComponent {
public static final String TYPE = "FusiontablesControl"; public static final String TYPE = "FusiontablesControl";
private static boolean warningGiven = false; // Whether or not we have given experimental warning private static boolean warningGiven = false; // Whether or not we have given the
// deprecation warning
/** /**
* Creates a new instance of a non-visible component whose icon is * Creates a new instance of a non-visible component whose icon is
...@@ -41,6 +45,25 @@ public class MockFusionTablesControl extends MockNonVisibleComponent { ...@@ -41,6 +45,25 @@ public class MockFusionTablesControl extends MockNonVisibleComponent {
super(editor, type, iconImage); super(editor, type, iconImage);
} }
/**
* Generate a dialog box indicating that the FusiontablesControl is
* deprecated.
*/
@Override
protected void onAttach() {
super.onAttach();
if (!warningGiven) {
warningGiven = true;
DeferredCommand.addCommand(new Command() {
@Override
public void execute() {
Ode.getInstance().genericWarning(MESSAGES.FusionTablesDeprecated());
}
});
}
}
/** /**
* Called when the component is dropped in the Designer window * Called when the component is dropped in the Designer window
* we give a warning that FusiontablesControl is deprecated * we give a warning that FusiontablesControl is deprecated
...@@ -56,4 +79,8 @@ public class MockFusionTablesControl extends MockNonVisibleComponent { ...@@ -56,4 +79,8 @@ public class MockFusionTablesControl extends MockNonVisibleComponent {
} }
} }
public static void resetWarning() {
warningGiven = false;
}
} }
...@@ -19,6 +19,7 @@ import com.google.appinventor.client.editor.ProjectEditor; ...@@ -19,6 +19,7 @@ import com.google.appinventor.client.editor.ProjectEditor;
import com.google.appinventor.client.editor.ProjectEditorFactory; import com.google.appinventor.client.editor.ProjectEditorFactory;
import com.google.appinventor.client.editor.simple.SimpleComponentDatabase; import com.google.appinventor.client.editor.simple.SimpleComponentDatabase;
import com.google.appinventor.client.editor.simple.components.MockComponent; import com.google.appinventor.client.editor.simple.components.MockComponent;
import com.google.appinventor.client.editor.simple.components.MockFusionTablesControl;
import com.google.appinventor.client.explorer.project.ComponentDatabaseChangeListener; import com.google.appinventor.client.explorer.project.ComponentDatabaseChangeListener;
import com.google.appinventor.client.explorer.project.Project; import com.google.appinventor.client.explorer.project.Project;
import com.google.appinventor.client.explorer.project.ProjectChangeListener; import com.google.appinventor.client.explorer.project.ProjectChangeListener;
...@@ -164,6 +165,7 @@ public final class YaProjectEditor extends ProjectEditor implements ProjectChang ...@@ -164,6 +165,7 @@ public final class YaProjectEditor extends ProjectEditor implements ProjectChang
@Override @Override
public void processProject() { public void processProject() {
resetExternalComponents(); resetExternalComponents();
resetProjectWarnings();
loadExternalComponents(); loadExternalComponents();
callLoadProject(); callLoadProject();
} }
...@@ -704,6 +706,14 @@ public final class YaProjectEditor extends ProjectEditor implements ProjectChang ...@@ -704,6 +706,14 @@ public final class YaProjectEditor extends ProjectEditor implements ProjectChang
} }
} }
// Resets any warnings that should be given when a project is loaded
// For now this is just the deprecation warning for the
// FusiontablesControl component.
private void resetProjectWarnings() {
MockFusionTablesControl.resetWarning();
}
private void resetExternalComponents() { private void resetExternalComponents() {
COMPONENT_DATABASE.addComponentDatabaseListener(this); COMPONENT_DATABASE.addComponentDatabaseListener(this);
try { try {
......
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