📄 pdapage.java
字号:
/*
* @(#)PdaPage.java
*
* Copyright (C) 2006 Sergey Bredikhin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package olivax.webmail;
import java.io.Writer;
import java.util.Vector;
import oliva.common.OlivaUtils;
public class PdaPage {
private Vector rows = new Vector(10);
private PdaPane lastPane = null;
private Vector lastRow = null;
private String title = null;
private String script = null;
public PdaPage() {
}
public void addPane(PdaPane pane) {
if(pane == null)
return;
flushLast();
lastPane = pane;
}
private void flushLast() {
if (lastPane != null) {
if (lastRow != null) {
lastRow.add(lastPane);
rows.add(lastRow);
lastRow = null;
} else
rows.add(lastPane);
}
}
public void addPaneToSameRow(PdaPane pane) {
if(pane == null)
return;
if(lastPane == null) {
lastPane = pane;
return;
}
if(lastRow == null) {
lastRow = new Vector(5);
}
lastRow.add(lastPane);
lastPane = pane;
}
private String showRow(Vector row) {
StringBuffer sb = new StringBuffer();
for(int i = 0; i < row.size(); i++) {
PdaPane pane = (PdaPane)row.get(i);
sb.append(pane.show());
}
return sb.toString();
}
public void show(Writer writer) throws Exception {
flushLast();
StringBuffer sb = new StringBuffer();
sb.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n");
sb.append("<html>\r\n");
sb.append("<head>\r\n");
sb.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=")
.append(Context.clntCp).append("\">\r\n");
// sb.append("<meta http-equiv=\"Content-Language\" content=\"ru-RU\">\r\n");
sb.append("<meta HTTP-EQUIV=\"PRAGMA\" content=\"NO-CACHE\">\r\n");
sb.append("<title>").append(OlivaUtils.nvl(title)).append("</title>\r\n");
sb.append("</head>\r\n");
if (script != null)
sb.append(script);
sb.append("<body bgcolor=\"#ffffff\" link=\"#000000\" alink=\"#000000\" vlink=\"#000000\" topmargin=\"0\" leftmargin=\"0\" bottommargin=\"0\" rightmargin=\"0\">");
writer.write(sb.toString());
for(int i = 0; i < rows.size(); i++) {
Object row = rows.get(i);
if(row instanceof PdaPane)
writer.write(((PdaPane)row).show());
else if(row instanceof Vector)
writer.write(showRow((Vector)row));
}
sb = new StringBuffer();
sb.append("</body>");
sb.append("</html>");
writer.write(sb.toString());
}
public void setTitle(String title) {
this.title = title;
}
public void setScript(String script) {
this.script = script;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -