📄 uiscreentabs_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Calendar;
import java.util.StringTokenizer;
import java.text.SimpleDateFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.sql.Timestamp;
import java.sql.Time;
import java.sql.*;
import org.ofbiz.entity.util.SequenceUtil;
import org.ofbiz.security.*;
import org.ofbiz.entity.*;
import org.ofbiz.entity.condition.*;
import org.ofbiz.entity.model.*;
import org.ofbiz.base.util.*;
import com.sourcetap.sfa.ui.*;
import com.sourcetap.sfa.event.*;
import com.sourcetap.sfa.util.UserInfo;
import com.sourcetap.sfa.ui.UIScreenSection;
public class uiScreenTabs_jsp extends HttpJspBase {
/*
* Takes a string in the following format:
* formatString
* Where the first letter is lowercase, and
* subsequent unique words begin with an upper case.
* The function will convert a java string to a regular
* string in title case format.
*/
String formatJavaString(String s){
char ca[] = s.toCharArray();
StringBuffer sb = new StringBuffer();
int previous = 0;
for(int i=0;i<ca.length;i++){
if(i==s.length()-1){
sb.append(s.substring(previous, previous+1).toUpperCase());
sb.append(s.substring(previous+1, s.length()));
}
if(Character.isUpperCase(ca[i])){
sb.append(s.substring(previous, previous+1).toUpperCase());
sb.append(s.substring(previous+1, i));
sb.append(" ");
previous = i;
}
}
return sb.toString();
}
/**
Properties must include:
NAME-name of the select used in name-value form submit.
VALUE_FIELD-the value sent in form submit.
DISPLAY_FIELD-the field used in the display of the drop-down. use a
Properties can include:
Selected-The value to test for, and set selected on the drop-down
EMPTY_FIRST: if just a blank field use "{field display vaalue}, else if value supplied use "{field value}, {field value display name}"
*/
String buildDropDown(List l, Map properties){
StringBuffer returnString = new StringBuffer();
GenericValue genericValue = null;
Iterator i = l.iterator();
String selected = ((String)(properties.get("SELECTED") != null ? properties.get("SELECTED") : ""));
String display = ((String)(properties.get("DISPLAY_FIELD") != null ? properties.get("DISPLAY_FIELD") : ""));
String selectJavaScript = ((String)(properties.get("SELECT_JAVASCRIPT") != null ? properties.get("SELECT_JAVASCRIPT") : ""));
returnString.append("<select name=\"" + properties.get("NAME") + "\" " + selectJavaScript + " >");
if(properties.get("EMPTY_FIRST") != null) {
String empty = (String)properties.get("EMPTY_FIRST");
if(empty.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(empty, ",");
returnString.append("<option value=\"" + ((String)tok.nextElement()).trim() + "\">" + ((String)tok.nextElement()).trim());
} else {
returnString.append("<option value=\"\">" + empty);
}
}
try{
while(i.hasNext()){
genericValue = (GenericValue)i.next();
returnString.append("<option value=\"" + String.valueOf(genericValue.get((String)properties.get("VALUE_FIELD"))) + "\"");
if(String.valueOf(genericValue.get((String)properties.get("VALUE_FIELD"))).equals(selected)){
returnString.append(" SELECTED ");
}
returnString.append(" >");
if(display.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(display, ",");
while(tok.hasMoreElements()){
String elem = (String)tok.nextElement();
returnString.append(String.valueOf(genericValue.get(elem.trim())));
returnString.append(" ");
}
} else {
returnString.append(genericValue.get(display));
}
}
} catch (Exception e){ e.printStackTrace(); }
returnString.append("</select>");
return returnString.toString();
}
String buildStringDropDown(List l, Map properties){
StringBuffer returnString = new StringBuffer();
String value = "";
Iterator i = l.iterator();
String selected = ((String)(properties.get("SELECTED") != null ? properties.get("SELECTED") : ""));
String display = ((String)(properties.get("DISPLAY_FIELD") != null ? properties.get("DISPLAY_FIELD") : ""));
String selectJavaScript = ((String)(properties.get("SELECT_JAVASCRIPT") != null ? properties.get("SELECT_JAVASCRIPT") : ""));
returnString.append("<select name=\"" + properties.get("NAME") + "\" " + selectJavaScript + " >");
if(properties.get("EMPTY_FIRST") != null) {
String empty = (String)properties.get("EMPTY_FIRST");
if(empty.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(empty, ",");
returnString.append("<option value=\"" + ((String)tok.nextElement()).trim() + "\">" + ((String)tok.nextElement()).trim());
} else {
returnString.append("<option value=\"\">" + empty);
}
}
while(i.hasNext()){
value = (String)i.next();
returnString.append("<option value=\"" + value + "\"");
if(value.equals(selected)){
returnString.append(" SELECTED ");
}
returnString.append(" >");
if(display.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(display, ",");
while(tok.hasMoreElements()){
String elem = (String)tok.nextElement();
returnString.append(value);
returnString.append(" ");
}
} else {
returnString.append(value);
}
}
returnString.append("</select>");
return returnString.toString();
}
String buildFieldDropDown(Vector fields, String entityName, HashMap properties){
if(properties == null) properties = new HashMap();
StringBuffer returnString = new StringBuffer();
ModelField modelField = null;
String selected = ((String)(properties.get("SELECTED") != null ? properties.get("SELECTED") : ""));
returnString.append("<select name=\"" + entityName + "\" >");
if(properties.get("EMPTY_FIRST") != null) returnString.append("<option value=\"\">" + properties.get("EMPTY_FIRST"));
for(int i=0;i<fields.size();i++){
modelField = (ModelField)fields.get(i);
returnString.append("<option value=\"" + modelField.getName() + "\"");
if((modelField.getName()).equals(selected)){
returnString.append(" SELECTED ");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -