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 User getPupilFromParam(IWContext iwc) throws RemoteException { User child = null; // Parameter name returning chosen User from SearchUserModule this.uniqueUserSearchParam = SearchUserModule.getUniqueUserParameterName(UNIQUE_SUFFIX); if (iwc.isParameterSet(PARAM_PUPIL_ID)) { String idStr = iwc.getParameter(PARAM_PUPIL_ID); int childID = Integer.parseInt(idStr); child = getUserBusiness(iwc).getUser(childID); } else if (iwc.isParameterSet(this.uniqueUserSearchParam)) { int childID = Integer.parseInt(iwc.getParameter(this.uniqueUserSearchParam)); child = getUserBusiness(iwc).getUser(childID); } return child; }
public void main(IWContext iwc) throws Exception { // iwrb = getResourceBundle(iwc); this.form = new Form(); this.form.setName(SEARCH_FORM_NAME); // Parameter name returning chosen User from SearchUserModule this.uniqueUserSearchParam = SearchUserModule.getUniqueUserParameterName(UNIQUE_SUFFIX); this.form.maintainAllParameters(); if (iwc.isParameterSet(PARAM_REMOVE_PLACEMENT) && !("-1".equals(iwc.getParameter(PARAM_REMOVE_PLACEMENT)))) { // A remove placement button is pressed String plcIdStr = null; try { plcIdStr = iwc.getParameter(PARAM_REMOVE_PLACEMENT); Integer plcPK = new Integer(plcIdStr); getCentralPlacementBusiness(iwc).removeSchoolClassMember(plcPK); } catch (Exception e) { logWarning("Error erasing SchooClassMember with PK: " + plcIdStr); log(e); } } this.pupil = getPupilFromParam(iwc); this.form.add(getMainTable()); setMainTableContent(getSearchTable(iwc)); setMainTableContent(getPupilTable(iwc, this.pupil)); setMainTableContent(getPlacementTable(iwc)); // Add empty bottom that fills the bottom window space setMainTableContent(this.transGIF); this.mainTable.setHeight(1, this.mainTableRow - 1, Table.HUNDRED_PERCENT); add(this.form); }
private SearchUserModule getSearchUserModule(/*IWContext iwc*/ ) { SearchUserModule searcher = new SearchUserModule(); searcher.setShowMiddleNameInSearch(false); searcher.setOwnFormContainer(false); searcher.setUniqueIdentifier(UNIQUE_SUFFIX); searcher.setSkipResultsForOneFound(true); searcher.setHeaderFontStyleName(getStyleName(STYLENAME_SMALL_HEADER)); searcher.setButtonStyleName(getStyleName(STYLENAME_INTERFACE_BUTTON)); searcher.setPersonalIDLength(12); searcher.setFirstNameLength(15); searcher.setLastNameLength(20); searcher.setShowSearchParamsAfterSearch(false); /*if (iwc.isParameterSet(uniqueUserSearchParam)) { searcher.maintainParameter(new Parameter(uniqueUserSearchParam, iwc.getParameter(uniqueUserSearchParam))); }*/ return searcher; }