Skip to content

Commit 5b33595

Browse files
authored
Merge pull request #10 from wet-boew/9-tight-coupling-in-menuitem-and-others
9 tight coupling in menuitem and others
2 parents 384db29 + 28c0b74 commit 5b33595

23 files changed

Lines changed: 293 additions & 284 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# JavaTemplates Change Log
22

3-
[Download and/or Installation instructions](https://gccode.ssc-spc.gc.ca/iitb-dgiit/sds/GOCWebTemplates/JavaTemplates/wikis/Documentation/Installation)
3+
[Download and/or Installation instructions](https://github.com/wet-boew/cdts-JavaTemplates/wiki/Installation)
4+
5+
## v2.5.1
6+
7+
- Minor refactoring: Functions now take parameters (and return value) using interfaces `java.util.List` and `java.util.Map` instead of concrete classes `java.util.ArrayList` and `java.util.HashMap` for more flexibility.
48

59
## v2.5.0
610

builds/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#
44
# DO NOT EDIT build.properties DIRECTLY!
55
#
6-
gocwebtemplate.build.version=2.5.0-SNAPSHOT
6+
gocwebtemplate.build.version=2.5.1-SNAPSHOT

gocwebtemplate-core/gocwebtemplate-core-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>ca.gc.gocwebtemplate</groupId>
1212
<artifactId>gocwebtemplate-core</artifactId>
13-
<version>2.5.0-SNAPSHOT</version>
13+
<version>2.5.1-SNAPSHOT</version>
1414
<relativePath>..</relativePath>
1515
</parent>
1616

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public abstract class Constants {
1313

1414
public static final String CACHE_KEY_STATICFILES_PREFIX = "GoC.Template.CacheKey";
1515

16-
public static final String WEB_TEMPLATE_DISTRIBUTION_VERSION = "2.5.0";
16+
public static final String WEB_TEMPLATE_DISTRIBUTION_VERSION = "2.5.1";
1717

1818
public static final String CDTS_DEFAULT_VERSION = "v4_0_46";
1919

Lines changed: 106 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,106 @@
1-
package goc.webtemplate;
2-
3-
import java.io.Serializable;
4-
import java.util.HashMap;
5-
6-
import com.google.gson.annotations.JsonAdapter;
7-
8-
/**
9-
* Holds confirugration properties for the Custom Search feature of the
10-
* application template.
11-
*/
12-
@SuppressWarnings("serial")
13-
public class CustomSearch implements Serializable {
14-
15-
private String action;
16-
private String placeholder;
17-
private String id;
18-
private String method;
19-
//NOTE: Custom serialization/adapter because value is serialized as a list of name+value tupples
20-
@JsonAdapter(goc.webtemplate.component.jsonentities.adapters.HashMapAdapter.class)
21-
private HashMap<String, String> hiddenInput;
22-
23-
public CustomSearch() {
24-
}
25-
26-
public CustomSearch(String action, String placeholder, String id, String method) {
27-
this.action = action;
28-
this.placeholder = placeholder;
29-
this.id = id;
30-
this.method = method;
31-
}
32-
33-
/**
34-
* Returns the path to the action attribute.
35-
* @return action value
36-
*/
37-
public String getAction() {
38-
return action;
39-
}
40-
41-
/**
42-
* Sets the path to the action attribute.
43-
*/
44-
public void setAction(String action) {
45-
this.action = action;
46-
}
47-
48-
/**
49-
* Returns the text for the search label, placeholder and hidden heading. If not set, the text "search" will be used for all the text.
50-
* @return the placeHolder value
51-
*/
52-
public String getPlaceholder() {
53-
return placeholder;
54-
}
55-
56-
/**
57-
* Sets the text for the search label, placeholder and hidden heading. If not set, the text "search" will be used for all the text.
58-
*/
59-
public void setPlaceholder(String placeHolder) {
60-
this.placeholder = placeHolder;
61-
}
62-
63-
/**
64-
* Returns the (optional) id to usefor the search input field, also used in the `for` attribute for the search label.
65-
* @return the id value
66-
*/
67-
public String getId() {
68-
return id;
69-
}
70-
71-
/**
72-
* Sets the (optional) id to usefor the search input field, also used in the `for` attribute for the search label.
73-
*/
74-
public void setId(String id) {
75-
this.id = id;
76-
}
77-
78-
/**
79-
* Returns the HTTP method to be used when submitting the search action (e.g. GET or POST)
80-
* @return the method value
81-
*/
82-
public String getMethod() {
83-
return method;
84-
}
85-
86-
/**
87-
* Returns the HTTP method to be used when submitting the search action (e.g. GET or POST)
88-
*/
89-
public void setMethod(String method) {
90-
this.method = method;
91-
}
92-
93-
/**
94-
* Returns the (optional) hidden form input fields.
95-
*/
96-
public HashMap<String, String> getHiddenInput() {
97-
return hiddenInput;
98-
}
99-
100-
/**
101-
* Sets the (optional) hidden form input fields.
102-
*/
103-
public void setHiddenInput(HashMap<String, String> hiddenInput) {
104-
this.hiddenInput = hiddenInput;
105-
}
106-
}
1+
package goc.webtemplate;
2+
3+
import java.io.Serializable;
4+
import java.util.Map;
5+
6+
import com.google.gson.annotations.JsonAdapter;
7+
8+
/**
9+
* Holds confirugration properties for the Custom Search feature of the
10+
* application template.
11+
*/
12+
@SuppressWarnings("serial")
13+
public class CustomSearch implements Serializable {
14+
15+
private String action;
16+
private String placeholder;
17+
private String id;
18+
private String method;
19+
//NOTE: Custom serialization/adapter because value is serialized as a list of name+value tupples
20+
@JsonAdapter(goc.webtemplate.component.jsonentities.adapters.MapAdapter.class)
21+
private Map<String, String> hiddenInput;
22+
23+
public CustomSearch() {
24+
}
25+
26+
public CustomSearch(String action, String placeholder, String id, String method) {
27+
this.action = action;
28+
this.placeholder = placeholder;
29+
this.id = id;
30+
this.method = method;
31+
}
32+
33+
/**
34+
* Returns the path to the action attribute.
35+
* @return action value
36+
*/
37+
public String getAction() {
38+
return action;
39+
}
40+
41+
/**
42+
* Sets the path to the action attribute.
43+
*/
44+
public void setAction(String action) {
45+
this.action = action;
46+
}
47+
48+
/**
49+
* Returns the text for the search label, placeholder and hidden heading. If not set, the text "search" will be used for all the text.
50+
* @return the placeHolder value
51+
*/
52+
public String getPlaceholder() {
53+
return placeholder;
54+
}
55+
56+
/**
57+
* Sets the text for the search label, placeholder and hidden heading. If not set, the text "search" will be used for all the text.
58+
*/
59+
public void setPlaceholder(String placeHolder) {
60+
this.placeholder = placeHolder;
61+
}
62+
63+
/**
64+
* Returns the (optional) id to usefor the search input field, also used in the `for` attribute for the search label.
65+
* @return the id value
66+
*/
67+
public String getId() {
68+
return id;
69+
}
70+
71+
/**
72+
* Sets the (optional) id to usefor the search input field, also used in the `for` attribute for the search label.
73+
*/
74+
public void setId(String id) {
75+
this.id = id;
76+
}
77+
78+
/**
79+
* Returns the HTTP method to be used when submitting the search action (e.g. GET or POST)
80+
* @return the method value
81+
*/
82+
public String getMethod() {
83+
return method;
84+
}
85+
86+
/**
87+
* Returns the HTTP method to be used when submitting the search action (e.g. GET or POST)
88+
*/
89+
public void setMethod(String method) {
90+
this.method = method;
91+
}
92+
93+
/**
94+
* Returns the (optional) hidden form input fields.
95+
*/
96+
public Map<String, String> getHiddenInput() {
97+
return hiddenInput;
98+
}
99+
100+
/**
101+
* Sets the (optional) hidden form input fields.
102+
*/
103+
public void setHiddenInput(Map<String, String> hiddenInput) {
104+
this.hiddenInput = hiddenInput;
105+
}
106+
}

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/MenuItem.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package goc.webtemplate;
22

33
import java.util.ArrayList;
4+
import java.util.List;
45

56
@SuppressWarnings("serial")
67
public class MenuItem extends Link {
7-
private ArrayList<MenuItem> subItems = null;
8+
private List<MenuItem> subItems = null;
89
private boolean openInNewWindow = false;
910
private String acronym = null;
1011

@@ -28,19 +29,19 @@ public MenuItem(String href, String text, String acronym, boolean openInNewWindo
2829
this(href, text, acronym, new ArrayList<MenuItem>(), openInNewWindow);
2930
}
3031

31-
public MenuItem(String href, String text, ArrayList<MenuItem> subItems) {
32+
public MenuItem(String href, String text, List<MenuItem> subItems) {
3233
this(href, text, null, subItems, false);
3334
}
3435

35-
public MenuItem(String href, String text, ArrayList<MenuItem> subItems, boolean openInNewWindow) {
36+
public MenuItem(String href, String text, List<MenuItem> subItems, boolean openInNewWindow) {
3637
this(href, text, null, subItems, openInNewWindow);
3738
}
3839

39-
public MenuItem(String href, String text, String acronym, ArrayList<MenuItem> subItems) {
40+
public MenuItem(String href, String text, String acronym, List<MenuItem> subItems) {
4041
this(href, text, acronym, subItems, false);
4142
}
4243

43-
public MenuItem(String href, String text, String acronym, ArrayList<MenuItem> subItems, boolean openInNewWindow) {
44+
public MenuItem(String href, String text, String acronym, List<MenuItem> subItems, boolean openInNewWindow) {
4445
super(href, text);
4546
this.subItems = subItems;
4647
this.openInNewWindow = openInNewWindow;
@@ -55,11 +56,11 @@ public boolean isOpenInNewWindow() {
5556
return this.openInNewWindow;
5657
}
5758

58-
public void setSubItems(ArrayList<MenuItem> subItems) {
59+
public void setSubItems(List<MenuItem> subItems) {
5960
this.subItems = subItems;
6061
}
6162

62-
public ArrayList<MenuItem> getSubItems() {
63+
public List<MenuItem> getSubItems() {
6364
return this.subItems;
6465
}
6566

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/MenuSection.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
package goc.webtemplate;
22

33
import java.util.ArrayList;
4+
import java.util.List;
45

56
public class MenuSection {
67
private String name = "";
78
private String link = "";
8-
private ArrayList<Link> items = null;
9+
private List<Link> items = null;
910
private boolean openInNewWindow = false;
1011

1112
public MenuSection() {
1213
this("", new ArrayList<Link>());
1314
}
1415

15-
public MenuSection(String sectionName, ArrayList<Link> menuLinks) {
16+
public MenuSection(String sectionName, List<Link> menuLinks) {
1617
this("", "", menuLinks);
1718
}
1819

19-
public MenuSection(String sectionName, String sectionLink, ArrayList<Link> menuLinks) {
20+
public MenuSection(String sectionName, String sectionLink, List<Link> menuLinks) {
2021
this(sectionName, sectionLink, menuLinks, false);
2122
}
2223

23-
public MenuSection(String sectionName, String sectionLink, ArrayList<Link> menuLinks, boolean openInNewWindow) {
24+
public MenuSection(String sectionName, String sectionLink, List<Link> menuLinks, boolean openInNewWindow) {
2425
this.name = sectionName;
2526
this.link = sectionLink;
2627
this.items = menuLinks;
@@ -51,11 +52,11 @@ public String getLink() {
5152
return this.link;
5253
}
5354

54-
public void setItems(ArrayList<Link> menuLinks) {
55+
public void setItems(List<Link> menuLinks) {
5556
this.items = menuLinks;
5657
}
5758

58-
public ArrayList<Link> getItems() {
59+
public List<Link> getItems() {
5960
return this.items;
6061
}
6162
}

0 commit comments

Comments
 (0)