<%@page import="com.ibm.wbit.tel.client.jsf.bean.BCInstance"%>
<%@page import="com.ibm.bpe.jsf.util.SelectionWrapper"%>
<%@page import="java.util.List"%>
<HTML>

<!--

Sample program for use with the Product
Licensed Materials  - Property of IBM
5724-I66
(c) Copyright IBM Corp.  2006, 2008
   
-->

<HEAD>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://com.ibm.bpe.jsf/taglib" prefix="bpe"%>
<jsp:useBean id="bcCheckHandler" scope="session" class="com.ibm.wbit.tel.client.jsf.handler.BCCheckHandler" />
<jsp:useBean id="bcCheckListHandler" scope="session" class="com.ibm.bpe.jsf.handler.BPCListHandler" />
<%
String contextPath = request.getContextPath();
%>
<link href=<%=contextPath+"/theme/styles.css"%> rel="stylesheet" type="text/css">
<title>Business Cases Check Status</title>
</HEAD>
<f:view locale="#{userInfo.locale}">
<f:loadBundle basename="com.ibm.wbit.tel.client.jsf.infrastructure.messages" var="bundle" />
<BODY class="NavigationBackgroundLeft">
 
  <table cellpadding="0" cellspacing="0" width="100%">
  <tr>
   <td class="Banner" colspan="2" >	
      <jsp:include page="Banner.jsp" flush="true" />
   </td>
  </tr>
  <tr valign="top">
   <td nowrap="nowrap" width="220">
   	  <jsp:include page="Content.jsp" flush="true" />
   </td>
   <td>
	<h:form styleClass="BackgroundView">

		<h:panelGrid styleClass="BackgroundViewBC" columns="1">
			<h:outputText styleClass="ViewHeadingBC" value="#{bcCheckHandler.navigationInfo}" />
			<%
				String subviewIDCustomProperties = bcCheckHandler.getSubviewIDCustomProperties();
				if (subviewIDCustomProperties != null) {
					subviewIDCustomProperties = subviewIDCustomProperties + ".jsp";
			%>	
				<h:outputText styleClass="SelectStatement" value="#{bundle['MSG_SUBVIEW_SEARCH_CRITERIA']}" />
				<jsp:include page="<%=subviewIDCustomProperties%>"	flush="true" />
			<%
			} else {
			%>
				<h:outputText styleClass="SelectStatement" value="#{bundle['MSG_SUBVIEW_SEARCH_CRITERIA_NOT_AV']}" />
			<%
			}
			%>
		</h:panelGrid>
			
		<h:panelGrid styleClass="commandbar" columns="1">
			<bpe:commandbar model="#{bcCheckHandler}" buttonStyleClass="button">
				<bpe:command label="#{bundle['BUTTON_REFRESH']}" commandID="RefreshCheckStatusList"
					commandClass="com.ibm.wbit.tel.client.jsf.command.BCCheck"
					context="#{bcCheckListHandler}" /> 
			</bpe:commandbar>
		</h:panelGrid>
			
		<h:panelGrid styleClass="BackgroundViewBC" columns="1">
			<h:outputText styleClass="ViewHeadingBC" value="#{bundle['LINE_SEARCH_RESULT']}" />
			<h:panelGrid styleClass="BackgroundSubViewBC" columns="1">
				<bpe:list model="#{bcCheckListHandler}" styleClass="list" rows="20"
					headerStyleClass="template-headers" buttonStyleClass="list-buttons" checkbox="false">
					<bpe:column name="name" action="BCDetails" />
					<bpe:column name="description" action="BCDetails" />
					<bpe:column name="executionState"  />
					<bpe:column name="startTime" />
					<bpe:column name="starter" />
					<%
						final List processInstances = bcCheckListHandler.getItems();
						if (!processInstances.isEmpty())
						{
							final BCInstance bcInstance = (BCInstance) ((SelectionWrapper) processInstances.get(0)).getObject();
							final List customProperties = bcInstance.getNamesOfCustomProperties();
							if (customProperties.size() > 0)
							{
					%>
					<bpe:column name="customProperty1"/>
					<%
							}
							if (customProperties.size() > 1)
							{
					%>
					<bpe:column name="customProperty2"/>
					<%
							}
							if (customProperties.size() > 2)
							{
					%>
					<bpe:column name="customProperty3"/>
					<%
							}
						}
					%>
				</bpe:list>
			</h:panelGrid>
		</h:panelGrid>

	</h:form>
   </td>
   </tr>
  </table>
 </BODY>
</f:view>
</HTML>