Exemple #1
0
  public StatsPanel() {
    setWidth100();
    setMembersMargin(10);

    service.getStatistics(
        Session.get().getSid(),
        I18N.getLocale(),
        new AsyncCallback<GUIParameter[][]>() {

          @Override
          public void onFailure(Throwable caught) {
            Log.serverError(caught);
          }

          @Override
          public void onSuccess(GUIParameter[][] parameters) {
            Label lastUpdateLabel =
                new Label(
                    "<b>"
                        + I18N.message("lastupdate")
                        + ": "
                        + parameters[3][0].getValue()
                        + "</b>");
            lastUpdateLabel.setHeight(30);
            lastUpdateLabel.setAlign(Alignment.RIGHT);

            PieStats charts = new PieStats(parameters);

            setMembers(lastUpdateLabel, charts);
          }
        });
  }
Exemple #2
0
  /** Prepares the language form */
  private Tab setupLanguage(final ValuesManager vm) {
    Tab languageTab = new Tab();
    languageTab.setTitle(I18N.message(LANGUAGE));

    SelectItem languageItem = ItemFactory.newLanguageSelector(LANGUAGE, false, true);
    languageItem.setTitle(I18N.message("defaultlang"));
    languageItem.setRequired(true);
    languageItem.setValue(I18N.getLocale());

    final DynamicForm languageForm = new DynamicForm();
    languageForm.setID("languageForm");
    languageForm.setValuesManager(vm);
    languageForm.setFields(languageItem);
    languageForm.setDisabled(true);
    languageTab.setPane(languageForm);
    return languageTab;
  }
Exemple #3
0
  @Override
  public void onModuleLoad() {
    // Setup the language for localization
    RequestInfo loc = WindowUtils.getRequestInfo();

    // Tries to capture locale parameter
    String lang;
    if (loc.getParameter(Constants.LOCALE) != null
        && !loc.getParameter(Constants.LOCALE).equals("")) {
      lang = loc.getParameter(Constants.LOCALE);
    } else {
      // First we initialize language values
      lang = Util.getBrowserLanguage();
    }
    I18N.setLocale(lang);

    // Get grid of scrollbars, and clear out the window's built-in margin,
    // because we want to take advantage of the entire client area.
    Window.enableScrolling(false);
    Window.setMargin("0px");

    infoService.getInfo(
        I18N.getLocale(),
        new AsyncCallback<GUIInfo>() {
          @Override
          public void onFailure(Throwable error) {
            SC.warn(error.getMessage());
          }

          @Override
          public void onSuccess(GUIInfo info) {
            I18N.init(info);

            WindowUtils.setTitle(
                info.getProductName()
                    + " "
                    + info.getRelease()
                    + (info.getLicensee() != null
                        ? " - " + I18N.message("licensedto") + ": " + info.getLicensee()
                        : ""));
            initGUI(info);
          }
        });
  }