Java Code Examples for com.google.gwt.user.client.ui.FlowPanel

The following examples show how to use com.google.gwt.user.client.ui.FlowPanel. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: appinventor-extensions   Source File: GalleryList.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates the GUI components for search tab.
 *
 * @param searchApp: the FlowPanel that search tab will reside.
 */
private void addGallerySearchTab(FlowPanel searchApp) {
  // Add search GUI
  FlowPanel searchPanel = new FlowPanel();
  final TextBox searchText = new TextBox();
  searchText.addStyleName("gallery-search-textarea");
  Button sb = new Button(MESSAGES.gallerySearchForAppsButton());
  searchPanel.add(searchText);
  searchPanel.add(sb);
  searchPanel.addStyleName("gallery-search-panel");
  searchApp.add(searchPanel);
  appSearchContent.addStyleName("gallery-search-results");
  searchApp.add(appSearchContent);
  searchApp.addStyleName("gallery-search");

  sb.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
      gallery.FindApps(searchText.getText(), 0, NUMAPPSTOSHOW, 0, true);
    }
  });
}
 
Example 2
Source Project: appinventor-extensions   Source File: GalleryAppBox.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates new Gallery app box.
 */
private GalleryAppBox() {
  gContainer = new FlowPanel();
  final HorizontalPanel container = new HorizontalPanel();
  container.setWidth("100%");
  container.setSpacing(0);
  container.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  HorizontalPanel panel = new HorizontalPanel();
  Image image = new Image();
  image.setResource(Ode.getImageBundle().waitingIcon());
  panel.add(image);
  Label label = new Label();
  label.setText(Ode.getMessages().defaultRpcMessage());
  panel.add(label);
  gContainer.add(panel);
  this.add(gContainer);
}
 
Example 3
/**
 * Creates new component design panel for non-visible components.
 */
public SimpleNonVisibleComponentsPanel() {
  // Initialize UI
  VerticalPanel panel = new VerticalPanel();
  panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

  heading = new Label("");
  heading.setStyleName("ya-NonVisibleComponentsHeader");
  panel.add(heading);

  componentsPanel = new FlowPanel();
  componentsPanel.setStyleName("ode-SimpleUiDesignerNonVisibleComponents");
  panel.add(componentsPanel);

  initWidget(panel);
}
 
Example 4
Source Project: cuba   Source File: CubaPopupButtonWidget.java    License: Apache License 2.0 6 votes vote down vote up
protected void resetSelectedItem() {
    for (Widget popupChild : getPopup()) {
        if (popupChild instanceof FlowPanel) {
            FlowPanel content = (FlowPanel) popupChild;
            for (Widget contentChild : content) {
                VButton button = null;
                if (contentChild instanceof CubaFileUploadWidget) {
                    button = ((CubaFileUploadWidget) contentChild).getSubmitButton();
                } else if (contentChild instanceof VButton) {
                    button = (VButton) contentChild;
                } else if (contentChild instanceof VUpload) {
                    button = ((VUpload) contentChild).submitButton;
                }

                if (button != null && button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
                    button.removeStyleName(SELECTED_ITEM_STYLE);
                }
            }
        }
    }
}
 
Example 5
Source Project: unitime   Source File: UniTimeDialogBox.java    License: Apache License 2.0 6 votes vote down vote up
public UniTimeDialogBox(boolean autoHide, boolean modal) {
      super(autoHide, modal);
      
setAnimationEnabled(true);
setGlassEnabled(true);
	
      iContainer = new FlowPanel();
      iContainer.addStyleName("dialogContainer");
      
      iClose = new Anchor();
  	iClose.setTitle(MESSAGES.hintCloseDialog());
      iClose.setStyleName("close");
      iClose.addClickHandler(new ClickHandler() {
      	@Override
          public void onClick(ClickEvent event) {
              onCloseClick(event);
          }
      });
      iClose.setVisible(autoHide);

      iControls = new FlowPanel();
      iControls.setStyleName("dialogControls");        
      iControls.add(iClose);
  }
 
