Skip to content
Permalink
Browse files

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
  • Loading branch information...
jisqyv authored and ewpatton committed Sep 11, 2019
1 parent b7f75bf commit edf486e454fc10adc69a2b643ad9d3aa0836a90f
@@ -2112,6 +2112,39 @@ public void run() {
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
* device or the emulator to App Inventor until you have a project
@@ -5,12 +5,15 @@

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.utils.MessageDialog;

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 static com.google.appinventor.client.Ode.MESSAGES;
@@ -27,7 +30,8 @@
public class MockFusionTablesControl extends MockNonVisibleComponent {

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
@@ -41,6 +45,25 @@ public MockFusionTablesControl(SimpleEditor editor, String type, Image 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
* we give a warning that FusiontablesControl is deprecated
@@ -56,4 +79,8 @@ public void onCreateFromPalette() {
}
}

public static void resetWarning() {
warningGiven = false;
}

}
@@ -19,6 +19,7 @@
import com.google.appinventor.client.editor.ProjectEditorFactory;
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.MockFusionTablesControl;
import com.google.appinventor.client.explorer.project.ComponentDatabaseChangeListener;
import com.google.appinventor.client.explorer.project.Project;
import com.google.appinventor.client.explorer.project.ProjectChangeListener;
@@ -164,6 +165,7 @@ public void execute() {
@Override
public void processProject() {
resetExternalComponents();
resetProjectWarnings();
loadExternalComponents();
callLoadProject();
}
@@ -704,6 +706,14 @@ public void execute() {
}
}

// 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() {
COMPONENT_DATABASE.addComponentDatabaseListener(this);
try {

0 comments on commit edf486e

Please sign in to comment.
You can’t perform that action at this time.