| Author |
Message |
|
|
Without any user action: You can replace the button with a outputText component, move the code in doSomthing() into the constructor and thats it!
|
 |
|
|
Here is a working example with a thread instead of a scheduled task:
Code:
@ManagedBean(name = "prendererTestView")
@SessionScoped
public class PortableRendererTestView implements Serializable {
public final String GROUPNAME = "mygroup";
private String buttonText = "click me";
public PortableRendererTestView() {
PushRenderer.addCurrentSession(GROUPNAME);
}
public void doSomething(ActionEvent event) {
buttonText = "In progress";
new Thread(new MyRunnable(this)).start();
}
public String getButtonText() {
return buttonText;
}
public void setButtonText(String buttonText) {
this.buttonText = buttonText;
}
public class MyRunnable implements Runnable {
private PortableRendererTestView view;
private PortableRenderer renderer;
public MyRunnable(PortableRendererTestView view) {
this.view = view;
renderer = PushRenderer.getPortableRenderer();
}
@Override
public void run() {
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
e.printStackTrace();
}
this.view.setButtonText("click me again");
renderer.render(GROUPNAME);
}
}
}
Code:
<ice:commandButton value="#{prendererTestView.buttonText}" actionListener="#{prendererTestView.doSomething}"/>
If you click on the Button the button text changed from "click me" to "in progress" and a thread starts. After 30 seconds the button-text changed to "click me again".
|
 |
|
|
Hello,
i never tried it but i think you can activate a scheduler on first request. And in the scheduled task you use the push api. Look at "Pushing from outside the JSF context" in the docs:
http://wiki.icefaces.org/display/ICE/Ajax+Push+-+APIs
Regards,
jonas
|
 |
|
|
Hello,
i get the following warning:
WARN: No response sent to request '/myapp/faces/javax.faces.resource/listen.icepush' with ICEfaces ID 'null' from 127.0.0.1 in 600 minutes. Unblocking thread 'btpool0-7'.
The ICEfaces ID is null!
The ThreadBlockingAdaptingServlet gets the ICEfaces Id with:
Code:
request.getParameter("ice.session")
Do I have to set the ice.session request parameter for myself?
For example on user login:
Code:
request.setParameter("ice.session", username + sessionid);
Best regards,
Jonas
|
 |
|
|
Another solution-> Use a JSF2.0 UIComponent instead of facelets:
http://blogs.sun.com/enterprisetechtips/entry/true_abstraction_composite_ui_components
Now i can handle optional attributes with default values...here is one example component:
Code:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:composite="http://java.sun.com/jsf/composite">
<head><title>(For validation only)</title></head>
<body>
<composite:interface
displayName="Input Text"
shortDescription="Input Text component." >
<composite:attribute name="id" required="true"
displayName="Id"
shortDescription="Id of the intput-text component"/>
<composite:attribute name="label" required="true"
displayName="Label"
shortDescription="Label"/>
<composite:attribute name="required" default="false"
displayName="required"
shortDescription="Required"/>
<composite:attribute name="value"
displayName="value"
shortDescription="value"/>
</composite:interface>
<composite:implementation>
<div style="position: relative;width: 100px; float:left; margin-top:5px; text-align: right;">
<ice:outputLabel value="#{cc.attrs.label}:" for="#{cc.attrs.id}" styleClass="custIceOutLbl"/>
</div>
<div style="position: relative;">
<ice:inputText id="#{cc.attrs.id}_inputText" label="#{cc.attrs.label}" required="#{cc.attrs.required}" value="#{cc.attrs.value}"/>
<ice:message id="error_#{cc.attrs.id}" for="#{cc.attrs.id}_inputText" showSummary="true" showDetail="true" effect="#{globalEffectBean.newEffect}" tooltip="true"/>
</div>
</composite:implementation>
</body>
</html>
Best regards,
Jonas
|
 |
|
|
|
...
|
 |
|
|
With Firebug i can see that the app tries to get
http://localhost:9090/myapp/faces/javax.faces.resource/listen.icepush
and gets a http 404 Not found error.
I noticed something else...(not related to the topic)
Icefaces loads a javascript file from:
http://yui.yahooapis.com/combo?3.1.1/build/oop/oop-min.js&3.1.1/build/event-custom/event-custom-min.js&3.1.1/build/attribute/attribute-base-min.js&3.1.1/build/base/base-base-min.js&3.1.1/build/event/event-base-min.js&3.1.1/build/dom/dom-min.js&3.1.1/build/node/node-min.js&3.1.1/build/event/event-delegate-min.js
Why is it done and what is if the app server has no access to the yahooapi.com adress?
Best Regards,
Jonas
|
 |
|
|
a simular problem:
http://www.icefaces.org/JForum/posts/list/17876.page
but i won't change my servlet mapping from "/faces/*" to "*.jsf".
|
 |