Example 6
Source Project: bitcoin-transaction-explorer   Source File: BitcoinJSONViewer.java    License: MIT License 6 votes vote down vote up
private void display(final int n, final FlowPanel container, final JSONValue tree) {
  JSONObject jsonObject;
  JSONString jsonString;
  JSONNumber jsonNumber;
  JSONArray jsonArray;
  final JSONBoolean jsonBoolean;

  // Just wanna point out the internal workings of JSONValue are weird as fuck
  if ((jsonObject = tree.isObject()) != null) {
    drawObject(container, n, jsonObject);
  } else if ((jsonString = tree.isString()) != null) {
    drawString(container, jsonString.stringValue());
  } else if ((jsonNumber = tree.isNumber()) != null) {
    drawNumber(container, jsonNumber.doubleValue());
  } else if (tree.isNull() != null) {
    drawNull(container);
  } else if ((jsonArray = tree.isArray()) != null) {
    drawArray(n, container, jsonArray);
  } else if ((jsonBoolean = tree.isBoolean()) != null) {
    drawBoolean(container, jsonBoolean.booleanValue());
  }
}
 
Example 7
Source Project: bitcoin-transaction-explorer   Source File: HexViewer.java    License: MIT License 6 votes vote down vote up
@Override
public void removeField(final int index) {
  final ContextField<Entry<T, byte[]>> contextField = fields.get(index);

  final FlowPanel byteSetContainer = (FlowPanel) contextField.getParent();

  contextField.removeFromParent();

  if(byteSetContainer.getWidgetCount() == 0) {
    byteSetContainer.removeFromParent();
  } else {
    this.byteSetContainer = byteSetContainer;
  }

  fields.remove(index);
}
 
Example 8
Source Project: gwt-traction   Source File: TractionDialogBox.java    License: Apache License 2.0 6 votes vote down vote up
public TractionDialogBox(boolean autoHide, boolean modal, boolean showCloseIcon) {
super(autoHide, modal, new TractionCaption());

container = new SimplePanel();
container.addStyleName("dialogContainer");

close = new Anchor();
close.setStyleName("x");
close.addClickHandler(new ClickHandler() {
           @Override
           public void onClick(ClickEvent event) {
               onCloseClick(event);
           }
});
setCloseIconVisible(showCloseIcon);

controls = new FlowPanel();
controls.setStyleName("dialogControls");
controls.add(close);

// add the controls to the end of the caption
TractionCaption caption = (TractionCaption) getCaption();
caption.add(controls);
   }
 
Example 9
Source Project: gwt-traction   Source File: UTCTimeBoxImplHtml4.java    License: Apache License 2.0 6 votes vote down vote up
public TimeBoxMenu() {
    super(true);
    setStyleName("gwt-TimeBox-menu");
    addAutoHidePartner(textbox.getElement());

    FlowPanel container = new FlowPanel();

    int numOptions = (int) (DAY / INTERVAL);
    options = new TimeBoxMenuOption[numOptions];

    // we need to use times for formatting, but we don't keep
    // them around. the purpose is only to generate text to
    // insert into the textbox.
    for (int i = 0; i < numOptions; i++) {
        options[i] = new TimeBoxMenuOption(i * INTERVAL);
        container.add(options[i]);
    }

    add(container);
}
 
Example 10
@Override
public void redraw() {
	super.redraw();
	this.clear();
	if (!this.aspects.isEmpty()) {
		FlowPanel flowPanel = new FlowPanel();
		int countAspectWidget = 0;
		for (AbstractTableColumnAspect<T> aspect : this.aspects) {
			Widget aspectWidget = aspect.asWidget();
			if (aspectWidget != null) {
				flowPanel.add(aspectWidget);
				countAspectWidget++;
			}
		}
		if (countAspectWidget > 0) {
			StyleUtils.addStyle(flowPanel, TableEditorTH.STYLE_FLOAT_RIGHT);
			this.append(flowPanel);
		}
	}
	if (this.text != null) {
		Label label = new Label();
		label.setText(this.text);
		this.append(label);
	}
}
 
