idok-commit AT lists.psi.ch
Subject: Commit emails of the iDok project
List archive
[idok-commit] idok commit r390 - trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client
Chronological Thread
- From: "AFS account Florian Huebner" <huebner AT savannah.psi.ch>
- To: idok-commit AT lists.psi.ch
- Subject: [idok-commit] idok commit r390 - trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client
- Date: Thu, 1 Oct 2009 08:50:38 +0200
- List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
- List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>
Author: huebner
Date: Thu Oct 1 08:50:37 2009
New Revision: 390
Log:
GWT 1.5 compliant version of the idok-wiki interface
Added:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/GalleryResultListWidgetSmartGwt.java
(contents, props changed)
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokPictureRecord.java
(contents, props changed)
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokRecord.java
(contents, props changed)
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/MimeTypes.java
(contents, props changed)
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/idokData.java
(contents, props changed)
Modified:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiInclude.java
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchUtil.java
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/SearchResultIteratorFromXml.java
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/TableResultListWidgetSmartGwt.java
Added:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/GalleryResultListWidgetSmartGwt.java
==============================================================================
--- (empty file)
+++
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/GalleryResultListWidgetSmartGwt.java
Thu Oct 1 08:50:37 2009
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2006-2008 iDok team.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+ */
+
+
+package ch.psi.idok.gwt.twiki.client;
+
+import java.util.Iterator;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Composite;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tile.TileGrid;
+import com.smartgwt.client.widgets.tile.events.RecordClickEvent;
+import com.smartgwt.client.widgets.tile.events.RecordClickHandler;
+import com.smartgwt.client.widgets.viewer.DetailViewerField;
+
+public class GalleryResultListWidgetSmartGwt extends Composite {
+
+
+ int itemCount = 0;
+
+ /**
+ * Constructor
+ */
+ public GalleryResultListWidgetSmartGwt(Iterator<SearchResultItem> it) {
+
+ HLayout layout = new HLayout();
+ layout.setWidth("75%");
+ layout.setHeight("75%");
+ layout.setMembersMargin(10);
+ layout.setLayoutMargin(5);
+ layout.setShowEdges(false);
+
+
+ TileGrid tileGrid = new TileGrid();
+ tileGrid.setTileWidth(194);
+ tileGrid.setTileHeight(150);
+ tileGrid.setHeight(400);
+ tileGrid.setWidth100();
+// tileGrid.setShowAllRecords(true);
+ tileGrid.setAutoFetchData(true);
+ tileGrid.setData(idokData.getPictureRecord(it));
+// tileGrid.setData(CarData.getRecords());
+
+
+
+ final DetailViewerField pictureField = new DetailViewerField("url");
+// final DetailViewerField pictureField = new
DetailViewerField("picture");
+ pictureField.setType("image");
+// pictureField.setImageURLPrefix("example/test/");
+ pictureField.setImageWidth(186);
+ pictureField.setImageHeight(120);
+
+ DetailViewerField nameField = new DetailViewerField("filename");
+// DetailViewerField nameField = new DetailViewerField("name");
+
+ tileGrid.setFields(pictureField,nameField);
+
+ tileGrid.addRecordClickHandler(new RecordClickHandler() {
+ public void onRecordClick(RecordClickEvent event) {
+
Window.open(event.getRecord().getAttribute("url"), "_blank", "");
+ }
+ });
+ VLayout vLayout = new VLayout();
+ vLayout.setShowEdges(false);
+ vLayout.setMembersMargin(5);
+ vLayout.setLayoutMargin(10);
+ vLayout.addMember(tileGrid);
+ layout.addMember(vLayout);
+
+
+
+ initWidget(layout);
+
+
+
+
+ }
+
+ public int getResultCount(){
+
+ return itemCount;
+ }
+
+}
\ No newline at end of file
Added:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokPictureRecord.java
==============================================================================
--- (empty file)
+++ trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokPictureRecord.java
Thu Oct 1 08:50:37 2009
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2006-2008 iDok team.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+ */
+
+package ch.psi.idok.gwt.twiki.client;
+
+import java.util.Date;
+
+import com.smartgwt.client.widgets.tile.TileRecord;
+
+public class IdokPictureRecord extends TileRecord{
+
+ public IdokPictureRecord() {
+ }
+
+ public IdokPictureRecord(String filename,String url, String revision,
int size, Date date, String author) {
+ setPictureName(filename);
+ setLinkText(filename);
+ setURL(url);
+ setRevision(revision);
+ setSize(size);
+ setDate(date);
+ setAuthor(author);
+
+ }
+
+ public String getLinkText() {
+ return getAttributeAsString("linkText");
+ }
+
+ public void setLinkText(String linkText) {
+ setAttribute("linkText", linkText);
+ }
+
+
+ public String getPicturename() {
+ return getAttributeAsString("fileName");
+ }
+
+ public void setPictureName(String filename) {
+ setAttribute("fileName", filename);
+ }
+
+ public String getURL() {
+ return getAttributeAsString("url");
+ }
+
+ private void setURL(String url) {
+ setAttribute("url", url);
+ }
+
+ public String getRevision() {
+ return getAttributeAsString("revision");
+ }
+
+ public void setRevision(String revision) {
+ setAttribute("revision", revision);
+ }
+
+ public int getSize() {
+ return getAttributeAsInt("size");
+ }
+
+ public void setSize(int size) {
+ setAttribute("size", size);
+ }
+
+ public Date getDate() {
+ return getAttributeAsDate("date");
+ }
+
+ public void setDate(Date date) {
+ setAttribute("date", date);
+ }
+
+ public String getAuthor() {
+ return getAttributeAsString("author");
+ }
+
+ public void setAuthor(String author) {
+ setAttribute("author", author);
+ }
+
+ public void setBackground(String background) {
+ setAttribute("background", background);
+ }
+
+ public String getBackground() {
+ return getAttributeAsString("background");
+ }
+
+ public String getFieldValue(String field) {
+ return getAttributeAsString(field);
+ }
+}
Added: trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokRecord.java
==============================================================================
--- (empty file)
+++ trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokRecord.java Thu
Oct 1 08:50:37 2009
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2006-2008 iDok team.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+ */
+
+package ch.psi.idok.gwt.twiki.client;
+
+import java.util.Date;
+
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
+public class IdokRecord extends ListGridRecord{
+
+ public IdokRecord() {
+ }
+
+ public IdokRecord(String fileName,String url, String revision, int size,
Date date, String author, String environment) {
+ setFileName(fileName);
+ setLinkText(fileName);
+ setURL(url);
+ setRevision(revision);
+ setSize(size);
+ setDate(date);
+ setAuthor(author);
+ setEnvironment(environment);
+
+ }
+
+ public String getLinkText() {
+ return getAttributeAsString("linkText");
+ }
+
+ public void setLinkText(String linkText) {
+ setAttribute("linkText", linkText);
+ }
+
+
+ public String getFilename() {
+ return getAttributeAsString("fileName");
+ }
+
+ public void setFileName(String filename) {
+ setAttribute("fileName", filename);
+ }
+
+ public String getURL() {
+ return getAttributeAsString("url");
+ }
+
+ private void setURL(String url) {
+ setAttribute("url", url);
+ }
+
+ public String getRevision() {
+ return getAttributeAsString("revision");
+ }
+
+ public void setRevision(String revision) {
+ setAttribute("revision", revision);
+ }
+
+ public int getSize() {
+ return getAttributeAsInt("size");
+ }
+
+ public void setSize(int size) {
+ setAttribute("size", size);
+ }
+
+ public Date getDate() {
+ return getAttributeAsDate("date");
+ }
+
+ public void setDate(Date date) {
+ setAttribute("date", date);
+ }
+
+ public String getAuthor() {
+ return getAttributeAsString("author");
+ }
+
+ public void setAuthor(String author) {
+ setAttribute("author", author);
+ }
+
+ public String getEnvironment() {
+ return getAttributeAsString("environment");
+ }
+
+ public void setEnvironment(String environment) {
+ setAttribute("environment", environment);
+ }
+
+ public void setBackground(String background) {
+ setAttribute("background", background);
+ }
+
+ public String getBackground() {
+ return getAttributeAsString("background");
+ }
+
+ public String getFieldValue(String field) {
+ return getAttributeAsString(field);
+ }
+}
Modified:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiInclude.java
==============================================================================
---
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiInclude.java
(original)
+++
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchTwikiInclude.java
Thu Oct 1 08:50:37 2009
@@ -20,6 +20,7 @@
package ch.psi.idok.gwt.twiki.client;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -27,6 +28,7 @@
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.Window;
+
/**
* Search the current HTML document for DIV elements with class
"idokInclude".
* For each found element, call the iDok ReST search service and render the
@@ -59,9 +61,28 @@
if (params.containsKey("idokRepository")
&& params.containsKey("idokQueryParam")
&& params.containsKey("idokMaxHits")) {
- IdokSearchUtil.doRestCall(params.get("idokRepository"),
params
- .get("idokQueryParam"), Integer.parseInt(params
- .get("idokMaxHits")), new RestCallbackHandler() {
+ String repository = params.get("idokRepository");
+ String query = params.get("idokQueryParam");
+ int hits = Integer.parseInt(params.get("idokMaxHits"));
+ Map <String, String[]> meta = new HashMap<String, String[]>();
+ if (params.containsKey("idokFiletypeFilter")&&
params.get("idokFiletypeFilter") != null){
+
meta.put("filetype",params.get("idokFiletypeFilter").split(","));
+ query += " AND (" +
MimeTypes.get(meta.get("filetype")[0]);
+ for (int i = 1; i < meta.get("filetype").length; i++)
{
+ query = query + " OR " +
MimeTypes.get(meta.get("filetype")[i]);
+ }
+ query += ")";
+ }
+ if (params.containsKey("idokFilter")&&
params.get("idokFilter") != null){
+
meta.put("filter",params.get("idokFilter").split(","));
+ query += " AND (" + meta.get("filter")[0];
+ for (int i = 1; i < meta.get("filter").length; i++) {
+ query = query + " OR " +
meta.get("filter")[i];
+ }
+ query += ")";
+ }
+
+ IdokSearchUtil.doRestCall(repository, query, hits, new
RestCallbackHandler() {
public void onFailure() {
Window.alert("ReST call to iDok search service
failed");
@@ -71,13 +92,11 @@
Iterator<SearchResultItem> it = new
SearchResultIteratorFromXml(
xmlString);
if (params.containsKey("idokFormat") &&
params.get("idokFormat").equals("list")) {
- container
-
.appendChild(new SimpleResultListWidget(it)
-
.getElement());
+
container.appendChild(new SimpleResultListWidget(it).getElement());
}else if
(params.containsKey("idokFormat") &&
params.get("idokFormat").equals("table")){
- container
- .appendChild(new
TableResultListWidgetSmartGwt(it)
-
.getElement());
+
container.appendChild(new TableResultListWidgetSmartGwt(it).getElement());
+ }else if
(params.containsKey("idokFormat") &&
params.get("idokFormat").equals("gallery")){
+
container.appendChild(new GalleryResultListWidgetSmartGwt(it).getElement());
}else{
Window.alert("No output format parameter was
set");
Modified:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchUtil.java
==============================================================================
--- trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchUtil.java
(original)
+++ trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/IdokSearchUtil.java
Thu Oct 1 08:50:37 2009
@@ -55,22 +55,21 @@
/**
* Base URL of iDok search ReST interface
*/
- static final String REST_BASE_URL =
"https://dms03.psi.ch/api/v1/search/";
-// static final String REST_BASE_URL =
-// "http://dms03.psi.ch:8183/v1/search/";
-
+// static final String REST_BASE_URL =
"https://dms.psi.ch/api/v1/search/"; //deployment
+ static final String REST_BASE_URL =
"http://dms02.psi.ch:8183/v1/search/"; //debugging
+
/**
* Base URL of iDok documents hosted by Subversion
*/
- static final String SVN_BASE_URL = "https://dms03.psi.ch/";
+ static final String SVN_BASE_URL = "https://dms.psi.ch/";
/**
* If true, use XMLHttpRequest, else use JSONP for accessing iDok ReST
* service
*/
- static final boolean USE_XHR = false;
-// static final boolean USE_XHR = true;
-
+// static final boolean USE_XHR = false; //use JSONP
+ static final boolean USE_XHR = true; //debugging
+
/**
* @return Pretty-printed byte size String
*/
Added: trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/MimeTypes.java
==============================================================================
--- (empty file)
+++ trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/MimeTypes.java Thu
Oct 1 08:50:37 2009
@@ -0,0 +1,677 @@
+/*
+ * Copyright (C) 2006-2008 iDok team.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+ */
+
+package ch.psi.idok.gwt.twiki.client;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class MimeTypes {
+
+ static String get(String key){
+ Map <String, String> mime = new HashMap<String, String>();
+ mime.put("3dm","x-world/x-3dmf");
+ mime.put("3dmf","x-world/x-3dmf");
+ mime.put("a","application/octet-stream");
+ mime.put("aab","application/x-authorware-bin");
+ mime.put("aam","application/x-authorware-map");
+ mime.put("aas","application/x-authorware-seg");
+ mime.put("abc","text/vnd.abc");
+ mime.put("acgi","text/html");
+ mime.put("afl","video/animaflex");
+ mime.put("ai","application/postscript");
+ mime.put("aif","audio/aiff");
+// mime.put("aif","audio/x-aiff");
+ mime.put("aifc","audio/aiff");
+// mime.put("aifc","audio/x-aiff");
+ mime.put("aiff","audio/aiff");
+// mime.put("aiff","audio/x-aiff");
+ mime.put("aim","application/x-aim");
+ mime.put("aip","text/x-audiosoft-intra");
+ mime.put("ani","application/x-navi-animation");
+
mime.put("aos","application/x-nokia-9000-communicator-add-on-software");
+ mime.put("aps","application/mime");
+ mime.put("arc","application/octet-stream");
+ mime.put("arj","application/arj");
+// mime.put("arj","application/octet-stream");
+ mime.put("art","image/x-jg");
+ mime.put("asf","video/x-ms-asf");
+ mime.put("asm","text/x-asm");
+ mime.put("asp","text/asp");
+ mime.put("asx","application/x-mplayer2");
+// mime.put("asx","video/x-ms-asf");
+// mime.put("asx","video/x-ms-asf-plugin");
+// mime.put("au","audio/basic");
+ mime.put("au","audio/x-au");
+// mime.put("avi","application/x-troff-msvideo");
+ mime.put("avi","video/avi");
+// mime.put("avi","video/msvideo");
+// mime.put("avi","video/x-msvideo");
+ mime.put("avs","video/avs-video");
+ mime.put("bcpio","application/x-bcpio");
+// mime.put("bin","application/mac-binary");
+// mime.put("bin","application/macbinary");
+ mime.put("bin","application/octet-stream");
+// mime.put("bin","application/x-binary");
+// mime.put("bin","application/x-macbinary");
+ mime.put("bm","image/bmp");
+ mime.put("bmp","image/bmp");
+// mime.put("bmp","image/x-windows-bmp");
+ mime.put("boo","application/book");
+ mime.put("book","application/book");
+ mime.put("boz","application/x-bzip2");
+ mime.put("bsh","application/x-bsh");
+ mime.put("bz","application/x-bzip");
+ mime.put("bz2","application/x-bzip2");
+ mime.put("c","text/plain");
+// mime.put("c","text/x-c");
+ mime.put("c++","text/plain");
+ mime.put("cat","application/vnd.ms-pki.seccat");
+ mime.put("cc","text/plain");
+// mime.put("cc","text/x-c");
+ mime.put("ccad","application/clariscad");
+ mime.put("cco","application/x-cocoa");
+ mime.put("cdf","application/cdf");
+// mime.put("cdf","application/x-cdf");
+// mime.put("cdf","application/x-netcdf");
+// mime.put("cer","application/pkix-cert");
+ mime.put("cer","application/x-x509-ca-cert");
+ mime.put("cha","application/x-chat");
+ mime.put("chat","application/x-chat");
+ mime.put("class","application/java");
+// mime.put("class","application/java-byte-code");
+ mime.put("class","application/x-java-class");
+ mime.put("com","application/octet-stream");
+// mime.put("com","text/plain");
+ mime.put("conf","text/plain");
+ mime.put("cpio","application/x-cpio");
+ mime.put("cpp","text/x-c");
+ mime.put("cpt","application/mac-compactpro");
+// mime.put("cpt","application/x-compactpro");
+// mime.put("cpt","application/x-cpt");
+ mime.put("crl","application/pkcs-crl");
+// mime.put("crl","application/pkix-crl");
+ mime.put("crt","application/pkix-cert");
+// mime.put("crt","application/x-x509-ca-cert");
+// mime.put("crt","application/x-x509-user-cert");
+// mime.put("csh","application/x-csh");
+ mime.put("csh","text/x-script.csh");
+// mime.put("css","application/x-pointplus");
+ mime.put("css","text/css");
+ mime.put("cxx","text/plain");
+ mime.put("dcr","application/x-director");
+ mime.put("deepv","application/x-deepv");
+ mime.put("def","text/plain");
+ mime.put("der","application/x-x509-ca-cert");
+ mime.put("dif","video/x-dv");
+ mime.put("dir","application/x-director");
+ mime.put("dl","video/dl");
+// mime.put("dl","video/x-dl");
+ mime.put("doc","application/msword");
+ mime.put("dot","application/msword");
+ mime.put("dp","application/commonground");
+ mime.put("drw","application/drafting");
+ mime.put("dump","application/octet-stream");
+ mime.put("dv","video/x-dv");
+ mime.put("dvi","application/x-dvi");
+ mime.put("dwf","drawing/x-dwf (old)");
+ mime.put("dwf","model/vnd.dwf");
+ mime.put("dwg","application/acad");
+// mime.put("dwg","image/vnd.dwg");
+// mime.put("dwg","image/x-dwg");
+ mime.put("dxf","application/dxf");
+// mime.put("dxf","image/vnd.dwg");
+// mime.put("dxf","image/x-dwg");
+ mime.put("dxr","application/x-director");
+ mime.put("el","text/x-script.elisp");
+ mime.put("elc","application/x-bytecode.elisp (compiled
elisp)");
+ mime.put("elc","application/x-elc");
+ mime.put("env","application/x-envoy");
+ mime.put("eps","application/postscript");
+ mime.put("es","application/x-esrehber");
+ mime.put("etx","text/x-setext");
+ mime.put("evy","application/envoy");
+// mime.put("evy","application/x-envoy");
+ mime.put("exe","application/octet-stream");
+ mime.put("f","text/plain");
+// mime.put("f","text/x-fortran");
+ mime.put("f77","text/x-fortran");
+ mime.put("f90","text/plain");
+// mime.put("f90","text/x-fortran");
+ mime.put("fdf","application/vnd.fdf");
+// mime.put("fif","application/fractals");
+ mime.put("fif","image/fif");
+ mime.put("fli","video/fli");
+// mime.put("fli","video/x-fli");
+ mime.put("flo","image/florian");
+ mime.put("flx","text/vnd.fmi.flexstor");
+ mime.put("fmf","video/x-atomic3d-feature");
+ mime.put("for","text/plain");
+// mime.put("for","text/x-fortran");
+// mime.put("fpx","image/vnd.fpx");
+ mime.put("fpx","image/vnd.net-fpx");
+ mime.put("frl","application/freeloader");
+ mime.put("funk","audio/make");
+ mime.put("g","text/plain");
+ mime.put("g3","image/g3fax");
+ mime.put("gif","image/gif");
+ mime.put("gl","video/gl");
+// mime.put("gl","video/x-gl");
+ mime.put("gsd","audio/x-gsm");
+ mime.put("gsm","audio/x-gsm");
+ mime.put("gsp","application/x-gsp");
+ mime.put("gss","application/x-gss");
+ mime.put("gtar","application/x-gtar");
+// mime.put("gz","application/x-compressed");
+ mime.put("gz","application/x-gzip");
+ mime.put("gzip","application/x-gzip");
+// mime.put("gzip","multipart/x-gzip");
+ mime.put("h","text/plain");
+ mime.put("h","text/x-h");
+ mime.put("hdf","application/x-hdf");
+ mime.put("help","application/x-helpfile");
+ mime.put("hgl","application/vnd.hp-hpgl");
+ mime.put("hh","text/plain");
+// mime.put("hh","text/x-h");
+ mime.put("hlb","text/x-script");
+// mime.put("hlp","application/hlp");
+// mime.put("hlp","application/x-helpfile");
+// mime.put("hlp","application/x-winhelp");
+ mime.put("hpg","application/vnd.hp-hpgl");
+ mime.put("hpgl","application/vnd.hp-hpgl");
+ mime.put("hqx","application/binhex");
+// mime.put("hqx","application/binhex4");
+// mime.put("hqx","application/mac-binhex");
+// mime.put("hqx","application/mac-binhex40");
+// mime.put("hqx","application/x-binhex40");
+// mime.put("hqx","application/x-mac-binhex40");
+ mime.put("hta","application/hta");
+ mime.put("htc","text/x-component");
+ mime.put("htm","text/html");
+ mime.put("html","text/html");
+ mime.put("htmls","text/html");
+ mime.put("htt","text/webviewhtml");
+ mime.put("htx","text/html");
+ mime.put("ice","x-conference/x-cooltalk");
+ mime.put("ico","image/x-icon");
+ mime.put("idc","text/plain");
+ mime.put("ief","image/ief");
+ mime.put("iefs","image/ief");
+ mime.put("iges","application/iges");
+// mime.put("iges","model/iges");
+ mime.put("igs","application/iges");
+ mime.put("igs","model/iges");
+ mime.put("ima","application/x-ima");
+ mime.put("imap","application/x-httpd-imap");
+ mime.put("inf","application/inf");
+ mime.put("ins","application/x-internett-signup");
+ mime.put("ip","application/x-ip2");
+ mime.put("isu","video/x-isvideo");
+ mime.put("it","audio/it");
+ mime.put("iv","application/x-inventor");
+ mime.put("ivr","i-world/i-vrml");
+ mime.put("ivy","application/x-livescreen");
+ mime.put("jam","audio/x-jam");
+ mime.put("jav","text/plain");
+// mime.put("jav","text/x-java-source");
+ mime.put("java","text/plain");
+// mime.put("java","text/x-java-source");
+ mime.put("jcm","application/x-java-commerce");
+ mime.put("jfif","image/jpeg");
+// mime.put("jfif","image/pjpeg");
+ mime.put("jfif-tbnl","image/jpeg");
+ mime.put("jpe","image/jpeg");
+// mime.put("jpe","image/pjpeg");
+ mime.put("jpeg","image/jpeg");
+// mime.put("jpeg","image/pjpeg");
+ mime.put("jpg","image/jpeg");
+// mime.put("jpg","image/pjpeg");
+ mime.put("jps","image/x-jps");
+ mime.put("js","application/x-javascript");
+ mime.put("jut","image/jutvision");
+ mime.put("kar","audio/midi");
+// mime.put("kar","music/x-karaoke");
+// mime.put("ksh","application/x-ksh");
+ mime.put("ksh","text/x-script.ksh");
+ mime.put("la","audio/nspaudio");
+// mime.put("la","audio/x-nspaudio");
+ mime.put("lam","audio/x-liveaudio");
+ mime.put("latex","application/x-latex");
+ mime.put("lha","application/lha");
+// mime.put("lha","application/octet-stream");
+// mime.put("lha","application/x-lha");
+ mime.put("lhx","application/octet-stream");
+ mime.put("list","text/plain");
+ mime.put("lma","audio/nspaudio");
+// mime.put("lma","audio/x-nspaudio");
+ mime.put("log","text/plain");
+// mime.put("lsp","application/x-lisp");
+ mime.put("lsp","text/x-script.lisp");
+ mime.put("lst","text/plain");
+ mime.put("lsx","text/x-la-asf");
+ mime.put("ltx","application/x-latex");
+// mime.put("lzh","application/octet-stream");
+ mime.put("lzh","application/x-lzh");
+ mime.put("lzx","application/lzx");
+// mime.put("lzx","application/octet-stream");
+// mime.put("lzx","application/x-lzx");
+ mime.put("m","text/plain");
+// mime.put("m","text/x-m");
+ mime.put("m1v","video/mpeg");
+ mime.put("m2a","audio/mpeg");
+ mime.put("m2v","video/mpeg");
+ mime.put("m3u","audio/x-mpequrl");
+ mime.put("man","application/x-troff-man");
+ mime.put("map","application/x-navimap");
+ mime.put("mar","text/plain");
+ mime.put("mbd","application/mbedlet");
+ mime.put("mc$","application/x-magic-cap-package-1.0");
+ mime.put("mcd","application/mcad");
+// mime.put("mcd","application/x-mathcad");
+// mime.put("mcf","image/vasa");
+ mime.put("mcf","text/mcf");
+ mime.put("mcp","application/netmc");
+ mime.put("me","application/x-troff-me");
+ mime.put("mht","message/rfc822");
+ mime.put("mhtml","message/rfc822");
+// mime.put("mid","application/x-midi");
+ mime.put("mid","audio/midi");
+// mime.put("mid","audio/x-mid");
+// mime.put("mid","audio/x-midi");
+// mime.put("mid","music/crescendo");
+// mime.put("mid","x-music/x-midi");
+// mime.put("midi","application/x-midi");
+ mime.put("midi","audio/midi");
+// mime.put("midi","audio/x-mid");
+// mime.put("midi","audio/x-midi");
+// mime.put("midi","music/crescendo");
+// mime.put("midi","x-music/x-midi");
+// mime.put("mif","application/x-frame");
+ mime.put("mif","application/x-mif");
+// mime.put("mime","message/rfc822");
+ mime.put("mime","www/mime");
+ mime.put("mjf","audio/x-vnd.audioexplosion.mjuicemediafile");
+ mime.put("mjpg","video/x-motion-jpeg");
+ mime.put("mm","application/base64");
+// mime.put("mm","application/x-meme");
+ mime.put("mme","application/base64");
+ mime.put("mod","audio/mod");
+// mime.put("mod","audio/x-mod");
+ mime.put("moov","video/quicktime");
+ mime.put("mov","video/quicktime");
+ mime.put("movie","video/x-sgi-movie");
+ mime.put("mp2","audio/mpeg");
+// mime.put("mp2","audio/x-mpeg");
+// mime.put("mp2","video/mpeg");
+// mime.put("mp2","video/x-mpeg");
+// mime.put("mp2","video/x-mpeq2a");
+ mime.put("mp3","audio/mpeg3");
+// mime.put("mp3","audio/x-mpeg-3");
+// mime.put("mp3","video/mpeg");
+// mime.put("mp3","video/x-mpeg");
+ mime.put("mpa","audio/mpeg");
+// mime.put("mpa","video/mpeg");
+ mime.put("mpc","application/x-project");
+ mime.put("mpe","video/mpeg");
+ mime.put("mpeg","video/mpeg");
+ mime.put("mpg","audio/mpeg");
+// mime.put("mpg","video/mpeg");
+ mime.put("mpga","audio/mpeg");
+ mime.put("mpp","application/vnd.ms-project");
+ mime.put("mpt","application/x-project");
+ mime.put("mpv","application/x-project");
+ mime.put("mpx","application/x-project");
+ mime.put("mrc","application/marc");
+ mime.put("ms","application/x-troff-ms");
+ mime.put("mv","video/x-sgi-movie");
+ mime.put("my","audio/make");
+ mime.put("mzz","application/x-vnd.audioexplosion.mzz");
+ mime.put("nap","image/naplps");
+ mime.put("naplps","image/naplps");
+ mime.put("nc","application/x-netcdf");
+ mime.put("ncm","application/vnd.nokia.configuration-message");
+ mime.put("nif","image/x-niff");
+ mime.put("niff","image/x-niff");
+ mime.put("nix","application/x-mix-transfer");
+ mime.put("nsc","application/x-conference");
+ mime.put("nvd","application/x-navidoc");
+ mime.put("o","application/octet-stream");
+ mime.put("oda","application/oda");
+ mime.put("omc","application/x-omc");
+ mime.put("omcd","application/x-omcdatamaker");
+ mime.put("omcr","application/x-omcregerator");
+ mime.put("p","text/x-pascal");
+ mime.put("p10","application/pkcs10");
+// mime.put("p10","application/x-pkcs10");
+ mime.put("p12","application/pkcs-12");
+// mime.put("p12","application/x-pkcs12");
+ mime.put("p7a","application/x-pkcs7-signature");
+ mime.put("p7c","application/pkcs7-mime");
+// mime.put("p7c","application/x-pkcs7-mime");
+ mime.put("p7m","application/pkcs7-mime");
+// mime.put("p7m","application/x-pkcs7-mime");
+ mime.put("p7r","application/x-pkcs7-certreqresp");
+ mime.put("p7s","application/pkcs7-signature");
+ mime.put("part","application/pro_eng");
+ mime.put("pas","text/pascal");
+ mime.put("pbm","image/x-portable-bitmap");
+ mime.put("pcl","application/vnd.hp-pcl");
+// mime.put("pcl","application/x-pcl");
+ mime.put("pct","image/x-pict");
+ mime.put("pcx","image/x-pcx");
+ mime.put("pdb","chemical/x-pdb");
+ mime.put("pdf","application/pdf");
+ mime.put("pfunk","audio/make");
+// mime.put("pfunk","audio/make.my.funk");
+ mime.put("pgm","image/x-portable-graymap");
+// mime.put("pgm","image/x-portable-greymap");
+ mime.put("pic","image/pict");
+ mime.put("pict","image/pict");
+ mime.put("pkg","application/x-newton-compatible-pkg");
+ mime.put("pko","application/vnd.ms-pki.pko");
+// mime.put("pl","text/plain");
+ mime.put("pl","text/x-script.perl");
+ mime.put("plx","application/x-pixclscript");
+// mime.put("pm","image/x-xpixmap");
+ mime.put("pm","text/x-script.perl-module");
+ mime.put("pm4","application/x-pagemaker");
+ mime.put("pm5","application/x-pagemaker");
+ mime.put("png","image/png");
+ mime.put("pnm","application/x-portable-anymap");
+// mime.put("pnm","image/x-portable-anymap");
+ mime.put("pot","application/mspowerpoint");
+// mime.put("pot","application/vnd.ms-powerpoint");
+ mime.put("pov","model/x-pov");
+ mime.put("ppa","application/vnd.ms-powerpoint");
+ mime.put("ppm","image/x-portable-pixmap");
+ mime.put("pps","application/mspowerpoint");
+// mime.put("pps","application/vnd.ms-powerpoint");
+// mime.put("ppt","application/mspowerpoint");
+ mime.put("ppt","application/powerpoint");
+// mime.put("ppt","application/vnd.ms-powerpoint");
+// mime.put("ppt","application/x-mspowerpoint");
+ mime.put("ppz","application/mspowerpoint");
+ mime.put("pre","application/x-freelance");
+ mime.put("prt","application/pro_eng");
+ mime.put("ps","application/postscript");
+ mime.put("psd","application/octet-stream");
+ mime.put("pvu","paleovu/x-pv");
+ mime.put("pwz","application/vnd.ms-powerpoint");
+ mime.put("py","text/x-script.phyton");
+ mime.put("pyc","applicaiton/x-bytecode.python");
+ mime.put("qcp","audio/vnd.qcelp");
+ mime.put("qd3","x-world/x-3dmf");
+ mime.put("qd3d","x-world/x-3dmf");
+ mime.put("qif","image/x-quicktime");
+ mime.put("qt","video/quicktime");
+ mime.put("qtc","video/x-qtc");
+ mime.put("qti","image/x-quicktime");
+ mime.put("qtif","image/x-quicktime");
+// mime.put("ra","audio/x-pn-realaudio");
+// mime.put("ra","audio/x-pn-realaudio-plugin");
+ mime.put("ra","audio/x-realaudio");
+ mime.put("ram","audio/x-pn-realaudio");
+// mime.put("ras","application/x-cmu-raster");
+ mime.put("ras","image/cmu-raster");
+// mime.put("ras","image/x-cmu-raster");
+ mime.put("rast","image/cmu-raster");
+ mime.put("rexx","text/x-script.rexx");
+ mime.put("rf","image/vnd.rn-realflash");
+ mime.put("rgb","image/x-rgb");
+// mime.put("rm","application/vnd.rn-realmedia");
+ mime.put("rm","audio/x-pn-realaudio");
+ mime.put("rmi","audio/mid");
+ mime.put("rmm","audio/x-pn-realaudio");
+ mime.put("rmp","audio/x-pn-realaudio");
+// mime.put("rmp","audio/x-pn-realaudio-plugin");
+ mime.put("rng","application/ringing-tones");
+// mime.put("rng","application/vnd.nokia.ringing-tone");
+ mime.put("rnx","application/vnd.rn-realplayer");
+ mime.put("roff","application/x-troff");
+ mime.put("rp","image/vnd.rn-realpix");
+ mime.put("rpm","audio/x-pn-realaudio-plugin");
+ mime.put("rt","text/richtext");
+// mime.put("rt","text/vnd.rn-realtext");
+ mime.put("rtf","application/rtf");
+// mime.put("rtf","application/x-rtf");
+ mime.put("rtf","text/richtext");
+// mime.put("rtx","application/rtf");
+ mime.put("rtx","text/richtext");
+ mime.put("rv","video/vnd.rn-realvideo");
+ mime.put("s","text/x-asm");
+ mime.put("s3m","audio/s3m");
+ mime.put("saveme","application/octet-stream");
+ mime.put("sbk","application/x-tbook");
+ mime.put("scm","application/x-lotusscreencam");
+// mime.put("scm","text/x-script.guile");
+// mime.put("scm","text/x-script.scheme");
+// mime.put("scm","video/x-scm");
+ mime.put("sdml","text/plain");
+ mime.put("sdp","application/sdp");
+ mime.put("sdp","application/x-sdp");
+ mime.put("sdr","application/sounder");
+ mime.put("sea","application/sea");
+ mime.put("sea","application/x-sea");
+ mime.put("set","application/set");
+ mime.put("sgm","text/sgml");
+// mime.put("sgm","text/x-sgml");
+ mime.put("sgml","text/sgml");
+// mime.put("sgml","text/x-sgml");
+ mime.put("sh","application/x-bsh");
+// mime.put("sh","application/x-sh");
+// mime.put("sh","application/x-shar");
+// mime.put("sh","text/x-script.sh");
+ mime.put("shar","application/x-bsh");
+// mime.put("shar","application/x-shar");
+ mime.put("shtml","text/html");
+// mime.put("shtml","text/x-server-parsed-html");
+ mime.put("sid","audio/x-psid");
+ mime.put("sit","application/x-sit");
+// mime.put("sit","application/x-stuffit");
+ mime.put("skd","application/x-koan");
+ mime.put("skm","application/x-koan");
+ mime.put("skp","application/x-koan");
+ mime.put("skt","application/x-koan");
+ mime.put("sl","application/x-seelogo");
+ mime.put("smi","application/smil");
+ mime.put("smil","application/smil");
+ mime.put("snd","audio/basic");
+ mime.put("snd","audio/x-adpcm");
+ mime.put("sol","application/solids");
+ mime.put("spc","application/x-pkcs7-certificates");
+// mime.put("spc","text/x-speech");
+ mime.put("spl","application/futuresplash");
+// mime.put("spr","application/x-sprite");
+ mime.put("sprite","application/x-sprite");
+ mime.put("src","application/x-wais-source");
+ mime.put("ssi","text/x-server-parsed-html");
+ mime.put("ssm","application/streamingmedia");
+ mime.put("sst","application/vnd.ms-pki.certstore");
+ mime.put("step","application/step");
+ mime.put("stl","application/sla");
+// mime.put("stl","application/vnd.ms-pki.stl");
+// mime.put("stl","application/x-navistyle");
+ mime.put("stp","application/step");
+ mime.put("sv4cpio","application/x-sv4cpio");
+ mime.put("sv4crc","application/x-sv4crc");
+ mime.put("svf","image/vnd.dwg");
+// mime.put("svf","image/x-dwg");
+// mime.put("svr","application/x-world");
+// mime.put("svr","x-world/x-svr");
+ mime.put("swf","application/x-shockwave-flash");
+ mime.put("t","application/x-troff");
+ mime.put("talk","text/x-speech");
+ mime.put("tar","application/x-tar");
+ mime.put("tbk","application/toolbook");
+// mime.put("tbk","application/x-tbook");
+ mime.put("tcl","application/x-tcl");
+// mime.put("tcl","text/x-script.tcl");
+ mime.put("tcsh","text/x-script.tcsh");
+ mime.put("tex","application/x-tex");
+ mime.put("texi","application/x-texinfo");
+ mime.put("texinfo","application/x-texinfo");
+// mime.put("text","application/plain");
+ mime.put("text","text/plain");
+ mime.put("tgz","application/gnutar");
+// mime.put("tgz","application/x-compressed");
+ mime.put("tif","image/tiff");
+// mime.put("tif","image/x-tiff");
+ mime.put("tiff","image/tiff");
+// mime.put("tiff","image/x-tiff");
+ mime.put("tr","application/x-troff");
+ mime.put("tsi","audio/tsp-audio");
+// mime.put("tsp","application/dsptype");
+ mime.put("tsp","audio/tsplayer");
+ mime.put("tsv","text/tab-separated-values");
+ mime.put("turbot","image/florian");
+ mime.put("txt","text/plain");
+ mime.put("uil","text/x-uil");
+ mime.put("uni","text/uri-list");
+ mime.put("unis","text/uri-list");
+ mime.put("unv","application/i-deas");
+ mime.put("uri","text/uri-list");
+ mime.put("uris","text/uri-list");
+ mime.put("ustar","application/x-ustar");
+// mime.put("ustar","multipart/x-ustar");
+// mime.put("uu","application/octet-stream");
+ mime.put("uu","text/x-uuencode");
+ mime.put("uue","text/x-uuencode");
+ mime.put("vcd","application/x-cdlink");
+ mime.put("vcs","text/x-vcalendar");
+ mime.put("vda","application/vda");
+ mime.put("vdo","video/vdo");
+ mime.put("vew","application/groupwise");
+ mime.put("viv","video/vivo");
+// mime.put("viv","video/vnd.vivo");
+ mime.put("vivo","video/vivo");
+// mime.put("vivo","video/vnd.vivo");
+ mime.put("vmd","application/vocaltec-media-desc");
+ mime.put("vmf","application/vocaltec-media-file");
+ mime.put("voc","audio/voc");
+// mime.put("voc","audio/x-voc");
+ mime.put("vos","video/vosaic");
+ mime.put("vox","audio/voxware");
+ mime.put("vqe","audio/x-twinvq-plugin");
+ mime.put("vqf","audio/x-twinvq");
+ mime.put("vql","audio/x-twinvq-plugin");
+ mime.put("vrml","application/x-vrml");
+// mime.put("vrml","model/vrml");
+// mime.put("vrml","x-world/x-vrml");
+ mime.put("vrt","x-world/x-vrt");
+ mime.put("vsd","application/x-visio");
+ mime.put("vst","application/x-visio");
+ mime.put("vsw","application/x-visio");
+ mime.put("w60","application/wordperfect6.0");
+ mime.put("w61","application/wordperfect6.1");
+ mime.put("w6w","application/msword");
+ mime.put("wav","audio/wav");
+// mime.put("wav","audio/x-wav");
+ mime.put("wb1","application/x-qpro");
+ mime.put("wbmp","image/vnd.wap.wbmp");
+ mime.put("web","application/vnd.xara");
+ mime.put("wiz","application/msword");
+ mime.put("wk1","application/x-123");
+ mime.put("wmf","windows/metafile");
+ mime.put("wml","text/vnd.wap.wml");
+ mime.put("wmlc","application/vnd.wap.wmlc");
+ mime.put("wmls","text/vnd.wap.wmlscript");
+ mime.put("wmlsc","application/vnd.wap.wmlscriptc");
+ mime.put("word","application/msword");
+ mime.put("wp","application/wordperfect");
+ mime.put("wp5","application/wordperfect");
+ mime.put("wp5","application/wordperfect6.0");
+ mime.put("wp6","application/wordperfect");
+ mime.put("wpd","application/wordperfect");
+// mime.put("wpd","application/x-wpwin");
+ mime.put("wq1","application/x-lotus");
+ mime.put("wri","application/mswrite");
+// mime.put("wri","application/x-wri");
+ mime.put("wrl","application/x-world");
+// mime.put("wrl","model/vrml");
+// mime.put("wrl","x-world/x-vrml");
+ mime.put("wrz","model/vrml");
+// mime.put("wrz","x-world/x-vrml");
+ mime.put("wsc","text/scriplet");
+ mime.put("wsrc","application/x-wais-source");
+ mime.put("wtk","application/x-wintalk");
+ mime.put("xbm","image/x-xbitmap");
+// mime.put("xbm","image/x-xbm");
+// mime.put("xbm","image/xbm");
+ mime.put("xdr","video/x-amt-demorun");
+ mime.put("xgz","xgl/drawing");
+ mime.put("xif","image/vnd.xiff");
+ mime.put("xl","application/excel");
+ mime.put("xla","application/excel");
+// mime.put("xla","application/x-excel");
+// mime.put("xla","application/x-msexcel");
+ mime.put("xlb","application/excel");
+// mime.put("xlb","application/vnd.ms-excel");
+// mime.put("xlb","application/x-excel");
+ mime.put("xlc","application/excel");
+// mime.put("xlc","application/vnd.ms-excel");
+// mime.put("xlc","application/x-excel");
+ mime.put("xld","application/excel");
+// mime.put("xld","application/x-excel");
+ mime.put("xlk","application/excel");
+// mime.put("xlk","application/x-excel");
+ mime.put("xll","application/excel");
+// mime.put("xll","application/vnd.ms-excel");
+// mime.put("xll","application/x-excel");
+ mime.put("xlm","application/excel");
+// mime.put("xlm","application/vnd.ms-excel");
+// mime.put("xlm","application/x-excel");
+ mime.put("xls","application/excel");
+// mime.put("xls","application/vnd.ms-excel");
+// mime.put("xls","application/x-excel");
+// mime.put("xls","application/x-msexcel");
+ mime.put("xlt","application/excel");
+// mime.put("xlt","application/x-excel");
+ mime.put("xlv","application/excel");
+// mime.put("xlv","application/x-excel");
+ mime.put("xlw","application/excel");
+// mime.put("xlw","application/vnd.ms-excel");
+// mime.put("xlw","application/x-excel");
+ mime.put("xlw","application/x-msexcel");
+ mime.put("xm","audio/xm");
+// mime.put("xml","application/xml");
+ mime.put("xml","text/xml");
+ mime.put("xmz","xgl/movie");
+ mime.put("xpix","application/x-vnd.ls-xpix");
+ mime.put("xpm","image/x-xpixmap");
+// mime.put("xpm","image/xpm");
+ mime.put("x-png","image/png");
+ mime.put("xsr","video/x-amt-showrun");
+ mime.put("xwd","image/x-xwd");
+// mime.put("xwd","image/x-xwindowdump");
+ mime.put("xyz","chemical/x-pdb");
+// mime.put("z","application/x-compress");
+ mime.put("z","application/x-compressed");
+// mime.put("zip","application/x-compressed");
+// mime.put("zip","application/x-zip-compressed");
+ mime.put("zip","application/zip");
+// mime.put("zip","multipart/x-zip");
+ mime.put("zoo","application/octet-stream");
+ mime.put("zsh","text/x-script.zsh");
+
+
+
+ return mime.get(key);
+ }
+
+}
Modified:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/SearchResultIteratorFromXml.java
==============================================================================
---
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/SearchResultIteratorFromXml.java
(original)
+++
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/SearchResultIteratorFromXml.java
Thu Oct 1 08:50:37 2009
@@ -48,13 +48,44 @@
* Constructor
*/
public SearchResultIteratorFromXml(String xmlString) {
+
// parse the XML document into a DOM
- Document messageDom = XMLParser.parse(xmlString);
+ String clean = xmlString.replaceAll("&#", "");
+ Document messageDom =
XMLParser.parse(stripNonValidXMLCharacters(clean));
// obtain list of search hits
hits = messageDom.getElementsByTagName("Hit");
numResults = hits.getLength();
}
+
+
+ /**
+ * This method ensures that the output String has only
+ * valid XML unicode characters as specified by the
+ * XML 1.0 standard. For reference, please see
+ * <a href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char">the
+ * standard</a>. This method will return an empty
+ * String if the input is null or empty.
+ *
+ * @param in The String whose non-valid characters we want to remove.
+ * @return The in String, stripped of non-valid characters.
+ */
+ public String stripNonValidXMLCharacters(String in) {
+ StringBuffer out = new StringBuffer(); // Used to hold the output.
+ char current; // Used to reference the current character.
+ if (in == null || ("".equals(in))) return ""; // vacancy test.
+ for (int i = 0; i < in.length(); i++) {
+ current = in.charAt(i); // NOTE: No IndexOutOfBoundsException
caught here; it should not happen.
+ if ((current == 0x9) ||
+ (current == 0xA) ||
+ (current == 0xD) ||
+ ((current >= 0x20) && (current <= 0xD7FF)) ||
+ ((current >= 0xE000) && (current <= 0xFFFD)) ||
+ ((current >= 0x10000) && (current <= 0x10FFFF)))
+ out.append(current);
+ }
+ return out.toString();
+ }
/**
* @see java.util.Iterator#hasNext()
Modified:
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/TableResultListWidgetSmartGwt.java
==============================================================================
---
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/TableResultListWidgetSmartGwt.java
(original)
+++
trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/TableResultListWidgetSmartGwt.java
Thu Oct 1 08:50:37 2009
@@ -1,34 +1,40 @@
+/*
+ * Copyright (C) 2006-2008 iDok team.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+ */
+
package ch.psi.idok.gwt.twiki.client;
-import java.util.ArrayList;
-import java.util.Date;
import java.util.Iterator;
-import java.util.List;
-
-import ch.psi.idok.gwt.twiki.client.IdokSearchUtil;
-import ch.psi.idok.gwt.twiki.client.SearchResultItem;
-import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.Cookies;
import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.DateDisplayFormat;
-import com.smartgwt.client.types.ListGridEditEvent;
import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.types.Positioning;
-import com.smartgwt.client.types.SortArrow;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.form.fields.DateItem;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.grid.events.CellClickEvent;
+import com.smartgwt.client.widgets.grid.events.CellClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -43,20 +49,22 @@
public TableResultListWidgetSmartGwt(Iterator<SearchResultItem> it) {
HLayout layout = new HLayout();
- layout.setWidth100();
- layout.setHeight100();
+ layout.setWidth("75%");
+ layout.setHeight("75%");
layout.setMembersMargin(10);
layout.setLayoutMargin(5);
+// layout.setLayoutRightMargin(300);
layout.setShowEdges(false);
-
+// layout.resizeBy(-300, 0);
final ListGrid grid = new ListGrid();
- grid.setWidth("100%");
- grid.setHeight("100%");
- grid.setLayoutAlign(Alignment.CENTER);
+// grid.setWidth("100%");
+// grid.resizeBy(-100, 0);
+// grid.setHeight("100%");
+// grid.setLayoutAlign(Alignment.CENTER);
// grid.setTop(50);
grid.setAlternateRecordStyles(true);
grid.setShowAllRecords(true);
@@ -66,10 +74,13 @@
grid.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
grid.setWrapCells(true);
grid.setCellHeight(40);
+// grid.setShowFilterEditor(true);
+// grid.setFilterOnKeypress(true);
+
ListGridField filenameField = new
ListGridField("fileName", "File Name");
- ListGridField urlField = new ListGridField("url", "URL",200);
+ final ListGridField urlField = new ListGridField("url",
"URL",200);
String test = urlField.getLinkText();
urlField.setType(ListGridFieldType.LINK);
urlField.setLinkText(filenameField.getLinkText());
@@ -109,64 +120,33 @@
VLayout vLayout = new VLayout();
vLayout.setShowEdges(false);
- vLayout.setWidth100();
+// vLayout.setWidth100();
vLayout.setMembersMargin(5);
vLayout.setLayoutMargin(10);
vLayout.addMember(grid);
+// vLayout.resizeBy(-300, 0);
layout.addMember(vLayout);
-// layout.addChild(grid);
+ grid.addCellClickHandler(new CellClickHandler() {
+ public void
onCellClick(CellClickEvent event) {
+ // TODO Auto-generated method
stub
+//
Window.imgHTML(urlField.getAttributeAsString("url"));
+//
Window.imgHTML("http://dms02.psi.ch/qtgui/Design/Header7.jpg");
+// Log.debug("The problem starts
here:");
+
Window.open(event.getRecord().getAttribute("url"), "_blank","");
+
+// PopupPanel popup = new
PopupPanel(true);
+// popup.setStyleName("popup");
+// popup.setWidget(new
Label(event.getRecord().getAttribute("url")));
+// popup.center();
+// popup.show();
+ }
-//// canvas.addChild(spacer);
-// canvas.addChild(grid);
-// canvas.addChild(spacer);
-
-
-// IButton clearDataButton = new IButton("Clear Data");
-// clearDataButton.setLeft(0);
-// clearDataButton.addClickHandler(new ClickHandler() {
-// public void onClick(ClickEvent event) {
-// grid.setData(new ListGridRecord[]{});
-// }
-// });
-// canvas.addChild(clearDataButton);
-
+ });
-
- initWidget(layout);
-
-
-
-
- //************************************************
-
-// Canvas canvas = new Canvas();
-//
-// final ListGrid countryGrid = new ListGrid();
-// countryGrid.setWidth(500);
-// countryGrid.setHeight(624);
-// countryGrid.setAlternateRecordStyles(true);
-// countryGrid.setShowAllRecords(true);
-// countryGrid.setCanEdit(true);
-// countryGrid.setEditEvent(ListGridEditEvent.CLICK);
-// countryGrid.setModalEditing(true);
-//
-// ListGridField countryCodeField = new
ListGridField("countryCode", "Flag", 50);
-// countryCodeField.setAlign(Alignment.CENTER);
-// countryCodeField.setType(ListGridFieldType.IMAGE);
-// countryCodeField.setImageURLPrefix("flags/16/");
-// countryCodeField.setImageURLSuffix(".png");
-// countryCodeField.setCanEdit(false);
-// ListGridField nameField = new ListGridField("countryName",
"Country");
-// ListGridField articleField = new ListGridField("article",
"Info");
-// articleField.setType(ListGridFieldType.LINK);
-//
-// countryGrid.setFields(new ListGridField[]
{countryCodeField, nameField, articleField});
-// countryGrid.setData(CountryData.getRecords());
-// canvas.addChild(countryGrid);
-//
-// initWidget(canvas);
+
+ initWidget(layout);
}
public int getResultCount(){
@@ -175,345 +155,3 @@
}
}
-
-class idokData {
- private static IdokRecord[] records;
-
- /**
- * Date format for rendering search results
- */
-// final static private DateTimeFormat dataFormatOut = DateTimeFormat
-// .getFormat("dd.MM.yyy - HH:mm");
-
-
- public static IdokRecord[] getRecords(Iterator<SearchResultItem>
it) {
- if (records == null) {
- records = getNewRecords(it);
- }
- return records;
- }
-
- public static IdokRecord[]
getNewRecords(Iterator<SearchResultItem> it) {
-
- List <IdokRecord> record = new ArrayList<IdokRecord>();
-
- while (it.hasNext()) {
-
- SearchResultItem hit = it.next();
-// String dateString =
dataFormatOut.format(hit.getDate());
- record.add(new
IdokRecord(hit.getName(),IdokSearchUtil.getDocumentURL(hit),hit.getRev(),(int)hit.getSize(),
hit.getDate(), hit.getAuthor(), hit.getEnv()));
- }
-
- IdokRecord[] table = new IdokRecord[record.size()];
- for (int i = 0; i < record.size(); i++) {
- table[i]=record.get(i);
- }
-
- return table;
- }
-}
-
-class IdokRecord extends ListGridRecord {
-
- public IdokRecord() {
- }
-
- public IdokRecord(String fileName,String url, String revision, int size,
Date date, String author, String environment) {
- setFileName(fileName);
- setLinkText(fileName);
- setURL(url);
- setRevision(revision);
- setSize(size);
- setDate(date);
- setAuthor(author);
- setEnvironment(environment);
-
- }
-
- public String getLinkText() {
- return getAttributeAsString("linkText");
- }
-
- public void setLinkText(String linkText) {
- setAttribute("linkText", linkText);
- }
-
-
- public String getFilename() {
- return getAttributeAsString("fileName");
- }
-
- public void setFileName(String filename) {
- setAttribute("fileName", filename);
- }
-
- public String getURL() {
- return getAttributeAsString("url");
- }
-
- private void setURL(String url) {
- setAttribute("url", url);
- }
-
- public String getRevision() {
- return getAttributeAsString("revision");
- }
-
- public void setRevision(String revision) {
- setAttribute("revision", revision);
- }
-
- public int getSize() {
- return getAttributeAsInt("size");
- }
-
- public void setSize(int size) {
- setAttribute("size", size);
- }
-
- public Date getDate() {
- return getAttributeAsDate("date");
- }
-
- public void setDate(Date date) {
- setAttribute("date", date);
- }
-
- public String getAuthor() {
- return getAttributeAsString("author");
- }
-
- public void setAuthor(String author) {
- setAttribute("author", author);
- }
-
- public String getEnvironment() {
- return getAttributeAsString("environment");
- }
-
- public void setEnvironment(String environment) {
- setAttribute("environment", environment);
- }
-
- public void setBackground(String background) {
- setAttribute("background", background);
- }
-
- public String getBackground() {
- return getAttributeAsString("background");
- }
-
- public String getFieldValue(String field) {
- return getAttributeAsString(field);
- }
-}
-
-
-
-
-
-
-
-
-
-
-//******************************************************************
-
-
-
-class CountryRecord extends ListGridRecord {
-
- public CountryRecord() {
- }
-
- public CountryRecord(String countryCode, String countryName, String
capital, String continent) {
- setCountryCode(countryCode);
- setCountryName(countryName);
- setCapital(capital);
- setContinent(continent);
- }
-
-
- public CountryRecord(String countryCode, String countryName, int
population) {
- setCountryCode(countryCode);
- setCountryName(countryName);
- setPopulation(population);
- }
-
- public CountryRecord(String continent, String countryName, String
countryCode, int area, int population, double gdp,
- Date independence, String government, int
governmentDesc, String capital, boolean memberG8, String article,
- String background) {
-
- setContinent(continent);
- setCountryName(countryName);
- setCountryCode(countryCode);
- setArea(area);
- setPopulation(population);
- setGdp(gdp);
- setIndependence(independence);
- setGovernment(government);
- setGovernmentDesc(governmentDesc);
- setCapital(capital);
- setMemberG8(memberG8);
- setArticle(article);
- setBackground(background);
- }
-
- public void setContinent(String continent) {
- setAttribute("continent", continent);
- }
-
- public String getContinent() {
- return getAttributeAsString("continent");
- }
-
- public void setCountryName(String countryName) {
- setAttribute("countryName", countryName);
- }
-
- public String getCountryName() {
- return getAttributeAsString("countryName");
- }
-
- public void setCountryCode(String countryCode) {
- setAttribute("countryCode", countryCode);
- }
-
- public String getCountryCode() {
- return getAttributeAsString("countryCode");
- }
-
- public void setArea(int area) {
- setAttribute("area", area);
- }
-
- public int getArea() {
- return getAttributeAsInt("area");
- }
-
- public void setPopulation(int population) {
- setAttribute("population", population);
- }
-
- public int getPopulation() {
- return getAttributeAsInt("population");
- }
-
- public void setGdp(double gdp) {
- setAttribute("gdp", gdp);
- }
-
- public double getGdp() {
- return getAttributeAsDouble("gdp");
- }
-
- public void setIndependence(Date independence) {
- setAttribute("independence", independence);
- }
-
- public Date getIndependence() {
- return getAttributeAsDate("independence");
- }
-
- public void setGovernment(String government) {
- setAttribute("government", government);
- }
-
- public String getGovernment() {
- return getAttributeAsString("government");
- }
-
- public void setGovernmentDesc(int governmentDesc) {
- setAttribute("government_desc", governmentDesc);
- }
-
- public int getGovernmentDesc() {
- return getAttributeAsInt("government_desc");
- }
-
- public void setCapital(String capital) {
- setAttribute("capital", capital);
- }
-
- public String getCapital() {
- return getAttributeAsString("capital");
- }
-
- public void setMemberG8(boolean memberG8) {
- setAttribute("member_g8", memberG8);
- }
-
- public boolean getMemberG8() {
- return getAttributeAsBoolean("member_g8");
- }
-
-
- public void setArticle(String article) {
- setAttribute("article", article);
- }
-
- public String getArticle() {
- return getAttributeAsString("article");
- }
-
- public void setBackground(String background) {
- setAttribute("background", background);
- }
-
- public String getBackground() {
- return getAttributeAsString("background");
- }
-
- public String getFieldValue(String field) {
- return getAttributeAsString(field);
- }
-}
-
-
-
-class CountryData {
-
- private static CountryRecord[] records;
-
- public static CountryRecord[] getRecords() {
- if (records == null) {
- records = getNewRecords();
- }
- return records;
- }
-
- public static CountryRecord[] getNewRecords() {
- return new CountryRecord[]{
- new CountryRecord("North America", "United States", "US",
9631420, 298444215, 12360, new Date(1776 - 1900, 6, 4), "federal republic",
2, "Washington, DC", true, "http://en.wikipedia.org/wiki/United_states",
"Britain's American colonies broke with the mother country in 1776 and were
recognized as the new nation of the United States of America following the
Treaty of Paris in 1783. During the 19th and 20th centuries, 37 new states
were added to the original 13 as the nation expanded across the North
American continent and acquired a number of overseas possessions. The two
most traumatic experiences in the nation's history were the Civil War
(1861-65) and the Great Depression of the 1930s. Buoyed by victories in World
Wars I and II and the end of the Cold War in 1991, the US remains the world's
most powerful nation state. The economy is marked by steady growth, low
unemployment and inflation, and rapid advances in technology."),
- new CountryRecord("Asia", "China", "CH", 9596960,
1313973713, 8859, null, "Communist state", 0, "Beijing", false,
"http://en.wikipedia.org/wiki/China", "For centuries China stood as a leading
civilization, outpacing the rest of the world in the arts and sciences, but
in the 19th and early 20th centuries, the country was beset by civil unrest,
major famines, military defeats, and foreign occupation. After World War II,
the Communists under MAO Zedong established an autocratic socialist system
that, while ensuring China's sovereignty, imposed strict controls over
everyday life and cost the lives of tens of millions of people. After 1978,
his successor DENG Xiaoping and other leaders focused on market-oriented
economic development and by 2000 output had quadrupled. For much of the
population, living standards have improved dramatically and the room for
personal choice has expanded, yet political controls remain tight."),
- new CountryRecord("Asia", "Japan", "JA", 377835, 127463611,
4018, null, "constitutional monarchy with parliamentary government", 1,
"Tokyo", true, "http://en.wikipedia.org/wiki/Japan", "In 1603, a Tokugawa
shogunate (military dictatorship) ushered in a long period of isolation from
foreign influence in order to secure its power. For 250 years this policy
enabled Japan to enjoy stability and a flowering of its indigenous culture.
Following the Treaty of Kanagawa with the US in 1854, Japan opened its ports
and began to intensively modernize and industrialize. During the late 19th
and early 20th centuries, Japan became a regional power that was able to
defeat the forces of both China and Russia. It occupied Korea, Formosa
(Taiwan), and southern Sakhalin Island. In 1931-32 Japan occupied Manchuria,
and in 1937 it launched a full-scale invasion of China. Japan attacked US
forces in 1941 - triggering America's entry into World War II - and soon
occupied much of Ea!
st and Southeast Asia. After its defeat in World War II, Japan recovered to
become an economic power and a staunch ally of the US. While the emperor
retains his throne as a symbol of national unity, actual power rests in
networks of powerful politicians, bureaucrats, and business executives. The
economy experienced a major slowdown starting in the 1990s following three
decades of unprecedented growth, but Japan still remains a major economic
power, both in Asia and globally. In 2005, Japan began a two-year term as a
non-permanent member of the UN Security Council."),
- new CountryRecord("Asia", "India", "IN", 3287590,
1095351995, 3611, new Date(1947 - 1900, 7, 15), "federal republic", 2, "New
Delhi", false, "http://en.wikipedia.org/wiki/India", "The Indus Valley
civilization, one of the oldest in the world, dates back at least 5,000
years. Aryan tribes from the northwest infiltrated onto Indian lands about
1500 B.C.; their merger with the earlier Dravidian inhabitants created the
classical Indian culture. Arab incursions starting in the 8th century and
Turkish in the 12th were followed by those of European traders, beginning in
the late 15th century. By the 19th century, Britain had assumed political
control of virtually all Indian lands. Indian armed forces in the British
army played a vital role in both World Wars. Nonviolent resistance to British
colonialism led by Mohandas GANDHI and Jawaharlal NEHRU brought independence
in 1947. The subcontinent was divided into the secular state of India and the
smaller Muslim state !
of Pakistan. A third war between the two countries in 1971 resulted in East
Pakistan becoming the separate nation of Bangladesh. Despite impressive gains
in economic investment and output, India faces pressing problems such as the
ongoing dispute with Pakistan over Kashmir, massive overpopulation,
environmental degradation, extensive poverty, and ethnic and religious
strife."),
- new CountryRecord("Europe", "Germany", "GM", 357021,
82422299, 2504, new Date(1871 - 1900, 0, 18), "federal republic", 2,
"Berlin", true, "http://en.wikipedia.org/wiki/Germany", "As Europe's largest
economy and second most populous nation, Germany remains a key member of the
continent's economic, political, and defense organizations. European power
struggles immersed Germany in two devastating World Wars in the first half of
the 20th century and left the country occupied by the victorious Allied
powers of the US, UK, France, and the Soviet Union in 1945. With the advent
of the Cold War, two German states were formed in 1949: the western Federal
Republic of Germany (FRG) and the eastern German Democratic Republic (GDR).
The democratic FRG embedded itself in key Western economic and security
organizations, the EC, which became the EU, and NATO, while the Communist GDR
was on the front line of the Soviet-led Warsaw Pact. The decline of the USSR
and the end of t!
he Cold War allowed for German unification in 1990. Since then, Germany has
expended considerable funds to bring Eastern productivity and wages up to
Western standards. In January 1999, Germany and 10 other EU countries
introduced a common European exchange currency, the euro."),
- new CountryRecord("Europe", "United Kingdom", "UK", 244820,
60609153, 1830, new Date(1801 - 1900, 0, 1), "constitutional monarchy", 1,
"London", true, "http://en.wikipedia.org/wiki/United_kingdom", "Great
Britain, the dominant industrial and maritime power of the 19th century,
played a leading role in developing parliamentary democracy and in advancing
literature and science. At its zenith, the British Empire stretched over
one-fourth of the earth's surface. The first half of the 20th century saw the
UK's strength seriously depleted in two World Wars. The second half witnessed
the dismantling of the Empire and the UK rebuilding itself into a modern and
prosperous European nation. As one of five permanent members of the UN
Security Council, a founding member of NATO, and of the Commonwealth, the UK
pursues a global approach to foreign policy; it currently is weighing the
degree of its integration with continental Europe. A member of the EU, it
chose to remain!
outside the Economic and Monetary Union for the time being. Constitutional
reform is also a significant issue in the UK. The Scottish Parliament, the
National Assembly for Wales, and the Northern Ireland Assembly were
established in 1999, but the latter is suspended due to wrangling over the
peace process."),
- new CountryRecord("Europe", "France", "FR", 547030,
60876136, 1816, null, "republic", 5, "Paris", true,
"http://en.wikipedia.org/wiki/France", "Although ultimately a victor in World
Wars I and II, France suffered extensive losses in its empire, wealth,
manpower, and rank as a dominant nation-state. Nevertheless, France today is
one of the most modern countries in the world and is a leader among European
nations. Since 1958, it has constructed a presidential democracy resistant to
the instabilities experienced in earlier parliamentary democracies. In recent
years, its reconciliation and cooperation with Germany have proved central to
the economic integration of Europe, including the introduction of a common
exchange currency, the euro, in January 1999. At present, France is at the
forefront of efforts to develop the EU's military capabilities to supplement
progress toward an EU foreign policy."),
- new CountryRecord("Europe", "Italy", "IT", 301230, 58133509,
1698, new Date(1861 - 1900, 2, 17), "republic", 5, "Rome", true,
"http://en.wikipedia.org/wiki/Italy", "Italy became a nation-state in 1861
when the regional states of the peninsula, along with Sardinia and Sicily,
were united under King Victor EMMANUEL II. An era of parliamentary government
came to a close in the early 1920s when Benito MUSSOLINI established a
Fascist dictatorship. His disastrous alliance with Nazi Germany led to
Italy's defeat in World War II. A democratic republic replaced the monarchy
in 1946 and economic revival followed. Italy was a charter member of NATO and
the European Economic Community (EEC). It has been at the forefront of
European economic and political unification, joining the Economic and
Monetary Union in 1999. Persistent problems include illegal immigration,
organized crime, corruption, high unemployment, sluggish economic growth, and
the low incomes and technical !
standards of southern Italy compared with the prosperous north."),
- new CountryRecord("Europe", "Russia", "RS", 17075200,
142893540, 1589, new Date(1991 - 1900, 7, 24), "federation", 3, "Moscow",
true, "http://en.wikipedia.org/wiki/Russia", "Founded in the 12th century,
the Principality of Muscovy, was able to emerge from over 200 years of Mongol
domination (13th-15th centuries) and to gradually conquer and absorb
surrounding principalities. In the early 17th century, a new Romanov Dynasty
continued this policy of expansion across Siberia to the Pacific. Under PETER
I (ruled 1682-1725), hegemony was extended to the Baltic Sea and the country
was renamed the Russian Empire. During the 19th century, more territorial
acquisitions were made in Europe and Asia. Repeated devastating defeats of
the Russian army in World War I led to widespread rioting in the major cities
of the Russian Empire and to the overthrow in 1917 of the imperial household.
The Communists under Vladimir LENIN seized power soon after and formed the
USSR. The !
brutal rule of Iosif STALIN (1928-53) strengthened communist rule and
Russian dominance of the Soviet Union at a cost of tens of millions of lives.
The Soviet economy and society stagnated in the following decades until
General Secretary Mikhail GORBACHEV (1985-91) introduced glasnost (openness)
and perestroika (restructuring) in an attempt to modernize Communism, but his
initiatives inadvertently released forces that by December 1991 splintered
the USSR into Russia and 14 other independent republics. Since then, Russia
has struggled in its efforts to build a democratic political system and
market economy to replace the strict social, political, and economic controls
of the Communist period. While some progress has been made on the economic
front, recent years have seen a recentralization of power under Vladimir
PUTIN and the erosion of nascent democratic institutions. A determined
guerrilla conflict still plagues Russia in Chechnya and threatens to
destabilize the North Ca!
ucasus region."),
- new CountryRecord("South America", "Brazil", "BR", 8511965,
188078227, 1556, new Date(1822 - 1900, 8, 7), "federative republic", 3,
"Brasilia", false, "http://en.wikipedia.org/wiki/Brazil", "Following three
centuries under the rule of Portugal, Brazil became an independent nation in
1822 and a republic in 1889. By far the largest and most populous country in
South America, Brazil overcame more than half a century of military
intervention in the governance of the country when in 1985 the military
regime peacefully ceded power to civilian rulers. Brazil continues to pursue
industrial and agricultural growth and development of its interior.
Exploiting vast natural resources and a large labor pool, it is today South
America's leading economic power and a regional leader. Highly unequal income
distribution remains a pressing problem."),
- new CountryRecord("North America", "Canada", "CA", 9984670,
33098932, 1114, new Date(1867 - 1900, 6, 1), "constitutional monarchy with
parliamentary democracy and federation", 1, "Ottawa", true,
"http://en.wikipedia.org/wiki/Canada", "A land of vast distances and rich
natural resources, Canada became a self-governing dominion in 1867 while
retaining ties to the British crown. Economically and technologically the
nation has developed in parallel with the US, its neighbor to the south
across an unfortified border. Canada's paramount political problem is meeting
public demands for quality improvements in health care and education services
after a decade of budget cuts. Canada also faces questions about integrity in
government following revelations regarding a corruption scandal in the
federal government that has helped revive the fortunes of separatists in
predominantly francophone Quebec."),
- new CountryRecord("North America", "Mexico", "MX", 1972550,
107449525, 1067, new Date(1810 - 1900, 8, 16), "federal republic", 2, "Mexico
(Distrito Federal)", false, "http://en.wikipedia.org/wiki/Mexico", "The site
of advanced Amerindian civilizations, Mexico came under Spanish rule for
three centuries before achieving independence early in the 19th century. A
devaluation of the peso in late 1994 threw Mexico into economic turmoil,
triggering the worst recession in over half a century. The nation continues
to make an impressive recovery. Ongoing economic and social concerns include
low real wages, underemployment for a large segment of the population,
inequitable income distribution, and few advancement opportunities for the
largely Amerindian population in the impoverished southern states. Elections
held in July 2000 marked the first time since the 1910 Mexican Revolution
that the opposition defeated the party in government, the Institutional
Revolutionary !
Party (PRI). Vicente FOX of the National Action Party (PAN) was sworn in on
1 December 2000 as the first chief executive elected in free and fair
elections."),
- new CountryRecord("Europe", "Spain", "SP", 504782, 40397842,
1029, new Date(1492 - 1900, 0, 1), "parliamentary monarchy", 4, "Madrid",
false, "http://en.wikipedia.org/wiki/Spain", "Spain's powerful world empire
of the 16th and 17th centuries ultimately yielded command of the seas to
England. Subsequent failure to embrace the mercantile and industrial
revolutions caused the country to fall behind Britain, France, and Germany in
economic and political power. Spain remained neutral in World Wars I and II,
but suffered through a devastating civil war (1936-39). A peaceful transition
to democracy following the death of dictator Francisco FRANCO in 1975, and
rapid economic modernization (Spain joined the EU in 1986), have given Spain
one of the most dynamic economies in Europe and made it a global champion of
freedom. Continuing challenges include Basque Fatherland and Liberty (ETA)
terrorism and relatively high unemployment."),
- new CountryRecord("Asia", "South Korea", "KS", 98480,
48846823, 965.3, new Date(1945 - 1900, 7, 15), "republic", 5, "Seoul", false,
"http://en.wikipedia.org/wiki/South_korea", "Korea was an independent kingdom
for much of the past millennium. Following its victory in the Russo-Japanese
War in 1905, Japan occupied Korea; five years later it formally annexed the
entire peninsula. After World War II, a Republic of Korea (ROK) was set up in
the southern half of the Korean Peninsula while a Communist-style government
was installed in the north (the DPRK). During the Korean War (1950-53), US
troops and UN forces fought alongside soldiers from the ROK to defend South
Korea from DPRK attacks supported by China and the Soviet Union. An armistice
was signed in 1953, splitting the peninsula along a demilitarized zone at
about the 38th parallel. Thereafter, South Korea achieved rapid economic
growth with per capita income rising to roughly 14 times the level of North
Ko!
rea. In 1993, KIM Yo'ng-sam became South Korea's first civilian president
following 32 years of military rule. South Korea today is a fully functioning
modern democracy. In June 2000, a historic first North-South summit took
place between the South's President KIM Tae-chung and the North's leader KIM
Jong Il."),
- new CountryRecord("Asia", "Indonesia", "ID", 1919440,
245452739, 865.6, new Date(1945 - 1900, 7, 17), "republic", 5, "Jakarta",
false, "http://en.wikipedia.org/wiki/Indonesia", "The Dutch began to colonize
Indonesia in the early 17th century; the islands were occupied by Japan from
1942 to 1945. Indonesia declared its independence after Japan's surrender,
but it required four years of intermittent negotiations, recurring
hostilities, and UN mediation before the Netherlands agreed to relinquish its
colony. Indonesia is the world's largest archipelagic state and home to the
world's largest Muslim population. Current issues include: alleviating
poverty, preventing terrorism, consolidating democracy after four decades of
authoritarianism, implementing financial sector reforms, stemming corruption,
and holding the military and police accountable for human rights violations.
Indonesia was the nation worst hit by the December 2004 tsunami, which
particularly affect!
ed Aceh province causing over 100,000 deaths and over $4 billion in damage.
An additional earthquake in March 2005 created heavy destruction on the
island of Nias. Reconstruction in these areas may take up to a decade. In
2005, Indonesia reached a historic peace agreement with armed separatists in
Aceh, but it continues to face a low intensity separatist guerilla movement
in Papua.")
- };
- }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Added: trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/idokData.java
==============================================================================
--- (empty file)
+++ trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client/idokData.java Thu
Oct 1 08:50:37 2009
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2006-2008 iDok team.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
+ */
+
+
+package ch.psi.idok.gwt.twiki.client;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.user.client.Window;
+
+public class idokData {
+ private static IdokRecord[] records;
+ private static IdokPictureRecord[] picrecords;
+
+ /**
+ * Date format for rendering search results
+ */
+// final static private DateTimeFormat dataFormatOut = DateTimeFormat
+// .getFormat("dd.MM.yyy - HH:mm");
+
+
+ public static IdokRecord[] getRecords(Iterator<SearchResultItem> it) {
+ if (records == null) {
+ records = getNewRecords(it);
+ }
+ return records;
+ }
+
+ public static IdokPictureRecord[]
getPictureRecord(Iterator<SearchResultItem> it){
+ if (picrecords == null) {
+ picrecords = getNewPictureRecords(it);
+ }
+
+ return picrecords;
+ }
+
+ public static IdokRecord[] getNewRecords(Iterator<SearchResultItem> it)
{
+
+ final List <IdokRecord> record = new ArrayList<IdokRecord>();
+
+ while (it.hasNext()) {
+
+ final SearchResultItem hit = it.next();
+// String dateString =
dataFormatOut.format(hit.getDate());
+
+
+
+ final String filename = hit.getName();
+ final String svnUrl =
IdokSearchUtil.getDocumentURL(hit);
+ final String url =
svnUrl.replaceFirst("!svn/ver/.*/", "");
+ final String revision = hit.getRev();
+ final int size = (int)hit.getSize();
+ final Date date = hit.getDate();
+ final String author = hit.getAuthor();
+ final String environment = hit.getEnv();
+
+
+//
RequestBuilder.GET,url.replaceFirst("!svn/ver/.*/", "")
+ RequestBuilder builder = new
RequestBuilder(RequestBuilder.GET,"http://www.google.ch");
+
+ try {
+ Request request = builder.sendRequest(null,
new RequestCallback() {
+ public void onError(Request request,
Throwable exception) {
+ // Couldn't connect to server (could
be timeout, SOP violation, etc.)
+ Window.alert(exception.toString());
+ }
+
+ public void onResponseReceived(Request
request, Response response) {
+ if (200 == response.getStatusCode()) {
+ // Process the response in
response.getText()
+ String filename = hit.getName();
+ String url =
IdokSearchUtil.getDocumentURL(hit);
+ String revision = hit.getRev();
+ int size = (int)hit.getSize();
+ Date date = hit.getDate();
+ String author = hit.getAuthor();
+ record.add(new
IdokRecord(filename,url,revision,size, date, author,environment));
+ } else {
+ // Handle the error. Can get the
status text from response.getStatusText()
+ }
+ }
+ });
+ } catch (RequestException e) {
+ // Couldn't connect to server
+ e.printStackTrace();
+ }
+
+
+
+ record.add(new IdokRecord(filename,url,revision,size,
date, author, environment));
+ }
+
+ IdokRecord[] table = new IdokRecord[record.size()];
+ for (int i = 0; i < record.size(); i++) {
+ table[i]=record.get(i);
+ }
+
+ return table;
+ }
+
+
+ public static IdokPictureRecord[]
getNewPictureRecords(Iterator<SearchResultItem> it) {
+
+ final List <IdokPictureRecord> picrecords = new
ArrayList<IdokPictureRecord>();
+
+ while (it.hasNext()) {
+
+ final SearchResultItem hit = it.next();
+
+ String revision = hit.getRev();
+ int size = (int)hit.getSize();
+ Date date = hit.getDate();
+ String filename = hit.getName();
+ String url = IdokSearchUtil.getDocumentURL(hit);
+ String author = hit.getAuthor();
+
+// if (responseCode != 200 ) {
+// continue;
+// }
+
+ picrecords.add(new
IdokPictureRecord(filename,url,revision,size, date, author));
+ }
+
+ IdokPictureRecord[] table = new IdokPictureRecord[picrecords.size()];
+ for (int i = 0; i < picrecords.size(); i++) {
+ table[i]=picrecords.get(i);
+ }
+
+ return table;
+ }
+
+}
- [idok-commit] idok commit r390 - trunk/sites/psi/java/ch/psi/idok/gwt/twiki/client, AFS account Florian Huebner, 10/01/2009
Archive powered by MHonArc 2.6.19.