Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSF Facelets template wizard: Support JSF 4+ namespace #7222

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:ui="__NS_JSF_PREFIX__facelets"
template="__TEMPLATE__">
__DEFINE_TAGS__
</ui:composition>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?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:ui="__NS_LOCATION__/jsf/facelets">
xmlns:ui="__NS_JSF_PREFIX__facelets">

<body>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?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:ui="__NS_LOCATION__/jsf/facelets"
xmlns:h="__NS_LOCATION__/jsf/html">
xmlns:ui="__NS_JSF_PREFIX__facelets"
xmlns:h="__NS_JSF_PREFIX__html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,28 @@ public void run() throws IOException {

Project project = Templates.getProject(wiz);
final JsfVersion jsfVersion = JsfVersionUtils.forProject(project);
String namespaceLocation = (jsfVersion != null && jsfVersion.isAtLeast(JsfVersion.JSF_2_2))
? NamespaceUtils.JCP_ORG_LOCATION : NamespaceUtils.SUN_COM_LOCATION;
HashMap args = new HashMap();
args.put("TEMPLATE", relativePath); //NOI18N
args.put("DEFINE_TAGS", definedTags); //NOI18N
args.put("NS_LOCATION", namespaceLocation); //NOI18N


if (jsfVersion != null && jsfVersion.isAtLeast(JsfVersion.JSF_4_0)) {
args.put("NS_LOCATION", NamespaceUtils.JAKARTA_ORG_LOCATION);
args.put("NS_JSF_PREFIX", NamespaceUtils.JAKARTA_ORG_LOCATION + ".");
} else if (jsfVersion != null && jsfVersion.isAtLeast(JsfVersion.JSF_2_2)) {
args.put("NS_LOCATION", NamespaceUtils.JCP_ORG_LOCATION);
args.put("NS_JSF_PREFIX", NamespaceUtils.JCP_ORG_LOCATION + "/jsf/");
} else {
args.put("NS_LOCATION", NamespaceUtils.SUN_COM_LOCATION);
args.put("NS_JSF_PREFIX", NamespaceUtils.SUN_COM_LOCATION + "/jsf/");
}

MapFormat formater = new MapFormat(args);
formater.setLeftBrace("__"); //NOI18N
formater.setRightBrace("__"); //NOI18N
formater.setExactMatch(false);

content = formater.format(content);

JSFFrameworkProvider.createFile(target, content, ENCODING);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,18 @@ public void run() throws IOException {
args.put("LAYOUT_CSS_PATH", layoutPath); //NOI18N
args.put("DEFAULT_CSS_PATH", defaultPath); //NOI18N
args.put("NS_LOCATION", namespaceLocation); //NOI18N

if (jsfVersion != null && jsfVersion.isAtLeast(JsfVersion.JSF_4_0)) {
args.put("NS_LOCATION", NamespaceUtils.JAKARTA_ORG_LOCATION);
args.put("NS_JSF_PREFIX", NamespaceUtils.JAKARTA_ORG_LOCATION + ".");
} else if (jsfVersion != null && jsfVersion.isAtLeast(JsfVersion.JSF_2_2)) {
args.put("NS_LOCATION", NamespaceUtils.JCP_ORG_LOCATION);
args.put("NS_JSF_PREFIX", NamespaceUtils.JCP_ORG_LOCATION + "/jsf/");
} else {
args.put("NS_LOCATION", NamespaceUtils.SUN_COM_LOCATION);
args.put("NS_JSF_PREFIX", NamespaceUtils.SUN_COM_LOCATION + "/jsf/");
}

MapFormat formater = new MapFormat(args);
formater.setLeftBrace("__"); //NOI18N
formater.setRightBrace("__"); //NOI18N
Expand Down
Loading