Example 11
Source Project: consulo   Source File: GwtLoadingPanelImplConnector.java    License: Apache License 2.0 6 votes vote down vote up
public static Widget createPanel() {
  // http://tobiasahlin.com/spinkit/
  // MIT
  FlowPanel flowPanel = new FlowPanel();
  flowPanel.addStyleName("sk-cube-grid");

  for (int i = 1; i <= 9; i++) {
    FlowPanel child = new FlowPanel();
    child.addStyleName("sk-cube sk-cube" + i);
    flowPanel.add(child);
  }

  FlowPanel container = GwtUIUtil.fillAndReturn(new FlowPanel());
  container.getElement().getStyle().setProperty("display", "flex");
  container.getElement().getStyle().setProperty("justifyContent", "center");

  flowPanel.getElement().getStyle().setProperty("alignSelf", "center");
  container.add(flowPanel);
  return container;
}
 
Example 12
@Test
public void testPanels() throws Exception {
  invokeAllAccessibleMethods(new AbsolutePanel() {});
  invokeAllAccessibleMethods(new CellPanel() {});
  invokeAllAccessibleMethods(new ComplexPanel() {});
  invokeAllAccessibleMethods(new DeckLayoutPanel() {});
  invokeAllAccessibleMethods(new DeckPanel() {});
  invokeAllAccessibleMethods(new DecoratorPanel() {});
  invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {});
  invokeAllAccessibleMethods(new DockPanel() {});
  invokeAllAccessibleMethods(new FlowPanel() {});
  invokeAllAccessibleMethods(new FocusPanel() {});
  invokeAllAccessibleMethods(new HorizontalPanel() {});
  invokeAllAccessibleMethods(new HTMLPanel("") {});
  invokeAllAccessibleMethods(new LayoutPanel() {});
  invokeAllAccessibleMethods(new PopupPanel() {});
  invokeAllAccessibleMethods(new RenderablePanel("") {});
  invokeAllAccessibleMethods(new ResizeLayoutPanel() {});
  invokeAllAccessibleMethods(new SimpleLayoutPanel() {});
  invokeAllAccessibleMethods(new SimplePanel() {});
  invokeAllAccessibleMethods(new SplitLayoutPanel() {});
  invokeAllAccessibleMethods(new StackPanel() {});
  invokeAllAccessibleMethods(new VerticalPanel() {});
}
 
Example 13
Source Project: core   Source File: ConnectionStep.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(final Context<T> context) {
    form = context.xa ? new Form<>(XADataSource.class) : new Form<>(DataSource.class);
    TextAreaItem connectionUrl = new TextAreaItem("connectionUrl", "Connection URL");
    NonRequiredTextBoxItem user = new NonRequiredTextBoxItem("username", "Username");
    PasswordBoxItem pass = new PasswordBoxItem("password", "Password") {{
        setRequired(false);
    }};
    NonRequiredTextBoxItem domain = new NonRequiredTextBoxItem("securityDomain", "Security Domain");

    if (context.xa) {
        form.setFields(user, pass, domain);
    } else {
        form.setFields(connectionUrl, user, pass, domain);
    }

    FlowPanel body = new FlowPanel();
    body.add(new FormHelpPanel(context.dataSourceHelp, form).asWidget());
    body.add(form.asWidget());
    return body;
}
 
Example 14
Source Project: core   Source File: SummaryStep.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(final Context<T> context) {
    FlowPanel body = new FlowPanel();
    form = context.xa ? new Form<>(XADataSource.class) : new Form<>(DataSource.class);
    TextBoxItem nameItem = new TextBoxItem("name", "Name");
    TextBoxItem jndiItem = new TextBoxItem("jndiName", "JNDI Name");
    TextBoxItem connectionUrl = new TextBoxItem("connectionUrl", "Connection URL");
    xaProperties = new PropertyListItem("_do_not_populate_", "Properties");
    TextBoxItem user = new TextBoxItem("username", "Username");
    PasswordBoxItem pass = new PasswordBoxItem("password", "Password");
    if (context.xa) {
        form.setFields(nameItem, jndiItem, xaProperties, user, pass);
    } else {
        form.setFields(nameItem, jndiItem, connectionUrl, user, pass);
    }
    form.setEnabled(false);

    body.add(new ContentDescription(MESSAGES.datasourceSummaryDescription()));
    body.add(form);
    return body;
}
 
