This sample code has been developed by Streamezzo.
Its purpose is to illustrate how to browse the device file system.

<%@page import="com.streamezzo.odp.utils.ShapeUtils" %>
![cdata[>
<%
int screenWidth = stzRequest.getUserAgent().getScreenWidth();
int screenHeight = stzRequest.getUserAgent().getScreenHeight();
%>
" encodingType="0"
resolution="0" idBits="16" lengthBits="16" colorBits="4"/>
<%
// LAYOUT
int thumbnailWidth = 20;
int thumbnailHeight = 24;
int margin = (int) (screenWidth * 0.1f);
int lineHeight = 30;
int lineWidth = screenWidth - margin * 2 + thumbnailWidth;
int startX = (int) (-screenWidth / 2 + margin + thumbnailWidth / 2f);
int startY = (int) (screenHeight / 2f - lineHeight / 2f - lineHeight);
int pathInfoY = (int) (screenHeight / 2f - lineHeight / 2f);
int NUMBER_OF_DISPLAYED_ITEMS = (int) ((screenHeight * 0.5f) / lineHeight);
%>
<%
for (int i = 0; i <= NUMBER_OF_DISPLAYED_ITEMS; i++) {
%>
">
<%
}
%>
<%
for (int i = 1; i <= NUMBER_OF_DISPLAYED_ITEMS; i++) {
%>
"/>
"/>
<%
if (i != NUMBER_OF_DISPLAYED_ITEMS) {
%>
"/>
<%
}
%>
<%
}
%>
"
pointerSize="<%= lineWidth+" "+lineHeight %>"/>
"
pointerSize="<%= lineWidth+" "+lineHeight %>"/>
<%
for (int i = 1; i <= NUMBER_OF_DISPLAYED_ITEMS; i++) {
%>
"
pointerSize="<%= lineWidth+" "+lineHeight %>"/>
"/>
"
pointerSize="<%= lineWidth+" "+lineHeight %>"/>
<%
}
%>
= 0)
||(fileName.indexOf(".JPG", 0) >= 0)
||(fileName.indexOf(".png", 0) >= 0)
||(fileName.indexOf(".PNG", 0) >= 0));
}
return compatible;
}
public void enableThumbnailIfCompatible()
{
int fileIndex;
try {
fileIndex = TypeUtils.parseInt(DomApi.getTextString("FileIndexTmp"));
} catch(Throwable t ){
return;
}
if (isCompatibleBitmapFile(fileIndex)) {
DomApi.startNode("getThumbnail"+fileIndex);
DomApi.startNode("ShowThumbnail"+fileIndex);
VM.log("Set thumbnail OK for file index "+fileIndex);
} else {
DomApi.startNode("HideThumbnail"+fileIndex);
VM.log("Set thumbnail KO for file index "+fileIndex);
}
}
]]>
![cdata[>
"
delta="<%= "0 "+(-lineHeight) %>" choice="-3">
"
style="PLAIN" face="MONOSPACE"/>
<%
for (int i=1 ; i<=NUMBER_OF_DISPLAYED_ITEMS ; i++) {
%>
">
" active="false" string=""
color="#000000" horizAlign="LEFT_ALIGNED"
vertAlign="MIDDLE" wrap="false"
displayRect="<%= lineWidth+" "+lineHeight %>"
style="PLAIN" face="MONOSPACE"/>
" string="" color="#000000"
horizAlign="LEFT_ALIGNED" vertAlign="MIDDLE"
wrap="false"
displayRect="<%= lineWidth+" "+lineHeight %>"
style="PLAIN" face="MONOSPACE"/>
">
" booleanvalue="true"/>
" timevalue="NOW"/>
">
"
keyCodes="DOWN" startTime="NEVER">
"/>
"/>
">
" booleanvalue="false"/>
">
"/>
">
"/>
"/>
" timevalue="NOW"/>
">
" startTime="NEVER"
url="<%="cmd://fs_getAttr?target=File"+i+"D&name=FULLNAME"%>">
"/>
"/>
" startTime="NEVER">
"/>
<%
}
%>
"
delta="<%= "0 "+(-lineHeight) %>" choice="-3">
<%
for (int i=1; i<=NUMBER_OF_DISPLAYED_ITEMS ; i++) {
%>
"
streamID="<%="ThumbnailStream"+i %>"/>
"
field="Bitmap.displaybox"
vec2fvalue="<%= thumbnailWidth+" "+thumbnailHeight %>"/>
"
field="Bitmap.boxfit" enumvalue="RATIO_ADJUST"/>
"
url="<%= "cmd://setMediaSource?onError=HideThumbnail"+i+"&media=Thumbnail"+i%>">
" name="source"/>
">
"
field="Bitmap.active" booleanvalue="false"/>
">
"
field="Bitmap.active" booleanvalue="true"/>
<%
}
%>
<%
for (int i=1; i<=NUMBER_OF_DISPLAYED_ITEMS ; i++) {
%>
"
field="Transform.active" booleanvalue="false"/>
<%
}
%>
">
">
">
">
">
">
"
style="BOLD" face="MONOSPACE" size="MEDIUM"/>
<%
StringBuffer sb = new StringBuffer("cmd://fs_loadID?filter=filter");
sb.append("&idT=NULLID,");
for (int i = 1; i <= NUMBER_OF_DISPLAYED_ITEMS; i++) {
sb.append("File" + i);
sb.append(",");
}
sb.append("NULLID&idS=PrevOK,");
for (int i = 1; i <= NUMBER_OF_DISPLAYED_ITEMS; i++) {
sb.append("File" + i + "OK");
sb.append(",");
}
sb.append("NextOK&idH=PrevNOK,");
for (int i = 1; i <= NUMBER_OF_DISPLAYED_ITEMS; i++) {
sb.append("File" + i + "NOK");
sb.append(",");
}
sb.append("NextNOK&index=index");
stzRequest.getLogger().debug("LOAD IDS COMMAND STRING = " + sb.toString());
%>
| Attachment | Size |
|---|---|
| File_system_browsing.swz | 580.03 KB |