private void addForm(IWContext iwc) {
    Form form = new Form();
    form.maintainParameter(PARAMETER_GROUP_ID);

    Table mainTable = new Table();
    mainTable.setWidth(660);
    mainTable.setHeight(200);
    mainTable.setCellpadding(0);
    mainTable.setCellspacing(0);
    form.add(mainTable);

    Table topTable = new Table(1, 1);
    topTable.setStyleClass(MAIN_STYLECLASS);
    topTable.setWidth(Table.HUNDRED_PERCENT);
    topTable.setHeight(160);

    topTable.add(
        this.iwrb.getLocalizedString(
            UPDATE_INFO, "Press Update to update all clubs linked to this league."),
        1,
        1);

    CloseButton close =
        new CloseButton(
            this.iwrb.getLocalizedImageButton("updateclubdivisiontemplate.close", "Close"));
    SubmitButton start =
        new SubmitButton(
            this.iwrb.getLocalizedImageButton("updateclubdivisiontemplate.update", "Update"),
            ACTION,
            ACTION_UPDATE);
    start.setSubmitConfirm(
        this.iwrb.getLocalizedString(
            "updateclubdivisiontemplate.confirm_message",
            "Are you sure you want to start the update process? The process will start in the background and once it is running you can not stop it nor start a new one."));
    Help help = getHelp(HELP_TEXT_KEY);

    Table bottomTable = new Table();
    bottomTable.setCellpadding(0);
    bottomTable.setCellspacing(5);
    bottomTable.setWidth(Table.HUNDRED_PERCENT);
    bottomTable.setHeight(39);
    bottomTable.setStyleClass(MAIN_STYLECLASS);
    bottomTable.add(help, 1, 1);
    bottomTable.setAlignment(2, 1, Table.HORIZONTAL_ALIGN_RIGHT);
    bottomTable.add(start, 2, 1);
    bottomTable.add(Text.getNonBrakingSpace(), 2, 1);
    bottomTable.add(close, 2, 1);

    mainTable.setVerticalAlignment(1, 1, Table.VERTICAL_ALIGN_TOP);
    mainTable.setVerticalAlignment(1, 3, Table.VERTICAL_ALIGN_TOP);
    mainTable.add(topTable, 1, 1);
    mainTable.add(bottomTable, 1, 3);

    add(form, iwc);
  }
  private void addInfo(IWContext iwc) {
    Form form = new Form();
    form.maintainParameter(PARAMETER_GROUP_ID);

    Table mainTable = new Table();
    mainTable.setWidth(660);
    mainTable.setHeight(200);
    mainTable.setCellpadding(0);
    mainTable.setCellspacing(0);
    form.add(mainTable);

    Table topTable = new Table(1, 1);
    topTable.setStyleClass(MAIN_STYLECLASS);
    topTable.setWidth(Table.HUNDRED_PERCENT);
    topTable.setHeight(160);

    topTable.add(
        this.iwrb.getLocalizedString(
            UPDATE_RUNNING,
            "The update process is now running in the background. You cannot start another one while this one is running."),
        1,
        1);

    CloseButton close =
        new CloseButton(
            this.iwrb.getLocalizedImageButton("updateclubdivisiontemplate.close", "Close"));
    Help help = getHelp(HELP_TEXT_KEY);

    Table bottomTable = new Table();
    bottomTable.setCellpadding(0);
    bottomTable.setCellspacing(5);
    bottomTable.setWidth(Table.HUNDRED_PERCENT);
    bottomTable.setHeight(39);
    bottomTable.setStyleClass(MAIN_STYLECLASS);
    bottomTable.add(help, 1, 1);
    bottomTable.setAlignment(2, 1, Table.HORIZONTAL_ALIGN_RIGHT);
    bottomTable.add(close, 2, 1);

    mainTable.setVerticalAlignment(1, 1, Table.VERTICAL_ALIGN_TOP);
    mainTable.setVerticalAlignment(1, 3, Table.VERTICAL_ALIGN_TOP);
    mainTable.add(topTable, 1, 1);
    mainTable.add(bottomTable, 1, 3);

    add(form, iwc);
  }
 public void main(IWContext iwc) throws Exception {
   // debugParameters(iwc);
   LoginEditor BE = new LoginEditor();
   if (iwc.isParameterSet(PARAM_MESSAGE)) {
     BE.setMessage(iwc.getParameter(PARAM_MESSAGE));
   }
   if (iwc.isParameterSet(PARAM_CHANGE)) {
     BE.setChangeLoginNextTime(true);
   }
   Table T = new Table(1, 1);
   T.setAlignment(1, 1, "center");
   T.setStyleClass(MAIN_STYLECLASS);
   T.add(BE, 1, 1);
   add(T, iwc);
   addTitle(
       getResourceBundle(iwc).getLocalizedString("login_editor", "Login Editor"),
       TITLE_STYLECLASS);
   // setTitle("Login Editor");
   // addTitle("Login Editor");
 }
  /**
   * @see
   *     com.idega.presentation.ui.AbstractChooserWindow#displaySelection(com.idega.presentation.IWContext)
   */
  public void displaySelection(IWContext iwc) {
    String uId = iwc.getParameter(this.PARAMETER_USER_ID);
    if (uId != null) {
      try {
        User user = getUserHome().findByPrimaryKey(new Integer(uId));
        Page page = getParentPage();
        page.setOnLoad(SELECT_FUNCTION_NAME + "('" + user.getName() + "','" + uId + "')");
      } catch (RemoteException e) {
      } catch (FinderException e) {
      }
    } else {

      init(iwc);

      addTitle(this.iwrb.getLocalizedString("select_a_user", "Select a user"), TITLE_STYLECLASS);

      this.form.maintainParameter(SCRIPT_PREFIX_PARAMETER);
      this.form.maintainParameter(SCRIPT_SUFFIX_PARAMETER);
      this.form.maintainParameter(DISPLAYSTRING_PARAMETER_NAME);
      this.form.maintainParameter(VALUE_PARAMETER_NAME);

      Table mainTable = new Table(1, 4);
      mainTable.setStyleClass(this.mainTableStyle);
      mainTable.setWidth(Table.HUNDRED_PERCENT);
      mainTable.setBorder(0);

      mainTable.add(getHeaderTable(iwc), 1, 1);
      mainTable.add(getNavigationTable(iwc), 1, 3);
      try {
        mainTable.add(getListTable(iwc), 1, 4);
      } catch (RemoteException r) {
        throw new RuntimeException(r.getMessage());
      }
      this.form.add(mainTable);
      add(this.form, iwc);
    }
  }
  /**
   * Creates a table with checkboxes for all the available categories
   *
   * @param resourcePath
   * @return table
   */
  private Table getCategoriesTable(IWContext iwc, boolean submitted) {
    if (!areCategoriesFetched) {
      getSelectedAndNotSelectedCategories(iwc);
    }

    Table categoriesTable = new Table();
    int categoriesCount = 0;
    Locale locale = getLocale(iwc);

    List<ContentCategory> allCategories = new ArrayList<ContentCategory>(selectedCategories);
    allCategories.addAll(notSelectedCategories);
    allCategories = getSortedCategories(allCategories, locale);
    if (ListUtil.isEmpty(allCategories)) {
      return categoriesTable;
    }

    for (ContentCategory category : allCategories) {
      HtmlSelectBooleanCheckbox categoryCheckBox =
          (HtmlSelectBooleanCheckbox)
              iwc.getApplication().createComponent(HtmlSelectBooleanCheckbox.COMPONENT_TYPE);
      categoryCheckBox.setId(getCategoryKey(category));
      if (selectedCategories.contains(category)) {
        categoryCheckBox.setSelected(Boolean.TRUE);
      } else {
        if (!submitted) {
          if (notSelectedCategories.size() == 1
              && selectedCategories.size() == 0
              && selectAnyCategory) {
            categoryCheckBox.setSelected(Boolean.TRUE);
          }
        }
      }
      categoriesTable.add(
          categoryCheckBox, categoriesCount % COLLUMNS + 1, categoriesCount / COLLUMNS + 1);

      Label categoryName = new Label(category.getName(locale.toString()), categoryCheckBox);
      categoriesTable.add(
          categoryName, categoriesCount % COLLUMNS + 1, categoriesCount / COLLUMNS + 1);
      categoriesCount++;
    }

    categoriesTable.setColumns(Math.min(categoriesCount, COLLUMNS));
    categoriesCount--;
    categoriesTable.setRows(categoriesCount / COLLUMNS + 1);

    if (getDisplaySaveButton()) {
      //	Add the save button
      if (this.resourcePath != null && this.resourcePath.length() > 0) {
        WFResourceUtil localizer = WFResourceUtil.getResourceUtilContent();
        HtmlCommandButton addCategoryButton =
            localizer.getButtonVB(getSaveButtonId(), "save", this);
        categoriesTable.add(addCategoryButton, 1, categoriesCount / COLLUMNS + 2);
        categoriesTable.setRows(categoriesCount / COLLUMNS + 2);
      }
    }

    categoriesTable.setId(categoriesTable.getId() + "_ver");
    categoriesTable.setStyleClass("wf_listtable");

    return categoriesTable;
  }