Example 15
@Override
protected Widget asWidget(final HandlerContext context) {
    ComplexAttributeForm fileAttributeForm = new ComplexAttributeForm(
            "file",
            wizard.getSecurityContext(),
            wizard.getResourceDescription()
    );
    formAssets = fileAttributeForm.build();

    FlowPanel layout = new FlowPanel();

    ContentDescription text = new ContentDescription(
            Console.CONSTANTS.logFileDescription());
    layout.add(text);
    layout.add(formAssets.asWidget());
    formAssets.getForm().setEnabled(true);

    return layout;
}
 
Example 16
Source Project: core   Source File: UploadStep.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(final Context context) {
    final FlowPanel panel = new FlowPanel();

    HTML description = new HTML(Console.CONSTANTS.common_label_chooseFile());
    description.getElement().setAttribute("style", "padding-bottom:15px;");
    panel.add(description);

    form = new FormPanel();

    // create a panel to hold all of the form widgets.
    VerticalPanel formPanel = new VerticalPanel();
    form.setWidget(formPanel);

    // create a FileUpload widgets.
    fileUpload = new FileUpload();
    fileUpload.setName("uploadFormElement");
    IdHelper.setId(fileUpload, id(), "file");
    formPanel.add(fileUpload);

    panel.add(form);
    return panel;
}
 
Example 17
Source Project: core   Source File: UnmanagedStep.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(final Context context) {
    FlowPanel panel = new FlowPanel();
    panel.add(new StaticHelpPanel(StaticHelp.unmanaged()).asWidget());

    form = new Form<>(UnmanagedBean.class);
    TextBoxItem name = new TextBoxItem("name", "Name");
    TextBoxItem runtimeName = new TextBoxItem("runtimeName", "Runtime Name") {
        @Override
        public void setFiltered(boolean filtered) {
            // ignore
        }
    };
    TextAreaItem path = new TextAreaItem("path", "Path");
    TextBoxItem relativeTo = new TextBoxItem("relativeTo", "Relative To", false);
    CheckBoxItem archive = new CheckBoxItem("archive", "Is Archive?");
    archive.setValue(true);
    enabled = new CheckBoxItem("enabled", "Enable");
    form.setFields(path, relativeTo, archive, name, runtimeName, enabled);
    panel.add(form.asWidget());

    return panel;
}
 
Example 18
Source Project: core   Source File: VerifyUploadStep.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected Widget asWidget(final Context context) {
    FlowPanel panel = new FlowPanel();
    panel.add(new StaticHelpPanel(StaticHelp.replace()).asWidget());

    form = new Form<>(UploadBean.class);
    TextBoxItem nameField = new TextBoxItem("name", Console.CONSTANTS.common_label_name());
    TextBoxItem runtimeNameField = new TextBoxItem("runtimeName", Console.CONSTANTS.common_label_runtimeName());
    enable = new CheckBoxItem("enableAfterDeployment", Console.CONSTANTS.common_label_enable());
    if (wizard instanceof CanEnableDeployment) {
        form.setFields(nameField, runtimeNameField, enable);
    } else {
        form.setFields(nameField, runtimeNameField);
    }
    panel.add(form.asWidget());

    return panel;
}
 
Example 19
Source Project: core   Source File: Wizard.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
public Footer() {
    cancel = new DefaultButton(CONSTANTS.common_label_cancel());
    cancel.addClickHandler(clickEvent -> onCancel());
    cancel.addStyleName("wizard-cancel");
    IdHelper.setId(cancel, id(), "cancel");

    back = new DefaultButton(CONSTANTS.wizard_back());
    back.addClickHandler(clickEvent -> onBack());
    IdHelper.setId(back, id(), "back");

    next = new DefaultButton(CONSTANTS.common_label_next());
    next.addClickHandler(clickEvent -> onNext());
    next.addStyleName("primary");
    IdHelper.setId(next, id(), "next");

    panel = new FlowPanel();
    panel.addStyleName("wizard-footer");
    panel.add(cancel);
    panel.add(back);
    panel.add(next);
}
 
