Markou moment
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package car;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
class Car implements Serializable {
|
||||
|
||||
private String name;
|
||||
private int year;
|
||||
|
||||
public Car(String name, int year)
|
||||
{
|
||||
this.name = name;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public int getYear()
|
||||
{
|
||||
return year;
|
||||
}
|
||||
|
||||
public void setYear(int year)
|
||||
{
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package car;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
|
||||
import jakarta.faces.application.FacesMessage;
|
||||
import jakarta.faces.context.FacesContext;
|
||||
import jakarta.faces.view.ViewScoped;
|
||||
import jakarta.inject.Named;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.primefaces.event.SelectEvent;
|
||||
|
||||
@Named(value = "carAutoCompleteBean")
|
||||
@ViewScoped
|
||||
public class CarAutoCompleteBean implements Serializable
|
||||
{
|
||||
private Car selectedCar;
|
||||
private static Map<String, Car> cars = new HashMap<String, Car>();
|
||||
|
||||
String simpleText;
|
||||
List<String> multipleSelects;
|
||||
|
||||
public CarAutoCompleteBean()
|
||||
{
|
||||
cars.put("BMW", new Car("BMW", 2024));
|
||||
cars.put("CC", new Car("CC", 2018));
|
||||
cars.put("Golf", new Car("Golf", 1998));
|
||||
cars.put("Jetta", new Car("Jetta", 2012));
|
||||
cars.put("Passat", new Car("Passat", 2016));
|
||||
|
||||
cars.put("Polo", new Car("Polo", 1978));
|
||||
cars.put("Scirocco", new Car("Scirocco", 1981));
|
||||
cars.put("Touareg", new Car("Touareg", 2019));
|
||||
}
|
||||
|
||||
public List<String> getMultipleSelects()
|
||||
{
|
||||
return multipleSelects;
|
||||
}
|
||||
|
||||
public void setMultipleSelects(List<String> multipleSelects)
|
||||
{
|
||||
this.multipleSelects = multipleSelects;
|
||||
}
|
||||
|
||||
public static Map<String, Car> getCars()
|
||||
{
|
||||
return cars;
|
||||
}
|
||||
|
||||
public Car getSelectedCar()
|
||||
{
|
||||
System.out.println(selectedCar);
|
||||
return selectedCar;
|
||||
}
|
||||
|
||||
public void setSelectedCar(Car selectedCar)
|
||||
{
|
||||
this.selectedCar = selectedCar;
|
||||
}
|
||||
|
||||
public List<Car> completeCar(String input)
|
||||
{
|
||||
List<Car> suggestions = new ArrayList<Car>();
|
||||
Set<String> keys = cars.keySet();
|
||||
for (String key : keys)
|
||||
{
|
||||
if (key.startsWith(input))
|
||||
{
|
||||
suggestions.add(cars.get(key));
|
||||
}
|
||||
}
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
public List<Car> completeCarContains(String input)
|
||||
{
|
||||
List<Car> suggestions = new ArrayList<Car>();
|
||||
Set<String> keys = cars.keySet();
|
||||
for (String key : keys)
|
||||
{
|
||||
String s = key.toLowerCase();
|
||||
if (s.contains(input.toLowerCase()))
|
||||
{
|
||||
suggestions.add(cars.get(key));
|
||||
}
|
||||
}
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
public String getSimpleText()
|
||||
{
|
||||
return simpleText;
|
||||
}
|
||||
|
||||
public void setSimpleText(String simpleText)
|
||||
{
|
||||
this.simpleText = simpleText;
|
||||
}
|
||||
public List<String> completeSimple(String input)
|
||||
{
|
||||
List<String> suggestions = new ArrayList<String>();
|
||||
|
||||
for (char c ='A'; c < 'Z'; ++c)
|
||||
{
|
||||
suggestions.add( Character.toString(c));
|
||||
}
|
||||
return suggestions;
|
||||
}
|
||||
public void handleSelect(SelectEvent event)
|
||||
{
|
||||
System.out.println("handleSelect:" + event );
|
||||
Object selectedObject = event.getObject();
|
||||
FacesMessage msg = new FacesMessage("Selected", "Item:" + selectedObject);
|
||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
}
|
||||
|
||||
public void handleSelectSimple(SelectEvent event)
|
||||
{
|
||||
System.out.println("handleSelect:" + event );
|
||||
Object selectedObject = event.getObject();
|
||||
FacesMessage msg = new FacesMessage("Selected", "Item:" + selectedObject);
|
||||
FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,13 @@
|
||||
package edu.slcc.asdv.caleb.mavenproject1;
|
||||
|
||||
import jakarta.ws.rs.ApplicationPath;
|
||||
import jakarta.ws.rs.core.Application;
|
||||
|
||||
/**
|
||||
* Configures Jakarta RESTful Web Services for the application.
|
||||
* @author Juneau
|
||||
*/
|
||||
@ApplicationPath("resources")
|
||||
public class JakartaRestConfiguration extends Application {
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package edu.slcc.asdv.caleb.mavenproject1.resources;
|
||||
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
@Path("jakartaee10")
|
||||
public class JakartaEE10Resource {
|
||||
|
||||
@GET
|
||||
public Response ping(){
|
||||
return Response
|
||||
.ok("ping Jakarta EE")
|
||||
.build();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user