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 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; }