Example 20
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: Apache License 2.0 5 votes vote down vote up
/**
   * Helper method called by constructor to initialize ui components
   */
  private void initComponents() {
    // Initialize UI
    panel = new VerticalPanel();
    panel.setWidth("100%");
    galleryGUI = new FlowPanel();
    appSingle = new FlowPanel();
    appDetails = new FlowPanel();
    appHeader = new FlowPanel();
    appInfo = new FlowPanel();
    appAction = new FlowPanel();
    appAuthor = new FlowPanel();
    appMeta = new FlowPanel();
    appDates = new FlowPanel();
    appPrimaryWrapper = new FlowPanel();
    appSecondaryWrapper = new FlowPanel();
    appDescPanel = new FlowPanel();
    appReportPanel = new FlowPanel();
    appSharePanel = new FlowPanel();
    appActionTabs = new TabPanel();
    sidebarTabs = new TabPanel();
    appComments = new FlowPanel();
    appCommentsList = new FlowPanel();
    appsByAuthor = new FlowPanel();
    appsByTags = new FlowPanel();
    appsRemixes = new FlowPanel();
    returnToGallery = new FlowPanel();
//    tagSelected = "";

    appCreated = new Label();
    appChanged = new Label();
    descBox = new FlowPanel();
    titleBox = new FlowPanel();
    desc = new TextArea();
    titleText = new TextArea();
    moreInfoText = new TextArea();
    creditText = new TextArea();
    ccLicenseRef = new HTML(MESSAGES.galleryCcLicenseRef());
    ccLicenseRef.addStyleName("app-action-html");
  }
 
Example 21
Source Project: appinventor-extensions   Source File: ProfilePage.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the GUI components for a regular app tab.
 * This method resides here because it needs access to global variables.
 * @param container: the FlowPanel that this app tab will reside.
 * @param content: the sub-panel that contains the actual app content.
 */
private void addGalleryAppTab(FlowPanel container, FlowPanel content, final String incomingUserId) {
  // Search specific
  generalTotalResultsLabel = new Label();
  container.add(generalTotalResultsLabel);

  final OdeAsyncCallback<GalleryAppListResult> byAuthorCallback = new OdeAsyncCallback<GalleryAppListResult>(
    // failure message
    MESSAGES.galleryError()) {
    @Override
    public void onSuccess(GalleryAppListResult appsResult) {
      refreshApps(appsResult,false);
    }
  };
  Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
  container.add(content);

  buttonNext = new Label();
  buttonNext.setText(MESSAGES.galleryMoreApps());
  buttonNext.addStyleName("active");

  FlowPanel next = new FlowPanel();
  next.add(buttonNext);
  next.addStyleName("gallery-nav-next");
  container.add(next);
  buttonNext.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
       if (!appCatalogExhausted) {
            // If the next page still has apps to retrieve, do it
            appCatalogCounter += NUMAPPSTOSHOW;
            Ode.getInstance().getGalleryService().getDeveloperApps(userId,appCatalogCounter ,NUMAPPSTOSHOW, byAuthorCallback);
          }
    }
  });
}
 
Example 22
Source Project: appinventor-extensions   Source File: ReportList.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Help method for Email Collapse Function
 * When the button(see more) is clicked, it will retrieve the whole email from database.
 * @param parent the parent container
 * @param emailId email id
 * @param preview email preview
 */
void createEmailCollapse(final FlowPanel parent, final long emailId, final String preview){
  final Label emailContent = new Label();
  emailContent.setText(preview);
  emailContent.addStyleName("inline-label");
  parent.add(emailContent);
  final Label actionButton = new Label();
  actionButton.setText(MESSAGES.seeMoreLink());
  actionButton.addStyleName("seemore-link");
  parent.add(actionButton);
  if(preview.length() <= MAX_EMAIL_PREVIEW_LENGTH){
    actionButton.setVisible(false);
  }
  actionButton.addClickHandler(new ClickHandler() {
    boolean ifPreview = true;
    @Override
    public void onClick(ClickEvent event) {
      if(ifPreview == true){
        OdeAsyncCallback<Email> callback = new OdeAsyncCallback<Email>(
            // failure message
            MESSAGES.serverUnavailable()) {
              @Override
              public void onSuccess(final Email email) {
                emailContent.setText(email.getBody());
                emailContent.addStyleName("inline");
                actionButton.setText(MESSAGES.hideLink());
                ifPreview = false;
              }
            };
        Ode.getInstance().getGalleryService().getEmail(emailId, callback);
      }else{
        emailContent.setText(preview);
        actionButton.setText(MESSAGES.seeMoreLink());
        ifPreview = true;
      }
    }
  });
}
 
