📄 expimageinform.java
字号:
package cn.myapps.core.expimp.exp.ejb;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import org.htmlparser.Node;
import org.htmlparser.Parser;
import org.htmlparser.tags.ImageTag;
import cn.myapps.constans.Environment;
import cn.myapps.core.dynaform.form.ejb.Form;
import cn.myapps.core.dynaform.form.ejb.FormProcess;
import cn.myapps.util.ProcessFactory;
public class ExpImageInForm extends ExpElement {
public ExpImageInForm(boolean expAll) {
super(expAll);
}
public String getName() {
return null;
}
public Map exportSQLS(String[] ids, Collection ignoreIds) throws Exception {
return null;
}
public Collection getImageUrls(String[] ids, Environment evt)
throws Exception {
Collection rtn = new ArrayList();
for (int i = 0; i < ids.length; i++) {
String id = ids[i];
FormProcess process = (FormProcess) ProcessFactory
.createProcess(FormProcess.class);
Form vo = (Form) process.doView(id);
if (vo != null) {
String context = vo.getTemplatecontext();
Parser parser = new Parser();
parser.setInputHTML(context);
Node[] nodes = parser.extractAllNodesThatAre(ImageTag.class);
for (int j = 0; j < nodes.length; j++) {
ImageTag el = (ImageTag) nodes[j];
if (el.getAttribute("className") == null) {
String url = el.getAttribute("src");
String ctxPath = evt.getContextPath();
if (url != null && url.trim().length() > 0) {
if (ctxPath != null) {
url = url.substring(ctxPath.length(), url.length());
}
if (!rtn.contains(evt.getWebcontextRealPath(url))) {
rtn.add(evt.getWebcontextRealPath(url));
}
}
}
}
}
}
return rtn;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -