Showcase Spinner - not working

UI Components for JSF
Post Reply
davidfeitosa
Posts: 3
Joined: 10 Feb 2011, 18:19

10 Feb 2011, 18:29

Hi!

I tried to run locally the Spinner example from the ShowCase application, but the only spinner that updates values was the "ajaxspinner".
The others remain with the same value: 0.

I am using PrimeFaces 2.2 with JSF 2.0 on Netbeans 6.9.1 and Glassfish v3.0.1.

Is it a limitation from the component in this release?

My files:

===================
SpinnerController.java
===================

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class SpinnerController implements Serializable {

private double number1;
private double number2;
private double number3;
private double number4;
private double number5;
private double number6;
private double number7;

//only gets and sets

}

============
spinner.xhtml
============

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<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:p="http://primefaces.prime.com.tr/ui" >
<h:head>
<title>Spinner</title>
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
</h:head>
<body>

<h:form>

<p:panel header="Spinners">
<h:panelGrid id="grid" columns="2" cellpadding="5">
<h:outputLabel for="spinnerBasic" value="Basic Spinner: " />
<p:spinner id="spinnerBasic" value="#{spinnerController.number1}"/>

<h:outputLabel for="spinnerStep" value="Step Factor: " />
<p:spinner id="spinnerStep" value="#{spinnerController.number2}" stepFactor="0.25"/>

<h:outputLabel for="minmax" value="Min/Max: " />
<p:spinner id="minmax" value="#{spinnerController.number3}" min="0" max="100"/>

<h:outputLabel for="prefix" value="Prefix: " />
<p:spinner id="prefix" value="#{spinnerController.number4}" prefix="$">
<f:convertNumber currencySymbol="$" type="currency"/>
</p:spinner>

<h:outputLabel for="width" value="Width: " />
<p:spinner id="width" value="#{spinnerController.number5}" width="32"/>

<h:outputLabel for="ajaxspinner" value="Ajax Spinner: " />
<p:outputPanel>
<p:spinner id="ajaxspinner" value="#{spinnerController.number6}">
<p:ajax update="ajaxspinnervalue" process="@this" />
</p:spinner>
<h:outputText id="ajaxspinnervalue" value="#{spinnerController.number6}" style="padding-left:10px"/>
</p:outputPanel>

<h:outputLabel for="showon" value="Show On: " />
<p:spinner id="showon" value="#{spinnerController.number7}" showOn="hover"/>

</h:panelGrid>
</p:panel>

<br />
<p:commandButton value="Submit" update="display" oncomplete="dialog.show()"/>

<p:ajaxStatus style="width:16px;height:16px;">
<f:facet name="start">
<h:graphicImage value="ajaxloading.gif" />
</f:facet>

<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>

<p:dialog header="Values" widgetVar="dialog" showEffect="fold" hideEffect="fold">
<h:panelGrid id="display" columns="2" cellpadding="5">
<h:outputText value="Value 1: " />
<h:outputText value="#{spinnerController.number1}" />

<h:outputText value="Value 2: " />
<h:outputText value="#{spinnerController.number2}" />

<h:outputText value="Value 3: " />
<h:outputText value="#{spinnerController.number3}" />

<h:outputText value="Value 4: " />
<h:outputText value="#{spinnerController.number4}" />

<h:outputText value="Value 5: " />
<h:outputText value="#{spinnerController.number5}" />

<h:outputText value="Value 6: " />
<h:outputText value="#{spinnerController.number6}" />

<h:outputText value="Value 7: " />
<h:outputText value="#{spinnerController.number7}" />
</h:panelGrid>
</p:dialog>

</h:form>


</body>
</html>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

10 Feb 2011, 20:07


davidfeitosa
Posts: 3
Joined: 10 Feb 2011, 18:19

10 Feb 2011, 21:41

I cannot also.

I copied and pasted the code, but it not works.
Only the ajax spinner do the work well, the others not.

I did the copy from the svn repository.

The interface is the same, but not the behaviour.

davidfeitosa
Posts: 3
Joined: 10 Feb 2011, 18:19

10 Feb 2011, 22:09

I found the problem:

I added the ajax="false" in the button.
It did not displayed the dialog, but shows an error in the currency spinner - the error was hidden.
I removed the currency spinner and the example works correctly.

I do not know why the error message was hidden before, but now works fine.

I am writing from Brazil and the currency symbol here is R$ (Brazil Real) instead of $.

Thanks! See you later!

wetgos
Posts: 1
Joined: 17 Sep 2011, 21:02

17 Sep 2011, 21:20

Hi,

I traced it down to:
21:08:33,488 FINE [javax.enterprise.resource.webcontainer.jsf.context] Adding Message[sourceId=j_idt4:prefix,summary=j_idt4:prefix: '$3' could not be understood as a currency value.)

When setting <p:spinner ... prefix="$ " /> it works! Note the space after the currency symbol.

Hope it helps.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 39 guests