Example 23
Source Project: appinventor-extensions   Source File: ModerationPageBox.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * load the moderation page, and setect tab index 0
 * For now, only one tab exists
 */
public static void loadModerationPage() {

  INSTANCE.reports = new ReportList();

  FlowPanel reportsContainer = new FlowPanel();
  reportsContainer.add(INSTANCE.reports);

  INSTANCE.add(reportsContainer, MESSAGES.moderationPageBoxCaption());
  INSTANCE.selectTab(0);

  // Styling options
  INSTANCE.addStyleName("gallery");
}
 
Example 24
Source Project: appinventor-extensions   Source File: GalleryListBox.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Load GalleryList
 */
public static void loadGalleryList(){
  INSTANCE.plist = new GalleryList();
  FlowPanel pContainer = new FlowPanel();
  pContainer.add(INSTANCE.plist);
  INSTANCE.add(pContainer);
}
 
Example 25
Source Project: appinventor-extensions   Source File: ProfileBox.java    License: Apache License 2.0 5 votes vote down vote up
/**
   * Creates new user profile box.
   */
  private ProfileBox() {
//    super(MESSAGES.userProfileBoxCaption(),
//        300,    // height
//        false,  // minimizable
//        false); // removable
    pContainer = new FlowPanel();
    this.add(pContainer);
  }
 
Example 26
Source Project: appinventor-extensions   Source File: TutorialPanel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates video on page!
 */
private static void createVideoDialog(String tutorialId) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText("Tutorial Video");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  VerticalPanel DialogBoxContents = new VerticalPanel();
  // Adds Youtube Video
  HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>");
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  ok.setStyleName("DialogBox-button");
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.center();
  dialogBox.show();
}
 
Example 27
Source Project: appinventor-extensions   Source File: Ode.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Possibly display the MIT App Inventor "Splash Screen"
 *
 * @param force Bypass the check to see if they have dimissed this version
 */
private void createWelcomeDialog(boolean force) {
  if (!shouldShowWelcomeDialog() && !force) {
    maybeShowNoProjectsDialog();
    return;
  }
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.createWelcomeDialogText());
  dialogBox.setHeight(splashConfig.height + "px");
  dialogBox.setWidth(splashConfig.width + "px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(splashConfig.content);
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button ok = new Button(MESSAGES.createWelcomeDialogButton());
  final CheckBox noshow = new CheckBox(MESSAGES.doNotShow());
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
        if (noshow.getValue()) { // User checked the box
          userSettings.getSettings(SettingsConstants.SPLASH_SETTINGS).
            changePropertyValue(SettingsConstants.SPLASH_SETTINGS_VERSION,
              "" + splashConfig.version);
          userSettings.saveSettings(null);
        }
        maybeShowNoProjectsDialog();
      }
    });
  holder.add(ok);
  holder.add(noshow);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}
 
Example 28
Source Project: appinventor-extensions   Source File: Ode.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Show a Dialog Box when we receive an SC_PRECONDITION_FAILED
 * response code to any Async RPC call. This is a signal that
 * either our session has expired, or our login cookie has otherwise
 * become invalid. This is a fatal error and the user should not
 * be permitted to continue (many ignore the red error bar and keep
 * working, in vain). So now when this happens, we put up this
 * modal dialog box which cannot be dismissed. Instead it presents
 * just one option, a "Reload" button which reloads the browser.
 * This should trigger a re-authentication (or in the case of an
 * App Inventor upgrade trigging the problem, the loading of newer
 * code).
 */

public void sessionDead() {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.invalidSessionDialogText());
  dialogBox.setWidth("400px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(MESSAGES.sessionDead());
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button reloadSession = new Button(MESSAGES.reloadWindow());
  reloadSession.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
        reloadWindow(true);
      }
    });
  holder.add(reloadSession);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}
 
Example 29
Source Project: appinventor-extensions   Source File: Ode.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 30
Source Project: appinventor-extensions   Source File: Ode.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Display a Dialog box that explains that you cannot connect a
 * device or the emulator to App Inventor until you have a project
 * selected.
 */

private void wontConnectDialog() {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.noprojectDialogTitle());
  dialogBox.setHeight("100px");
  dialogBox.setWidth("400px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML("<p>" + MESSAGES.noprojectDuringConnect() + "</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();
}