-
1. Re: dataFilterSlider
ilya_shaikovsky Jun 18, 2007 9:45 AM (in response to puh)try to explore the demo at [url]http://livedemo.exadel.com/richfaces-demo/[/urk]
-
-
3. Re: dataFilterSlider
puh Jun 19, 2007 5:08 AM (in response to puh)Yes I have already explored this, but know I have the following mistake:
org.apache.jasper.JasperException: org.richfaces.component.EnclosingFormRequiredException: class org.richfaces.component.html.HtmlDataFilterSlider (id="slider_1") did not find parent form.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
root cause
And here is my jsp-code:
[CODE]
<f:view>
<a4j:outputPanel id="slider-body">
<rich:dataFilterSlider sliderListener="#{suggestionBox.doSlide}"
startRange="0"
endRange="50000"
increment="10000"
handleValue="1"
for="scoreIndex"
forValRef="suggstionBox.result"
filterBy="getScore"
manualInput="true"
onSlide="true"
onChange="true"
storeResults="true"
trackStyleClass="track"
width="400px"
styleClass="slider-container"
rangeStyleClass="range"
trailer="true"
trailerStyleClass="trailer"
handleStyleClass="handle"
id="slider_1" >
</rich:dataFilterSlider>
</a4j:outputPanel>
<rich:dataTable id="scoreIndex" style="width: 100%"
styleClass="standardTable"
headerClass="standardTable_Header"
var="table" value="#{suggestionBox.result}" >
<h:column>
<f:facet name="header">
<h:outputText value="TITLE" />
</f:facet>
<h:outputText value="#{table.title}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="PMID" />
</f:facet>
<h:outputText value="#{table.pmid}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="SCORE" />
</f:facet>
<h:outputText value="#{table.score}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="SOURCE" />
</f:facet>
<h:outputText value="#{table.source}" />
</h:column>
</rich:dataTable>
</f:view>
[/CODE]
Do you know, what to do?
Thank you!! -
4. Re: dataFilterSlider
ilya_shaikovsky Jun 19, 2007 9:18 AM (in response to puh)Data Filter Slider as any component that send ajax or non-ajax reuest requires form around. So wrap your table and slider with the form element.
-
5. Re: dataFilterSlider
puh Jun 19, 2007 11:06 AM (in response to puh)Yes I have seen this! Sorry!
But know the slider slides, but he doesn´t change the dataTable. If I change the slider value I get a NullPointerEcxeption. It seems, that the slider doesn`t get the information, what he has to slide.
Perhabs you know, what I am making wrong??
Here is the code of my jsp:
<a4j:form id="form1" reRender="list-body" ajaxSubmit="true" ignoreDupResponses="true" requestDelay="100">
<a4j:region id="stat1">
<a4j:outputPanel id="slider-body">
<rich:dataFilterSlider
for="scoreIndex"
forValRef="suggestionBox.result"
filterBy="getPmid"
manualInput="true"
onSlide="true"
onChange="true"
storeResults="true"
trackStyleClass="track"
width="400px"
styleClass="slider-container"
rangeStyleClass="range"
trailer="true"
trailerStyleClass="trailer"
handleStyleClass="handle"
startRange="1000000"
endRange="100000000"
increment="1000000"
handleValue="1"
id="slider_1" >
</rich:dataFilterSlider>
</a4j:outputPanel>
<a4j:outputPanel id="list-body">
<rich:dataTable id="scoreIndex" style="width: 100%"
styleClass="standardTable"
headerClass="standardTable_Header"
var="table" value="#{suggestionBox.result}" >
<h:column>
<f:facet name="header">
<h:outputText value="TITLE" />
</f:facet>
<h:outputText value="#{table.title}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="PMID" />
</f:facet>
<h:outputText value="#{table.pmid}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="SCORE" />
</f:facet>
<h:outputText value="#{table.score}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="SOURCE" />
</f:facet>
<h:outputText value="#{table.source}" />
</h:column>
</rich:dataTable>
</a4j:outputPanel>
</a4j:region>
</a4j:form>
</f:view>
and here is the code of my beans:
Bean1:
import java.io.File;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.Vector;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.richfaces.event.DataFilterSliderEvent;
public class SG implements Serializable
{
/**
*
*/
private static final long serialVersionUID = 1L;
private String property;
private List data;
private List tokens;
private String rows;
private String first;
private String cellspacing;
private String cellpadding;
private String minchars;
private String frequency;
private String rules;
private boolean check;
private String shadowDepth;
private String border = "1";
private String width = "200";
private String height = "150";
private String shadowOpacity = "4";
private ArrayList result;
private ArrayList list;
public List autocomplete(Object event) {
List v = new Vector();
String prefix = event.toString();
StringTokenizer token = new StringTokenizer (prefix, ",");
while (token.hasMoreTokens()) {
prefix = token.nextToken();
if(prefix.length()>0){
List tmp = new Vector();
tmp = executeSuggestQuery("select * from diseaseresult where title like '"+prefix+"%' limit 0,50");
v.addAll(tmp);
//v.addAll(tmp+","+standSchon);
}
}
return v;
}
private List executeSuggestQuery(String query) {
String dbName = "datenmodell";
String host = "localhost:3309";
String user = "root";
String pw = "280280";
Vector v = null;
Connection conn;
Statement stmt;
ResultSet rs;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://"+host+"/"+dbName,user,pw);
stmt = conn.createStatement();
rs = stmt.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
v = new Vector(rs.getFetchSize());
while(rs.next()){
Data d = new Data(rs.getString(1));
v.add(d);
}
}catch (SQLException e) {
e.printStackTrace();
v = new Vector();
v.add(e.getMessage());
return v;
}catch (ClassNotFoundException e) {
e.printStackTrace();
v = new Vector();
v.add(e.getMessage());
return v;
}
return v;
}
public String Testausgabe(){
try {
StringTokenizer token = new StringTokenizer(property, ",");
String suchText = "";
if (token.countTokens() > 0) {
while (token.hasMoreTokens()) {
suchText = suchText + "\"" + token.nextToken()+"\"";
}
} else {
suchText = property;
}
this.list = search(suchText, medline_index, medline_fields);
result = new ArrayList();
for(int i = 1; i < list.size(); i= i + 4)
{
Table table = new Table(this.list.get(i+3).toString(), this.list.get(i).toString(), this.list.get(i+1).toString(), this.list.get(i+2).toString());
result.add(table);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "success";
}
public ArrayList getResult() {
return result;
}
double schwelli=0.0;
public static String entry_medline = "PMID";//Gibt Entry ID an... Muss ich noch was ändern!!!
public static String[] medline_fields ={"ABSTRACTS", "TITLE"};// Felder, die durchsucht werden sollen
public static File medline_index = new File("C:/Dokumente und Einstellungen/Kirsten/Desktop/Medline_Index_Standard");//Angabe, wo der Index ist... z.B. C:\\Index_Medline
/** Voila... Die Suchmethode... Braucht als Parameter den SuchString, den Index und die Felder...
* Gibt dir dann eine ArrayList zurück, die folgendermassen aufgebaut ist:
* 1.Suchwort
* 2.Entry_ID
* 3.Score
* 4.Quelle
* Die ganze Methode ist bis jetzt noch nicht das NonplusUltra, aber sie funzt für den Medline-index ganz vorzüglich!!!
* Alles getrennt durch einen Tab ("\t")...
* @param q
* @param index
* @param fields
* @return
* @throws Exception
*/
public ArrayList search(String q, File index, String [] fields) throws Exception {
Directory fsDir = FSDirectory.getDirectory(index, false);
IndexSearcher is = new IndexSearcher(fsDir);
Analyzer analyzer = new StandardAnalyzer();
QueryParser queryparser = new MultiFieldQueryParser (fields, analyzer);
Query query = queryparser.parse(q);
Hits hits = is.search(query);
ArrayList list = new ArrayList();
System.out.println(hits.length() + " Treffer insgesamt ohne Schwellwert-Filterung gefunden!");
for (int i = 0; i < hits.length(); i++) {
if (hits.score(i)>0.8){
Document doc = hits.doc(i);
//list.add(q+"\n\n"+doc.get(entry_medline)+"\n\n"+hits.score(i)+"\n\n"+"MEDLINE");
list.add(q);
list.add(doc.get(entry_medline));
float sco = hits.score(i);
list.add((new Float(sco)).toString());//(hits.score(i));
list.add("MEDLINE");
//System.out.println(i+" "+list.get(i));
}
}
return list;
}
/** Diese Methode setzt den Score-Schwellwert schwelli*/
void setSchwelli (double zahl){
schwelli = zahl;
}
/*public static void main (String [] args) {
SucheFürKirsten kirsten = new SucheFürKirsten();
try {
String q = "aarskog syndrome";
kirsten.search("\""+q+"\"",medline_index, medline_fields);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
public List getData() {
return data;
}
public void setData(List data) {
this.data = data;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
public String getCellpadding() {
return cellpadding;
}
public void setCellpadding(String cellpadding) {
this.cellpadding = cellpadding;
}
public String getCellspacing() {
return cellspacing;
}
public void setCellspacing(String cellspacing) {
this.cellspacing = cellspacing;
}
public boolean isCheck() {
return check;
}
public void setCheck(boolean check) {
this.check = check;
}
public String getFirst() {
return first;
}
public int getIntFirst() {
return Integer.parseInt(getFirst());
}
public void setFirst(String first) {
this.first = first;
}
public String getFrequency() {
return frequency;
}
public double getDoubleFrequency() {
return Double.parseDouble(getFrequency());
}
public void setFrequency(String frequency) {
this.frequency = frequency;
}
public String getMinchars() {
return minchars;
}
public void setMinchars(String minchars) {
this.minchars = minchars;
}
public String getRows() {
return rows;
}
public int getIntRows() {
return Integer.parseInt(getRows());
}
public void setRows(String rows) {
this.rows = rows;
}
public String getRules() {
return rules;
}
public void setRules(String rules) {
this.rules = rules;
}
public List getTokens() {
return tokens;
}
public void setTokens(List tokens) {
this.tokens = tokens;
}
public void OnSelect() {
System.out.print("Onselect works!!!");
}
public String getShadowDepth() {
return shadowDepth;
}
public void setShadowDepth(String shadowDepth) {
this.shadowDepth = shadowDepth;
}
public String getBorder() {
return border;
}
public void setBorder(String border) {
this.border = border;
}
public String getWidth() {
return width;
}
public void setWidth(String width) {
this.width = width;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
/*public void doSlide(DataFilterSliderEvent event) {
Integer oldSliderVal = event.getOldSliderVal();
event.g
Integer newSliderVal = event.getNewSliderVal();
System.out.println("Old Slider Value = " + oldSliderVal.toString() + " " + "New Slider Value = " + newSliderVal.toString());
}*/
}
and my Table-Bean:
import java.io.Serializable;
/**
* @author Kirsten
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Table implements Serializable{
private String pmid;
private String title;
private String source;
private String score;
/**
*
*/
public Table(String title, String pmid, String score, String source) {
this.title=title;
this.pmid=pmid;
this.score=score;
this.source=source;
}
/**
* @return Returns the pmid.
*/
public String getPmid() {
return pmid;
}
/**
* @return Returns the score.
*/
public String getScore() {
return score;
}
/**
* @return Returns the source.
*/
public String getSource() {
return source;
}
/**
* @return Returns the title.
*/
public String getTitle() {
return title;
}
/**
* @return Returns the pmid.
*/
public void setPmid(String pmid) {
this.pmid = pmid;
}
/**
* @return Returns the score.
*/
public void setScore(String score) {
this.score = score;
}
/**
* @return Returns the source.
*/
public void setSource(String source) {
this.source = source;
}
/**
* @return Returns the title.
*/
public void setTitle(String title) {
this.title = title;
}
}
Perhabs you know, what I have to change, so that it works right?
Thank you!! -
6. Re: dataFilterSlider
ilya_shaikovsky Jun 19, 2007 11:40 AM (in response to puh)Data Filter Slider - ajaxed out of the box. remove ajaxSubmit from the form element
-
7. Re: dataFilterSlider
ilya_shaikovsky Jun 19, 2007 11:42 AM (in response to puh)but it mustn't be the reason. what about the exception. Paste it please.
-
8. Re: dataFilterSlider
puh Jun 19, 2007 12:03 PM (in response to puh)The mistake is gone now. Thank you. But the slider doesn`t change any value inside my table. Do you know why?? Do I have to write some code into my bean??
-
9. Re: dataFilterSlider
ilya_shaikovsky Jun 19, 2007 12:14 PM (in response to puh)ok. The last question I think about your environment. (JSF and RF versions)
-
10. Re: dataFilterSlider
puh Jun 19, 2007 12:17 PM (in response to puh)I use richfaces 3.0 and ajax4jsf1.1.0
But do you think, that I have to fill in something in my bean, that is missing know to refer to the column I want to change? -
11. Re: dataFilterSlider
ilya_shaikovsky Jun 19, 2007 12:25 PM (in response to puh)Please make an update to 3.0.1 and 1.1.1 or 3.0.2 and 1.1.2 SNAPSHOTS. Release version was consists numerous bugs fixed later.
-
12. Re: dataFilterSlider
puh Jun 19, 2007 12:59 PM (in response to puh)I have downloaded ajax4jsf the latest version. Where can I download the SNAPSHOTS?? I am too blind to find it.
-
13. Re: dataFilterSlider
puh Jun 19, 2007 1:22 PM (in response to puh)With the new ajax4jsf it doesn`t work. Perhaps with the new SNAPSHOTS, but where to download? Do you think that there is something wrong in my code? Could you please take a look at it.
-
14. Re: dataFilterSlider
puh Jun 19, 2007 1:25 PM (in response to puh)Oh, I think that I have found it. Now I have Snapshots 3.0.1 and ajax4jsf the latest version. But it doesn`t work. Help Please!