|
|
Hello,
i updated from Beta1 to Beta2 and get the following warning:
WARNING: JSF1091: No mime type could be found for file listen.icepush. To resolve this, add a mime-type mapping to the applications web.xml.
in german:
com.sun.faces.context.ExternalContextImpl getMimeType
WARNUNG: JSF1091: Für Datei listen.icepush konnte kein Mime-Typ gefunden werden. Fügen Sie eine Mime-Typ-Zuordnung zur web.xml der Anwendung hinzu, um dies aufzulösen.
I suspect that the server push not working correct, because the progress bar of the outputProgress Component is not working for me.
How can I fix it.
Best Regards,
Jonas
|
 |
|
|
Ok i have found the solution here:
http://www.ibm.com/developerworks/java/library/j-facelets/
There is a example "Passing Actions":
In custom component -> action="#{backingBean[action]}"
Code:
<h:commandLink id="#{action}" value="#{label}"
action="#{backingBean[action]}"/>
Using:
Code:
<cust:columnCommand label="Edit" action="editCD"
backingBean="${CDManagerBean}"/>
It works with validators too ;-)
Best Regards,
Jonas
EDIT: Still one problem: How to handle optional attributes?
errormessage: //C:/.../META-INF/components/inputSecret-component.xhtml @7,206 validator="#{backingBean[validator]}": Target Unreachable, identifier 'backingBean' resolved to null
|
 |
|
|
Hello,
I want to create a custom component. But I don't know how i can set default values for attributes with flag required = false. And I can not refer validators from view.
Here is my example component (inputSecret-component.xhtml):
Code:
<div xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:f="http://java.sun.com/jsf/core">
<ice:outputLabel value="#{label}:" for="#{id}" styleClass="custIceOutLbl"/>
<ice:inputSecret id="#{id}" label="#{label}" required="#{required}" value="#{value}" immediate="#{immediate}" partialSubmit="#{partialSubmit}" validator="#{validator}" binding="#{binding}"/>
<ice:message id="error_#{id}" for="#{id}"/>
</div>
First example:
Code:
<cust:inputSecret id="password" label="new Password" value="#{myView.newPassword}" immediate="true" partialSubmit="true" validator="#{myView.validateNewPassword}" />
It appears the faces message:
//C:/...META-INF/components/inputSecret-component.xhtml @4,193 validator="#{validator}":
/detail.xhtml @26,189 validator="#{myView.validateNewPassword}":
The class 'de...MyView$$EnhancerByCGLIB$$123c457' does not have the property 'validateNewPassword'.
Second Example without validator:
Code:
<cust:inputSecret id="password" label="new Password" value="#{myView.newPassword}" immediate="true" partialSubmit="true" />
It appears the faces message:
//C:/...META-INF/components/inputSecret-component.xhtml @4,193 validator="#{validator}":
Identity 'validator' was null and was unable to invoke
Is there a simple solution for this?
Best Regards,
Jonas
|
 |
|
|
In Firefox: On mouseover the style of the submenus changed from
Code:
left: 241px; top: 1px; display: none;
to
Code:
This doesn't happen in IE8 or Chrome.
The DIV for the Menu has no onmouseover attribute. There must be a javascript snippet that fires the mouseover event for the div over the id...or so..
Here is a example div (from Chrome):
Code:
<div xmlns="http://www.w3.org/1999/xhtml" class="iceMnuBarItem"
id="navigationMenuForm:j_idt13:j_idt14:_6"
onmouseout="Ice.Menu.hideOnMouseOut('navigationMenuForm:j_idt13',event);"><a
class="iceCmdLnk" href="javascript:;"
id="navigationMenuForm:j_idt13:j_idt14:_6:link" onblur="setFocus('');"
onclick="var form=formOf(this);form['navigationMenuForm:j_idcl'].value='navigationMenuForm:j_idt13:j_idt14:_6:link';return iceSubmit(form,this,event);"
onfocus="setFocus(this.id);"><span class="iceOutTxt iceMnuItmLabel"
id="navigationMenuForm:j_idt13:j_idt14:_6:out">Administration</span></a></div>
<div xmlns="http://www.w3.org/1999/xhtml" class="iceMnuBarSubMenu"
id="navigationMenuForm:j_idt13:j_idt14:_6_sub" style="display: none">
Where can I find the javascript snippet which adds the onmouseover event to the iceMnuBarItem div?
Best Regards,
Jonas
|
 |
|
|
Hello,
i have the same problem in IE8. In Firefox the menu works.
Regards,
Jonas
|
 |
|
|
jonas.esser wrote:
Hello,
[s]My Posts with BBCode are not rendered correct. Why?[/s]
Example:
Code:
public class MyClazz(){
private String myString;
}
See screenshot...
Best Regards,
Jonas
correction: Only in the preview it doesn't work... sorry... forget my question.
|
 |
|
|
Hello,
My Posts with BBCode are not rendered correct. Why?
Example:
Code:
public class MyClazz(){
private String myString;
}
See screenshot...
Best Regards,
Jonas
correction: Only in the preview it doesn't work... sorry... forget my question.
|
 |
|
|