playgrnd
@ 35
playgrnd / jsf-sample / src / main / java / com / uralian / sample / TemperatureBean.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
/* * TemperatureBean.java Jan 23, 2012 * * Copyright 2012 Uralian. All rights reserved. */ package com.uralian.sample; import java.io.Serializable; import java.util.Random; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; /** * @author Vlad Orzhekhovskiy */ @ManagedBean @SessionScoped public class TemperatureBean implements Serializable { private static final long serialVersionUID = 1L; private static final String[] colors = {"blue", "green", "black", "red"}; private static final Random rnd = new Random(); public double celsius = 0; public double getCelsius() { return celsius; } public void setCelsius(double celsius) { this.celsius = celsius; } public double getFahrenheit() { return celsius / 5 * 9 + 32; } public void setFahrenheit(double fahrenheit) { this.celsius = (fahrenheit - 32) * 5 / 9; } public double getKelvin() { return celsius + 273; } public void setKelvin(double kelvin) { this.celsius = kelvin - 273; } public String getRandomColor() { return colors[rnd.nextInt(colors.length)]; } } |
Commits for playgrnd/jsf-sample/src/main/java/com/uralian/sample/TemperatureBean.java
Revision | Author | Commited | Message |
---|---|---|---|
35 | snark | Thu 17 Aug, 2017 23:28:40 +0000 | add jsf-sample project |