Skip to content

Commit

Permalink
Merge pull request #7222 from matthiasblaesing/ns_jsf4
Browse files Browse the repository at this point in the history
JSF Facelets template wizard: Support JSF 4+ namespace
  • Loading branch information
matthiasblaesing committed Apr 11, 2024
2 parents a80767d + 65e0d51 commit e8fb660
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 40 deletions.
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

0 comments on commit e8fb660

Please sign in to comment.