[JBoss Seam] - Re: Charts
by jknotzke
Here's my code:
chartProcessor.xhtml
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| template="layout/template.xhtml">
|
| <ui:define name="body">
|
| <h:messages globalOnly="true" styleClass="message"/>
|
| <h:form id="chartProcessorForm">
|
| <rich:panel>
| <f:facet name="header">chartProcessor</f:facet>
|
| <s:decorate id="nameDecoration" template="layout/edit.xhtml">
| <s:graphicImage value="#{chartprocesserHome.chart}" />
| </s:decorate>
|
| <div style="clear:both"/>
|
| </rich:panel>
|
| <div class="actionButtons">
| <h:commandButton id="save"
| value="Save"
| action="#{chartProcessorHome.persist}"
| rendered="#{!chartProcessorHome.managed}"/>
| <h:commandButton id="update"
| value="Save"
| action="#{chartProcessorHome.update}"
| rendered="#{chartProcessorHome.managed}"/>
| <h:commandButton id="delete"
| value="Delete"
| action="#{chartProcessorHome.remove}"
| rendered="#{chartProcessorHome.managed}"/>
| <s:button propagation="end"
| id="done"
| value="Done"
| view="/chartProcessorList.xhtml"/>
| </div>
|
| </h:form>
|
| </ui:define>
|
| </ui:composition>
|
And ChartProcessor.java
| package com.techsolcom.powermanager;
|
| import java.io.IOException;
| import java.io.Serializable;
|
| import javax.persistence.Entity;
| import javax.persistence.EntityManager;
|
| import org.jboss.seam.annotations.Factory;
| import org.jboss.seam.annotations.In;
| import javax.persistence.Id;
| import org.jboss.seam.annotations.Name;
| import org.jfree.chart.ChartFactory;
| import org.jfree.chart.ChartUtilities;
| import org.jfree.chart.JFreeChart;
| import org.jfree.chart.plot.PlotOrientation;
| import org.jfree.data.category.DefaultCategoryDataset;
| import org.jfree.data.xy.XYSeries;
| import org.jfree.data.xy.XYSeriesCollection;
| import org.hibernate.validator.NotNull;
|
| @Entity
| public class ChartProcessor implements Serializable
| {
| byte[] chart;
|
| @Factory("chart")
| public void createChart()
| {
|
| System.out.println("Trying to create a FREAKING CHART!!");
|
| XYSeries series = new XYSeries("XYGraph");
| series.add(1, 1);
| series.add(1, 2);
| series.add(2, 1);
| series.add(3, 9);
| series.add(4, 10);
| // Add the series to your data set
| XYSeriesCollection dataset = new XYSeriesCollection();
| dataset.addSeries(series);
| // Generate the graph
| JFreeChart chart = ChartFactory.createXYLineChart("XY Chart", // Title
| "x-axis", // x-axis Label
| "y-axis", // y-axis Label
| dataset, // Dataset
| PlotOrientation.VERTICAL, // Plot Orientation
| true, // Show Legend
| true, // Use tooltips
| false // Configure chart to generate URLs?
| );
|
| try{
| this.chart = ChartUtilities.encodeAsPNG(chart.createBufferedImage(400, 400));
| } catch (IOException e){
| e.printStackTrace();
| }
|
| }
| }
|
All I get is a little graphic icon.. No exception.. Oh, and " System.out.println("Trying to create a FREAKING CHART!!");" never gets executed.. at least not that I can see.
Thanks
J
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070259#4070259
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070259
18Â years, 9Â months
[Messaging, JMS & JBossMQ] - org.jboss.mq.SpyJMSException: Exiting on IOE
by ppradhan
Hi,
I am using jboss 4.0.2 with cache. I use JMS to send log messges to be saved to a database. No special configuration, however, over some time period ( e.g. a month or more) I get this exception:
2007-07-27 11:17:31,318 WARN [org.jboss.mq.Connection] Connection failure, use javax.jms.Connection.setExceptionListener() to handle this error and reconnect
org.jboss.mq.SpyJMSException: Exiting on IOE; - nested throwable: (java.io.EOFException)
at org.jboss.mq.SpyJMSException.getAsJMSException(SpyJMSException.java:66)
at org.jboss.mq.Connection.asynchFailure(Connection.java:437)
at org.jboss.mq.il.uil2.UILClientILService.asynchFailure(UILClientILService.java:156)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleStop(SocketManager.java:413)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:345)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2675)
at java.io.ObjectInputStream.readByte(ObjectInputStream.java:874)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:290)
... 1 more
After a few of these , I get following:
2007-07-27 11:39:19,048 INFO [STDOUT] Cannot send a message to the JMS server; - nested throwable: (java.io.IOException: Client is not connected)
The wiki pages re jbossMQ mention the High Availability JMSMQ, which I am not sure is being used since I am using the default server configuration.
My question is : do I need to use an ExceptionListener , trap this exception and then reopen the connection, or is this a memory/heap problem that I can fix some other way? Restarting the server fixes the problem but nor desirable.
Any help will be appreciated
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070258#4070258
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070258
18Â years, 9Â months
[JBoss Seam] - Seam conversation propagation
by Stateless Bean
I learn conversations and looking for somethink like that:
if ("success")
retirect to....
else if("error"){
end current conversation
redirect to...
}
is this good idea?
| <navigation from-action="#{registerAction.register}">
| <rule if-outcome="success">
| <end-conversation/>
| <redirect view-id="/Registered.xhtml"/>
| </rule>
| <rule if-outcome="error">
| <redirect view-id="/Register.xhtml"/>
| </rule>
| </navigation>
|
2. My page has menu on left side like:
Main Page
Emails
Trade
logout
etc.
each link opens only one page whitch has some info (each link = one SFSB), and here is my frustration, what type of scope to use.
Users only clicks on this links.
Conversations are for keeping some data for few pages, is this right? than this ins't good to set Scope=Conversation,
Event is mostly to remoting, and isnt recomended to.
And don't know witch scope to set, any help?
Maybe better way is to set conversation scope but with short living time like 5min.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070253#4070253
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070253
18Â years, 9Â months
[JBoss Portal] - Re: where should i include my javascript file?
by saigon_man
Thanks for the hint, I followed the instruction but somehow, the browser could not find the javascript.
Here what I've done
in my jboss-portlet.xml
<portlet>
| <portlet-name>HelloWorldJSPPortlet</portlet-name>
| <transaction>
| <trans-attribute>Required</trans-attribute>
| </transaction>
| <header-content>
| <script type="text/javascript" src="/js/myscript.js"/>
| </header-content>
| </portlet>
|
|
i created a folder called js at the same level as WEB-INF and put myscript.js in there. When I click on the button in that jsp portlet to invoke the function in javascript, the browser complaints that it can not find that file. So, my war structure is:
mywar.war
---- js
---- myscript.js
---- WEB-INF
---- jboss-portlet.xml
---- some more xml files
here is the code in my jsp file
| <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
|
| <portlet:defineObjects/>
| <div id="msg">I am default</div>
| <br/>
| <button onclick="testing();">Change me</button>
|
in myscript.js
| function testing(){
| document.getElementById("msg").innerHTML = "I am changed";
| }
|
Am I missing something here?
Thanks
TL
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070247#4070247
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070247
18Â years, 9Â months