menu.jsp
<!-- Definition of the absolute font size so that table fits on a PDA -->
<%! String FontSize="2"; %>
<html>
<head>
<link rel="stylesheet" href="css/mi.css" type="text/css">
</head>
<body>
<jsp:useBean id="dataHandler" scope="session" class="mdkInventory1.bean.BasicDataHandler" />
<jsp:useBean id="tableViewDefinition" scope="session" class="mdkInventory1.bean.TableViewDefinition" />
<!-- For event handling we need a HTML "form" command -->
<form method="post" action="start" id="<%=tableViewDefinition.getFormName() %>" name="<%=tableViewDefinition.getFormName() %>" >
<font face="'Arial Narrow',sans-serif">
<!-- Display header panel -->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#fffbd5">
<tr bgcolor="#fffbd5" class="headerPanel">
<td align="left" valign="middle" class="headerPanel" ><%=tableViewDefinition.getHeaderPanelEntryLeft() %> </td>
<td align="right" valign="middle" class="headerPanel" ><%=tableViewDefinition.getHeaderPanelEntryRight()%> </td>
</tr>
</table>
<!-- Command line - contains the commands add, delete etc.. The commands are separated by 2 blanks-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#fffbd5">
<tr bgcolor="#fffbd5">
<td class="commandLine"><%=tableViewDefinition.getCommandLine("")%></td>
</tr>
<tr bgcolor="#fffbd5">
<!-- Title -->
<td class="centerPageTitle"><%=tableViewDefinition.getCenterPageTitle()%></td>
</tr>
</table>
<!-- Table definition -->
<table width="100%" bgcolor="#D4E2EE" border="1" cellpadding="1" cellspacing="0">
<%
int cols = dataHandler.getTableColumns();
int rows = dataHandler.getTableRows();
// Background color for title row
String bgColor = "#9CAECE";
String rowClass = "miHeader";
String cellClass = "1stCellHeader";
// begin table with table header
%> <tr bgcolor="<%=bgColor %>" class="<%=rowClass%>" > <%
for(int j=0; j < cols; j++) {
// In the first column (except the title row) we display a inputfield that is used to display the actual
/// quantity of the item on stock and can be used to change the value. The value is recoverd by the
/// servlet when the user clicks on the SAVE button.
/// The field is only displayed when it is not null. null means that this data entry is available as row
/// but should not be displayed.
if (dataHandler.getHeaderContent(j) != null) {
%> <td align="left" valign="middle" class="<%=cellClass%>" ><%=dataHandler.getHeaderContent(j)%> </td> <%
}
cellClass = "nextCellHeader";
}
rowClass = "miBody";
// end of a row
%> </tr> <%
rowClass = "miBody";
bgColor = "#DCE3EC";
for(int i=0; i < rows; i++) {
cellClass = "1stCellBody";
// begin of a row
%> <tr bgcolor="<%=bgColor %>" class="<%=rowClass%>" > <%
for(int j=0; j < cols; j++) {
// In the first column (except the title row) we display a checkbox, that can be used to mark an entry
/// that should be deleted. The checkbox gets the name which is supplied by the tableViewDefinition. This name is
/// used in the servlet to determine which entry should be deleted
if (j == 0) {
%> <td width="5px" align="center" valign="middle" class="<%=cellClass%>" >
<INPUT TYPE="Text" Name="<%=dataHandler.getCurrentSubTableContent(i, j)%>" Value="<%=dataHandler.getCurrentSubTableContent(i, 5)%>" size="3" class="nopad" ></td> <%
} else {
// Only columns with a header not null are displayed
if (dataHandler.getHeaderContent(j) != null) {
String value = dataHandler.getCurrentSubTableContent(i, j);
if (i > 1) {
// Value for table field is HTML encoded to prevent display errors because of special HTML characters (e.g. <)
/// Hint: Table header is not encoded since it can contain HTML command (like the link to change the sort order).
value = mdkInventory1.ControllerServlet.encodeForHtml(value);
}
// An empty string does not surround the field with a box, so we output a   to display the table correctly
if (value.trim().length() < 1){
value = " ";
}
%> <td align="left" valign="middle" class="<%=cellClass%>" ><%=value%> </td> <%
}
}
cellClass = "nextCellBody";
}
// end of a row
%> </tr> <%
// To make the tableview look nicer, we use alternating colors for rows (light blue and light grey)
if (bgColor.compareTo("#DCE3EC") == 0) {
// light blue
bgColor = "#CBD5E1";
} else {
// lighter blue
bgColor = "#DCE3EC";
}
}
%>
</table>
</form>
<form method="post" action="start" id="MIFormFooter" name="MIFormFooter" >
<!-- Table for navigation. The navigation icons including the eventhandler reference is generated in the bean -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle">Page <input type="text" name="GOTO_PAGE" size="2" value="<%=tableViewDefinition.getCurrentPage()%>"> /<%=tableViewDefinition.getMaxPage()%> <%=tableViewDefinition.getGotoIcon()%></td>
<td align="right" valign="middle">
<%=tableViewDefinition.getTopIcon()%><%=tableViewDefinition.getPageupIcon()%><%=tableViewDefinition.getPagedownIcon()%><%=tableViewDefinition.getBottomIcon()%>
</td>
</tr>
</table>
<!-- Display footer panel -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#eff6fb" class="footerpanel" >
<td align="left" valign="middle" class="footerPanel" ><%=tableViewDefinition.getFooterPanelEntryLeft() %> </td>
<td align="right" valign="middle" class="footerPanel"><%=tableViewDefinition.getFooterPanelEntryRight()%> </td>
</tr>
</table>
</font>
</form>
</body>
</html>