*internal screaming*

This commit is contained in:
2023-10-20 13:38:03 -05:00
parent b072abc361
commit 4f7b942791
61 changed files with 2615 additions and 101 deletions

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>10-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv700ee10</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
</properties>
</project-shared-configuration>

View File

@@ -0,0 +1,42 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.slcc.asdv.caleb</groupId>
<artifactId>SelectAll</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>SelectAll-1.0-SNAPSHOT</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jakartaee>10.0.0</jakartaee>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,132 @@
package com.corejsf;
import java.awt.Color;
import java.io.Serializable;
import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import javax.faces.bean.ManagedBean;
// or import javax.inject.Named;
import javax.faces.bean.SessionScoped;
// or import javax.enterprise.context.SessionScoped;
import javax.faces.model.SelectItem;
@ManagedBean(name="form") // or @Named("form")
@SessionScoped
public class RegisterForm implements Serializable {
public enum Education { HIGH_SCHOOL, BACHELOR, MASTER, DOCTOR };
public static class Weekday {
private int dayOfWeek;
public Weekday(int dayOfWeek) {
this.dayOfWeek = dayOfWeek;
}
public String getDayName() {
DateFormatSymbols symbols = new DateFormatSymbols();
String[] weekdays = symbols.getWeekdays();
return weekdays[dayOfWeek];
}
public int getDayNumber() {
return dayOfWeek;
}
}
private String name;
private boolean contactMe;
private int[] bestDaysToContact;
private Integer yearOfBirth;
private int[] colors;
private Set<String> languages = new TreeSet<String>();
private Education education = Education.BACHELOR;
public String getName() { return name; }
public void setName(String newValue) { name = newValue; }
public boolean getContactMe() { return contactMe; }
public void setContactMe(boolean newValue) { contactMe = newValue; }
public int[] getBestDaysToContact() { return bestDaysToContact; }
public void setBestDaysToContact(int[] newValue) { bestDaysToContact = newValue; }
public Integer getYearOfBirth() { return yearOfBirth; }
public void setYearOfBirth(Integer newValue) { yearOfBirth = newValue; }
public int[] getColors() { return colors; }
public void setColors(int[] newValue) { colors = newValue; }
public Set<String> getLanguages() { return languages; }
public void setLanguages(Set<String> newValue) { languages = newValue; }
public Education getEducation() { return education; }
public void setEducation(Education newValue) { education = newValue; }
public Collection<SelectItem> getYearItems() { return birthYears; }
public Weekday[] getDaysOfTheWeek() { return daysOfTheWeek; }
public SelectItem[] getLanguageItems() { return languageItems; }
public SelectItem[] getColorItems() { return colorItems; }
public Map<String, Education> getEducationItems() { return educationItems; }
public String getBestDaysConcatenated() {
return Arrays.toString(bestDaysToContact);
}
public String getColorsConcatenated() {
StringBuilder result = new StringBuilder();
for (int color : colors) result.append(String.format("%06x ", color));
return result.toString();
}
private SelectItem[] colorItems = {
new SelectItem(Color.RED.getRGB(), "Red"), // value, label
new SelectItem(Color.GREEN.getRGB(), "Green"),
new SelectItem(Color.BLUE.getRGB(), "Blue"),
new SelectItem(Color.YELLOW.getRGB(), "Yellow"),
new SelectItem(Color.ORANGE.getRGB(), "Orange", "", true) // disabled
};
private static Map<String, Education> educationItems;
static {
educationItems = new LinkedHashMap<String, Education>();
educationItems.put("High School", Education.HIGH_SCHOOL); // label, value
educationItems.put("Bachelor's", Education.BACHELOR);
educationItems.put("Master's", Education.MASTER);
educationItems.put("Doctorate", Education.DOCTOR);
};
private static SelectItem[] languageItems = {
new SelectItem("English"),
new SelectItem("French"),
new SelectItem("Russian"),
new SelectItem("Italian"),
new SelectItem("Esperanto", "Esperanto", "", true) // disabled
};
private static Collection<SelectItem> birthYears;
static {
birthYears = new ArrayList<SelectItem>();
// The first item is a "no selection" item
birthYears.add(new SelectItem(null, "Pick a year:", "", false, false, true));
for (int i = 1900; i < 2020; ++i) birthYears.add(new SelectItem(i));
}
private static Weekday[] daysOfTheWeek;
static {
daysOfTheWeek = new Weekday[7];
for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++) {
daysOfTheWeek[i - Calendar.SUNDAY] = new Weekday(i);
}
}
}

View File

