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; }
// 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; }
public PresentationObject getChooser(IWContext iwc, IWBundle bundle) { if (useOldLogic) { // Old chooser Table table = new Table(2, 1); table.setCellpadding(0); table.setCellspacing(0); Parameter value = new Parameter(getChooserParameter(), ""); if (this._stringValue != null) { value.setValue(this._stringValue); } table.add(value); PresentationObject object = getPresentationObject(iwc); table.add(new Parameter(VALUE_PARAMETER_NAME, value.getName())); // GenericButton button = new // GenericButton("chooserbutton",bundle.getResourceBundle(iwc).getLocalizedString(chooserText,"Choose")); if (this._addForm) { SubmitButton button = new SubmitButton(this._iwrb.getLocalizedString("choose", "Choose")); table.add(button, 2, 1); this._form.addParameter(CHOOSER_SELECTION_PARAMETER, getChooserParameter()); this._form.addParameter( FORM_ID_PARAMETER, "window.opener.document.getElementById(\"" + this._form.getID() + "\")."); this._form.addParameter(SCRIPT_SUFFIX_PARAMETER, "value"); if (this.filter != null) { if (this.filter.length() > 0) { this._form.addParameter(FILTER_PARAMETER, this.filter); } } addParametersToForm(this._form); } else { getLink(this._iwrb); if (getUsePublicWindowOpener()) { this.link.setPublicWindowToOpen(getChooserWindowClass()); } else { this.link.setWindowToOpen(getChooserWindowClass()); } this.link.addParameter(CHOOSER_SELECTION_PARAMETER, getChooserParameter()); this.link.addParameter(FORM_ID_PARAMETER, getParentFormID()); // TODO Make the javascript work for other objects than form elements, // e.g. a Link /* * if(object instanceof Layer){ * link.addParameter(SCRIPT_SUFFIX_PARAMETER,"title"); } */ this.link.addParameter(SCRIPT_SUFFIX_PARAMETER, "value"); // } // this was object.getID() but the id could change if this object was kept in session but // the form changed // by using getName() the reference is not lost, however we might need to add extra steps // for handling more than one // chooser of the same type in the same form. this.link.addParameter(DISPLAYSTRING_PARAMETER_NAME, object.getName()); this.link.addParameter(VALUE_PARAMETER_NAME, value.getName()); if (this._attributeName != null && this._attributeValue != null) { this.link.addParameter(this._attributeName, this._attributeValue); } if (this.filter != null) { if (this.filter.length() > 0) { this.link.addParameter(FILTER_PARAMETER, this.filter); } } addParametersToLink(this.link); table.add(this.link, 2, 1); } table.add(object, 1, 1); table.add(new Parameter(DISPLAYSTRING_PARAMETER_NAME, "151324213")); return (table); } else { // New chooser Layer container = new Layer(); String chooserObject = getChooserHelperVarName(); if (chooserObject == null) { chooserObject = AbstractChooserBlock.GLOBAL_HELPER_NAME; } else { add( PresentationUtil.getJavaScriptAction( PresentationUtil.getJavaScriptLinesLoadedLazily( CoreUtil.getResourcesForChooser(iwc), new StringBuilder("if (!") .append(chooserObject) .append(") var ") .append(chooserObject) .append(" = new ChooserHelper();") .toString()))); } PresentationObject object = getPresentationObject(iwc); container.add(object); Image chooser = getChooser(bundle); chooser.setStyleClass("chooserStyle"); chooser.setMarkupAttribute("choosername", chooserObject); // OnClick action StringBuffer action = new StringBuffer("addChooserObject('").append(chooser.getId()).append("', '"); action.append(getChooserWindowClass().getName()); if (getHiddenInputAttribute() == null) { action.append("', null, '"); } else { action.append("', '").append(getHiddenInputAttribute()).append("', '"); } action.append(ICBuilderConstants.CHOOSER_VALUE_VIEWER_ID_ATTRIBUTE).append("', '"); action .append(getResourceBundle().getLocalizedString("loading", "Loading...")) .append("', ") .append( _stringValue == null ? "null" : new StringBuilder("'").append(_stringValue).append("'").toString()) .append(", ") .append( _stringDisplay == null ? "null" : new StringBuilder("'").append(_stringDisplay).append("'").toString()) .append(");"); chooser.setOnClick(action.toString()); container.add(chooser); return container; } }
private Layer getInfoLayer(int theCase) { Layer layerInfo = new Layer(Layer.DIV); // layerInfo.setOverflow("hidden"); // layerInfo.setVisibility("hidden"); layerInfo.setPositionType("relative"); layerInfo.setWidth("270"); layerInfo.setHeight("100"); layerInfo.setStyleClass("ehealth_row_outer_div"); Table tableInfo = new Table(1, 10); tableInfo.setNoWrap(); tableInfo.setCellpadding(0); tableInfo.setCellspacing(0); tableInfo.setBorder(0); // tableInfo.setWidth(200); int column = 1; tableInfo.setWidth(column, 1, "200"); // tableInfo.setWidth(column++, 1, "70"); Image transpImg = Table.getTransparentCell(_iwc); transpImg.setWidth(15); transpImg.setHeight(16); Layer layer = new Layer(Layer.DIV); layer.setOnMouseOver("setRowColor(this);"); layer.setPositionType("relative"); // layer.setHeight(20); layer.setStyleClass("ehealth_row_div"); Image corners = getBundle(_iwc).getImage("thirdLevel.gif"); corners.setBorder(0); corners.setHeight(16); corners.setWidth(19); layer.setBackgroundImage(corners); int theRow = 1; ArrayList cases = new ArrayList(); if (age != null && age.getYears() >= 70) { if (theCase == 1) { cases.add("Vårdplats:"); cases.add("Journalanteckningar:"); cases.add("Remisser och svar:"); // cases.add("Läkemedel:"); } else if (theCase == 2) { cases.add("Vårdplats:"); cases.add("Journalanteckningar:"); cases.add("Remisser och svar:"); } } else { if (theCase == 1) { cases.add("Vårdplats:"); cases.add("Journalanteckningar:"); // cases.add("Läkemedel:"); } else if (theCase == 2) { cases.add("Vårdplats:"); cases.add("Journalanteckningar:"); // cases.add("Läkemedel:"); } } Iterator iter = cases.iterator(); while (iter.hasNext()) { Layer layers = (Layer) layer.clone(); layers.setID("inf" + theCase + "_" + theRow); String text = (String) iter.next(); layers.add(text); tableInfo.add(layers, column, theRow); theRow++; } layerInfo.add(tableInfo); return layerInfo; }
/** * Returns the default delete icon with the tooltip specified. * * @param toolTip The tooltip to display on mouse over. * @return Image The delete icon. */ protected Image getDeleteIcon(String toolTip) { Image deleteImage = iwb.getImage("shared/delete.gif", 12, 12); deleteImage.setToolTip(toolTip); return deleteImage; }