Listing 1
public abstract class CommonUtils {
/**
* Static attribute used to cache the CommonUtils
* subclass instance
*/
private static CommonUtils cv_CommonUtils = null;
/**
* Example abstract methods providing common behavior with
* platform specific implementations
*/
public abstract Thread spawnThread(Runnable runnable);
public abstract String dumpException(Throwable ex);
public abstract InputStream getResourceAsStream(String systemID);
/**
* Factory method to retrieve the appropriate CommonUtils instance
*/
public static CommonUtils create() {
if (cv_CommonUtils == null) {
Class commonUtilsClass = null;
try {
//the CommonConstants.COMMONUTILS_CLASS has a different classname
// value depending on the platform we are running on
commonUtilsClass =
Class.forName(CommonConstants.COMMONUTILS_CLASS);
} catch (ClassNotFoundException ex) {
//exception handling logic not shown
}
try {
cv_CommonUtils = (CommonUtils) (commonUtilsClass.newInstance());
} catch (InstantiationException instex) {
//exception handling logic not shown
} catch (IllegalAccessException illaccex) {
//exception handling logic not shown
} catch (ClassCastException ccex) {
//exception handling logic not shown
}
}
return cv_CommonUtils;
}
}
Listing 2
<%@ Page language="VJ#" Codebehind="mbss_results.aspx.jsl" AutoEventWireup="false"
Inherits="logiclibrary.application.general.mbss_results" %>
<%@ Register TagPrefix="app" Namespace="com.logiclibrary.aspnetsupport.controlslib"
Assembly="logiclibrary" %>
<SCRIPT>
function submitForm(action){
form = document.forms.mbssForm;
form.action.value=action;
form.submit();
}
function LLI_checkOrUncheckAll(formObj) {
var checkOrUncheck = formObj.elements["checkAll"].checked;
for (var i=0; i<formObj.elements.length; i++) {
var curElement = formObj.elements[i];
if (curElement.type == "checkbox" && curElement.name != "checkAll") {
curElement.checked = checkOrUncheck;
}
}
}
</SCRIPT>
<form id="mbssForm" method="post"
runat="server" actionProperty="/application/general/mbss.do">
<app:TitleControl runat="server" title="Model Based Search Results"/>
<INPUT type="hidden" name="action" value="display"/>
<INPUT type="hidden" name="resetAttachments" value="true"/>
<DIV id="pagetitle">
<DIV id="breadcrumbs">
<A href="home.do">Home</A> >
<A href="javascript:submitForm('edit')">Model Based Search</A> >
</DIV>
<SPAN class="title">
<IMG border="0" src="/logiclibrary/common/images/target.gif"
width="17" height="17">
Model Based Search Results:
<app:WriteControl runat="server" nested="true"
property="resultsCount"/>
<app:ConditionControl runat="server" nested="true" condition="equal"
property="resultsCount" value="1">
asset
</app:ConditionControl>
<app:ConditionControl runat="server" nested="true"
condition="notEqual"
property="resultsCount" value="1">
assets
</app:ConditionControl>
found
</SPAN>
<DIV id="pageactions">
<A class="action" href="javascript:submitForm('edit')">
[Edit search properties]
</A>
</DIV>
</DIV>
<app:ConditionControl runat="server" nested="true" condition="notEqual"
property="resultsCount" value="0">
<TABLE class="itemlist" cellspacing="0" cellpadding="0" border="0">
<TBODY>
<TR>
<TH style="width: 10%">Attached</TH>
<TH style="width:20%">Name( Version )</TH>
<TH>Description</TH>
<TH style="width:10%">Score</TH>
</TR>
<TR>
<TD colspan="4">
<input type="checkbox" name="checkAll" value="checkAll"
onClick="LLI_checkOrUncheckAll(this.form);">
Attach All Results
</input>
</TD>
</TR>
<app:StrutsCustomRepeater runat="server" nested="true"
property="results">
<app:ConditionControl runat="server" nested="true"
condition="equal" property="gone" value="false">
<TR>
<TD>
<app:CheckBoxControl runat="server" property="attached"/>
</TD>
<TD>
<SPAN <app:ConditionControl runat="server" nested="true"
condition="notEqual" property="inResults"
value="true">
class="notInResults"</app:ConditionControl>>
<A href="asset.do?URN=<app:WriteControl runat="server" nested="true" property="assetURN"/>">
<app:WriteControl runat="server" nested="true" property="assetName"/>
( <app:WriteControl runat="server" nested="true" property="assetVersion"/> )
</A>
</SPAN>
</TD>
<TD>
<app:WriteControl runat="server" nested="true"property="assetDescription"/>
</TD>
<TD>
<app:WriteControl runat="server" nested="true" property="score"/>
</TD>
</TR>
</app:ConditionControl>
</app:StrutsCustomRepeater>
</TBODY>
</TABLE>
</app:ConditionControl>
</form>