@@ -0,0 +1,130 @@
package com.corejsf;
import jakarta.enterprise.context.SessionScoped;
import java.awt.Color;
import java.io.Serializable;
import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import jakarta.faces.model.SelectItem;
import jakarta.inject.Named;
@Named("form") // or @Named("form")
@SessionScoped
public class RegisterForm implements Serializable {
public enum Education { HIGH_SCHOOL, BACHELOR, MASTER, DOCTOR };
public static class Weekday {
private int dayOfWeek;
public Weekday(int dayOfWeek) {
this.dayOfWeek = dayOfWeek;
}
public String getDayName() {
DateFormatSymbols symbols = new DateFormatSymbols();
String[] weekdays = symbols.getWeekdays();
return weekdays[dayOfWeek];
}
public int getDayNumber() {
return dayOfWeek;
}
}
private String name;
private boolean contactMe;
private int[] bestDaysToContact;
private Integer yearOfBirth;
private int[] colors;
private Set<String> languages = new TreeSet<String>();
private Education education = Education.BACHELOR;
public String getName() { return name; }
public void setName(String newValue) { name = newValue; }
public boolean getContactMe() { return contactMe; }
public void setContactMe(boolean newValue) { contactMe = newValue; }
public int[] getBestDaysToContact() { return bestDaysToContact; }
public void setBestDaysToContact(int[] newValue) { bestDaysToContact = newValue; }
public Integer getYearOfBirth() { return yearOfBirth; }
public void setYearOfBirth(Integer newValue) { yearOfBirth = newValue; }
public int[] getColors() { return colors; }
public void setColors(int[] newValue) { colors = newValue; }
public Set<String> getLanguages() { return languages; }
public void setLanguages(Set<String> newValue) { languages = newValue; }
public Education getEducation() { return education; }
public void setEducation(Education newValue) { education = newValue; }
public Collection<SelectItem> getYearItems() { return birthYears; }
public Weekday[] getDaysOfTheWeek() { return daysOfTheWeek; }
public SelectItem[] getLanguageItems() { return languageItems; }
public SelectItem[] getColorItems() { return colorItems; }
public Map<String, Education> getEducationItems() { return educationItems; }
public String getBestDaysConcatenated() {
return Arrays.toString(bestDaysToContact);
}
public String getColorsConcatenated() {
StringBuilder result = new StringBuilder();
for (int color : colors) result.append(String.format("%06x ", color));
return result.toString();
}
private SelectItem[] colorItems = {
new SelectItem(Color.RED.getRGB(), "Red"), // value, label
new SelectItem(Color.GREEN.getRGB(), "Green"),
new SelectItem(Color.BLUE.getRGB(), "Blue"),
new SelectItem(Color.YELLOW.getRGB(), "Yellow"),
new SelectItem(Color.ORANGE.getRGB(), "Orange", "", true) // disabled
};
private static Map<String, Education> educationItems;
static {
educationItems = new LinkedHashMap<String, Education>();
educationItems.put("High School", Education.HIGH_SCHOOL); // label, value
educationItems.put("Bachelor's", Education.BACHELOR);
educationItems.put("Master's", Education.MASTER);
educationItems.put("Doctorate", Education.DOCTOR);
};
private static SelectItem[] languageItems = {
new SelectItem("English"),
new SelectItem("French"),
new SelectItem("Russian"),
new SelectItem("Italian"),
new SelectItem("Esperanto", "Esperanto", "", true) // disabled
};
private static Collection<SelectItem> birthYears;
static {
birthYears = new ArrayList<SelectItem>();
// The first item is a "no selection" item
birthYears.add(new SelectItem(null, "Pick a year:", "", false, false, true));
for (int i = 1900; i < 2020; ++i) birthYears.add(new SelectItem(i));
}
private static Weekday[] daysOfTheWeek;
static {
daysOfTheWeek = new Weekday[7];
for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++) {
daysOfTheWeek[i - Calendar.SUNDAY] = new Weekday(i);
}
}
}

View File

@@ -0,0 +1,21 @@
indexWindowTitle=Checkboxes, Radio buttons, Menus, and Listboxes
indexPageTitle=Please fill out the following information
namePrompt=Name:
contactMePrompt=Contact me
bestDayPrompt=What's the best day to contact you?
yearOfBirthPrompt=What year were you born?
buttonPrompt=Submit information
backPrompt=Back
languagePrompt=Select the languages you speak:
educationPrompt=Select your highest education level:
emailAppPrompt=Select your email application:
colorPrompt=Select your favorite colors:
thankYouLabel=Thank you {0}, for your information
contactMeLabel=Contact me:
bestDayLabel=Best day to contact you:
yearOfBirthLabel=Your year of birth:
colorLabel=Colors:
languageLabel=Languages:
educationLabel=Education:

