Text getCategoryText(String content) {
   Text text = new Text(content);
   if (this._catFontStyle != null) {
     text.setFontStyle(this._catFontStyle);
   }
   return text;
 }
 private void drawObject() throws RemoteException {
   Text text = getText(this.defaultText);
   if (this._product != null) {
     text.setText(this._product.getProductName(this._productLocaleId));
   }
   add(text);
 }
 Text getHeader(String content) {
   Text text = new Text(content);
   if (this._headerFontStyle != null) {
     text.setFontStyle(this._headerFontStyle);
   }
   return text;
 }
  public void main(IWContext iwc) throws Exception {
    _editPermission = (iwc.hasEditPermission(this) || this.isOwnerOfProject(iwc));
    Text tBreak = (Text) Text.getBreak().clone();
    tBreak.setFontSize(Text.FONT_SIZE_7_HTML_1);
    this.addAtBeginning(tBreak);

    IWBundle iwb = this.getBundle(iwc);
    IWResourceBundle iwrb = iwb.getResourceBundle(iwc);

    // this.addAtBeginning(new Text(this.getGroupName(),true,false,true));
    super.main(iwc);
    if (_editPermission) {
      Table table = new Table(8, 1);
      table.setHorizontalAlignment("left");
      table.setCellpadding(0);
      table.setCellpadding(0);

      table.setWidth(1, "6");
      table.setWidth(3, "6");
      table.setWidth(5, "12");
      table.setWidth(7, "6");

      //      table.add(getAddAndRemoveGroupLinkIcon(iwc, iwb),2,1);
      //      table.add(getAddAndRemoveGroupLink(iwc, iwrb),4,1);
      //
      //      table.add(getAddAndRemoveUserLinkIcon(iwc, iwb),6,1);
      //      table.add(getAddAndRemoveUserLink(iwc, iwrb),8,1);

      table.add(getAddAndRemoveUserLinkIcon(iwc, iwb), 2, 1);
      table.add(getAddAndRemoveUserLink(iwc, iwrb), 4, 1);

      this.add(table);
    }
  }
 Text getTeaserText(String content) {
   Text text = new Text(content);
   if (this._teaserFontStyle != null) {
     text.setFontStyle(this._teaserFontStyle);
   }
   // text.setHorizontalAlignment(Paragraph.HORIZONTAL_ALIGN_JUSTIFY);
   return text;
 }
 Table getPagesTable(int pages, List parameters) {
   Table pagesTable = new Table(pages + 2, 1);
   pagesTable.setCellpadding(2);
   pagesTable.setCellspacing(2);
   if (parameters == null) {
     parameters = new Vector();
   }
   Parameter parameter;
   Text pageText;
   if (this.currentPage > 1) {
     pageText = getText(this.iwrb.getLocalizedString("travel.previous", "Previous"));
     Link prevLink = new Link(pageText);
     prevLink.addParameter(_VIEW_PAGE, this.currentPage - 1);
     for (int l = 0; l < parameters.size(); l++) {
       parameter = (Parameter) parameters.get(l);
       prevLink.addParameter(parameter);
     }
     pagesTable.add(prevLink, 1, 1);
   }
   Link pageLink;
   for (int i = 1; i <= pages; i++) {
     if (i == this.currentPage) {
       pageText = getText(Integer.toString(i));
       pageText.setBold(true);
     } else {
       pageText = getText(Integer.toString(i));
     }
     pageLink = new Link(pageText);
     pageLink.addParameter(_VIEW_PAGE, i);
     for (int l = 0; l < parameters.size(); l++) {
       parameter = (Parameter) parameters.get(l);
       pageLink.addParameter(parameter);
     }
     pagesTable.add(pageLink, i + 1, 1);
   }
   if (this.currentPage < pages) {
     pageText = getText(this.iwrb.getLocalizedString("travel.next", "Next"));
     Link nextLink = new Link(pageText);
     nextLink.addParameter(_VIEW_PAGE, this.currentPage + 1);
     for (int l = 0; l < parameters.size(); l++) {
       parameter = (Parameter) parameters.get(l);
       nextLink.addParameter(parameter);
     }
     pagesTable.add(nextLink, pages + 2, 1);
   }
   return pagesTable;
 }
  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);
  }
  public Table getSearchTable(IWContext iwc) {
    // *** Search Table *** START - the uppermost table
    Table table = new Table();
    table.setBorder(0);
    table.setCellpadding(0);
    table.setCellspacing(0);

    int col = 1;
    int row = 1;

    Image space1 = (Image) this.transGIF.clone();
    space1.setWidth(6);

    // *** HEADING Search pupil ***
    table.add(space1, col, row);
    Text pupilTxt = new Text(localize(KEY_SEARCH_PUPIL_HEADING, "Search pupil"));
    pupilTxt.setFontStyle(STYLE_UNDERLINED_SMALL_HEADER);
    table.add(pupilTxt, col++, row);
    table.setRowHeight(row, "40");
    table.setRowVerticalAlignment(row, Table.VERTICAL_ALIGN_BOTTOM);
    col = 1;
    row++;
    // User search module - configure and add
    SearchUserModule searchMod = getSearchUserModule();
    table.add(searchMod, col++, row);

    // Get pupil if only one found
    try {
      searchMod.process(iwc);
      User oneChild = searchMod.getUser();
      if (oneChild != null) {
        this.pupil = oneChild;
      }
    } catch (Exception e) {
    }

    return table;
  }
 private Text getTitleText(String content) {
   Text text = new Text(content);
   text.setFontStyle(
       "font-family:Verdana,Arial,Helvetica,sans-serif;font-size:9pt;font-weight:bold;color:#FFFFFF;");
   return text;
 }
