From: Eric C. <ecr...@us...> - 2006-09-28 01:07:24
|
User: ecrutchfield Date: 06/09/27 18:07:22 Modified: andromda-aspdotnet/src/main/resources/templates/aspdotnet sessionObject.cs.vsl andromda-aspdotnet/src/main/resources/META-INF/andromda cartridge.xml Log: generate session objects in app_code if vs2005 solution Revision Changes Path 1.4 +6 -1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/sessionObject.cs.vsl Index: sessionObject.cs.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/sessionObject.cs.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- sessionObject.cs.vsl 25 Sep 2006 19:09:49 -0000 1.3 +++ sessionObject.cs.vsl 28 Sep 2006 01:07:22 -0000 1.4 @@ -1,4 +1,9 @@ -#set($generatedFile = "Common/${sessionObject.name}.cs") +#if($is2005Solution) +#set($folder = "App_Code/target/src/") +#else +#set($folder = "target/src/") +#end +#set($generatedFile = "${folder}${sessionObject.fullyQualifiedPath}/${sessionObject.name}.cs") using System; namespace ${sessionObject.packageName} 1.3 +1 -1 cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- cartridge.xml 25 Sep 2006 19:25:00 -0000 1.2 +++ cartridge.xml 28 Sep 2006 01:07:22 -0000 1.3 @@ -285,7 +285,7 @@ <template path="templates/aspdotnet/sessionObject.cs.vsl" outputPattern="$generatedFile" - outlet="web_generated" + outlet="web" overwrite="true"> <modelElements variable="sessionObject"> <modelElement> |
From: Eric C. <ecr...@us...> - 2006-09-28 05:35:31
|
User: ecrutchfield Date: 06/09/27 22:35:30 Modified: andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005 webform.aspx.vsl Default.master.vsl renderFormInput.vm webformBase.cs.vsl andromda-aspdotnet/src/main/resources/META-INF/andromda cartridge.xml Added: andromda-aspdotnet/src/main/resources/calendar CalendarControl.js CalendarControlHead.js CalendarControl.css Removed: andromda-aspdotnet/src/main/resources/calendar style.css oboutCalendar.js Log: fix bug with calendar parameters Revision Changes Path 1.3 +3 -3 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/webform.aspx.vsl Index: webform.aspx.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/webform.aspx.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- webform.aspx.vsl 25 Sep 2006 19:14:29 -0000 1.2 +++ webform.aspx.vsl 28 Sep 2006 05:35:30 -0000 1.3 @@ -29,15 +29,15 @@ <asp:FileUpload ID="${parameter.name}FileSelector" runat="server" /></td> #else <asp:$type id="$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}$type" ToolTip="<%$ Resources:GeneratedResources, ${key}_${parameter.name}_${type}_Help %>" - #if(${parameter.isCalendar()})ReadOnly="True" #end#if(${parameter.isReadOnly()})ReadOnly="True" #end #if(${parameter.inputTextarea})TextMode="MultiLine" #if($parameter.fieldColumnCount)Columns=${parameter.fieldColumnCount} #end #if($parameter.fieldRowCount)Rows=${parameter.fieldRowCount} #end#end #if(${parameter.inputPassword})TextMode="Password" #end + #if(${parameter.readOnly})ReadOnly="True" #end #if(${parameter.inputTextarea})TextMode="MultiLine" #if($parameter.fieldColumnCount)Columns=${parameter.fieldColumnCount} #end #if($parameter.fieldRowCount)Rows=${parameter.fieldRowCount} #end#end #if(${parameter.inputPassword})TextMode="Password" #end #if($type.equalsIgnoreCase('ListBox'))SelectionMode=Multiple #end#if($type.equals('RadioButton')) GroupName="${parameter.getRadioButtonGroup()}" #end runat="server"></asp:$type> #if(${parameter.required}) #if(!$type.equalsIgnoreCase("checkbox")) <asp:RequiredFieldValidator id="${parameter.name}RF" runat="server" ErrorMessage="You must specify a value for this field." ControlToValidate="$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}TextBox"></asp:RequiredFieldValidator> #end #end -#if(${parameter.isCalendar()}) - <asp:Calendar ID="${parameter.name}Calendar" runat="server" ></asp:Calendar> +#if(${parameter.calendar}) + <IMG id="$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}${parameter.viewType}Calendar" src="~/calendar/calendar.gif" runat="server"> #end #end #if ($parameter.validationRequired) 1.2 +3 -1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/Default.master.vsl Index: Default.master.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/Default.master.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- Default.master.vsl 17 Sep 2006 17:30:41 -0000 1.1 +++ Default.master.vsl 28 Sep 2006 05:35:30 -0000 1.2 @@ -4,9 +4,11 @@ <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <link href="~/layout/default.css" rel="stylesheet" type="text/css" /> - + <link href="~/calendar/CalendarControl.css" rel="stylesheet" type="text/css" /> + <SCRIPT language="javascript" src="<% Response.Write(ResolveClientUrl("~/calendar/CalendarControlHead.js")); %>"></SCRIPT> </head> <body > + <SCRIPT language="javascript" src="<% Response.Write(ResolveClientUrl("~/calendar/CalendarControl.js"));%>"></SCRIPT> <form id="form1" runat="server"> <div id="menu"> <asp:contentplaceholder id="MenuPlaceHolder" runat="server"> 1.2 +3 -0 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/renderFormInput.vm Index: renderFormInput.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/renderFormInput.vm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- renderFormInput.vm 25 Sep 2006 19:12:43 -0000 1.1 +++ renderFormInput.vm 28 Sep 2006 05:35:30 -0000 1.2 @@ -15,6 +15,9 @@ protected System.Web.UI.WebControls.HiddenField $stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}Hidden; #else protected System.Web.UI.WebControls.$aspType $stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}$aspType; +#if($parameter.calendar) + protected System.Web.UI.HtmlControls.HtmlImage $stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}${aspType}Calendar; +#end #end #end protected System.Web.UI.WebControls.Button ${action.actionMethodName}Button; 1.4 +3 -0 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/webformBase.cs.vsl Index: webformBase.cs.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/web2005/webformBase.cs.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- webformBase.cs.vsl 28 Sep 2006 01:12:54 -0000 1.3 +++ webformBase.cs.vsl 28 Sep 2006 05:35:30 -0000 1.4 @@ -53,6 +53,9 @@ this.$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}${parameter.viewType}.DataSource = base.Controller.${action.formImplementationPropertyName}.Get$stringUtils.capitalize(${parameter.backingListName})(); this.$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}${parameter.viewType}.DataBind(); #end +#if ($parameter.calendar) + this.$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}${parameter.viewType}Calendar.Attributes.Add("onclick", "javascript:showCalendarControl(" + $stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}${parameter.viewType}.ClientID + "); "); +#end ## Now render any error messages for the validation controls. This is done ## here because we need to do some string manipulation on the value we pull from ## the resource. 1.1 cartridges/andromda-aspdotnet/src/main/resources/calendar/CalendarControl.js Index: CalendarControl.js =================================================================== document.write("<iframe id='CalendarControlIFrame' src='javascript:false;' frameBorder='0' scrolling='no'></iframe>"); document.write("<div id='CalendarControl'></div>"); 1.1 cartridges/andromda-aspdotnet/src/main/resources/calendar/CalendarControlHead.js Index: CalendarControlHead.js =================================================================== //Script provided courtesy of Purdue University Engineering Computer Network. web...@ec... function positionInfo(object) { var p_elm = object; this.getElementLeft = getElementLeft; function getElementLeft() { var x = 0; var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } while (elm != null) { x+= elm.offsetLeft; elm = elm.offsetParent; } return parseInt(x); } this.getElementWidth = getElementWidth; function getElementWidth(){ var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } return parseInt(elm.offsetWidth); } this.getElementRight = getElementRight; function getElementRight(){ return getElementLeft(p_elm) + getElementWidth(p_elm); } this.getElementTop = getElementTop; function getElementTop() { var y = 0; var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } while (elm != null) { y+= elm.offsetTop; elm = elm.offsetParent; } return parseInt(y); } this.getElementHeight = getElementHeight; function getElementHeight(){ var elm; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } return parseInt(elm.offsetHeight); } this.getElementBottom = getElementBottom; function getElementBottom(){ return getElementTop(p_elm) + getElementHeight(p_elm); } } function CalendarControl() { var calendarId = 'CalendarControl'; var currentYear = 0; var currentMonth = 0; var currentDay = 0; var selectedYear = 0; var selectedMonth = 0; var selectedDay = 0; var months = ['January','February','March','April','May','June','July','August','September','October','November','December']; var dateField = null; function getProperty(p_property){ var p_elm = calendarId; var elm = null; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } if (elm != null){ if(elm.style){ elm = elm.style; if(elm[p_property]){ return elm[p_property]; } else { return null; } } else { return null; } } } function setElementProperty(p_property, p_value, p_elmId){ var p_elm = p_elmId; var elm = null; if(typeof(p_elm) == "object"){ elm = p_elm; } else { elm = document.getElementById(p_elm); } if((elm != null) && (elm.style != null)){ elm = elm.style; elm[ p_property ] = p_value; } } function setProperty(p_property, p_value) { setElementProperty(p_property, p_value, calendarId); } function getDaysInMonth(year, month) { return [31,((!(year % 4 ) && ( (year % 100 ) || !( year % 400 ) ))?29:28),31,30,31,30,31,31,30,31,30,31][month-1]; } function getDayOfWeek(year, month, day) { var date = new Date(year,month-1,day) return date.getDay(); } this.setDate = setDate; function setDate(year, month, day) { if (dateField) { if (month < 10) {month = "0" + month;} if (day < 10) {day = "0" + day;} var dateString = month+"/"+day+"/"+year; dateField.value = dateString; hide(); } return; } this.changeMonth = changeMonth; function changeMonth(change) { currentMonth += change; currentDay = 0; if(currentMonth > 12) { currentMonth = 1; currentYear++; } else if(currentMonth < 1) { currentMonth = 12; currentYear--; } calendar = document.getElementById(calendarId); calendar.innerHTML = calendarDrawTable(); } this.changeYear = changeYear; function changeYear(change) { currentYear += change; currentDay = 0; calendar = document.getElementById(calendarId); calendar.innerHTML = calendarDrawTable(); } function getCurrentYear() { var year = new Date().getYear(); if(year < 1900) year += 1900; return year; } function getCurrentMonth() { return new Date().getMonth() + 1; } function getCurrentDay() { return new Date().getDate(); } function calendarDrawTable() { var dayOfMonth = 1; var validDay = 0; var startDayOfWeek = getDayOfWeek(currentYear, currentMonth, dayOfMonth); var daysInMonth = getDaysInMonth(currentYear, currentMonth); var css_class = null; //CSS class for each day var table = "<table cellspacing='0' cellpadding='0' border='0'>"; table = table + "<tr class='header'>"; table = table + " <td colspan='2' class='previous'><a href='javascript:changeCalendarControlMonth(-1);'><</a> <a href='javascript:changeCalendarControlYear(-1);'>«</a></td>"; table = table + " <td colspan='3' class='title'>" + months[currentMonth-1] + "<br>" + currentYear + "</td>"; table = table + " <td colspan='2' class='next'><a href='javascript:changeCalendarControlYear(1);'>»</a> <a href='javascript:changeCalendarControlMonth(1);'>></a></td>"; table = table + "</tr>"; table = table + "<tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr>"; for(var week=0; week < 6; week++) { table = table + "<tr>"; for(var dayOfWeek=0; dayOfWeek < 7; dayOfWeek++) { if(week == 0 && startDayOfWeek == dayOfWeek) { validDay = 1; } else if (validDay == 1 && dayOfMonth > daysInMonth) { validDay = 0; } if(validDay) { if (dayOfMonth == selectedDay && currentYear == selectedYear && currentMonth == selectedMonth) { css_class = 'current'; } else if (dayOfWeek == 0 || dayOfWeek == 6) { css_class = 'weekend'; } else { css_class = 'weekday'; } table = table + "<td><a class='"+css_class+"' href=\"javascript:setCalendarControlDate("+currentYear+","+currentMonth+","+dayOfMonth+")\">"+dayOfMonth+"</a></td>"; dayOfMonth++; } else { table = table + "<td class='empty'> </td>"; } } table = table + "</tr>"; } table = table + "<tr class='header'><th colspan='7' style='padding: 3px;'><a href='javascript:hideCalendarControl();'>Close</a></td></tr>"; table = table + "</table>"; return table; } this.show = show; function show(field) { // If the calendar is visible and associated with // this field do not do anything. if (dateField == field) { return; } else { dateField = field; } if(dateField) { try { var dateString = new String(dateField.value); var dateParts = dateString.split("-"); selectedMonth = parseInt(dateParts[0],10); selectedDay = parseInt(dateParts[1],10); selectedYear = parseInt(dateParts[2],10); } catch(e) {} } if (!(selectedYear && selectedMonth && selectedDay)) { selectedMonth = getCurrentMonth(); selectedDay = getCurrentDay(); selectedYear = getCurrentYear(); } currentMonth = selectedMonth; currentDay = selectedDay; currentYear = selectedYear; if(document.getElementById){ calendar = document.getElementById(calendarId); calendar.innerHTML = calendarDrawTable(currentYear, currentMonth); setElementProperty('display', 'block', 'CalendarControlIFrame'); setProperty('display', 'block'); var fieldPos = new positionInfo(dateField); var calendarPos = new positionInfo(calendarId); var x = fieldPos.getElementLeft(); var y = fieldPos.getElementBottom(); setProperty('left', x + "px"); setProperty('top', y + "px"); setElementProperty('left', x + "px", 'CalendarControlIFrame'); setElementProperty('top', y + "px", 'CalendarControlIFrame'); setElementProperty('width', calendarPos.getElementWidth() + "px", 'CalendarControlIFrame'); setElementProperty('height', calendarPos.getElementHeight() + "px", 'CalendarControlIFrame'); } } this.hide = hide; function hide() { if(dateField) { setProperty('display', 'none'); setElementProperty('display', 'none', 'CalendarControlIFrame'); dateField = null; } } } var calendarControl = new CalendarControl(); function showCalendarControl(textField) { calendarControl.show(textField); } function hideCalendarControl() { calendarControl.hide(); } function setCalendarControlDate(year, month, day) { calendarControl.setDate(year, month, day); } function changeCalendarControlYear(change) { calendarControl.changeYear(change); } function changeCalendarControlMonth(change) { calendarControl.changeMonth(change); } 1.1 cartridges/andromda-aspdotnet/src/main/resources/calendar/CalendarControl.css Index: CalendarControl.css =================================================================== #CalendarControlIFrame { display: none; left: 0px; position: absolute; top: 0px; height: 250px; width: 250px; z-index: 99; } #CalendarControl { position:absolute; background-color:#FFF; margin:0; padding:0; display:none; z-index: 100; } #CalendarControl table { font-family: arial, verdana, helvetica, sans-serif; font-size: 8pt; border-left: 1px solid #336; border-right: 1px solid #336; } #CalendarControl th { font-weight: normal; } #CalendarControl th a { font-weight: normal; text-decoration: none; color: #FFF; padding: 1px; } #CalendarControl td { text-align: center; } #CalendarControl .header { background-color: #336; } #CalendarControl .weekday { background-color: #DDD; color: #000; } #CalendarControl .weekend { background-color: #FFC; color: #000; } #CalendarControl .current { border: 1px solid #339; background-color: #336; color: #FFF; } #CalendarControl .weekday, #CalendarControl .weekend, #CalendarControl .current { display: block; text-decoration: none; border: 1px solid #FFF; width: 2em; } #CalendarControl .weekday:hover, #CalendarControl .weekend:hover, #CalendarControl .current:hover { color: #FFF; background-color: #336; border: 1px solid #999; } #CalendarControl .previous { text-align: left; } #CalendarControl .next { text-align: right; } #CalendarControl .previous, #CalendarControl .next { padding: 1px 3px 1px 3px; font-size: 1.4em; } #CalendarControl .previous a, #CalendarControl .next a { color: #FFF; text-decoration: none; font-weight: bold; } #CalendarControl .title { text-align: center; font-weight: bold; color: #FFF; } #CalendarControl .empty { background-color: #CCC; border: 1px solid #FFF; } 1.4 +0 -1 cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- cartridge.xml 28 Sep 2006 01:07:22 -0000 1.3 +++ cartridge.xml 28 Sep 2006 05:35:30 -0000 1.4 @@ -54,7 +54,6 @@ path="calendar/*.*" outputPattern="calendar/{0}" outlet="web" - outputCondition="is2003Solution" overwrite="false"/> <resource path="layout/*.*" |
From: Eric C. <ecr...@us...> - 2006-10-01 01:44:47
|
User: ecrutchfield Date: 06/09/30 18:44:47 Modified: andromda-aspdotnet/src/main/resources/META-INF/andromda cartridge.xml Added: andromda-aspdotnet/src/main/resources/templates/aspdotnet/forms formImplMacros.vm formMacros.vm formImpl.cs.vsl Form.cs.vsl andromda-aspdotnet/src/main/resources/templates/aspdotnet/controllers ControllerImpl.cs.vsl Controller.cs.vm Controller.cs.vsl Removed: andromda-aspdotnet/src/main/resources/templates/aspdotnet/uicontrollers UIPController.cs.vsl Controller.cs.vm formImplMacros.vm Form.cs.vsl formMacros.vm formImpl.cs.vsl UIPControllerImpl.cs.vsl Log: rename/move files/folders to more appropriate places/names Revision Changes Path 1.1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/forms/formImplMacros.vm Index: formImplMacros.vm =================================================================== ## ## This macro renders the backing list support for the form implementation ## #macro(renderBackingListImplSupport $field $ownerParameter) #if ($field.name) #set ($labelListName = "${field.name}LabelList") #set ($valueListName = "${field.name}ValueList") #set ($backingListName = "${field.name}BackingList") #else #set ($labelListName = $field.getLabelListName($ownerParameter)) #set ($valueListName = $field.getValueListName($ownerParameter)) #set ($backingListName = $field.getBackingListName($ownerParameter)) #end #set ($listType = "System.Object[]") #set ($labelListMethod = $stringUtils.capitalize($labelListName)) #set ($valueListMethod = $stringUtils.capitalize($valueListName)) #set ($backingListMethod = $stringUtils.capitalize($backingListName)) System.Web.UI.WebControls.ListItemCollection _${backingListName} = null; string[] _${labelListName} = null; string[] _${valueListName} = null; /// <summary> /// Get the backing list for the ${action.name} field. You must have first set the labels /// and values via the <cref="Set${labelListMethod}"/> and <cref="Set${valueListMethod}"/> methods. /// </summary> public System.Web.UI.WebControls.ListItemCollection Get${backingListMethod}() { //return an empty collection if they never set the backing list labels and values. if (this._${labelListName} == null || this._${valueListName} == null) return new System.Web.UI.WebControls.ListItemCollection(); if (this._${labelListName}.Length != this._${valueListName}.Length) throw new InvalidOperationException("The number of values and labels are not the same."); if (this._${backingListName} == null) { this._${backingListName} = new System.Web.UI.WebControls.ListItemCollection(); } else this._${backingListName}.Clear(); for (int i = 0; i < this._${labelListName}.Length; i++) { System.Web.UI.WebControls.ListItem listItem = new System.Web.UI.WebControls.ListItem(this._${labelListName}[i], this._${valueListName}[i]); this._${backingListName}.Add(listItem); } return this._${backingListName}; } /// <summary> /// Set the backing list labels for the ${action.name} field. You must also call /// <see cref="Set${valueListMethod}"/> passing in the same number of items. /// </summary> /// <param name="list">a string array of the labels</param> public void Set${labelListMethod}(string[] list) { this._${labelListName} = list; } /// <summary> /// Set the backing list values for the ${action.name} field. You must also call /// <see cref="Set${labelListMethod}"/> passing in the same number of items. /// </summary> /// <param name="list">a string array of the values</param> public void Set${valueListMethod}(string[] list) { this._${valueListName} = list; } #end ## ## This macro renders the code that sets the property ## of the form using the value of the input field defined on the page. ## #macro( populateFormProperties ) #if(!$action.tableAction && !$action.tableLink) #foreach($parameter in ${action.parameters}) #if(!${parameter.inputHidden} && !${parameter.inputTable}) #set($viewType = ${parameter.viewType}) #set($fieldName = "this.$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}$viewType") ## if we can't get the value from the field (e.g. Label) then we need to get it from it's Hidden counterpart. #if($viewType.equalsIgnoreCase("HyperLink") || $viewType.equalsIgnoreCase("Label")) #set($fieldName = "this.$stringUtils.lowerCamelCaseName(${action.name})_${parameter.name}Hidden") #end #set($formProperty = "$parameter.capitalisedName") org.andromda.cartridges.aspdotnet.FormPopulator.PopulateForm(${fieldName}, base.Controller.${action.formImplementationPropertyName}, "${formProperty}"); #end #end #end #end ## ## This macro renders the date/time formatters within the form implementation ## #macro(renderDateTimeFormatters $field $ownerParameter) #if ($field.backingListName) #set ($dateFormatter = $field.dateFormatter) #set ($timeFormatter = $field.timeFormatter) #set ($fieldName = $field.name) #else #set ($dateFormatter = $field.getDateFormatter($ownerParameter)) #set ($timeFormatter = $field.getTimeFormatter($ownerParameter)) #set ($fieldName = $field.getFormPropertyName($ownerParameter)) #end #set ($lenient = !$field.strictDateFormat) #if ($field.type.dateType) java.text.DateFormat $dateFormatter = new java.text.SimpleDateFormat("$field.format"); ${dateFormatter}.setLenient($lenient); this.dateTimeFormatters.put("$fieldName", $dateFormatter); #elseif ($field.type.timeType) java.text.DateFormat $timeFormatter = new java.text.SimpleDateFormat("$field.format"); this.dateTimeFormatters.put("$fieldName", $timeFormatter); #end #end 1.1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/forms/formMacros.vm Index: formMacros.vm =================================================================== ## ## This macro renders the backing list support for the form implementation ## #macro(renderBackingListSupport $field $ownerParameter) #if ($field.name) #set ($labelListName = "${field.name}LabelList") #set ($valueListName = "${field.name}ValueList") #set ($backingListName = "${field.name}BackingList") #else #set ($labelListName = $field.getLabelListName($ownerParameter)) #set ($valueListName = $field.getValueListName($ownerParameter)) #set ($backingListName = $field.getBackingListName($ownerParameter)) #end #set ($listType = "System.Object[]") #set ($labelListMethod = $stringUtils.capitalize($labelListName)) #set ($valueListMethod = $stringUtils.capitalize($valueListName)) #set ($backingListMethod = $stringUtils.capitalize($backingListName)) /// <summary> /// Get the backing list for the ${action.name} field. You must have first set the labels /// and values via the <cref="Set${labelListMethod}"/> and <cref="Set${valueListMethod}"/> methods. /// </summary> System.Web.UI.WebControls.ListItemCollection Get${backingListMethod}(); /// <summary> /// Set the backing list labels for the ${field.name} field. You must also call /// <see cref="Set${valueListMethod}"/> passing in the same number of items. /// </summary> /// <param name="list">a string array of the labels</param> void Set${labelListMethod}(string[] list); /// <summary> /// Set the backing list values for the ${field.name} field. You must also call /// <see cref="Set${labelListMethod}"/> passing in the same number of items. /// </summary> /// <param name="list">a string array of the values</param> void Set${valueListMethod}(string[] list); #end 1.1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/forms/formImpl.cs.vsl Index: formImpl.cs.vsl =================================================================== #if($is2005Solution) #set($folder = "App_Code/target/src/") #else #set($folder = "target/src/") #end #set($generatedFile = "${folder}${action.fullyQualifiedFormImplementationPath}.cs") using System; using System.Collections; namespace ${action.packageName} { /// <summary> $action.getDocumentation(" /// ", 80, false) /// </summary> [Serializable] public class $action.formImplementationName #if ($stringUtils.isNotBlank($action.formImplementationInterfaceList)) : $action.formImplementationInterfaceList#end { ## ## Constructor ## #region Constructor public ${action.formImplementationName}() {} #endregion #foreach ($field in $action.formFields) #region Getter/Setter for ${stringUtils.capitalize($field.name)} #if ($field.type.collectionType) #set ($fieldTypeName = "System.Collections.IList") #elseif ($field.type.fileType) #set ($fieldTypeName = "$fileTypeName") #else #set ($fieldTypeName = $field.type.fullyQualifiedName) #end private $fieldTypeName _$field.name#if ($field.defaultValuePresent) = $field.defaultValue#end; /// <summary> /// Get/set the value for the ${field.name} field. /// </summary> /// <remarks> $field.getDocumentation(" /// ", 80, false) /// </remarks> public $fieldTypeName ${stringUtils.capitalize($field.name)} { get { return this._${field.name}; } set { this._${field.name} = value; } } #if (!$field.complex && !$field.defaultValuePresent && $field.selectable) #renderBackingListImplSupport($field "") #end #endregion #end } } 1.1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/forms/Form.cs.vsl Index: Form.cs.vsl =================================================================== #if($is2005Solution) #set($folder = "App_Code/target/src/") #else #set($folder = "target/src/") #end #set ($generatedFile = "${folder}${operation.fullyQualifiedFormPath}/I${operation.formName}.cs") // license-header cs merge-point using System; namespace $operation.owner.packageName { /// <summary> /// This interface encapsulates the fields that are used in the execution of the /// <code>$operation.name</code> method, which is located on the /// <see cref="$operation.owner.fullyQualifiedName"/> controller. /// <seealso cref="${operation.owner.fullyQualifiedName}.${operation.signature}"/> /// </summary> /// <remarks> $operation.getDocumentation(" /// ", 80, false) /// </remarks> public interface I${operation.formName} { #foreach ($field in $operation.formFields) #if ($field.type.collectionType) #set ($fieldTypeName = "System.Collections.IList") #elseif ($field.type.fileType) #set ($fieldTypeName = "$fileTypeName") #else #set ($fieldTypeName = $field.type.fullyQualifiedName) #end /// <summary> $field.getDocumentation(" /// ", 80, false) /// </summary> $fieldTypeName $stringUtils.capitalize(${field.name}) { get; ## - don't allow fields with default values to be set #if (!$field.defaultValuePresent) set; #end } ## - don't allow fields with default values to be set #if (!$field.defaultValuePresent) #if (!$field.complex && $field.selectable) #renderBackingListSupport($field "") #end #if ($field.backingValueRequired) //renderBackingValueSupport($field "") #end #foreach ($attribute in $field.attributes) #if ($attribute.isSelectable($field)) #renderBackingListSupport($attribute $field) #elseif ($attribute.isBackingValueRequired($field)) //renderBackingValueSupport($attribute $field) #end #end #end #end } } 1.1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/controllers/ControllerImpl.cs.vsl Index: ControllerImpl.cs.vsl =================================================================== #if($is2005Solution) #set($folder = "App_Code/src/main/") #else #set($folder = "src/main/") #end #set($generatedFile = "${folder}${controller.fullyQualifiedImplementationPath}.cs") using System; using System.Collections; namespace $controller.packageName { /// <summary> /// <see cref="${controller.fullyQualifiedName}"/> /// </summary> public class ${controller.implementationName} : ${controller.fullyQualifiedName} { ## ## create an overriden method for all operations on the controller ## #foreach($operation in ${controller.operations}) /// <summary> /// <see cref="$controller.fullyQualifiedName.$operation.signature"/> /// </summary> ${operation.implementationFormSignature} { //${toDoTag} add an implementation for ${controller.implementationName}.${operation.name}() #if(${operation.returnType.booleanType}) return false; #elseif(${operation.returnTypePresent}) return null; #end } #end } } 1.1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/controllers/Controller.cs.vm Index: Controller.cs.vm =================================================================== ## ## This macro determines what to do when processing a transition ## #macro (processTransition $transition) #if (!$transition) null; #elseif ($transition.enteringFinalState) #set ($targetUseCase = $transition.target.targetUseCase) "~/target/src/${targetUseCase.fullyQualifiedPath}/${targetUseCase.normalizedName}UC.aspx"; #elseif ($transition.enteringView) "~/target/src/${transition.target.fullyQualifiedPath}/${transition.target.normalizedName}.aspx"; #elseif ($transition.enteringDecisionPoint) __${transition.operationCall.name}(#if (!$action.formFields.empty)form#end); #else ${transition.target.actionMethodName}(#if (!$action.formFields.empty)form#end); #end #end 1.1 cartridges/andromda-aspdotnet/src/main/resources/templates/aspdotnet/controllers/Controller.cs.vsl Index: Controller.cs.vsl =================================================================== #if($is2005Solution) #set($folder = "App_Code/target/src/") #else #set($folder = "target/src/") #end #set($generatedFile = "${folder}${controller.fullyQualifiedNamePath}.cs") using System; using System.Collections; using System.Web; namespace $controller.packageName { /// <summary> $controller.getDocumentation(" /// ", 80, false) /// </summary> public abstract class $controller.name { ## ## Contructor of the controller that will instanciate(if it is null) the formData(s) ## #region Constructor public ${controller.name}() { //Instantiate the Form objects to hold data from the pages during transitions //between action states. #foreach ($action in $controller.useCase.actions) if (this.${action.formImplementationPropertyName} == null) this.${action.formImplementationPropertyName} = new ${action.fullyQualifiedFormImplementationName}(); #end } #endregion ## ## Navigation from the initial state to the first action. ## /// <summary> /// Calling this method starts the use case. The user will be redirected to /// the starting WebForm. /// </summary> public void StartUseCase() { this.${stringUtils.capitalize(${controller.useCase.normalizedName})}(); } ## ## controller methods ## #region Abstract methods #foreach($operation in ${controller.operations}) /// <summary> $operation.getDocumentation(" /// ", 80, false) /// </summary> ${operation.formSignature}; #end #endregion ## ## form data ## #region Public properties #foreach ($action in $controller.useCase.actions) /// <summary> /// Get/set the <see cref="${action.fullyQualifiedFormImplementationName}"/> from HttpSession. /// </summary> public ${action.fullyQualifiedFormImplementationName} ${action.formImplementationPropertyName} { get { return HttpContext.Current.Session["${action.controller.fullyQualifiedName}.${action.formImplementationName}"] as ${action.fullyQualifiedFormImplementationName}; } set { HttpContext.Current.Session["${action.controller.fullyQualifiedName}.${action.formImplementationName}"] = value; } } #end #endregion ##todo add public method that can be called from base page #region Controller Action methods #foreach ($action in $controller.useCase.actions) /// <summary> $action.getDocumentation(" /// ", 80, false) /// </summary> public virtual void ${stringUtils.capitalize(${action.triggerName})}() { string forward = String.Empty; ${action.fullyQualifiedFormImplementationName} form = this.${action.formImplementationPropertyName}; forward = #processTransition($action) this.${action.formImplementationPropertyName} = form; HttpContext.Current.Response.Redirect(forward); } #foreach ($actionState in $action.actionStates) /// <summary> $actionState.getDocumentation(" /// ", 80, false) /// </summary> private string ${actionState.actionMethodName}(#if (!$action.formFields.empty) $action.fullyQualifiedFormImplementationName form#end) { string forward = null; #if ($actionState.controllerCalls.empty) forward = #processTransition($actionState.forward) #else #foreach ($controllerCall in $actionState.controllerCalls) #if (!$action.actionFormFields.empty) this.${controllerCall.formCall}; #else // We pass an empty form implementation to the controller. // We know there are no parameters on this operation because the // cartridge would have issued a model validation error this.${controllerCall.name}(new ${controllerCall.interfaceName}()); #end #end forward = #processTransition($actionState.forward) #end return forward; } #end #end #endregion #if (!$controller.serviceReferences.isEmpty()) #region Service references #foreach ($serviceRef in $controller.serviceReferences) #if ($stringUtils.isNotBlank($serviceRef.targetElement.accessorImplementation)) /// <summary> /// Returns a reference to the $serviceRef.name back-end service. /// </summary> protected $serviceRef.targetElement.fullyQualifiedName ${serviceRef.getterName}() { try { return $serviceRef.targetElement.accessorImplementation; } catch (Exception ex) { throw new InvalidOperationException(ex); } } #end #end #endregion #end #if(!$controller.sessionObjects.isEmpty()) #region Session Object references #foreach ($sessionObject in $controller.sessionObjects) #set ($targetElement = $sessionObject.targetElement) /// <summary> $sessionObject.getDocumentation(" /// ", 80, false) /// </summary> public $targetElement.fullyQualifiedName ${stringUtils.capitalize($sessionObject.name)} { get { return HttpContext.Current.Session["${sessionObject.fullyQualifiedName}"] as $targetElement.fullyQualifiedName; } set { HttpContext.Current.Session["${sessionObject.fullyQualifiedName}"] = value; } } #end #endregion #end } } 1.5 +7 -7 cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- cartridge.xml 28 Sep 2006 05:35:30 -0000 1.4 +++ cartridge.xml 1 Oct 2006 01:44:47 -0000 1.5 @@ -5,9 +5,9 @@ <macrolibrary name="templates/aspdotnet/web2003/tables.vm"/> <macrolibrary name="templates/aspdotnet/web2005/tables.vm"/> <macrolibrary name="templates/aspdotnet/validation.vm"/> - <macrolibrary name="templates/aspdotnet/uicontrollers/formImplMacros.vm"/> - <macrolibrary name="templates/aspdotnet/uicontrollers/formMacros.vm"/> - <macrolibrary name="templates/aspdotnet/uicontrollers/Controller.cs.vm"/> + <macrolibrary name="templates/aspdotnet/forms/formImplMacros.vm"/> + <macrolibrary name="templates/aspdotnet/forms/formMacros.vm"/> + <macrolibrary name="templates/aspdotnet/controllers/Controller.cs.vm"/> <!-- cartridge-macrolibrary merge-point--> </templateEngine> @@ -325,7 +325,7 @@ </template> <template - path="templates/aspdotnet/uicontrollers/UIPControllerImpl.cs.vsl" + path="templates/aspdotnet/controllers/ControllerImpl.cs.vsl" outputPattern="$generatedFile" outlet="web" overwrite="false"> @@ -342,7 +342,7 @@ </template> <template - path="templates/aspdotnet/uicontrollers/UIPController.cs.vsl" + path="templates/aspdotnet/controllers/Controller.cs.vsl" outputPattern="$generatedFile" outlet="web" overwrite="true"> @@ -356,7 +356,7 @@ </modelElements> </template> <template - path="templates/aspdotnet/uicontrollers/Form.cs.vsl" + path="templates/aspdotnet/forms/Form.cs.vsl" outputPattern="$generatedFile" outlet="web" overwrite="true"> @@ -370,7 +370,7 @@ </template> <template - path="templates/aspdotnet/uicontrollers/formImpl.cs.vsl" + path="templates/aspdotnet/forms/formImpl.cs.vsl" outputPattern="$generatedFile" outlet="web" overwrite="true"> |
From: Eric C. <ecr...@us...> - 2006-10-01 13:28:22
|
User: ecrutchfield Date: 06/10/01 06:28:22 Modified: andromda-aspdotnet/src/main/resources/META-INF/andromda cartridge.xml Log: always generate ControllerImpl class as it's referenced in other generated code Revision Changes Path 1.6 +0 -2 cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-aspdotnet/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- cartridge.xml 1 Oct 2006 01:44:47 -0000 1.5 +++ cartridge.xml 1 Oct 2006 13:28:22 -0000 1.6 @@ -334,8 +334,6 @@ <type name="org.andromda.metafacades.uml.FrontEndController"> <!--if this property is not present it's no use generating the controller--> <property name="useCase"/> - <!--only useful generating if we have at least one operation--> - <property name="operations"/> </type> </modelElement> </modelElements> |