View File

@@ -0,0 +1,13 @@
package edu.slcc.asdv.caleb.selectall;
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 {
}

View File

@@ -0,0 +1,20 @@
package edu.slcc.asdv.caleb.selectall.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();
}
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="3.0" xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd">
<!-- Define Persistence Unit -->
<persistence-unit name="my_persistence_unit">
</persistence-unit>
</persistence>

View File

@@ -0,0 +1,21 @@
indexWindowTitle=Checkboxes, Radio buttons, Menus, and Listboxes
indexPageTitle=Please fill out the following information
namePrompt=Name:
contactMePrompt=Contact me
bestDayPrompt=What's the best day to contact you?
yearOfBirthPrompt=What year were you born?
buttonPrompt=Submit information
backPrompt=Back
languagePrompt=Select the languages you speak:
educationPrompt=Select your highest education level:
emailAppPrompt=Select your email application:
colorPrompt=Select your favorite colors:
thankYouLabel=Thank you {0}, for your information
contactMeLabel=Contact me:
bestDayLabel=Best day to contact you:
yearOfBirthLabel=Your year of birth:
colorLabel=Colors:
languageLabel=Languages:
educationLabel=Education:

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<resource-bundle>
<base-name>messages</base-name>
<var>messages</var>
</resource-bundle>
</application>
</faces-config>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
</web-app>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<h:outputStylesheet library="css" name="styles.css"/>
<title>#{messages.indexWindowTitle}</title>
</h:head>
<h:body>
<h:outputText value="#{messages.indexPageTitle}" styleClass="emphasis"/>
<h:form>
<h:panelGrid columns="2">
#{messages.namePrompt}
<h:inputText value="#{form.name}"/>
#{messages.contactMePrompt}
<h:selectBooleanCheckbox value="#{form.contactMe}"/>
#{messages.bestDayPrompt}
<h:selectManyMenu value="#{form.bestDaysToContact}">
<f:selectItems value="#{form.daysOfTheWeek}" var="w"
itemLabel="#{w.dayName}" itemValue="#{w.dayNumber}"/>
</h:selectManyMenu>
#{messages.yearOfBirthPrompt}
<h:selectOneMenu value="#{form.yearOfBirth}" required="true">
<f:selectItems value="#{form.yearItems}"/>
</h:selectOneMenu>
#{messages.colorPrompt}
<h:selectManyCheckbox value="#{form.colors}"
selectedClass="selected" disabledClass="disabled"
onchange="submit()">
<f:selectItems value="#{form.colorItems}"/>
</h:selectManyCheckbox>
#{messages.languagePrompt}
<h:selectManyListbox size="5" value="#{form.languages}">
<f:selectItems value="#{form.languageItems}"/>
</h:selectManyListbox>
#{messages.educationPrompt}
<h:selectOneRadio value="#{form.education}"
layout="pageDirection">
<f:selectItems value="#{form.educationItems}"/>
</h:selectOneRadio>
</h:panelGrid>
<h:commandButton value="#{messages.buttonPrompt}" action="showInformation"/>
</h:form>
<h:messages/>
</h:body>
</html>

View File

@@ -0,0 +1,10 @@
.emphasis {
font-style: italic;
font-size: 1.3em;
}
.disabled {
color: gray;
}
.selected {
font-weight: bold;
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>#{messages.indexWindowTitle}</title>
</h:head>
<h:body>
<h:form>
<h:outputStylesheet library="css" name="styles.css"/>
<h:outputFormat value="#{messages.thankYouLabel}">
<f:param value="#{form.name}"/>
</h:outputFormat>
<h:panelGrid columns="2">
#{messages.contactMeLabel}
<h:outputText value="#{form.contactMe}"/>
#{messages.bestDayLabel}
<h:outputText value="#{form.bestDaysConcatenated}"/>
#{messages.yearOfBirthLabel}
<h:outputText value="#{form.yearOfBirth}"/>
#{messages.languageLabel}
<h:outputText value="#{form.languages}"/>
#{messages.colorLabel}
<h:outputText value="#{form.colorsConcatenated}"/>
#{messages.educationLabel}
<h:outputText value="#{form.education}"/>
</h:panelGrid>
<h:commandButton value="#{messages.backPrompt}" action="index"/>
</h:form>
</h:body>
</html>