Exemplo n.º 10
0
 private Text getTitleText(String content) {
   Text text = new Text(content);
   text.setFontStyle(IWConstants.BUILDER_FONT_STYLE_TITLE);
   return text;
 }
    public PresentationObject getObjectToAddToColumn(
        int colIndex, int rowIndex, Object item, IWContext iwc, boolean beforeEntities)
        throws Exception {
      if (item == null) {
        if (beforeEntities && (rowIndex == 1)) {
          Text text = new Text();
          text.setFontFace(Text.FONT_FACE_ARIAL);
          text.setFontColor("#FFFFFF");
          text.setFontSize(Text.FONT_SIZE_7_HTML_1);
          text.setBold();

          switch (colIndex) {
            case 1:
              text.setText("Choose");
              break;
            case 3:
              text.setText("Name");
              break;
            case 5:
              text.setText("Title");
              break;
            case 7:
              text.setText("Phone");
              break;
            case 9:
              text.setText("e-mail");
              break;
            default:
              return null;
          }
          return text;
        }
      } else {
        Text text = new Text("");

        StaffHolder staffHolder = (StaffHolder) item;

        switch (colIndex) {
          case 1:
            return getCheckBox(staffHolder.getGroupID());
            // break;
          case 3:
            /** @todo change accesscontrol */
            //              boolean staffHolderIsSuperAdmin =
            // iwc.getAccessController().getAdministratorUser().getID() == staffHolder.getUserID();
            //              if(iwc.isSuperAdmin() && !staffHolderIsSuperAdmin){  //tmp
            //                text = new Link(staffHolder.getName());
            //  //              ((Link)text).setWindowToOpen(StaffEditor.class);
            //  //
            // ((Link)text).addParameter(StaffBusiness.PARAMETER_USER_ID,staffHolder.getUserID());
            //                ((Link)text).setWindowToOpen(StaffPropertyWindow.class);
            //                ((Link)text).addParameter(StaffPropertyWindow.PARAMETERSTRING_USER_ID,
            // staffHolder.getUserID());
            //              } else {
            text.setText(staffHolder.getName());
            //              }
            break;
          case 5:
            if (staffHolder.getTitle() != null) {
              text.setText(staffHolder.getTitle());
            }
            break;
          case 7:
            if (staffHolder.getWorkPhone() != null) {
              text.setText(staffHolder.getWorkPhone());
            }
            break;
          case 9:
            if (staffHolder.getEmail() != null) {
              text.setText(staffHolder.getEmail());
            }
            break;
          default:
            return null;
        }
        text.setFontSize(Text.FONT_SIZE_7_HTML_1);
        text.setFontFace(Text.FONT_FACE_ARIAL);
        return text;
      }
      return null;
    }
  private void listExisting(IWContext iwc) throws FinderException, RemoteException {
    getApplicationBusiness(iwc).checkApplicationCategoryPriorityConstraint();
    Collection categories =
        getApplicationBusiness(iwc).getApplicationCategoryHome().findAllOrderedByPriority();

    Form form = new Form();
    form.setID("applicationCategoryCreator");
    form.setStyleClass("adminForm");

    Table2 table = new Table2();
    table.setWidth("100%");
    table.setCellpadding(0);
    table.setCellspacing(0);
    table.setStyleClass("ruler");
    table.setStyleClass("adminTable");
    form.add(table);

    TableRowGroup group = table.createHeaderRowGroup();
    TableRow row = group.createRow();
    TableCell2 cell = row.createHeaderCell();
    cell.setStyleClass("firstColumn");
    cell.setStyleClass("category");
    cell.add(new Text(this.iwrb.getLocalizedString("category", "Category")));

    cell = row.createHeaderCell();
    cell.setStyleClass("description");
    cell.add(new Text(this.iwrb.getLocalizedString("description", "Description")));

    cell = row.createHeaderCell();
    cell.setStyleClass("description");
    cell.add(new Text(this.iwrb.getLocalizedString("priority", "Priority")));

    cell = row.createHeaderCell();
    cell.setStyleClass("edit");
    cell.add(Text.getNonBrakingSpace());

    cell = row.createHeaderCell();
    cell.setStyleClass("remove");
    cell.setStyleClass("lastColumn");
    cell.add(Text.getNonBrakingSpace());

    group = table.createBodyRowGroup();
    int iRow = 1;

    Iterator iter = categories.iterator();
    while (iter.hasNext()) {
      ApplicationCategory cat = (ApplicationCategory) iter.next();
      row = table.createRow();

      Link edit =
          new Link(this.iwb.getImage("edit.png", this.iwrb.getLocalizedString("edit", "Edit")));
      edit.addParameter(PARAMETER_ACTION, ACTION_EDIT);
      edit.addParameter("id", cat.getPrimaryKey().toString());

      Link delete =
          new Link(
              this.iwb.getImage("delete.png", this.iwrb.getLocalizedString("remove", "Remove")));
      delete.addParameter(PARAMETER_ACTION, ACTION_DELETE);
      delete.addParameter("id", cat.getPrimaryKey().toString());

      if (iRow % 2 == 0) {
        row.setStyleClass("evenRow");
      } else {
        row.setStyleClass("oddRow");
      }

      cell = row.createCell();
      cell.setStyleClass("firstColumn");
      cell.setStyleClass("category");
      cell.add(new Text(cat.getName()));

      cell = row.createCell();
      cell.setStyleClass("description");
      if (cat.getDescription() != null) {
        String description = cat.getDescription();
        if (description.length() > 35) {
          description = description.substring(0, 35) + "...";
        }
        cell.add(new Text(description));
      } else {
        cell.add(new Text(Text.NON_BREAKING_SPACE));
      }

      cell = row.createCell();
      cell.setStyleClass("description");

      Link up =
          new Link(
              this.iwb.getImage("previous.png", this.iwrb.getLocalizedString("previous", "Up")));
      up.addParameter(PARAMETER_ACTION, ACTION_CATEGORY_UP);
      up.addParameter("id", cat.getPrimaryKey().toString());
      up.setStyleClass("flippedImageLink");
      cell.add(up);

      if (iRow <= 1) {

        up.setStyleAttribute("visibility", "hidden");
      }

      Link down =
          new Link(this.iwb.getImage("next.png", this.iwrb.getLocalizedString("next", "Down")));
      down.addParameter(PARAMETER_ACTION, ACTION_CATEGORY_DOWN);
      down.addParameter("id", cat.getPrimaryKey().toString());
      down.setStyleClass("flippedImageLink");
      cell.add(down);

      if (iRow >= categories.size()) {

        down.setStyleAttribute("visibility", "hidden");
      }

      cell = row.createCell();
      cell.setStyleClass("edit");
      cell.add(edit);

      cell = row.createCell();
      cell.setStyleClass("lastColumn");
      cell.setStyleClass("remove");
      cell.add(delete);

      iRow++;
    }

    Layer buttonLayer = new Layer(Layer.DIV);
    buttonLayer.setStyleClass("buttonLayer");
    form.add(buttonLayer);

    SubmitButton newLink =
        new SubmitButton(
            this.iwrb.getLocalizedString("new_category", "New Category"),
            PARAMETER_ACTION,
            ACTION_CREATE);
    buttonLayer.add(newLink);

    add(form);
  }
  private Table getPlacementTable(IWContext iwc) throws RemoteException {
    Table table = new Table();
    // table.setColor("#DDDDDD");
    table.setBorder(0);
    table.setWidth(Table.HUNDRED_PERCENT);
    table.setCellpadding(1);
    table.setCellspacing(2);
    int col = 1;
    int row = 1;

    // *** HEADING Placements ***
    Text pupilTxt = new Text(localize(KEY_PLACEMENTS_HEADING, "Placements"));
    pupilTxt.setFontStyle(STYLE_UNDERLINED_SMALL_HEADER);
    table.add(pupilTxt, col++, row);
    table.setRowHeight(row, "40");
    table.setRowVerticalAlignment(row, Table.VERTICAL_ALIGN_BOTTOM);
    table.mergeCells(col, row, table.getColumns(), row);
    col = 1;
    row++;

    // empty space row
    table.add(this.transGIF, col, row);
    table.setRowHeight(row, "10");
    col = 1;
    row++;

    //  *** Column headings ***
    table.add(getLocalizedSmallHeader(KEY_NUMBER, "No."), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_SCHOOL_TYPE, "School type"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_PROVIDER, "Provider"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_SCHOOL_YEAR, "School year"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_STUDY_PATH, "Study path"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_SCHOOL_GROUP, "School group"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_START_DATE, "Start date"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_END_DATE, "End date"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_REGISTRATOR, "Registrator"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_REGISTRATION_CREATED_DATE, "Created date"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_PLACEMENT_PARAGRAPH_SHORT, "Par"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(getLocalizedSmallHeader(KEY_NOTES, "Notes"), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(Text.getNonBrakingSpace(), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
    table.add(Text.getNonBrakingSpace(), col, row);
    table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);

    table.setRowColor(row, getHeaderColor());

    table.setRowHeight(row, "18");
    row++;

    // Loop placements
    Collection placements = null;
    try {
      if (this.pupil != null) {
        placements =
            getSchoolBusiness(iwc)
                .getSchoolClassMemberHome()
                .findAllOrderedByRegisterDate(this.pupil);
      }
    } catch (FinderException e) {
    }

    if (placements != null && placements.size() > 0) {
      int zebra = 0;
      int rowNum = 0;
      table.add(new HiddenInput(PARAM_REMOVE_PLACEMENT, "-1"), 1, 1);
      for (Iterator iter = placements.iterator(); iter.hasNext(); ) {
        rowNum++;
        SchoolClassMember plc = (SchoolClassMember) iter.next();
        col = 1;

        // Row number
        table.add(getSmallText(String.valueOf(rowNum)), col++, row);
        // School type
        try {
          table.add(getSmallText(plc.getSchoolType().getName()), col++, row);
        } catch (Exception e) {
          col++;
        }
        // Provider
        try {
          table.add(getSmallText(plc.getSchoolClass().getSchool().getName()), col++, row);
        } catch (Exception e) {
          col++;
        }
        // School year
        try {
          table.add(getSmallText(plc.getSchoolYear().getName()), col++, row);
        } catch (Exception e) {
          col++;
        }
        // Study path
        try {
          if (plc.getStudyPathId() != -1) {
            SchoolStudyPathHome home =
                (SchoolStudyPathHome) IDOLookup.getHome(SchoolStudyPath.class);
            SchoolStudyPath sp = home.findByPrimaryKey(new Integer(plc.getStudyPathId()));
            table.add(getSmallText(sp.getCode()), col, row);
          }
        } catch (Exception e) {
        }
        col++;
        // School type
        try {
          table.add(getSmallText(plc.getSchoolClass().getSchoolClassName()), col++, row);
        } catch (Exception e) {
          col++;
        }
        // Start date
        try {
          String dateStr =
              getCentralPlacementBusiness(iwc).getDateString(plc.getRegisterDate(), "yyyy-MM-dd");
          table.add(getSmallText(dateStr), col++, row);
        } catch (Exception e) {
          col++;
        }
        // End date
        try {
          String dateStr =
              getCentralPlacementBusiness(iwc).getDateString(plc.getRemovedDate(), "yyyy-MM-dd");
          table.add(getSmallText(dateStr), col++, row);
        } catch (Exception e) {
          col++;
        }
        // Registrator
        try {
          int registratorID = plc.getRegistratorId();
          User registrator = getUserBusiness(iwc).getUser(registratorID);
          if (registrator != null) {
            Name name =
                new Name(
                    registrator.getFirstName(),
                    registrator.getMiddleName(),
                    registrator.getLastName());
            table.add(
                getSmallText(name.getName(iwc.getApplicationSettings().getDefaultLocale(), false)),
                col++,
                row);
          }
        } catch (Exception e) {
          col++;
        }
        // Created date
        try {
          String dateStr =
              getCentralPlacementBusiness(iwc)
                  .getDateString(plc.getRegistrationCreatedDate(), "yyyy-MM-dd");
          table.add(getSmallText(dateStr), col++, row);
        } catch (Exception e) {
          col++;
        }
        // Placement paragraph
        try {
          if (plc.getPlacementParagraph() != null) {
            table.add(getSmallText(plc.getPlacementParagraph()), col++, row);
          } else {
            col++;
          }
        } catch (Exception e) {
          col++;
        }
        // Notes
        try {
          if (plc.getNotes() != null) {
            table.add(getSmallText(plc.getNotes()), col++, row);
          } else {
            col++;
          }
        } catch (Exception e) {
          col++;
        }
        // Pupil overview button
        try {
          // Get Pupil overview button
          String plcId = ((Integer) plc.getPrimaryKey()).toString();
          String schClassId = String.valueOf(plc.getSchoolClassId());

          Link editButt =
              new Link(this.getEditIcon(localize(KEY_TOOLTIP_PUPIL_OVERVIEW, "Pupil overview")));
          editButt.setWindowToOpen(PlacementHistoryEditPlacement.class);
          editButt.setParameter(
              SchoolAdminOverview.PARAMETER_METHOD,
              String.valueOf(SchoolAdminOverview.METHOD_OVERVIEW));
          editButt.addParameter(
              SchoolAdminOverview.PARAMETER_METHOD,
              String.valueOf(SchoolAdminOverview.METHOD_OVERVIEW));
          editButt.addParameter(SchoolAdminOverview.PARAMETER_SHOW_ONLY_OVERVIEW, "true");
          editButt.addParameter(SchoolAdminOverview.PARAMETER_SHOW_NO_CHOICES, "true");
          editButt.addParameter(SchoolAdminOverview.PARAMETER_PAGE_ID, getParentPage().getPageID());
          editButt.addParameter(
              SchoolAdminOverview.PARAMETER_USER_ID, String.valueOf(plc.getClassMemberId()));
          editButt.addParameter(SchoolAdminOverview.PARAMETER_SCHOOL_CLASS_ID, schClassId);
          editButt.addParameter(SchoolAdminOverview.PARAMETER_SCHOOL_CLASS_MEMBER_ID, plcId);
          editButt.addParameter(
              SchoolAdminOverview.PARAMETER_RESOURCE_PERMISSION,
              SchoolAdminOverview.PARAMETER_RESOURCE_PERM_VALUE_CENTRAL_ADMIN);
          editButt.addParameter(
              SchoolAdminOverview.PARAMETER_FROM_CENTRAL_PLACEMENT_EDITOR, "true");
          if (plc.getRemovedDate() != null) {
            editButt.addParameter(
                SchoolAdminOverview.PARAMETER_SCHOOL_CLASS_MEMBER_REMOVED_DATE,
                plc.getRemovedDate().toString());
          }

          table.add(editButt, col, row);
          table.setAlignment(col++, row, Table.HORIZONTAL_ALIGN_CENTER);
        } catch (Exception e) {
          col++;
        }
        // Remove button
        try {
          // Get remove button
          Image delImg = getDeleteIcon(localize(KEY_TOOLTIP_REMOVE_PLC, "Delete placement"));
          int plcID = ((Integer) plc.getPrimaryKey()).intValue();

          SubmitButton delButt = new SubmitButton(delImg);
          delButt.setValueOnClick(PARAM_REMOVE_PLACEMENT, String.valueOf(plcID));
          delButt.setSubmitConfirm(
              localize(
                  KEY_CONFIRM_REMOVE_PLC_MSG,
                  "Do you really want to erase this school placement and its resource placements?"));
          delButt.setToolTip(localize(KEY_TOOLTIP_REMOVE_PLC, "Delete school placement"));
          table.add(delButt, col, row);
          table.setAlignment(col, row, Table.HORIZONTAL_ALIGN_CENTER);
        } catch (Exception e) {
        }

        String zebraColor = zebra % 2 == 0 ? getZebraColor2() : getZebraColor1();
        table.setRowColor(row, zebraColor);
        col = 2;
        row++;

        // Resources
        String rscStr = getResourceBusiness(iwc).getResourcesStringXtraInfo(plc);
        if (!("".equals(rscStr))) {
          table.add(
              getSmallText("<i>" + localize(KEY_RESOURCES, "Resources") + ":</i> "), col, row);
          table.add(getSmallText("<i>" + rscStr + "</i>"), col, row);
          table.setRowColor(row, zebraColor);
          table.mergeCells(col, row, table.getColumns(), row);
          row++;
        }

        zebra++;
      }
    }

    col = 1;

    // empty space row
    table.add(this.transGIF, col, row);
    table.setRowHeight(row, "20");

    return table;
  }
  public Table getPupilTable(IWContext iwc, User pupil) {
    // *** Search Table *** START - the uppermost table
    Table table = new Table();
    table.setWidth("100%");
    table.setBorder(0);
    table.setCellpadding(2);
    table.setCellspacing(0);
    this.transGIF.setHeight("1");
    this.transGIF.setWidth("1");

    int row = 1;
    int col = 1;
    // add empty space row
    table.add(this.transGIF, col++, row);
    table.add(this.transGIF, col++, row);
    table.add(this.transGIF, col++, row);
    table.add(this.transGIF, col++, row);
    table.add(this.transGIF, col++, row);
    // Set COLUMN WIDTH for column 1 to 5
    table.setWidth(1, row, "100");
    // table.setWidth(2, row, "70");
    // table.setWidth(3, row, "70");
    // table.setWidth(4, row, "70");
    // table.setWidth(5, row, "104");

    row++;
    col = 1;

    // *** HEADING Pupil ***
    Text pupilTxt = new Text(localize(KEY_PUPIL_HEADING, "Pupil"));
    pupilTxt.setFontStyle(STYLE_UNDERLINED_SMALL_HEADER);
    table.add(pupilTxt, col++, row);
    table.setRowHeight(row, "20");
    table.setRowVerticalAlignment(row, Table.VERTICAL_ALIGN_BOTTOM);
    row++;
    col = 1;

    // empty space row
    table.add(this.transGIF, col, row);
    table.setRowHeight(row, "5");
    col = 1;
    row++;

    // Personal Id Number
    table.add(getSmallHeader(localize(KEY_PERSONAL_ID_LABEL, "Personal id: ")), col++, row);
    if (pupil != null) {
      table.add(getSmallText(pupil.getPersonalID()), col++, row);
    }
    row++;
    col = 1;
    // Last Name
    table.add(getSmallHeader(localize(KEY_LAST_NAME_LABEL, "Last name: ")), col++, row);

    Table nameTable = new Table();
    col = 1;
    nameTable.setCellpadding(0);
    nameTable.setCellspacing(0);
    if (pupil != null) {
      nameTable.add(getSmallText(pupil.getLastName()), col++, 1);
    }
    // First Name
    nameTable.add(getSmallHeader(localize(KEY_FIRST_NAME_LABEL, "First name: ")), col++, 1);
    if (pupil != null) {
      nameTable.add(getSmallText(pupil.getFirstName()), col++, 1);
    }
    nameTable.setWidth(1, 1, "100");
    nameTable.setWidth(2, 1, "100");
    nameTable.setWidth(3, 1, "100");
    table.add(nameTable, 2, row);
    table.mergeCells(2, row, 5, row);
    row++;
    col = 1;

    // Address and Phone
    table.add(getSmallHeader(localize(KEY_ADDRESS_LABEL, "Address: ")), col++, row);
    row++;
    col = 1;
    table.add(getSmallHeader(localize(KEY_PHONE_LABEL, "Phone: ")), col++, row);
    if (pupil != null) {
      try {
        // pupil address
        Address address = getUserBusiness(iwc).getUsersMainAddress(pupil);
        StringBuffer aBuf = new StringBuffer(address.getStreetAddress());
        aBuf.append(", ");
        aBuf.append(address.getPostalCode().getPostalAddress());
        row--;
        table.add(getSmallText(aBuf.toString()), col, row);
        row++;
        // Get pupil phones
        Collection phones = pupil.getPhones();
        int i = 0;
        int phonesSize = phones.size();
        StringBuffer pBuf = new StringBuffer();
        for (Iterator iter = phones.iterator(); iter.hasNext(); i++) {
          Phone phone = (Phone) iter.next();
          pBuf.append(phone.getNumber());
          if (i < phonesSize - 1) {
            pBuf.append(", ");
          }
        }
        pBuf.append("&nbsp;");
        table.add(getSmallText(pBuf.toString()), col, row);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    row++;
    col = 1;

    return table;
  }
Exemplo n.º 15
0
 private Text getSmallText(String content) {
   Text text = new Text(content);
   text.setFontStyle(IWConstants.BUILDER_FONT_STYLE_SMALL);
   return text;
 }
 private Text getText(String content) {
   Text text = new Text(content);
   text.setFontStyle(
       "font-family:Arial,Helvetica,sans-serif;font-size:8pt;font-weight:bold;color:#000000;");
   return text;
 }
  public void main(IWContext iwc) throws Exception {
    parseAction(iwc);
    IWResourceBundle resourceBundle = getResourceBundle(iwc);

    // uploading
    Text uploadingText =
        new Text(
            resourceBundle.getLocalizedString(
                "query_uploader_upload_query_headline", "Upload Query"));
    uploadingText.setBold();
    add(uploadingText);
    Form form = new Form();
    addMaintainParametersToForm(form);
    Table table = new Table(2, 4);
    int row = 1;
    String queryInfo =
        resourceBundle.getLocalizedString("query_uploader_replace_query", "Replace query");
    table.add(queryInfo, 1, row);
    PresentationObject queryList = getDropDownOfQueriesForReplacing(resourceBundle, iwc);
    table.add(queryList, 2, row);
    row++;
    String defaultName =
        resourceBundle.getLocalizedString("query_uploader_default_queryname", "My query");
    TextInput textInput = new TextInput(KEY_QUERY_NAME, defaultName);
    Text info =
        new Text(resourceBundle.getLocalizedString("query_uploader_query_name", "set query name"));
    table.add(info, 1, row);
    table.add(textInput, 2, row);
    row++;
    table.add(getPrivatePublicRadioButtons(resourceBundle), 2, row);
    SimpleFileChooser uploader = new SimpleFileChooser(form, KEY_QUERY_FILE_ID);
    row++;
    table.add(uploader, 2, row);

    form.add(table);
    form.addParameter(KEY_QUERY_UPLOAD_IS_SUBMITTED, KEY_QUERY_UPLOAD_IS_SUBMITTED);
    add(form);

    // downloading
    add(Text.getBreak());
    Text downloadingText =
        new Text(
            resourceBundle.getLocalizedString(
                "query_uploader_download_query_headline", "Download Query"));
    downloadingText.setBold();
    add(downloadingText);
    Form downloadForm = new Form();
    row = 1;
    addMaintainParametersToForm(downloadForm);
    Table downloadTable = new Table(2, 3);
    PresentationObject downloadQueryList = getDropDownOfQueriesForDownloading(iwc);
    downloadTable.add(downloadQueryList, 1, row);
    downloadTable.add(getDownloadButton(resourceBundle), 2, row++);
    if (this.downloadUrl != null) {
      String downloadText =
          resourceBundle.getLocalizedString("query_uploader_download_query", "Download");
      downloadTable.add(new Link(downloadText, this.downloadUrl), 1, row++);
    }
    downloadTable.add(getGoBackButton(resourceBundle), 1, row);
    downloadForm.add(downloadTable);
    add(downloadForm);
  }
 private Text emphasizeText(Text t) {
   t.setBold(true);
   t.setStyleAttribute("color:blue");
   return t;
 }
Exemplo n.º 19
0
  // public PresentationObject getVisitForm(IWContext iwc, User userVK) throws
  // java.rmi.RemoteException {
  public UIComponent getDoctorForm() {
    IWResourceBundle iwrb = this.getResourceBundle(_iwc);
    Form myForm = new Form();
    myForm.setName(prmForm);

    Table table = new Table(3, 3);
    table.setCellpadding(0);
    table.setCellspacing(0);
    table.setBorder(0);
    table.setVerticalAlignment(1, 1, Table.VERTICAL_ALIGN_TOP);
    table.setVerticalAlignment(3, 1, Table.VERTICAL_ALIGN_TOP);
    table.setVerticalAlignment(1, 2, Table.VERTICAL_ALIGN_BOTTOM);
    table.setVerticalAlignment(1, 3, Table.VERTICAL_ALIGN_BOTTOM);

    table.setWidth(400);
    table.setWidth(2, 1, 15);
    table.setWidth(1, 1, 73);

    myForm.add(table);

    Age age = null;
    String doctorInfo = null;

    if (user != null && user.getDateOfBirth() != null) age = new Age(user.getDateOfBirth());
    else if (user != null && user.getPersonalID() != null)
      age = new Age(PIDChecker.getInstance().getDateFromPersonalID(user.getPersonalID()));

    int userIDDr = 45;

    if (age != null && age.getYears() >= 70) {
      userIDDr = 46; // 45   41047
    }

    PresentationObject picture = null;
    User doctor = null;

    int userImageID = -1;
    try {
      doctor =
          ((UserBusiness) IBOLookup.getServiceInstance(_iwc, UserBusiness.class)).getUser(userIDDr);
    } catch (Exception fe) {
      log(fe);
    }

    if (doctor != null) userImageID = doctor.getSystemImageID();

    if (userImageID == -1) {
      Table fakeImageTable = new Table(1, 1);
      fakeImageTable.setAlignment(1, 1, Table.HORIZONTAL_ALIGN_CENTER);
      fakeImageTable.setBorder(4);
      fakeImageTable.setHeight(140);
      fakeImageTable.setWidth(100);
      String fakeImageColor = "#CCCCCC";
      Text photoText = new Text(iwrb.getLocalizedString("managerview.photo_text", "Photo"));
      photoText.setBold();
      photoText.setFontColor(fakeImageColor);
      photoText.setFontSize(Text.FONT_SIZE_12_STYLE_TAG);
      fakeImageTable.add(photoText, 1, 1);
      fakeImageTable.setBorderColor(fakeImageColor);
      picture = fakeImageTable;
    } else {
      Image image = new Image();
      image.setImageID(userImageID);
      image.setWidth(73);

      picture = image;
    }
    table.add(picture, 1, 1);

    if (age != null && age.getYears() >= 70) {
      doctorInfo =
          "<b>Dr. Inga Pren</b><br>Allmänläkare<br>Telefon:<br>018-987624<br>Telefontid: Mån-ons, kl 08:30-10.00<br>Webbsida: <a href='http://www.flogsta.se' target='_new'>www.flogsta.se</a>";
    } else {
      doctorInfo =
          "<b>Dr. Magne Syhl</b><br>Allmänläkare<br>Telefon:<br>018-987654<br>Telefontid: Mån-ons, kl 08-10.00<br>Webbsida: <a href='http://www.gimovc.se' target='_new'>www.gimovc.se</a>";
    }

    table.add(doctorInfo, 3, 1);
    GenericButton message =
        getButton(new GenericButton("send_message", localize(prmSendMessage, "Send message")));
    if (_messagePage != null) message.setPageToOpen(_messagePage);

    table.add(message, 3, 2);
    table.setHeight(3, 2, "25");

    GenericButton visitbooking =
        getButton(new GenericButton("visit", localize(prmVisitBooking, "Book an appointment")));
    if (_appointmentPage != null) visitbooking.setPageToOpen(_appointmentPage);

    SubmitButton smb = new SubmitButton();
    smb.setStyleClass("ehealth_InterfaceButton");
    smb.setValue("Skicka meddelande >");
    smb.setPageToOpen(132);

    table.add(visitbooking, 3, 3);

    return myForm;
  }
  /*
   * (non-Javadoc)
   *
   * @see is.idega.idegaweb.member.presentation.UserEditor#presentateUserRelations(com.idega.presentation.IWContext)
   */
  protected void presentUserRelations(IWContext iwc) throws RemoteException {
    Table relationsTable = new Table();
    relationsTable.setCellspacing(4);
    relationsTable.setWidth(Table.HUNDRED_PERCENT);
    int row = 1;

    if (user != null) {
      addSeperator(iwrb.getLocalizedString("mbe.user_relations", "User relations"));
      CommuneFamilyService familyService = getFamilyService(iwc);

      // parent handling
      relationsTable.add(getHeader(iwrb.getLocalizedString("mbe.parents", "Parents")), 1, row++);
      Collection parents = null;
      try {
        parents = familyService.getParentsFor(user);
        if (parents != null && !parents.isEmpty()) {
          for (Iterator iter = parents.iterator(); iter.hasNext(); ) {
            User parent = (User) iter.next();
            relationsTable.add(getRelatedUserLink(parent), 1, row);
            relationsTable.add(
                PersonalIDFormatter.format(parent.getPersonalID(), iwc.getCurrentLocale()),
                2,
                row++);
          }
        }
      } catch (Exception e1) {
      }
      row++;

      // partner handling
      relationsTable.add(getHeader(iwrb.getLocalizedString("mbe.spouse", "Spouse")), 1, row++);
      User partner = null;
      try {
        partner = familyService.getSpouseFor(this.user);
      } catch (NoSpouseFound e) {
      } catch (Exception e) {
      }
      if (partner != null) {
        relationsTable.add(getRelatedUserLink(partner), 1, row);
        relationsTable.add(
            PersonalIDFormatter.format(partner.getPersonalID(), iwc.getCurrentLocale()), 2, row++);
      }
      row++;

      // cohabitant handling
      relationsTable.add(
          getHeader(iwrb.getLocalizedString("mbe.cohabitant", "Cohabitant")), 1, row++);
      User cohabitant = null;
      try {
        cohabitant = familyService.getCohabitantFor(this.user);
      } catch (NoCohabitantFound e) {
      }
      if (cohabitant != null) {
        relationsTable.add(getRelatedUserLink(cohabitant), 1, row);
        relationsTable.add(
            PersonalIDFormatter.format(cohabitant.getPersonalID(), iwc.getCurrentLocale()),
            2,
            row++);
      }
      row++;

      // biological children handling
      relationsTable.add(
          getHeader(iwrb.getLocalizedString("mbe.parential_children", "Parential children")),
          1,
          row++);
      Collection children = null;
      Collection custodianChildren = null;
      Text star = new Text(" *");
      star.setStyleClass(STYLENAME_HEADER);
      try {
        children = familyService.getChildrenFor(user);
        custodianChildren = familyService.getChildrenInCustodyOf(user);
        if (custodianChildren != null && !custodianChildren.isEmpty()) {
          for (Iterator iter = custodianChildren.iterator(); iter.hasNext(); ) {
            User child = (User) iter.next();
            relationsTable.add(getRelatedUserLink(child), 1, row);
            if (children != null && !children.contains(child)) {
              relationsTable.add(star, 1, row);
            }
            relationsTable.add(
                PersonalIDFormatter.format(child.getPersonalID(), iwc.getCurrentLocale()),
                2,
                row++);
            row++;
          }
        }
      } catch (Exception e2) {
      }
    }
    relationsTable.setWidth(1, "300");
    row++;

    Text infoText =
        new Text(
            iwrb.getLocalizedString(
                "person_is_only_custodian", "* Not child, person is only custodian"));
    infoText.setStyleClass(STYLENAME_TEXT);
    relationsTable.add(infoText, 1, row++);
    row++;

    relationsTable.setAlignment(2, row, Table.HORIZONTAL_ALIGN_RIGHT);
    relationsTable.add(getEditButton(iwc, ACTION_EDIT_RELATIONS), 2, row);

    addToMainPart(relationsTable);
  }