public void init(String id) {
      currentId = id;

      JSONObject object = trustActionCache.getTrustAction(id);

      String trust = Util.str(object.get("fond"));
      String desc = Util.str(object.get("description"));
      String defaultdesc = Util.str(object.get("defaultdesc"));
      String actionclub = Util.str(object.get("actionclub"));
      String actiontrust = Util.str(object.get("actionfond"));
      String debetpost = Util.strSkipNull(object.get("debetpost"));
      String creditpost = Util.strSkipNull(object.get("creditpost"));

      Util.setIndexByValue(trustBox.getListbox(), trust);
      descBox.setText(desc);
      defaultDescBox.setText(defaultdesc);
      accountCredIdBox.setText(creditpost);
      Util.setIndexByValue(accountCredNameBox, creditpost);
      accountDebIdBox.setText(debetpost);
      Util.setIndexByValue(accountDebNameBox, debetpost);
      Util.setIndexByValue(actionClubBox, actionclub);
      Util.setIndexByValue(actionTrustBox, actiontrust);
    }
  private void addRow(JSONObject object, int row) {
    String desc = Util.str(object.get("description"));
    String id = Util.str(object.get("id"));
    String trust = Util.str(object.get("fond"));
    String defaultdesc = Util.str(object.get("defaultdesc"));
    String actionclub = Util.str(object.get("actionclub"));
    String actiontrust = Util.str(object.get("actionfond"));
    String debetpost = Util.strSkipNull(object.get("debetpost"));
    String creditpost = Util.strSkipNull(object.get("creditpost"));

    table.setText(row, 0, trustActionCache.trustGivesDesc(trust));
    table.setText(row, 1, desc);
    table.setText(row, 2, defaultdesc);
    table.setText(row, 3, Util.debkred(elements, actionclub));
    table.setText(row, 4, Util.debkred(elements, actiontrust));

    if (!("".equals(debetpost))) {
      table.setText(row, 5, posttypeCache.getDescriptionWithType(debetpost));
    }
    if (!("".equals(creditpost))) {
      table.setText(row, 6, posttypeCache.getDescriptionWithType(creditpost));
    }
    table.getCellFormatter().setStyleName(row, 0, "desc");
    table.getCellFormatter().setStyleName(row, 1, "desc");
    table.getCellFormatter().setStyleName(row, 2, "desc");
    table.getCellFormatter().setStyleName(row, 5, "desc");
    table.getCellFormatter().setStyleName(row, 6, "desc");

    Image editImage = ImageFactory.editImage("projectEditView_editImage");
    editImage.addClickHandler(me);
    idHolder.add(id, editImage);

    table.setWidget(row, 7, editImage);

    String style = (((row + 1) % 6) < 3) ? "line2" : "line1";
    table.getRowFormatter().setStyleName(row, style);
  }
  public EditPortalUserPopup(
      Elements elements, Constants constants, I18NAccount messages, JSONObject object, String id) {
    this.elements = elements;
    this.constants = constants;
    this.messages = messages;
    this.id = id;

    setModal(true);

    String title =
        "Rediger detaljer for "
            + Util.str(object.get("firstname"))
            + " "
            + Util.str(object.get("lastname"));
    setText(title);
    setAnimationEnabled(true);
    setAutoHideEnabled(true);

    HorizontalPanel hp = new HorizontalPanel();
    delTable = new AccountTable("tableborder");
    hp.add(delTable);

    delTable.setHeader(0, 0, elements.portal_homepage());
    delTable.setHeader(1, 0, elements.portal_twitter());
    delTable.setHeader(2, 0, elements.portal_facebook());
    delTable.setHeader(3, 0, elements.portal_linkedin());
    delTable.setHeader(4, 0, elements.portal_access());
    delTable.setHTML(5, 0, "&nbsp;");

    delTable.setText(0, 1, Util.str(object.get("homepage")));
    delTable.setText(1, 1, Util.str(object.get("twitter")));
    delTable.setText(2, 1, Util.str(object.get("facebook")));
    delTable.setText(3, 1, Util.str(object.get("linkedin")));
    boolean isDeactivated = Util.getBoolean(object.get("deactivated"));

    delTable.setText(
        4, 1, isDeactivated ? elements.portal_access_blocked() : elements.portal_access_granted());

    delHomepage = ImageFactory.deleteImage("delhomepage");
    delTwitter = ImageFactory.deleteImage("deltwitter");
    delFacebook = ImageFactory.deleteImage("delfacebook");
    delLinkedin = ImageFactory.deleteImage("dellinkedin");
    delHomepage.addClickHandler(this);
    delTwitter.addClickHandler(this);
    delFacebook.addClickHandler(this);
    delLinkedin.addClickHandler(this);

    delTable.setWidget(0, 2, delHomepage);
    delTable.setWidget(1, 2, delTwitter);
    delTable.setWidget(2, 2, delFacebook);
    delTable.setWidget(3, 2, delLinkedin);

    blockAccessButton = new NamedButton("block_acceess", "Sperr tilgang");
    blockAccessButton.addClickHandler(this);

    grantAccessButton = new NamedButton("grant_acceess", "Gi tilgang");
    grantAccessButton.addClickHandler(this);

    delPortalImage = new NamedButton("delete_portal_image", "Slett profilbilde");
    delPortalImage.addClickHandler(this);

    delTable.setWidget(5, 0, blockAccessButton);
    delTable.setWidget(5, 1, grantAccessButton);
    delTable.setWidget(6, 3, delPortalImage);

    profileImage =
        new Image(
            "/RegnskapServer/services/portal/portal_admin.php?action=image&image="
                + id
                + "&foolcache="
                + System.currentTimeMillis());
    delTable.setWidget(0, 3, profileImage);
    delTable.getFlexCellFormatter().setRowSpan(0, 3, 6);

    blockAccessButton.setEnabled(!isDeactivated);
    grantAccessButton.setEnabled(isDeactivated);

    add(hp);
  }