Ejemplo n.º 1
0
  private void initGUI(final GUIInfo info) {
    // Prepare a value manager that will include all forms spanned in each
    // tab
    vm = new ValuesManager();

    // Create all the tabs each one for a specific setup step
    tabs = new TabSet();
    tabs.setWidth(500);
    tabs.setHeight(250);

    Tab registrationTab = setupRegistration(vm);
    Tab repositoryTab = setupRepository(vm);
    Tab databaseTab = setupDatabase(vm);
    Tab languageTab = setupLanguage(vm);
    Tab smtpTab = setupSmtp(vm);
    tabs.setTabs(registrationTab, repositoryTab, databaseTab, languageTab, smtpTab);

    // This is the button used to confirm each step
    submit = new IButton();
    submit.setTitle(I18N.message("next"));
    submit.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onSubmit(info);
          }
        });

    // Prepare the heading panel with Logo and Title
    // Prepare the logo image to be shown inside the login form
    Label header = new Label(I18N.message("setup"));
    header.setStyleName("setupHeader");
    header.setIcon(Util.brandUrl("logo.png"));
    header.setIconWidth(205);
    header.setIconHeight(40);
    header.setHeight(45);

    // Prepare a panel to layout setup components
    VLayout layout = new VLayout();
    layout.setHeight(500);
    layout.setWidth(400);
    layout.setMembersMargin(5);
    layout.addMember(header);
    layout.addMember(tabs);
    layout.addMember(submit);

    // Panel for horizontal centering
    VLayout vPanel = new VLayout();
    vPanel.setDefaultLayoutAlign(Alignment.CENTER);
    vPanel.setWidth100();
    vPanel.setHeight(300);
    vPanel.addMember(layout);

    RootPanel.get().add(vPanel);

    // Remove the loading frame
    RootPanel.getBodyElement().removeChild(RootPanel.get("loadingWrapper").getElement());
  }
Ejemplo n.º 2
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);
          }
        });
  }