public void main(IWContext iwc) throws Exception { ELUtil.getInstance().autowire(this); String val = iwc.getParameter("submitBtn"); if (!StringUtil.isEmpty(val)) { dao.createDish( iwc.getParameter("dishName"), iwc.getParameter("dishDescription"), iwc.getParameter("dishPrice")); } Layer container = new Layer(); // <div> add(container); IWResourceBundle iwrb = getResourceBundle(iwc); Form form = new Form(); container.add(form); createField(form, "Dish", "dish_name", new TextInput("dishName"), iwrb); createField(form, "Description", "description", new TextArea("dishDescription"), iwrb); createField(form, "Price", "price", new TextInput("dishPrice"), iwrb); SubmitButton submitBtn = new SubmitButton("submitBtn", iwrb.getLocalizedString("submit", "Submit")); form.add(submitBtn); }
private RemoteScriptingResults handleShirtSizeUpdate( IWContext iwc, String sourceName, String distanceIdString) { IWResourceBundle iwrb = getResourceBundle(iwc); if (distanceIdString != null) { Integer distanceID = Integer.valueOf(distanceIdString); RunBusiness runBiz = getRunBiz(iwc); try { Vector ids = new Vector(); Vector names = new Vector(); String shirtSizeMetadata = null; if (distanceID.intValue() != -1) { Group runDistance = runBiz.getRunGroupByGroupId(distanceID); shirtSizeMetadata = runDistance.getMetaData(PARAMETER_SHIRT_SIZES_PER_RUN); } List shirtSizes = null; if (shirtSizeMetadata != null) { shirtSizes = ListUtil.convertCommaSeparatedStringToList(shirtSizeMetadata); Iterator shirtIt = shirtSizes.iterator(); // ShirtSizeHome shirtSizeHome = (ShirtSizeHome) IDOLookup.getHome(ShirtSize.class); if (shirtIt.hasNext()) { ids.add("-1"); names.add( iwrb.getLocalizedString( "run_distance_dd.select_shirt_size", "Select shirt size...")); } while (shirtIt.hasNext()) { String shirtSizeKey = (String) shirtIt.next(); // ShirtSize shirtSize = shirtSizeHome.findByPrimaryKey(shirtSizeKey); // String s = iwrb.getLocalizedString(shirtSize.getName(),shirtSize.getName()); ids.add(shirtSizeKey); names.add(iwrb.getLocalizedString("shirt_size." + shirtSizeKey, shirtSizeKey)); } if (shirtSizes.isEmpty()) { ids.add("-1"); names.add(iwrb.getLocalizedString("unavailable", "Unavailable")); } } else { ids.add("-1"); names.add(iwrb.getLocalizedString("unavailable", "Unavailable")); } RemoteScriptingResults rsr = new RemoteScriptingResults(RemoteScriptHandler.getLayerName(sourceName, "id"), ids); rsr.addLayer(RemoteScriptHandler.getLayerName(sourceName, "name"), names); return rsr; } catch (Exception e) { e.printStackTrace(); } } return null; }
private PresentationObject getPrivatePublicRadioButtons(IWResourceBundle iwrb) { RadioGroup radioGroup = new RadioGroup(KEY_PERMISSION); radioGroup.setWidth(1); radioGroup.addRadioButton( PRIVATE, new Text(iwrb.getLocalizedString("query_uploader_private_query", "private")), true); radioGroup.addRadioButton( PUBLIC, new Text(iwrb.getLocalizedString("query_uploader_public_query", "public"))); return radioGroup; }
private void addActions(Layer main) { StringBuilder actions = new StringBuilder("GroupJoinerHelper.FAILURE_MSG = '") .append(iwrb.getLocalizedString("failed", "Failed")) .append(JS_STR_INITIALIZATION_END) .append("GroupJoinerHelper.ADDING_TO_GROUP_MSG = '") .append(iwrb.getLocalizedString("adding_to_group", "Adding to group")) .append(JS_STR_INITIALIZATION_END) .append("GroupJoinerHelper.REMOVING_FROM_GROUP_MSG = '") .append(iwrb.getLocalizedString("removing_from_group", "Removing from group")) .append(JS_STR_INITIALIZATION_END); String actionString = PresentationUtil.getJavaScriptAction(actions.toString()); main.add(actionString); }
public String getCurrentVersionForLabel(IWResourceBundle resourceBundle) { String tempCurrentVersion = getRoot().getTextTrim(CURRENT_VERSION); String version = resourceBundle.getLocalizedString("man_manager_version", "Version"); StringBuffer buffer = new StringBuffer(); buffer.append(version).append(" ").append(tempCurrentVersion); return buffer.toString(); }
private PresentationObject getGoBackButton(IWResourceBundle resourceBundle) { String goBackText = resourceBundle.getLocalizedString("ro_back_to_list", "Back to list"); Link goBack = new Link(goBackText); goBack.addParameter(ReportQueryBuilder.PARAM_LAYOUT_FOLDER_ID, this.layoutFolderId); goBack.setAsImageButton(true); return goBack; }
private PresentationObject getDropDownOfQueriesForReplacing(IWResourceBundle iwrb, IWContext iwc) throws RemoteException, FinderException { DropdownMenu dropDownMenu = getDropDownOfQueries(KEY_CHOSEN_QUERY_FOR_REPLACING, iwc); String doNotUseReplaceAQuery = iwrb.getLocalizedString("step_5_do_not_replace_a_query", "don't replace a query"); dropDownMenu.addMenuElementFirst(VALUE_DO_NOT_REPLACE_A_QUERY, doNotUseReplaceAQuery); return dropDownMenu; }
private Link getAddAndRemoveUserLink(IWContext iwc, IWResourceBundle iwrb) throws Exception { Link addLink = new Link(iwrb.getLocalizedString("add_remove_user", "Add/Remove user")); addLink.setFontFace(Text.FONT_FACE_ARIAL); addLink.setFontSize(Text.FONT_SIZE_7_HTML_1); addLink.setBold(); addLink.setWindowToOpen(ParticipantList.UserGroupSetter.class); addLink.addParameter(GroupGroupSetter.PARAMETER_GROUP_ID, this.getGroupId(iwc)); return addLink; }
private PresentationObject getDownloadButton(IWResourceBundle resourceBundle) { SubmitButton downloadButton = new SubmitButton( resourceBundle.getLocalizedString("ro_download", "Download..."), KEY_QUERY_DOWNLOAD_IS_SUBMITTED, "true"); downloadButton.setAsImageButton(true); return downloadButton; }
private void createField( Form form, String defaultLabel, String locKey, InterfaceObject io, IWResourceBundle iwrb) { Layer container = new Layer(); form.add(container); Label label = new Label(iwrb.getLocalizedString(locKey, defaultLabel), io); container.add(label); container.add(io); }
private Link getLink(IWResourceBundle iwrb) { if (this.link == null) { if (this._buttonImage == null) { this.link = new Link(iwrb.getLocalizedString("choose", "Choose")); } else { this._buttonImage.setHorizontalSpacing(3); this.link = new Link(this._buttonImage); } } return this.link; }
public String getUserNameDWR(String personalID, String localeStr) { try { if (personalID != null && !personalID.trim().equals("")) { UserHome uHome = (UserHome) IDOLookup.getHome(User.class); User user = uHome.findByPersonalID(personalID); return user.getName(); } else { return ""; } } catch (IDOLookupException e) { e.printStackTrace(); } catch (FinderException e) { } try { IWContext iwc = IWContext.getInstance(); Locale locale = iwc.getCurrentLocale(); IWResourceBundle iwrb = getBundle().getResourceBundle(locale); return iwrb.getLocalizedString("landsmot.user_not_found", "User not found"); } catch (UnavailableIWContext e) { return "User not found"; } }
private GenericButton getSaveButton() { GenericButton save = new GenericButton("save", _iwrb.getLocalizedString("save", "Save")); StringBuffer preAction = null; if (actionAfterPropertySaved != null) { preAction = new StringBuffer("var actionAfter = function() {") .append(actionAfterPropertySaved) .append("}; "); } StringBuffer action = new StringBuffer(); if (preAction != null) { action.append(preAction.toString()); } action .append(getChooserHelperVarName()) .append(getChooserHelperVarName() != null ? "." : "") .append("saveSelectedValues('") .append(getResourceBundle().getLocalizedString("saving", "Saving...")) .append("', "); if (getInstanceId() == null) { action.append("null, "); } else { action.append("'").append(getInstanceId()).append("', "); } if (getMethod() == null) { action.append("null"); } else { action.append("'").append(getMethod()).append("'"); } action .append(", ") .append(needsReload) .append(", '") .append(getResourceBundle().getLocalizedString("reload", "Reloading...")); action.append("', "); if (preAction == null) { action.append("null"); } else { action.append("actionAfter"); } action.append(");"); save.setOnClick(action.toString()); return save; }
private void addLocalized(IWContext iwc) { Locale locale = iwc.getCurrentLocale(); DateFormatSymbols symbols = new DateFormatSymbols(locale); IWBundle iwb = this.getBundle(iwc); IWResourceBundle iwrb = iwb.getResourceBundle(iwc); String[] monthStrings; if (this.showNullValue) { if (this.inShort) { this.dayString = iwrb.getLocalizedString(DAY_KEY_S, "D"); this.monthString = iwrb.getLocalizedString(MONTH_KEY_S, "M"); this.yearString = iwrb.getLocalizedString(YEAR_KEY_S, "Y"); } else { this.dayString = iwrb.getLocalizedString(DAY_KEY, "Day"); this.monthString = iwrb.getLocalizedString(MONTH_KEY, "Month"); this.yearString = iwrb.getLocalizedString(YEAR_KEY, "Year"); } this.theDay.setMenuElementDisplayString("00", this.dayString); this.theMonth.setMenuElementDisplayString("00", this.monthString); if (this.showYear) { this.theYear.setMenuElementDisplayString("YY", this.yearString); } } if (this.inShort) { monthStrings = symbols.getShortMonths(); } else { monthStrings = symbols.getMonths(); } for (int i = 1; i <= 12; i++) { String value = Integer.toString(i); if (i < 10) { value = "0" + value; } this.theMonth.setMenuElementDisplayString(value, monthStrings[i - 1]); } }
// 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 com.idega.user.app.ToolbarElement#getName(com.idega.presentation.IWContext) */ public String getName(IWContext iwc) { IWBundle bundle = iwc.getApplicationContext().getIWMainApplication().getBundle(IW_BUNDLE_IDENTIFIER); IWResourceBundle resourceBundle = bundle.getResourceBundle(iwc); return resourceBundle.getLocalizedString("button.generate_year", "Generate Year Group"); }
@Override protected void initializeComponent(FacesContext context) { super.initializeComponent(context); IWContext iwc = IWContext.getIWContext(context); IWBundle bundle = getBundle(context, IWBundleStarter.IW_BUNDLE_IDENTIFIER); IWResourceBundle iwrb = bundle.getResourceBundle(iwc); Layer container = new Layer(); add(container); PublicEventCreator creator = new PublicEventCreator(); creator.setOnEventCreated( "function() {window.parent.showLoadingMessage('" .concat(iwrb.getLocalizedString("reloading", "Reloading...")) .concat("');window.parent.reloadPage();}")); container.add(creator); Layer events = new Layer(); container.add(events); IFrame frame = new IFrame("eventsViewer", "http://bedework.sidan.is/cal/main/showMain.rdo", 750, 600); events.add(frame); // IWContext iwc = IWContext.getIWContext(context); // if (!iwc.isLoggedOn()) { // return; // } // // HtmlTag div = // (HtmlTag)context.getApplication().createComponent(HtmlTag.COMPONENT_TYPE); // div.setValue(divTag); // div.setStyleClass("calendarEventCreator"); // // IWBundle bundle = getBundle(context, IWBundleStarter.IW_BUNDLE_IDENTIFIER); // IWResourceBundle iwrb = bundle.getResourceBundle(iwc); // // GenericButton gb = new GenericButton(); // div.getChildren().add(gb); // gb.setValue(iwrb.getLocalizedString("show_event", "Show event")); // // PresentationUtil.addStyleSheetToHeader(iwc, // web2Business.getBundleURIToFancyBoxStyleFile()); // // List<String> jsFiles = new ArrayList<String>(); // jsFiles.add(jQuery.getBundleURIToJQueryLib()); // jsFiles.addAll(web2Business.getBundleURIsToFancyBoxScriptFiles()); // // jsFiles.add(bundle.getVirtualPathWithFileNameString("javascript/EventCreationHelper.js")); // PresentationUtil.addJavaScriptSourcesLinesToHeader(iwc, jsFiles); // String action = "EventCreationHelper.initializeHiddenLink();"; // if (!CoreUtil.isSingleComponentRenderingProcess(iwc)) { // action = "jQuery(window).load(function() {" + action + "});"; // } // // PresentationUtil.addJavaScriptActionToBody(iwc, action); // gb.setOnClick("EventCreationHelper.showPublicEventsWindow();"); // // getChildren().add(div); // HtmlTag div = // (HtmlTag)context.getApplication().createComponent(HtmlTag.COMPONENT_TYPE); // div.setValue(divTag); // // IWBundle bundle = getBundle(context, IWBundleStarter.IW_BUNDLE_IDENTIFIER); // FaceletComponent facelet = // (FaceletComponent)context.getApplication().createComponent(FaceletComponent.COMPONENT_TYPE); // facelet.setFaceletURI(bundle.getFaceletURI("EventViewer.xhtml")); // // div.getChildren().add(facelet); // getChildren().add(div); }
/* (non-Javadoc) * @see com.idega.user.app.ToolbarElement#getName(com.idega.presentation.IWContext) */ public String getName(IWContext iwc) { IWBundle bundle = iwc.getApplicationContext().getIWMainApplication().getBundle(IW_BUNDLE_IDENTIFIER); IWResourceBundle resourceBundle = bundle.getResourceBundle(iwc); return resourceBundle.getLocalizedString("button.marathon_runner_import", "Runner import"); }
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); }
@SuppressWarnings("unchecked") @Override protected void initializeComponent(FacesContext context) { ELUtil.getInstance().autowire(this); iwc = IWContext.getIWContext(context); if (!iwc.isLoggedOn()) { return; } if (userId == null) { userId = iwc.getCurrentUserId(); } // HtmlTag div = new // HtmlTag();//(HtmlTag)context.getApplication().createComponent(HtmlTag.COMPONENT_TYPE); // getChildren().add(div); // div.setValue(divTag); Layer main = new Layer(); this.add(main); IWBundle bundle = getBundle(context, IWBundleStarter.IW_BUNDLE_IDENTIFIER); iwrb = bundle.getResourceBundle(iwc); if (groupId == null) { Label label = new Label(); main.add(label); label.addText(iwrb.getLocalizedString("no_group_set", "No group set")); return; } Group group = null; Collection<Group> groups = null; try { group = this.getUserBusiness().getGroupBusiness().getGroupByGroupID(Integer.valueOf(groupId)); groups = this.getUserBusiness().getUserGroups(userId); } catch (Exception e) { Logger.getLogger(this.getClass().getName()) .log(Level.WARNING, "failed getting groups by ids", e); } GenericButton joinButton = new GenericButton(); main.add(joinButton); GenericButton leaveButton = new GenericButton(); main.add(leaveButton); StringBuilder parameters = new StringBuilder() .append(this.userId) .append(CoreConstants.JS_STR_PARAM_SEPARATOR) .append(this.groupId) .append("','#") .append(joinButton.getId()) .append("','#") .append(leaveButton.getId()) .append(CoreConstants.JS_STR_PARAM_END); joinButton.setValue(iwrb.getLocalizedString("join", "Join")); String action = new StringBuilder("GroupJoinerHelper.joinGroup('").append(parameters).toString(); joinButton.setOnClick(action); leaveButton.setValue(iwrb.getLocalizedString("leave", "Leave")); action = new StringBuilder("GroupJoinerHelper.leaveGroup('").append(parameters).toString(); leaveButton.setOnClick(action); if (groups.contains(group)) { joinButton.setStyleAttribute("display : none;"); } else { leaveButton.setStyleAttribute("display : none;"); } addActions(main); }
public String getPlacementString(SchoolClassMember placement, User user, IWResourceBundle iwrb) { // Placement StringBuffer buf = new StringBuffer(""); try { // add school name buf.append(placement.getSchoolClass().getSchool().getName()); } catch (Exception e) { } try { // school year SchoolYear theYear = placement.getSchoolYear(); if (theYear != null) { buf.append( ", " + iwrb.getLocalizedString( CentralPlacementEditorConstants.KEY_SCHOOL_YEAR, "school year") + " " + theYear.getName()); } } catch (Exception e) { } try { // add school group buf.append( ", " + iwrb.getLocalizedString(CentralPlacementEditorConstants.KEY_SCHOOL_GROUP, "group") + " " + placement.getSchoolClass().getSchoolClassName()); } catch (Exception e) { } try { // add study path if (placement.getStudyPathId() != -1) { SchoolStudyPathHome home = (SchoolStudyPathHome) IDOLookup.getHome(SchoolStudyPath.class); SchoolStudyPath sp = home.findByPrimaryKey(new Integer(placement.getStudyPathId())); buf.append( ", " + iwrb.getLocalizedString( CentralPlacementEditorConstants.KEY_STUDY_PATH, "Study path") + " " + sp.getCode()); } } catch (Exception e) { } try { // add language if (placement.getLanguage() != null && !("-1").equals(placement.getLanguage())) { buf.append( ", " + iwrb.getLocalizedString(CentralPlacementEditorConstants.KEY_LANGUAGE, "Language") + " " + iwrb.getLocalizedString(placement.getLanguage(), "")); } } catch (Exception e) { } try { // add native language if (user.getNativeLanguage() != null) { buf.append( ", " + iwrb.getLocalizedString( CentralPlacementEditorConstants.KEY_NATIVE_LANGUAGE, "Native language") + " " + user.getNativeLanguage()); } } catch (Exception e) { } return buf.toString(); }
public String getLinkName(IWResourceBundle resourceBundle) { return resourceBundle.getLocalizedString("edit", "Edit"); }